From 0eed59406cde5a853828d455df452787d3b2ecfd Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Wed, 4 Mar 2026 11:41:12 +0800 Subject: [PATCH] opt: check kde atom _kde_net_wm_window_type_override) --- src/client/client.h | 15 +++++++++++++++ src/mango.c | 14 +++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/client/client.h b/src/client/client.h index 4788e448..646dbef0 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -448,8 +448,23 @@ static inline int32_t client_should_overtop(Client *c) { return 0; } +static inline bool +extra_xwayland_surface_has_window_type(struct wlr_xwayland_surface *surface, + xcb_atom_t atom) { + for (size_t i = 0; i < surface->window_type_len; i++) { + if (surface->window_type[i] == atom) + return true; + } + return false; +} + static inline int32_t client_wants_focus(Client *c) { #ifdef XWAYLAND + + if (extra_xwayland_surface_has_window_type( + c->surface.xwayland, atom_kde_net_wm_window_type_override)) + return false; + return client_is_unmanaged(c) && wlr_xwayland_surface_override_redirect_wants_focus( c->surface.xwayland) && diff --git a/src/mango.c b/src/mango.c index 8a93a792..1b2b13eb 100644 --- a/src/mango.c +++ b/src/mango.c @@ -919,7 +919,6 @@ static struct { int32_t hotspot_y; } last_cursor; -#include "client/client.h" #include "config/preset.h" struct Pertag { @@ -988,12 +987,14 @@ static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11}; static struct wl_listener xwayland_ready = {.notify = xwaylandready}; static struct wlr_xwayland *xwayland; static struct wl_event_source *sync_keymap; +static xcb_atom_t atom_kde_net_wm_window_type_override; #endif #include "animation/client.h" #include "animation/common.h" #include "animation/layer.h" #include "animation/tag.h" +#include "client/client.h" #include "config/parse_config.h" #include "dispatch/bind_define.h" #include "ext-protocol/all.h" @@ -6552,6 +6553,17 @@ void xwaylandready(struct wl_listener *listener, void *data) { /* xwayland can't auto sync the keymap, so we do it manually and we need to wait the xwayland completely inited */ + + xcb_connection_t *xcb_conn = + xcb_connect(NULL, NULL); // ๆˆ–ไปŽ wlr_xwayland ่Žทๅ– + xcb_intern_atom_cookie_t cookie = + xcb_intern_atom(xcb_conn, 0, strlen("_KDE_NET_WM_WINDOW_TYPE_OVERRIDE"), + "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE"); + xcb_intern_atom_reply_t *reply = + xcb_intern_atom_reply(xcb_conn, cookie, NULL); + atom_kde_net_wm_window_type_override = reply->atom; + free(reply); + wl_event_source_timer_update(sync_keymap, 500); }