]> git.mdlowis.com Git - proto/labwc.git/commitdiff
desktop: try harder to avoid focusing unfocusable views
authorJohn Lindgren <john@jlindgren.net>
Sat, 23 Sep 2023 16:20:44 +0000 (12:20 -0400)
committerJohan Malm <johanmalm@users.noreply.github.com>
Fri, 29 Sep 2023 17:04:32 +0000 (18:04 +0100)
Make desktop_focus_view() do nothing if the view is not focusable.

src/desktop.c

index 7376555eed79e321246dff940aee425d4f2e7a03..1b34e983c1409df675811f25ae82c107ea1ed3c7 100644 (file)
@@ -38,14 +38,16 @@ 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'.
-        * See notes by view_isfocusable()
+        * view_isfocusable() should return false for those views.
         */
-       if (!view->surface) {
-               return;
-       }
+       assert(view->surface);
 
        struct server *server = view->server;
        if (input_inhibit_blocks_surface(&server->seat, view->surface->resource)
@@ -62,9 +64,11 @@ desktop_focus_view(struct view *view, bool raise)
                return;
        }
 
-       if (!view->mapped) {
-               return;
-       }
+       /*
+        * view_isfocusable() should return false for any views that are
+        * neither mapped nor minimized.
+        */
+       assert(view->mapped);
 
        /*
         * Switch workspace if necessary to make the view visible