Skip to content

Commit

Permalink
c2: make override_redirect only match top-level windows without a client
Browse files Browse the repository at this point in the history
Fixes #625

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
  • Loading branch information
yshui committed May 16, 2024
1 parent c092e17 commit 97c14ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
11 changes: 10 additions & 1 deletion src/c2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1588,14 +1588,23 @@ 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;
case C2_L_PBSHAPED: predef_target = w->bounding_shaped; break;
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);
Expand Down

0 comments on commit 97c14ee

Please sign in to comment.