From 1942ab6cc4bb742169ee7b1786ec8c58b4a6ef28 Mon Sep 17 00:00:00 2001 From: William Wold Date: Sun, 9 Sep 2018 22:47:58 -0700 Subject: [PATCH] Give windows pointer focus immediately when they are switched to --- sway/desktop/transaction.c | 3 +++ sway/tree/container.c | 2 +- sway/tree/node.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index b4eec933f..7c44dcc40 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -10,6 +10,7 @@ #include "sway/desktop.h" #include "sway/desktop/idle_inhibit_v1.h" #include "sway/desktop/transaction.h" +#include "sway/input/cursor.h" #include "sway/output.h" #include "sway/tree/container.h" #include "sway/tree/node.h" @@ -532,4 +533,6 @@ void transaction_commit_dirty(void) { // if the transaction has nothing to wait for. transaction_progress_queue(); } + if (config->handler_context.seat) + cursor_send_pointer_motion(config->handler_context.seat->cursor, 0, true); } diff --git a/sway/tree/container.c b/sway/tree/container.c index ccd79f0e7..ebc600270 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -218,7 +218,7 @@ static struct sway_container *container_at_tabbed(struct sway_node *parent, // Surfaces struct sway_node *current = seat_get_active_child(seat, parent); - return tiling_container_at(current, lx, ly, surface, sx, sy); + return current ? tiling_container_at(current, lx, ly, surface, sx, sy) : NULL; } /** diff --git a/sway/tree/node.c b/sway/tree/node.c index 74661c1ab..f02cdb079 100644 --- a/sway/tree/node.c +++ b/sway/tree/node.c @@ -38,7 +38,7 @@ void node_set_dirty(struct sway_node *node) { } bool node_is_view(struct sway_node *node) { - return node->type == N_CONTAINER && node->sway_container->view; + return node && node->type == N_CONTAINER && node->sway_container->view; } char *node_get_name(struct sway_node *node) {