From bb676013ed1b1b48847694a2159e3b009636b181 Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Sun, 25 Feb 2018 09:57:30 +0100 Subject: add xwayland unmanaged tests to support dmenu This adds `wlr_xwayland_surface_is_unamanged`, to allow compositors more fine grained control over XWayland focus. A surface that is unmanaged should not receive focus, while other windows that are just override redirect may want it (dmenu). The way unamanged is determined is taken from wlc. --- rootston/desktop.c | 6 +++++- rootston/seat.c | 2 +- rootston/xwayland.c | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'rootston') diff --git a/rootston/desktop.c b/rootston/desktop.c index 8ac741bb..a8b070ce 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -426,13 +426,17 @@ void view_init(struct roots_view *view, struct roots_desktop *desktop) { view_damage_whole(view); } -void view_setup(struct roots_view *view) { +void view_initial_focus(struct roots_view *view) { struct roots_input *input = view->desktop->server->input; // TODO what seat gets focus? the one with the last input event? struct roots_seat *seat; wl_list_for_each(seat, &input->seats, link) { roots_seat_set_focus(seat, view); } +} + +void view_setup(struct roots_view *view) { + view_initial_focus(view); view_center(view); view_update_output(view, NULL); diff --git a/rootston/seat.c b/rootston/seat.c index 1b7d05c4..9acbb737 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -721,7 +721,7 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { #ifdef WLR_HAS_XWAYLAND if (view && view->type == ROOTS_XWAYLAND_VIEW && - view->xwayland_surface->override_redirect) { + wlr_xwayland_surface_is_unmanaged(view->xwayland_surface)) { return; } #endif diff --git a/rootston/xwayland.c b/rootston/xwayland.c index e9e0d5e0..1aa5a96c 100644 --- a/rootston/xwayland.c +++ b/rootston/xwayland.c @@ -350,5 +350,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { } view_setup(view); + } else { + view_initial_focus(view); } } -- cgit v1.2.3