From 1096bf90d96bc18a7e09fe5f26fa0c703f1fbdf8 Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Wed, 19 Jun 2013 19:36:48 +0800 Subject: Misc: --paint-exclude & #119 - Add --paint-exclude to prevent certain windows from being painted, for debugging purposes. - Add predefined matching target "x", "y", "width", "height", "widthb", "heightb", "border_width", and "fullscreen". - Fix bug #119, wrong man page install dir in CMake configuration. Thanks to sstewartgallus for reporting. --- c2.c | 8 ++++++++ c2.h | 16 ++++++++++++++++ common.h | 16 ++++++++++++++++ compton.c | 17 +++++++++++++++++ compton.h | 11 ----------- 5 files changed, 57 insertions(+), 11 deletions(-) diff --git a/c2.c b/c2.c index bd286278a..d2ca7be1f 100644 --- a/c2.c +++ b/c2.c @@ -1043,6 +1043,14 @@ c2_match_once_leaf(session_t *ps, win *w, const c2_l_t *pleaf, *perr = false; switch (pleaf->predef) { case C2_L_PID: tgt = wid; break; + case C2_L_PX: tgt = w->a.x; break; + case C2_L_PY: tgt = w->a.y; break; + case C2_L_PWIDTH: tgt = w->a.width; break; + case C2_L_PHEIGHT: tgt = w->a.height; break; + case C2_L_PWIDTHB: tgt = w->widthb; break; + case C2_L_PHEIGHTB: tgt = w->heightb; break; + case C2_L_PBDW: tgt = w->a.border_width; break; + case C2_L_PFULLSCREEN: tgt = win_is_fullscreen(ps, w); break; case C2_L_POVREDIR: tgt = w->a.override_redirect; break; case C2_L_PARGB: tgt = (WMODE_ARGB == w->mode); break; case C2_L_PFOCUSED: tgt = w->focused_real; break; diff --git a/c2.h b/c2.h index b26a687de..e2ab38d83 100644 --- a/c2.h +++ b/c2.h @@ -99,6 +99,14 @@ struct _c2_l { enum { C2_L_PUNDEFINED, C2_L_PID, + C2_L_PX, + C2_L_PY, + C2_L_PWIDTH, + C2_L_PHEIGHT, + C2_L_PWIDTHB, + C2_L_PHEIGHTB, + C2_L_PBDW, + C2_L_PFULLSCREEN, C2_L_POVREDIR, C2_L_PARGB, C2_L_PFOCUSED, @@ -177,6 +185,14 @@ typedef struct { // Predefined targets. const static c2_predef_t C2_PREDEFS[] = { [C2_L_PID ] = { "id" , C2_L_TCARDINAL , 0 }, + [C2_L_PX ] = { "x" , C2_L_TCARDINAL , 0 }, + [C2_L_PY ] = { "y" , C2_L_TCARDINAL , 0 }, + [C2_L_PWIDTH ] = { "width" , C2_L_TCARDINAL , 0 }, + [C2_L_PHEIGHT ] = { "height" , C2_L_TCARDINAL , 0 }, + [C2_L_PWIDTHB ] = { "widthb" , C2_L_TCARDINAL , 0 }, + [C2_L_PHEIGHTB ] = { "heightb" , C2_L_TCARDINAL , 0 }, + [C2_L_PBDW ] = { "border_width" , C2_L_TCARDINAL , 0 }, + [C2_L_PFULLSCREEN ] = { "fullscreen" , C2_L_TCARDINAL , 0 }, [C2_L_POVREDIR ] = { "override_redirect" , C2_L_TCARDINAL , 0 }, [C2_L_PARGB ] = { "argb" , C2_L_TCARDINAL , 0 }, [C2_L_PFOCUSED ] = { "focused" , C2_L_TCARDINAL , 0 }, diff --git a/common.h b/common.h index 76a7b34e3..d3bc58023 100644 --- a/common.h +++ b/common.h @@ -468,6 +468,8 @@ typedef struct { int benchmark; /// Window to constantly repaint in benchmark mode. 0 for full-screen. Window benchmark_wid; + /// A list of conditions of windows not to paint. + c2_lptr_t *paint_blacklist; /// Whether to work under synchronized mode for debugging. bool synchronize; @@ -896,6 +898,8 @@ typedef struct _win { bool rounded_corners; /// Whether this window is to be painted. bool to_paint; + /// Whether the window is painting excluded. + bool paint_excluded; /// Whether this window is in open/close state. bool in_openclose; @@ -936,6 +940,7 @@ typedef struct _win { const c2_lptr_t *cache_ivclst; const c2_lptr_t *cache_bbblst; const c2_lptr_t *cache_oparule; + const c2_lptr_t *cache_pblst; // Opacity-related members /// Current window opacity. @@ -1720,6 +1725,17 @@ rect_is_fullscreen(session_t *ps, int x, int y, unsigned wid, unsigned hei) { && (x + wid) >= ps->root_width && (y + hei) >= ps->root_height); } +/** + * Check if a window is a fullscreen window. + * + * It's not using w->border_size for performance measures. + */ +static inline bool +win_is_fullscreen(session_t *ps, const win *w) { + return rect_is_fullscreen(ps, w->a.x, w->a.y, w->widthb, w->heightb) + && !w->bounding_shaped; +} + /** * Determine if a window has a specific property. * diff --git a/compton.c b/compton.c index 74bebfb47..0f578791f 100644 --- a/compton.c +++ b/compton.c @@ -1128,6 +1128,8 @@ paint_preprocess(session_t *ps, win *list) { to_paint = false; } + to_paint = to_paint && !w->paint_excluded; + if (to_paint) { // If opacity changes if (w->opacity != opacity_old) { @@ -2493,6 +2495,9 @@ win_on_factor_change(session_t *ps, win *w) { win_determine_blur_background(ps, w); if (ps->o.opacity_rules) win_update_opacity_rule(ps, w); + if (ps->o.paint_blacklist) + w->paint_excluded = win_match(ps, w, ps->o.paint_blacklist, + &w->cache_pblst); } /** @@ -2934,6 +2939,8 @@ configure_win(session_t *ps, XConfigureEvent *ce) { restack_win(ps, w, ce->above); } + bool factor_change = false; + // Windows restack (including window restacks happened when this // window is not mapped) could mess up all reg_ignore ps->reg_ignore_expire = true; @@ -2949,6 +2956,7 @@ configure_win(session_t *ps, XConfigureEvent *ce) { if (w->a.x != ce->x || w->a.y != ce->y || w->a.width != ce->width || w->a.height != ce->height || w->a.border_width != ce->border_width) { + factor_change = true; free_region(ps, &w->extents); free_region(ps, &w->border_size); } @@ -2979,6 +2987,9 @@ configure_win(session_t *ps, XConfigureEvent *ce) { XFixesDestroyRegion(ps->dpy, extents); add_damage(ps, damage); } + + if (factor_change) + win_on_factor_change(ps, w); } // override_redirect flag cannot be changed after window creation, as far @@ -5217,6 +5228,7 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) { { "glx-use-gpushader4", no_argument, NULL, 303 }, { "opacity-rule", required_argument, NULL, 304 }, { "shadow-exclude-reg", required_argument, NULL, 305 }, + { "paint-exclude", required_argument, NULL, 306 }, // Must terminate with a NULL entry { NULL, 0, NULL, 0 }, }; @@ -5460,6 +5472,10 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) { if (!parse_geometry(ps, optarg, &ps->o.shadow_exclude_reg_geom)) exit(1); break; + case 306: + // --paint-exclude + condlst_add(ps, &ps->o.paint_blacklist, optarg); + break; default: usage(1); break; @@ -6817,6 +6833,7 @@ session_destroy(session_t *ps) { free_wincondlst(&ps->o.invert_color_list); free_wincondlst(&ps->o.blur_background_blacklist); free_wincondlst(&ps->o.opacity_rules); + free_wincondlst(&ps->o.paint_blacklist); #endif // Free tracked atom list diff --git a/compton.h b/compton.h index 06d48e1b3..c0773db99 100644 --- a/compton.h +++ b/compton.h @@ -478,17 +478,6 @@ dump_drawable(session_t *ps, Drawable drawable) { } } -/** - * Check if a window is a fullscreen window. - * - * It's not using w->border_size for performance measures. - */ -static inline bool -win_is_fullscreen(session_t *ps, const win *w) { - return rect_is_fullscreen(ps, w->a.x, w->a.y, w->widthb, w->heightb) - && !w->bounding_shaped; -} - static void win_rounded_corners(session_t *ps, win *w); -- cgit v1.2.1