xwayland: treat Globally Active windows according to type

Tested with IntelliJ IDEA and JDownloader 2, which were problematic in
the past.

Fixes: #1139 #1341
This commit is contained in:
John Lindgren 2024-02-14 21:11:03 -05:00 committed by Johan Malm
parent 3ebc07f7aa
commit 9e3785f8cd

View file

@ -91,17 +91,15 @@ xwayland_view_wants_focus(struct view *view)
*/ */
case WLR_ICCCM_INPUT_MODEL_GLOBAL: case WLR_ICCCM_INPUT_MODEL_GLOBAL:
/* /*
* Assume the window does want focus if it wants window * Assume that NORMAL and DIALOG windows always want
* decorations (according to _MOTIF_WM_HINTS). This is * focus. These window types should show up in the
* a stop-gap fix to ensure that various applications * Alt-Tab switcher and be automatically focused when
* (mainly Java-based ones such as IntelliJ IDEA) get * they become topmost.
* focus normally and appear in the window switcher. It
* would be better to match based on _NET_WM_WINDOW_TYPE
* instead, but that property isn't currently available
* through wlroots API.
*/ */
return (xsurface->decorations == return (xwayland_surface_contains_window_type(xsurface,
WLR_XWAYLAND_SURFACE_DECORATIONS_ALL) ? NET_WM_WINDOW_TYPE_NORMAL)
|| xwayland_surface_contains_window_type(xsurface,
NET_WM_WINDOW_TYPE_DIALOG)) ?
VIEW_WANTS_FOCUS_ALWAYS : VIEW_WANTS_FOCUS_OFFER; VIEW_WANTS_FOCUS_ALWAYS : VIEW_WANTS_FOCUS_OFFER;
/* /*