1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-10-27 05:24:17 -04:00

win: remove wmwin

wmwin can be trivially computed from other information in struct win,
there is no need to save it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-02-19 22:47:28 +00:00
parent 56af75c5e0
commit b4c7519eb2
No known key found for this signature in database
GPG key ID: D3A4405BE6CC17F4
4 changed files with 17 additions and 15 deletions

View file

@ -1571,7 +1571,7 @@ static bool c2_match_once_leaf_int(const struct managed_win *w, const c2_l_t *le
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 = w->wmwin; 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;

View file

@ -973,7 +973,10 @@ static bool cdbus_process_win_get(session_t *ps, DBusMessage *msg) {
cdbus_m_win_get_do(client_win, cdbus_reply_wid);
cdbus_m_win_get_do(ever_damaged, cdbus_reply_bool);
cdbus_m_win_get_do(window_type, cdbus_reply_enum);
cdbus_m_win_get_do(wmwin, cdbus_reply_bool);
if (!strcmp("wmwin", target)) {
cdbus_reply_bool(ps, msg, win_is_wmwin(w));
return true;
}
cdbus_m_win_get_do(leader, cdbus_reply_wid);
if (!strcmp("focused_raw", target)) {
cdbus_reply_bool(ps, msg, win_is_focused_raw(w));

View file

@ -149,13 +149,14 @@ static void win_update_focused(session_t *ps, struct managed_win *w) {
if (w->focused_force != UNSET) {
w->focused = w->focused_force;
} else {
bool is_wmwin = win_is_wmwin(w);
w->focused = win_is_focused_raw(w);
// Use wintype_focus, and treat WM windows and override-redirected
// windows specially
if (ps->o.wintype_option[w->window_type].focus ||
(ps->o.mark_wmwin_focused && w->wmwin) ||
(ps->o.mark_ovredir_focused && w->base.id == w->client_win && !w->wmwin) ||
(ps->o.mark_wmwin_focused && is_wmwin) ||
(ps->o.mark_ovredir_focused && w->base.id == w->client_win && !is_wmwin) ||
(w->a.map_state == XCB_MAP_STATE_VIEWABLE &&
c2_match(ps->c2_state, w, ps->o.focus_blacklist, NULL))) {
w->focused = true;
@ -1465,8 +1466,6 @@ static xcb_window_t find_client_win(session_t *ps, xcb_window_t w) {
*/
void win_recheck_client(session_t *ps, struct managed_win *w) {
assert(ps->server_grabbed);
// Initialize wmwin to false
w->wmwin = false;
// Look for the client window
@ -1480,9 +1479,8 @@ void win_recheck_client(session_t *ps, struct managed_win *w) {
// client window
if (!cw) {
cw = w->base.id;
w->wmwin = !w->a.override_redirect;
log_debug("(%#010x): client self (%s)", w->base.id,
(w->wmwin ? "wmwin" : "override-redirected"));
(w->a.override_redirect ? "override-redirected" : "wmwin"));
}
// Unmark the old one
@ -1629,7 +1627,6 @@ struct win *fill_win(session_t *ps, struct win *w) {
.leader = XCB_NONE,
.cache_leader = XCB_NONE,
.window_type = WINTYPE_UNKNOWN,
.wmwin = false,
.focused = false,
.opacity = 0,
.opacity_target = 0,
@ -2367,9 +2364,8 @@ bool destroy_win_start(session_t *ps, struct win *w) {
if (win_check_flags_all(mw, WIN_FLAGS_CLIENT_STALE)) {
mw->client_win = mw->base.id;
mw->wmwin = !mw->a.override_redirect;
log_debug("(%#010x): client self (%s)", mw->base.id,
(mw->wmwin ? "wmwin" : "override-redirected"));
(mw->a.override_redirect ? "override-redirected" : "wmwin"));
}
// Clear some flags about stale window information. Because now

View file

@ -175,10 +175,6 @@ struct managed_win {
xcb_window_t client_win;
/// Type of the window.
wintype_t window_type;
/// Whether it looks like a WM window. We consider a window WM window if
/// it does not have a decedent with WM_STATE and it is not override-
/// redirected itself.
bool wmwin;
/// Leader window ID of the window.
xcb_window_t leader;
/// Cached topmost window ID of the window.
@ -444,6 +440,13 @@ bool attr_pure win_is_focused_raw(const struct managed_win *w);
/// check if window has ARGB visual
bool attr_pure win_has_alpha(const struct managed_win *w);
/// Whether it looks like a WM window. We consider a window WM window if
/// it does not have a decedent with WM_STATE and it is not override-
/// redirected itself.
static inline bool attr_pure win_is_wmwin(const struct managed_win *w) {
return w->base.id == w->client_win && !w->a.override_redirect;
}
/// check if reg_ignore_valid is true for all windows above us
bool attr_pure win_is_region_ignore_valid(session_t *ps, const struct managed_win *w);