fix: miss judgment on x11 pop-up windows that shouldn't focus

This commit is contained in:
DreamMaoMao 2025-05-13 19:03:13 +08:00
parent faa56cc9b9
commit df58383e18
2 changed files with 30 additions and 1 deletions

View File

@ -382,6 +382,35 @@ client_set_suspended(Client *c, int suspended)
wlr_xdg_toplevel_set_suspended(c->surface.xdg->toplevel, suspended);
}
static inline int
client_should_ignore_focus(Client *c) {
#ifdef XWAYLAND
int i;
if (client_is_x11(c)) {
struct wlr_xwayland_surface *surface = c->surface.xwayland;
const uint32_t no_focus_types[] = {
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_COMBO,
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DND,
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_MENU,
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_NOTIFICATION,
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_POPUP_MENU,
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH,
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DESKTOP,
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLTIP,
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY};
for (i = 0;
i < LENGTH(no_focus_types); ++i) {
if (wlr_xwayland_surface_has_window_type(surface,
no_focus_types[i])) {
return 1;
}
}
}
#endif
return 0;
}
static inline int
client_wants_focus(Client *c)
{

2
dwl.c
View File

@ -1404,7 +1404,7 @@ focusclient(Client *c, int lift)
Client *old_c = NULL;
LayerSurface *old_l = NULL;
if (locked)
if (locked || (c && client_should_ignore_focus(c)))
return;
/* Raise client in stacking order if requested */