From 5e9ee32d63d7a02e65f05ee00295ef41e115b2eb Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sun, 10 Dec 2017 15:13:27 -0500 Subject: [PATCH] set focus on new window --- sway/desktop/wl_shell.c | 7 +++++++ sway/desktop/xdg_shell_v6.c | 7 +++++++ sway/desktop/xwayland.c | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c index 3f5a358a..3d3b1c44 100644 --- a/sway/desktop/wl_shell.c +++ b/sway/desktop/wl_shell.c @@ -7,6 +7,8 @@ #include "sway/layout.h" #include "sway/server.h" #include "sway/view.h" +#include "sway/input/seat.h" +#include "sway/input/input-manager.h" #include "log.h" static bool assert_wl_shell(struct sway_view *view) { @@ -126,4 +128,9 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) { sway_view->swayc = cont; arrange_windows(cont->parent, -1, -1); + + for (int i = 0; i < server->input->seats->length; ++i) { + struct sway_seat *seat = server->input->seats->items[i]; + sway_seat_set_focus(seat, cont); + } } diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 2435c256..8ad6a5ec 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -7,6 +7,8 @@ #include "sway/layout.h" #include "sway/server.h" #include "sway/view.h" +#include "sway/input/seat.h" +#include "sway/input/input-manager.h" #include "log.h" static bool assert_xdg(struct sway_view *view) { @@ -132,4 +134,9 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { sway_view->swayc = cont; arrange_windows(cont->parent, -1, -1); + + for (int i = 0; i < server->input->seats->length; ++i) { + struct sway_seat *seat = server->input->seats->items[i]; + sway_seat_set_focus(seat, cont); + } } diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 65c7e1ec..724c8a82 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -10,6 +10,8 @@ #include "sway/server.h" #include "sway/view.h" #include "sway/output.h" +#include "sway/input/seat.h" +#include "sway/input/input-manager.h" #include "log.h" static bool assert_xwayland(struct sway_view *view) { @@ -171,4 +173,9 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { sway_view->swayc = cont; arrange_windows(cont->parent, -1, -1); + + for (int i = 0; i < server->input->seats->length; ++i) { + struct sway_seat *seat = server->input->seats->items[i]; + sway_seat_set_focus(seat, cont); + } }