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

@ -378,7 +378,7 @@ void foreign_toplevel_update_outputs(struct view *view);
void desktop_focus_view(struct view *view, bool raise);
void desktop_arrange_all_views(struct server *server);
void desktop_focus_output(struct output *output);
struct view *desktop_topmost_mapped_view(struct server *server);
struct view *desktop_topmost_focusable_view(struct server *server);
enum lab_cycle_dir {
LAB_CYCLE_DIR_NONE,
@ -393,7 +393,7 @@ enum lab_cycle_dir {
*/
struct view *desktop_cycle_view(struct server *server, struct view *start_view,
enum lab_cycle_dir dir);
void desktop_focus_topmost_mapped_view(struct server *server);
void desktop_focus_topmost_view(struct server *server);
void keyboard_cancel_keybind_repeat(struct keyboard *keyboard);
void keyboard_key_notify(struct wl_listener *listener, void *data);

View file

@ -69,6 +69,8 @@ struct view_impl {
struct view *(*get_root)(struct view *self);
void (*append_children)(struct view *self, struct wl_array *children);
struct view_size_hints (*get_size_hints)(struct view *self);
/* if not implemented, view is assumed to want focus */
bool (*wants_focus)(struct view *self);
};
struct view {