aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/tree/view.h1
-rw-r--r--sway/desktop/xwayland.c17
2 files changed, 18 insertions, 0 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 789a67c0..9e34b0d1 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -169,6 +169,7 @@ struct sway_xwayland_unmanaged {
169 169
170 int lx, ly; 170 int lx, ly;
171 171
172 struct wl_listener request_activate;
172 struct wl_listener request_configure; 173 struct wl_listener request_configure;
173 struct wl_listener request_fullscreen; 174 struct wl_listener request_fullscreen;
174 struct wl_listener commit; 175 struct wl_listener commit;
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 40288f97..2f11b5fc 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -121,6 +121,20 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) {
121 } 121 }
122} 122}
123 123
124static void unmanaged_handle_request_activate(struct wl_listener *listener, void *data) {
125 struct wlr_xwayland_surface *xsurface = data;
126 if (!xsurface->mapped) {
127 return;
128 }
129 struct sway_seat *seat = input_manager_current_seat();
130 struct sway_container *focus = seat_get_focused_container(seat);
131 if (focus && focus->view && focus->view->pid != xsurface->pid) {
132 return;
133 }
134
135 seat_set_focus_surface(seat, xsurface->surface, false);
136}
137
124static void unmanaged_handle_destroy(struct wl_listener *listener, void *data) { 138static void unmanaged_handle_destroy(struct wl_listener *listener, void *data) {
125 struct sway_xwayland_unmanaged *surface = 139 struct sway_xwayland_unmanaged *surface =
126 wl_container_of(listener, surface, destroy); 140 wl_container_of(listener, surface, destroy);
@@ -129,6 +143,7 @@ static void unmanaged_handle_destroy(struct wl_listener *listener, void *data) {
129 wl_list_remove(&surface->unmap.link); 143 wl_list_remove(&surface->unmap.link);
130 wl_list_remove(&surface->destroy.link); 144 wl_list_remove(&surface->destroy.link);
131 wl_list_remove(&surface->override_redirect.link); 145 wl_list_remove(&surface->override_redirect.link);
146 wl_list_remove(&surface->request_activate.link);
132 free(surface); 147 free(surface);
133} 148}
134 149
@@ -176,6 +191,8 @@ static struct sway_xwayland_unmanaged *create_unmanaged(
176 surface->destroy.notify = unmanaged_handle_destroy; 191 surface->destroy.notify = unmanaged_handle_destroy;
177 wl_signal_add(&xsurface->events.set_override_redirect, &surface->override_redirect); 192 wl_signal_add(&xsurface->events.set_override_redirect, &surface->override_redirect);
178 surface->override_redirect.notify = unmanaged_handle_override_redirect; 193 surface->override_redirect.notify = unmanaged_handle_override_redirect;
194 wl_signal_add(&xsurface->events.request_activate, &surface->request_activate);
195 surface->request_activate.notify = unmanaged_handle_request_activate;
179 196
180 return surface; 197 return surface;
181} 198}