From 00ce7d0de030b42958e80766534c9220d57873d3 Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Sat, 27 Oct 2012 21:46:01 +0800 Subject: [PATCH] Bug fix #57: Fix incorrect handling of InputOnly windows - Stop rendering InputOnly windows. In the past I've misunderstood the whole thing, I guess, sorry. Thanks to garfilth and funeral1988 for reporting and providing valuable information. - Fix a possible segfault in DDEBUG_EVENTS. - Add "dbe" as a configuration file option. - Attempt to slightly reduce the rendering delay after VSync in non-DBE mode. I don't think, however, that this would be greatly helpful for the tearing issue. --- compton.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/compton.c b/compton.c index 4394e8088..090bae83e 100755 --- a/compton.c +++ b/compton.c @@ -784,6 +784,13 @@ win_match_once(win *w, const wincond *cond) { cond); #endif + if (InputOnly == w->a.class) { +#ifdef DEBUG_WINMATCH + printf(": InputOnly\n"); +#endif + return false; + } + // Determine the target target = NULL; switch (cond->target) { @@ -1710,6 +1717,10 @@ paint_all(Display *dpy, XserverRegion region, win *t) { XFixesDestroyRegion(dpy, reg_tmp); XFixesDestroyRegion(dpy, reg_tmp2); + // Do this as early as possible + if (!opts.dbe) + XFixesSetPictureClipRegion(dpy, tgt_buffer, 0, 0, None); + // Wait for VBlank vsync_wait(); @@ -1724,7 +1735,6 @@ paint_all(Display *dpy, XserverRegion region, win *t) { } // No-DBE painting mode else if (tgt_buffer != tgt_picture) { - XFixesSetPictureClipRegion(dpy, tgt_buffer, 0, 0, None); XRenderComposite( dpy, PictOpSrc, tgt_buffer, None, tgt_picture, 0, 0, 0, 0, @@ -1819,7 +1829,8 @@ map_win(Display *dpy, Window id, Bool override_redirect) { win *w = find_win(dpy, id); - if (!w) return; + // Don't care about window mapping if it's an InputOnly window + if (!w || InputOnly == w->a.class) return; reg_ignore_expire = True; @@ -3167,7 +3178,7 @@ ev_handle(XEvent *ev) { if (!w) w = find_toplevel(dpy, wid); - if (w->name) + if (w && w->name) window_name = w->name; else to_free = (Bool) wid_get_name(dpy, wid, &window_name); @@ -3686,6 +3697,8 @@ parse_config(char *cpath, struct options_tmp *pcfgtmp) { parse_vsync(sval); // --alpha-step config_lookup_float(&cfg, "alpha-step", &opts.alpha_step); + // --dbe + lcfg_lookup_bool(&cfg, "dbe", &opts.dbe); // --paint-on-overlay lcfg_lookup_bool(&cfg, "paint-on-overlay", &opts.paint_on_overlay); // --sw-opti