diff options
-rw-r--r-- | c2.c | 8 | ||||
-rw-r--r-- | c2.h | 16 | ||||
-rw-r--r-- | common.h | 16 | ||||
-rw-r--r-- | compton.c | 17 | ||||
-rw-r--r-- | compton.h | 11 |
5 files changed, 57 insertions, 11 deletions
@@ -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; @@ -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 }, @@ -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. @@ -1721,6 +1726,17 @@ rect_is_fullscreen(session_t *ps, int x, int y, unsigned wid, unsigned hei) { } /** + * 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. * * @param ps current session @@ -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 @@ -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); |