diff options
author | emersion <contact@emersion.fr> | 2018-07-18 20:00:48 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-07-18 20:00:48 +0100 |
commit | 747725b8bb35bf3fd38d442f5bb565e7a4b11ec4 (patch) | |
tree | b486f3576982ab0f94183323d44bc4bbb3a456e3 /sway/desktop/xwayland.c | |
parent | Handle xwayland override_redirect flag change (diff) | |
download | sway-747725b8bb35bf3fd38d442f5bb565e7a4b11ec4.tar.gz sway-747725b8bb35bf3fd38d442f5bb565e7a4b11ec4.tar.zst sway-747725b8bb35bf3fd38d442f5bb565e7a4b11ec4.zip |
Don't unfocus when an override redirect window is mapped
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r-- | sway/desktop/xwayland.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 1ee3f660..7737a33a 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -69,16 +69,11 @@ static void unmanaged_handle_map(struct wl_listener *listener, void *data) { | |||
69 | surface->ly = xsurface->y; | 69 | surface->ly = xsurface->y; |
70 | desktop_damage_surface(xsurface->surface, surface->lx, surface->ly, true); | 70 | desktop_damage_surface(xsurface->surface, surface->lx, surface->ly, true); |
71 | 71 | ||
72 | if (!xsurface->override_redirect) { | 72 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
73 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 73 | struct wlr_xwayland *xwayland = |
74 | struct wlr_xwayland *xwayland = | 74 | seat->input->server->xwayland.wlr_xwayland; |
75 | seat->input->server->xwayland.wlr_xwayland; | 75 | wlr_xwayland_set_seat(xwayland, seat->wlr_seat); |
76 | wlr_xwayland_set_seat(xwayland, seat->wlr_seat); | 76 | seat_set_focus_surface(seat, xsurface->surface, false); |
77 | seat_set_focus_surface(seat, xsurface->surface); | ||
78 | } | ||
79 | |||
80 | // TODO: we don't send surface enter/leave events to xwayland unmanaged | ||
81 | // surfaces, but xwayland doesn't support HiDPI anyway | ||
82 | } | 77 | } |
83 | 78 | ||
84 | static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) { | 79 | static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) { |
@@ -89,18 +84,16 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) { | |||
89 | wl_list_remove(&surface->link); | 84 | wl_list_remove(&surface->link); |
90 | wl_list_remove(&surface->commit.link); | 85 | wl_list_remove(&surface->commit.link); |
91 | 86 | ||
92 | if (!xsurface->override_redirect) { | 87 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
93 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 88 | if (seat->wlr_seat->keyboard_state.focused_surface == |
94 | if (seat->wlr_seat->keyboard_state.focused_surface == | 89 | xsurface->surface) { |
95 | xsurface->surface) { | 90 | // Restore focus |
96 | // Restore focus | 91 | struct sway_container *previous = |
97 | struct sway_container *previous = | 92 | seat_get_focus_inactive(seat, &root_container); |
98 | seat_get_focus_inactive(seat, &root_container); | 93 | if (previous) { |
99 | if (previous) { | 94 | // Hack to get seat to re-focus the return value of get_focus |
100 | // Hack to get seat to re-focus the return value of get_focus | 95 | seat_set_focus(seat, previous->parent); |
101 | seat_set_focus(seat, previous->parent); | 96 | seat_set_focus(seat, previous); |
102 | seat_set_focus(seat, previous); | ||
103 | } | ||
104 | } | 97 | } |
105 | } | 98 | } |
106 | } | 99 | } |