Bug fix #191: Add rounded-corners detection to --unredir-if-possible
Add `bounding_shape` and `rounded_corners` as condition match target. Deprecate --shadow-ignore-shaped. Add rounded-corners detection to win_is_fullscreen(). Slightly modify win_rounded_corners() logic. Thanks to tdryer for reporting. (#191)
This commit is contained in:
3
src/c2.c
3
src/c2.c
@ -764,6 +764,7 @@ c2_l_postprocess(session_t *ps, c2_l_t *pleaf) {
|
||||
if (pleaf->predef) {
|
||||
switch (pleaf->predef) {
|
||||
case C2_L_PFOCUSED: ps->o.track_focus = true; break;
|
||||
// case C2_L_PROUNDED: ps->o.detect_rounded_corners = true; break;
|
||||
case C2_L_PNAME:
|
||||
case C2_L_PCLASSG:
|
||||
case C2_L_PCLASSI:
|
||||
@ -1057,6 +1058,8 @@ c2_match_once_leaf(session_t *ps, win *w, const c2_l_t *pleaf,
|
||||
case C2_L_PARGB: tgt = (WMODE_ARGB == w->mode); break;
|
||||
case C2_L_PFOCUSED: tgt = win_is_focused_real(ps, w); break;
|
||||
case C2_L_PWMWIN: tgt = w->wmwin; break;
|
||||
case C2_L_PBSHAPED: tgt = w->bounding_shaped; break;
|
||||
case C2_L_PROUNDED: tgt = w->rounded_corners; break;
|
||||
case C2_L_PCLIENT: tgt = w->client_win; break;
|
||||
case C2_L_PLEADER: tgt = w->leader; break;
|
||||
default: *perr = true; assert(0); break;
|
||||
|
4
src/c2.h
4
src/c2.h
@ -113,6 +113,8 @@ struct _c2_l {
|
||||
C2_L_PARGB,
|
||||
C2_L_PFOCUSED,
|
||||
C2_L_PWMWIN,
|
||||
C2_L_PBSHAPED,
|
||||
C2_L_PROUNDED,
|
||||
C2_L_PCLIENT,
|
||||
C2_L_PWINDOWTYPE,
|
||||
C2_L_PLEADER,
|
||||
@ -201,6 +203,8 @@ const static c2_predef_t C2_PREDEFS[] = {
|
||||
[C2_L_PARGB ] = { "argb" , C2_L_TCARDINAL , 0 },
|
||||
[C2_L_PFOCUSED ] = { "focused" , C2_L_TCARDINAL , 0 },
|
||||
[C2_L_PWMWIN ] = { "wmwin" , C2_L_TCARDINAL , 0 },
|
||||
[C2_L_PBSHAPED ] = { "bounding_shaped" , C2_L_TCARDINAL , 0 },
|
||||
[C2_L_PROUNDED ] = { "rounded_corners" , C2_L_TCARDINAL , 0 },
|
||||
[C2_L_PCLIENT ] = { "client" , C2_L_TWINDOW , 0 },
|
||||
[C2_L_PWINDOWTYPE ] = { "window_type" , C2_L_TSTRING , 0 },
|
||||
[C2_L_PLEADER ] = { "leader" , C2_L_TWINDOW , 0 },
|
||||
|
@ -1962,7 +1962,7 @@ rect_is_fullscreen(session_t *ps, int x, int y, unsigned wid, unsigned hei) {
|
||||
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;
|
||||
&& (!w->bounding_shaped || w->rounded_corners);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -647,6 +647,8 @@ wid_get_prop_adv(const session_t *ps, Window w, Atom atom, long offset,
|
||||
*/
|
||||
static void
|
||||
win_rounded_corners(session_t *ps, win *w) {
|
||||
w->rounded_corners = false;
|
||||
|
||||
if (!w->bounding_shaped)
|
||||
return;
|
||||
|
||||
@ -676,11 +678,9 @@ win_rounded_corners(session_t *ps, win *w) {
|
||||
for (i = 0; i < nrects; ++i)
|
||||
if (rects[i].width >= minwidth && rects[i].height >= minheight) {
|
||||
w->rounded_corners = true;
|
||||
cxfree(rects);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
w->rounded_corners = false;
|
||||
cxfree(rects);
|
||||
}
|
||||
|
||||
@ -4483,10 +4483,15 @@ usage(int ret) {
|
||||
"--no-fading-openclose\n"
|
||||
" Do not fade on window open/close.\n"
|
||||
"--shadow-ignore-shaped\n"
|
||||
" Do not paint shadows on shaped windows.\n"
|
||||
" Do not paint shadows on shaped windows. (Deprecated, use\n"
|
||||
" --shadow-exclude \'bounding_shaped\' or\n"
|
||||
" --shadow-exclude \'bounding_shaped && !rounded_corners\' instead.)\n"
|
||||
"--detect-rounded-corners\n"
|
||||
" Try to detect windows with rounded corners and don't consider\n"
|
||||
" them shaped windows.\n"
|
||||
" them shaped windows. Affects --shadow-ignore-shaped,\n"
|
||||
" --unredir-if-possible, and possibly others. You need to turn this\n"
|
||||
" on manually if you want to match against rounded_corners in\n"
|
||||
" conditions.\n"
|
||||
"--detect-client-opacity\n"
|
||||
" Detect _NET_WM_OPACITY on client windows, useful for window\n"
|
||||
" managers not passing _NET_WM_OPACITY of client windows to frame\n"
|
||||
|
Reference in New Issue
Block a user