view/xwayland: avoid focusing views that don't want focus

XWayland views can self-declare that they don't want keyboard focus via
the ICCCM WM_HINTS property. Most of the logic is already in place to
avoid giving focus to such views (e.g. taskbars).

Add a couple of missing pieces to make this work:

- Hook up view_isfocusable() to look at WM_HINTS for XWayland views
- Adjust desktop_focus_topmost_mapped_view() to skip unfocusable views
This commit is contained in:
John Lindgren 2023-09-23 11:51:47 -04:00 committed by Johan Malm
parent d503370a77
commit 7e72bf975f
10 changed files with 29 additions and 13 deletions

View file

@ -88,7 +88,7 @@ focus_next_surface(struct server *server, struct wlr_xwayland_surface *xsurface)
* to the topmost mapped view. This fixes dmenu
* not giving focus back when closed with ESC.
*/
desktop_focus_topmost_mapped_view(server);
desktop_focus_topmost_view(server);
}
static void
@ -166,7 +166,7 @@ unmanaged_handle_request_activate(struct wl_listener *listener, void *data)
* Validate that the unmanaged surface trying to grab focus is actually
* a child of the topmost mapped view before granting the request.
*/
struct view *view = desktop_topmost_mapped_view(server);
struct view *view = desktop_topmost_focusable_view(server);
if (view && view->type == LAB_XWAYLAND_VIEW) {
struct wlr_xwayland_surface *surf =
wlr_xwayland_surface_from_wlr_surface(view->surface);