c2: make override_redirect only match top-level windows without a client

Fixes #625

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-05-16 18:27:29 +01:00
parent c092e170f2
commit 97c14ee65d
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
2 changed files with 11 additions and 1 deletions

View File

@ -28,6 +28,7 @@
## Notable changes
* `override_redirect` in rules now only matches top-level windows that doesn't have a client window. Some window managers (e.g. awesome) set override_redirect for all window manager frame windows, causing this rule to match against everything (#625).
* Marginally improve performance when resizing/opening/closing windows. (#1190)
* Type and format specifiers are no longer used in rules. These specifiers are what you put after the colon (':') in rules, e.g. the `:32c` in `"_GTK_FRAME_EXTENTS@:32c"`. Now this information is ignored and the property is matched regardless of format or type.

View File

@ -1588,7 +1588,6 @@ static bool c2_match_once_leaf_int(const struct managed_win *w, const c2_l_t *le
case C2_L_PHEIGHTB: predef_target = w->heightb; break;
case C2_L_PBDW: predef_target = w->g.border_width; break;
case C2_L_PFULLSCREEN: predef_target = w->is_fullscreen; break;
case C2_L_POVREDIR: predef_target = w->a.override_redirect; break;
case C2_L_PARGB: predef_target = win_has_alpha(w); break;
case C2_L_PFOCUSED: predef_target = win_is_focused_raw(w); break;
case C2_L_PWMWIN: predef_target = win_is_wmwin(w); break;
@ -1596,6 +1595,16 @@ static bool c2_match_once_leaf_int(const struct managed_win *w, const c2_l_t *le
case C2_L_PROUNDED: predef_target = w->rounded_corners; break;
case C2_L_PCLIENT: predef_target = w->client_win; break;
case C2_L_PLEADER: predef_target = w->leader; break;
case C2_L_POVREDIR:
// When user wants to check override-redirect, they almost always
// want to check the client window, not the frame window. We
// don't track the override-redirect state of the client window
// directly, however we can assume if a window has a window
// manager frame around it, it's not override-redirect.
predef_target =
w->a.override_redirect && (w->client_win == w->base.id ||
w->client_win == XCB_WINDOW_NONE);
break;
default: unreachable();
}
return c2_int_op(leaf, predef_target);