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.
This commit is contained in:
parent
044a5c991c
commit
c02b3fadf0
@ -43,4 +43,4 @@ include(GNUInstallDirs)
|
|||||||
install(FILES
|
install(FILES
|
||||||
"compton.1"
|
"compton.1"
|
||||||
"compton-trans.1"
|
"compton-trans.1"
|
||||||
DESTINATION "${CMAKE_INSTALL_MANDIR}" COMPONENT doc)
|
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT doc)
|
||||||
|
8
src/c2.c
8
src/c2.c
@ -1043,6 +1043,14 @@ c2_match_once_leaf(session_t *ps, win *w, const c2_l_t *pleaf,
|
|||||||
*perr = false;
|
*perr = false;
|
||||||
switch (pleaf->predef) {
|
switch (pleaf->predef) {
|
||||||
case C2_L_PID: tgt = wid; break;
|
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_POVREDIR: tgt = w->a.override_redirect; break;
|
||||||
case C2_L_PARGB: tgt = (WMODE_ARGB == w->mode); break;
|
case C2_L_PARGB: tgt = (WMODE_ARGB == w->mode); break;
|
||||||
case C2_L_PFOCUSED: tgt = w->focused_real; break;
|
case C2_L_PFOCUSED: tgt = w->focused_real; break;
|
||||||
|
16
src/c2.h
16
src/c2.h
@ -99,6 +99,14 @@ struct _c2_l {
|
|||||||
enum {
|
enum {
|
||||||
C2_L_PUNDEFINED,
|
C2_L_PUNDEFINED,
|
||||||
C2_L_PID,
|
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_POVREDIR,
|
||||||
C2_L_PARGB,
|
C2_L_PARGB,
|
||||||
C2_L_PFOCUSED,
|
C2_L_PFOCUSED,
|
||||||
@ -177,6 +185,14 @@ typedef struct {
|
|||||||
// Predefined targets.
|
// Predefined targets.
|
||||||
const static c2_predef_t C2_PREDEFS[] = {
|
const static c2_predef_t C2_PREDEFS[] = {
|
||||||
[C2_L_PID ] = { "id" , C2_L_TCARDINAL , 0 },
|
[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_POVREDIR ] = { "override_redirect" , C2_L_TCARDINAL , 0 },
|
||||||
[C2_L_PARGB ] = { "argb" , C2_L_TCARDINAL , 0 },
|
[C2_L_PARGB ] = { "argb" , C2_L_TCARDINAL , 0 },
|
||||||
[C2_L_PFOCUSED ] = { "focused" , C2_L_TCARDINAL , 0 },
|
[C2_L_PFOCUSED ] = { "focused" , C2_L_TCARDINAL , 0 },
|
||||||
|
16
src/common.h
16
src/common.h
@ -468,6 +468,8 @@ typedef struct {
|
|||||||
int benchmark;
|
int benchmark;
|
||||||
/// Window to constantly repaint in benchmark mode. 0 for full-screen.
|
/// Window to constantly repaint in benchmark mode. 0 for full-screen.
|
||||||
Window benchmark_wid;
|
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.
|
/// Whether to work under synchronized mode for debugging.
|
||||||
bool synchronize;
|
bool synchronize;
|
||||||
|
|
||||||
@ -896,6 +898,8 @@ typedef struct _win {
|
|||||||
bool rounded_corners;
|
bool rounded_corners;
|
||||||
/// Whether this window is to be painted.
|
/// Whether this window is to be painted.
|
||||||
bool to_paint;
|
bool to_paint;
|
||||||
|
/// Whether the window is painting excluded.
|
||||||
|
bool paint_excluded;
|
||||||
/// Whether this window is in open/close state.
|
/// Whether this window is in open/close state.
|
||||||
bool in_openclose;
|
bool in_openclose;
|
||||||
|
|
||||||
@ -936,6 +940,7 @@ typedef struct _win {
|
|||||||
const c2_lptr_t *cache_ivclst;
|
const c2_lptr_t *cache_ivclst;
|
||||||
const c2_lptr_t *cache_bbblst;
|
const c2_lptr_t *cache_bbblst;
|
||||||
const c2_lptr_t *cache_oparule;
|
const c2_lptr_t *cache_oparule;
|
||||||
|
const c2_lptr_t *cache_pblst;
|
||||||
|
|
||||||
// Opacity-related members
|
// Opacity-related members
|
||||||
/// Current window opacity.
|
/// 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);
|
&& (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.
|
* Determine if a window has a specific property.
|
||||||
*
|
*
|
||||||
|
@ -1128,6 +1128,8 @@ paint_preprocess(session_t *ps, win *list) {
|
|||||||
to_paint = false;
|
to_paint = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
to_paint = to_paint && !w->paint_excluded;
|
||||||
|
|
||||||
if (to_paint) {
|
if (to_paint) {
|
||||||
// If opacity changes
|
// If opacity changes
|
||||||
if (w->opacity != opacity_old) {
|
if (w->opacity != opacity_old) {
|
||||||
@ -2493,6 +2495,9 @@ win_on_factor_change(session_t *ps, win *w) {
|
|||||||
win_determine_blur_background(ps, w);
|
win_determine_blur_background(ps, w);
|
||||||
if (ps->o.opacity_rules)
|
if (ps->o.opacity_rules)
|
||||||
win_update_opacity_rule(ps, w);
|
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);
|
restack_win(ps, w, ce->above);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool factor_change = false;
|
||||||
|
|
||||||
// Windows restack (including window restacks happened when this
|
// Windows restack (including window restacks happened when this
|
||||||
// window is not mapped) could mess up all reg_ignore
|
// window is not mapped) could mess up all reg_ignore
|
||||||
ps->reg_ignore_expire = true;
|
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
|
if (w->a.x != ce->x || w->a.y != ce->y
|
||||||
|| w->a.width != ce->width || w->a.height != ce->height
|
|| w->a.width != ce->width || w->a.height != ce->height
|
||||||
|| w->a.border_width != ce->border_width) {
|
|| w->a.border_width != ce->border_width) {
|
||||||
|
factor_change = true;
|
||||||
free_region(ps, &w->extents);
|
free_region(ps, &w->extents);
|
||||||
free_region(ps, &w->border_size);
|
free_region(ps, &w->border_size);
|
||||||
}
|
}
|
||||||
@ -2979,6 +2987,9 @@ configure_win(session_t *ps, XConfigureEvent *ce) {
|
|||||||
XFixesDestroyRegion(ps->dpy, extents);
|
XFixesDestroyRegion(ps->dpy, extents);
|
||||||
add_damage(ps, damage);
|
add_damage(ps, damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (factor_change)
|
||||||
|
win_on_factor_change(ps, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
// override_redirect flag cannot be changed after window creation, as far
|
// 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 },
|
{ "glx-use-gpushader4", no_argument, NULL, 303 },
|
||||||
{ "opacity-rule", required_argument, NULL, 304 },
|
{ "opacity-rule", required_argument, NULL, 304 },
|
||||||
{ "shadow-exclude-reg", required_argument, NULL, 305 },
|
{ "shadow-exclude-reg", required_argument, NULL, 305 },
|
||||||
|
{ "paint-exclude", required_argument, NULL, 306 },
|
||||||
// Must terminate with a NULL entry
|
// Must terminate with a NULL entry
|
||||||
{ NULL, 0, NULL, 0 },
|
{ 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))
|
if (!parse_geometry(ps, optarg, &ps->o.shadow_exclude_reg_geom))
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
|
case 306:
|
||||||
|
// --paint-exclude
|
||||||
|
condlst_add(ps, &ps->o.paint_blacklist, optarg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage(1);
|
usage(1);
|
||||||
break;
|
break;
|
||||||
@ -6817,6 +6833,7 @@ session_destroy(session_t *ps) {
|
|||||||
free_wincondlst(&ps->o.invert_color_list);
|
free_wincondlst(&ps->o.invert_color_list);
|
||||||
free_wincondlst(&ps->o.blur_background_blacklist);
|
free_wincondlst(&ps->o.blur_background_blacklist);
|
||||||
free_wincondlst(&ps->o.opacity_rules);
|
free_wincondlst(&ps->o.opacity_rules);
|
||||||
|
free_wincondlst(&ps->o.paint_blacklist);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Free tracked atom list
|
// 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
|
static void
|
||||||
win_rounded_corners(session_t *ps, win *w);
|
win_rounded_corners(session_t *ps, win *w);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user