aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-09-02 21:41:24 +0200
committerGitHub <noreply@github.com>2018-09-02 21:41:24 +0200
commite438342157272f6a807ea28ef1b554e01530ead8 (patch)
treefb510fe69ef12a9de9d299fa1543c32b49a16e8e /sway/desktop
parent159edc6d13db42b15b28c7ea58cdf2371d29297d (diff)
parent6fb03817c9d2bd29697a91f92d680b0c6a2c5996 (diff)
Merge pull request #2560 from RyanDwyer/focus-on-window-activation
Implement focus_on_window_activation
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/xwayland.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 68d70b64..10faf91d 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -337,6 +337,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
wl_list_remove(&xwayland_view->request_fullscreen.link);
wl_list_remove(&xwayland_view->request_move.link);
wl_list_remove(&xwayland_view->request_resize.link);
+ wl_list_remove(&xwayland_view->request_activate.link);
wl_list_remove(&xwayland_view->set_title.link);
wl_list_remove(&xwayland_view->set_class.link);
wl_list_remove(&xwayland_view->set_window_type.link);
@@ -463,6 +464,19 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
seat_begin_resize_floating(seat, view->swayc, seat->last_button, e->edges);
}
+static void handle_request_activate(struct wl_listener *listener, void *data) {
+ struct sway_xwayland_view *xwayland_view =
+ wl_container_of(listener, xwayland_view, request_activate);
+ struct sway_view *view = &xwayland_view->view;
+ struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
+ if (!xsurface->mapped) {
+ return;
+ }
+ view_request_activate(view);
+
+ transaction_commit_dirty();
+}
+
static void handle_set_title(struct wl_listener *listener, void *data) {
struct sway_xwayland_view *xwayland_view =
wl_container_of(listener, xwayland_view, set_title);
@@ -555,6 +569,10 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
&xwayland_view->request_fullscreen);
xwayland_view->request_fullscreen.notify = handle_request_fullscreen;
+ wl_signal_add(&xsurface->events.request_activate,
+ &xwayland_view->request_activate);
+ xwayland_view->request_activate.notify = handle_request_activate;
+
wl_signal_add(&xsurface->events.request_move,
&xwayland_view->request_move);
xwayland_view->request_move.notify = handle_request_move;