summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Grenville <pyxlcy@gmail.com>2014-04-21 22:45:27 +0800
committerRichard Grenville <pyxlcy@gmail.com>2014-04-21 22:45:27 +0800
commit5df42e8eb18437bdaa431b8fd5c422c66d67b75f (patch)
treee4089a88ff7a16ce4ca41f8b3c60f620709402b1
parent6a5738080a69b6978c81a257c4784ab67ce8de92 (diff)
downloadtdebase-5df42e8eb18437bdaa431b8fd5c422c66d67b75f.tar.gz
tdebase-5df42e8eb18437bdaa431b8fd5c422c66d67b75f.zip
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)
-rw-r--r--c2.c3
-rw-r--r--c2.h4
-rw-r--r--common.h2
-rw-r--r--compton.c15
4 files changed, 18 insertions, 6 deletions
diff --git a/c2.c b/c2.c
index f70dcb5a7..6baf1337e 100644
--- a/c2.c
+++ b/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;
diff --git a/c2.h b/c2.h
index 3c56e2fa7..e9aaf8b59 100644
--- a/c2.h
+++ b/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 },
diff --git a/common.h b/common.h
index d563c3764..bbbfeae8e 100644
--- a/common.h
+++ b/common.h
@@ -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);
}
/**
diff --git a/compton.c b/compton.c
index 14d7d0739..00464ffc0 100644
--- a/compton.c
+++ b/compton.c
@@ -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"