Misc: Try to avoid evaluating conditions after window unmap & others

- Try to avoid evaluating conditions after window unmap/destruction.
  Unfortunately, frequently this doesn't work due to the asynchronous
  nature of X.

- Add _GTK_FRAME_EXTENTS exclusion rules to compton.sample.conf. Thanks
  to memeplex, hexchain, and others for info. (#189)

- Add debugging option --show-all-xerrors, and other debugging changes.
  Doc update.
pull/2/head
Richard Grenville 10 years ago
parent dbba28f946
commit b175464e8c

@ -1292,6 +1292,8 @@ c2_match_once(session_t *ps, win *w, const c2_ptr_t cond) {
bool bool
c2_matchd(session_t *ps, win *w, const c2_lptr_t *condlst, c2_matchd(session_t *ps, win *w, const c2_lptr_t *condlst,
const c2_lptr_t **cache, void **pdata) { const c2_lptr_t **cache, void **pdata) {
assert(IsViewable == w->a.map_state);
// Check if the cached entry matches firstly // Check if the cached entry matches firstly
if (cache && *cache && c2_match_once(ps, w, (*cache)->ptr)) { if (cache && *cache && c2_match_once(ps, w, (*cache)->ptr)) {
if (pdata) if (pdata)

@ -14,6 +14,7 @@
// === Options === // === Options ===
// Debug options, enable them using -D in CFLAGS // Debug options, enable them using -D in CFLAGS
// #define DEBUG_BACKTRACE 1
// #define DEBUG_REPAINT 1 // #define DEBUG_REPAINT 1
// #define DEBUG_EVENTS 1 // #define DEBUG_EVENTS 1
// #define DEBUG_RESTACK 1 // #define DEBUG_RESTACK 1
@ -72,6 +73,10 @@
#define COMPTON_VERSION "unknown" #define COMPTON_VERSION "unknown"
#endif #endif
#if defined(DEBUG_ALLOC_REG)
#define DEBUG_BACKTRACE 1
#endif
// === Includes === // === Includes ===
// For some special functions // For some special functions
@ -568,6 +573,8 @@ typedef struct _options_t {
c2_lptr_t *paint_blacklist; c2_lptr_t *paint_blacklist;
/// Whether to work under synchronized mode for debugging. /// Whether to work under synchronized mode for debugging.
bool synchronize; bool synchronize;
/// Whether to show all X errors.
bool show_all_xerrors;
// === VSync & software optimization === // === VSync & software optimization ===
/// User-specified refresh rate. /// User-specified refresh rate.
@ -1192,13 +1199,13 @@ extern session_t *ps_g;
static inline void static inline void
print_timestamp(session_t *ps); print_timestamp(session_t *ps);
#ifdef DEBUG_ALLOC_REG #ifdef DEBUG_BACKTRACE
#include <execinfo.h> #include <execinfo.h>
#define BACKTRACE_SIZE 5 #define BACKTRACE_SIZE 25
/** /**
* Print current backtrace, excluding the first two items. * Print current backtrace.
* *
* Stolen from glibc manual. * Stolen from glibc manual.
*/ */
@ -1211,12 +1218,14 @@ print_backtrace(void) {
size = backtrace(array, BACKTRACE_SIZE); size = backtrace(array, BACKTRACE_SIZE);
strings = backtrace_symbols(array, size); strings = backtrace_symbols(array, size);
for (size_t i = 2; i < size; i++) for (size_t i = 0; i < size; i++)
printf ("%s\n", strings[i]); printf ("%s\n", strings[i]);
free(strings); free(strings);
} }
#ifdef DEBUG_ALLOC_REG
/** /**
* Wrapper of <code>XFixesCreateRegion</code>, for debugging. * Wrapper of <code>XFixesCreateRegion</code>, for debugging.
*/ */
@ -1247,6 +1256,8 @@ XFixesDestroyRegion_(Display *dpy, XserverRegion reg,
#define XFixesDestroyRegion(dpy, reg) XFixesDestroyRegion_(dpy, reg, __func__, __LINE__) #define XFixesDestroyRegion(dpy, reg) XFixesDestroyRegion_(dpy, reg, __func__, __LINE__)
#endif #endif
#endif
// === Functions === // === Functions ===
/** /**

@ -576,6 +576,9 @@ discard_ignore(session_t *ps, unsigned long sequence) {
static void static void
set_ignore(session_t *ps, unsigned long sequence) { set_ignore(session_t *ps, unsigned long sequence) {
if (ps->o.show_all_xerrors)
return;
ignore_t *i = malloc(sizeof(ignore_t)); ignore_t *i = malloc(sizeof(ignore_t));
if (!i) return; if (!i) return;
@ -2374,8 +2377,13 @@ static void
win_determine_fade(session_t *ps, win *w) { win_determine_fade(session_t *ps, win *w) {
if (UNSET != w->fade_force) if (UNSET != w->fade_force)
w->fade = w->fade_force; w->fade = w->fade_force;
else if ((ps->o.no_fading_openclose && w->in_openclose) else if (ps->o.no_fading_openclose && w->in_openclose)
|| win_match(ps, w, ps->o.fade_blacklist, &w->cache_fblst)) w->fade = false;
// Ignore other possible causes of fading state changes after window
// gets unmapped
else if (IsViewable != w->a.map_state) {
}
else if (win_match(ps, w, ps->o.fade_blacklist, &w->cache_fblst))
w->fade = false; w->fade = false;
else else
w->fade = ps->o.wintype_fade[w->window_type]; w->fade = ps->o.wintype_fade[w->window_type];
@ -2403,8 +2411,7 @@ win_update_shape(session_t *ps, win *w) {
win_update_shape_raw(ps, w); win_update_shape_raw(ps, w);
// Shadow state could be changed win_on_factor_change(ps, w);
win_determine_shadow(ps, w);
/* /*
// If clear_shadow state on the window possibly changed, destroy the old // If clear_shadow state on the window possibly changed, destroy the old
@ -2457,13 +2464,14 @@ static void
win_determine_shadow(session_t *ps, win *w) { win_determine_shadow(session_t *ps, win *w) {
bool shadow_old = w->shadow; bool shadow_old = w->shadow;
w->shadow = (UNSET == w->shadow_force ? if (UNSET != w->shadow_force)
(ps->o.wintype_shadow[w->window_type] w->shadow = w->shadow_force;
&& !win_match(ps, w, ps->o.shadow_blacklist, &w->cache_sblst) else if (IsViewable == w->a.map_state)
&& !(ps->o.shadow_ignore_shaped && w->bounding_shaped w->shadow = (ps->o.wintype_shadow[w->window_type]
&& !w->rounded_corners) && !win_match(ps, w, ps->o.shadow_blacklist, &w->cache_sblst)
&& !(ps->o.respect_prop_shadow && 0 == w->prop_shadow)) && !(ps->o.shadow_ignore_shaped && w->bounding_shaped
: w->shadow_force); && !w->rounded_corners)
&& !(ps->o.respect_prop_shadow && 0 == w->prop_shadow));
// Window extents need update on shadow state change // Window extents need update on shadow state change
if (w->shadow != shadow_old) { if (w->shadow != shadow_old) {
@ -2488,17 +2496,13 @@ win_determine_shadow(session_t *ps, win *w) {
*/ */
static void static void
win_determine_invert_color(session_t *ps, win *w) { win_determine_invert_color(session_t *ps, win *w) {
// Do not change window invert color state when the window is unmapped,
// unless it comes from w->invert_color_force.
if (UNSET == w->invert_color_force && IsViewable != w->a.map_state)
return;
bool invert_color_old = w->invert_color; bool invert_color_old = w->invert_color;
if (UNSET != w->invert_color_force) if (UNSET != w->invert_color_force)
w->invert_color = w->invert_color_force; w->invert_color = w->invert_color_force;
else else if (IsViewable == w->a.map_state)
w->invert_color = win_match(ps, w, ps->o.invert_color_list, &w->cache_ivclst); w->invert_color = win_match(ps, w, ps->o.invert_color_list,
&w->cache_ivclst);
if (w->invert_color != invert_color_old) if (w->invert_color != invert_color_old)
add_damage_win(ps, w); add_damage_win(ps, w);
@ -2509,6 +2513,9 @@ win_determine_invert_color(session_t *ps, win *w) {
*/ */
static void static void
win_determine_blur_background(session_t *ps, win *w) { win_determine_blur_background(session_t *ps, win *w) {
if (IsViewable != w->a.map_state)
return;
bool blur_background_old = w->blur_background; bool blur_background_old = w->blur_background;
w->blur_background = ps->o.blur_background w->blur_background = ps->o.blur_background
@ -2526,6 +2533,9 @@ win_determine_blur_background(session_t *ps, win *w) {
*/ */
static void static void
win_update_opacity_rule(session_t *ps, win *w) { win_update_opacity_rule(session_t *ps, win *w) {
if (IsViewable != w->a.map_state)
return;
// If long is 32-bit, unfortunately there's no way could we express "unset", // If long is 32-bit, unfortunately there's no way could we express "unset",
// so we just entirely don't distinguish "unset" and OPAQUE // so we just entirely don't distinguish "unset" and OPAQUE
opacity_t opacity = OPAQUE; opacity_t opacity = OPAQUE;
@ -3295,11 +3305,13 @@ xerror(Display __attribute__((unused)) *dpy, XErrorEvent *ev) {
{ {
char buf[BUF_LEN] = ""; char buf[BUF_LEN] = "";
XGetErrorText(ps->dpy, ev->error_code, buf, BUF_LEN); XGetErrorText(ps->dpy, ev->error_code, buf, BUF_LEN);
printf("error %d (%s) request %d minor %d serial %lu (\"%s\")\n", printf("error %4d %-12s request %4d minor %4d serial %6lu: \"%s\"\n",
ev->error_code, name, ev->request_code, ev->error_code, name, ev->request_code,
ev->minor_code, ev->serial, buf); ev->minor_code, ev->serial, buf);
} }
// print_backtrace();
return 0; return 0;
} }
@ -3904,10 +3916,12 @@ ev_focus_report(XFocusChangeEvent* ev) {
* Determine whether we should respond to a <code>FocusIn/Out</code> * Determine whether we should respond to a <code>FocusIn/Out</code>
* event. * event.
*/ */
/*
inline static bool inline static bool
ev_focus_accept(XFocusChangeEvent *ev) { ev_focus_accept(XFocusChangeEvent *ev) {
return NotifyNormal == ev->mode || NotifyUngrab == ev->mode; return NotifyNormal == ev->mode || NotifyUngrab == ev->mode;
} }
*/
static inline void static inline void
ev_focus_in(session_t *ps, XFocusChangeEvent *ev) { ev_focus_in(session_t *ps, XFocusChangeEvent *ev) {
@ -4401,6 +4415,8 @@ usage(int ret) {
" Daemonize process.\n" " Daemonize process.\n"
"-S\n" "-S\n"
" Enable synchronous operation (for debugging).\n" " Enable synchronous operation (for debugging).\n"
"--show-all-xerrors\n"
" Show all X errors (for debugging).\n"
"--config path\n" "--config path\n"
" Look for configuration file at the path.\n" " Look for configuration file at the path.\n"
"--write-pid-path path\n" "--write-pid-path path\n"
@ -5522,6 +5538,7 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
{ "vsync-use-glfinish", no_argument, NULL, 311 }, { "vsync-use-glfinish", no_argument, NULL, 311 },
{ "xrender-sync", no_argument, NULL, 312 }, { "xrender-sync", no_argument, NULL, 312 },
{ "xrender-sync-fence", no_argument, NULL, 313 }, { "xrender-sync-fence", no_argument, NULL, 313 },
{ "show-all-xerrors", no_argument, NULL, 314 },
// Must terminate with a NULL entry // Must terminate with a NULL entry
{ NULL, 0, NULL, 0 }, { NULL, 0, NULL, 0 },
}; };
@ -5542,6 +5559,8 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
ps->o.display = mstrcpy(optarg); ps->o.display = mstrcpy(optarg);
else if ('S' == o) else if ('S' == o)
ps->o.synchronize = true; ps->o.synchronize = true;
else if (314 == o)
ps->o.show_all_xerrors = true;
else if ('?' == o || ':' == o) else if ('?' == o || ':' == o)
usage(1); usage(1);
} }
@ -5595,6 +5614,7 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
break; break;
case 'd': case 'd':
case 'S': case 'S':
case 314:
break; break;
P_CASELONG('D', fade_delta); P_CASELONG('D', fade_delta);
case 'I': case 'I':

Loading…
Cancel
Save