]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Revert "desktop: try harder to avoid focusing unfocusable views"
authorJohn Lindgren <john@jlindgren.net>
Tue, 3 Oct 2023 02:12:22 +0000 (22:12 -0400)
committerJohn Lindgren <john@jlindgren.net>
Wed, 4 Oct 2023 14:28:39 +0000 (10:28 -0400)
Some X11 applications (MATLAB is known to be one) apparently still use
the outdated "globally active" input focus model, in which they declare
they don't want the window manager to give them input focus, but expect
to be able to take it explicitly themselves via XSetInputFocus().

Such applications are not a good fit for the Wayland world, and may have
issues even with remotely modern X11 window managers that prevent such
"focus stealing". Labwc certainly doesn't (and won't) allow it. However,
to avoid breaking such applications entirely, let's still allow the user
to give focus by clicking in the window.

For the sake of applications that legitimately don't want to be given
input focus (such as taskbars or other "panels"), we still don't give
focus to them automatically when another view is closed, and they aren't
shown in Alt-Tab.

This reverts commit cae96b0cce441dd9f1981c312ae0108b3b4e42c9.

src/desktop.c

index 1b34e983c1409df675811f25ae82c107ea1ed3c7..41c43afad782d2ed3261b5fa0799457d32a01da8 100644 (file)
@@ -38,16 +38,13 @@ void
 desktop_focus_view(struct view *view, bool raise)
 {
        assert(view);
-       if (!view_isfocusable(view)) {
-               return;
-       }
-
        /*
         * Guard against views with no mapped surfaces when handling
         * 'request_activate' and 'request_minimize'.
-        * view_isfocusable() should return false for those views.
         */
-       assert(view->surface);
+       if (!view->surface) {
+               return;
+       }
 
        struct server *server = view->server;
        if (input_inhibit_blocks_surface(&server->seat, view->surface->resource)
@@ -64,11 +61,9 @@ desktop_focus_view(struct view *view, bool raise)
                return;
        }
 
-       /*
-        * view_isfocusable() should return false for any views that are
-        * neither mapped nor minimized.
-        */
-       assert(view->mapped);
+       if (!view->mapped) {
+               return;
+       }
 
        /*
         * Switch workspace if necessary to make the view visible