]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xwayland: treat Globally Active windows according to type
authorJohn Lindgren <john@jlindgren.net>
Thu, 15 Feb 2024 02:11:03 +0000 (21:11 -0500)
committerJohan Malm <johanmalm@users.noreply.github.com>
Tue, 5 Mar 2024 20:51:32 +0000 (20:51 +0000)
Tested with IntelliJ IDEA and JDownloader 2, which were problematic in
the past.

Fixes: #1139 #1341
src/xwayland.c

index 6c954deefe4ed83b34b7c11e6c99a809cbd87503..8f3ac1e33700cc7d866a4087c18462d3ac88bc5d 100644 (file)
@@ -91,17 +91,15 @@ xwayland_view_wants_focus(struct view *view)
         */
        case WLR_ICCCM_INPUT_MODEL_GLOBAL:
                /*
-                * Assume the window does want focus if it wants window
-                * decorations (according to _MOTIF_WM_HINTS). This is
-                * a stop-gap fix to ensure that various applications
-                * (mainly Java-based ones such as IntelliJ IDEA) get
-                * 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.
+                * Assume that NORMAL and DIALOG windows always want
+                * focus. These window types should show up in the
+                * Alt-Tab switcher and be automatically focused when
+                * they become topmost.
                 */
-               return (xsurface->decorations ==
-                       WLR_XWAYLAND_SURFACE_DECORATIONS_ALL) ?
+               return (xwayland_surface_contains_window_type(xsurface,
+                               NET_WM_WINDOW_TYPE_NORMAL)
+                       || xwayland_surface_contains_window_type(xsurface,
+                               NET_WM_WINDOW_TYPE_DIALOG)) ?
                        VIEW_WANTS_FOCUS_ALWAYS : VIEW_WANTS_FOCUS_OFFER;
 
        /*