From 9be6bd8b1d0c879b936d39cbcaf925392f17d3a2 Mon Sep 17 00:00:00 2001 From: John Lindgren Date: Mon, 2 Oct 2023 22:12:22 -0400 Subject: [PATCH] Revert "desktop: try harder to avoid focusing unfocusable views" 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 | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/desktop.c b/src/desktop.c index 1b34e983..41c43afa 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -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