From e374e9c530bbaf9fca0291fc7ee2857fc72b4bda Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 8 Jul 2025 13:47:39 +0800 Subject: [PATCH] opt: optimize global and above x11 window judge --- src/client/client.h | 24 +++++++++++++++--------- src/maomao.c | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/client/client.h b/src/client/client.h index f403044..2bf3b8b 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -397,20 +397,26 @@ static inline int client_should_ignore_focus(Client *c) { return 0; } +static inline int client_should_global(Client *c) { + +#ifdef XWAYLAND + if (client_is_x11(c)) { + struct wlr_xwayland_surface *surface = c->surface.xwayland; + + if (surface->sticky) + return 1; + } +#endif + return 0; +} + static inline int client_should_overtop(Client *c) { #ifdef XWAYLAND if (client_is_x11(c)) { struct wlr_xwayland_surface *surface = c->surface.xwayland; - const uint32_t over_top_types[] = { - WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY}; - for (size_t i = 0; - i < sizeof(over_top_types) / sizeof(over_top_types[0]); ++i) { - if (wlr_xwayland_surface_has_window_type(surface, - over_top_types[i])) { - return 1; - } - } + if (surface->above) + return 1; } #endif return 0; diff --git a/src/maomao.c b/src/maomao.c index 2899ba9..61e471a 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -3905,7 +3905,7 @@ mapnotify(struct wl_listener *listener, void *data) { c->bw = borderpx; } - if (client_should_overtop(c) && !client_get_parent(c)) { + if (client_should_global(c)) { c->isunglobal = 1; }