aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFerdinand Bachmann <theferdi265@gmail.com>2022-04-16 18:59:22 +0200
committerFerdinand Bachmann <theferdi265@gmail.com>2022-04-16 20:56:30 +0200
commitd3a2ea33e5308f46d4c148cc1de7c428de782536 (patch)
tree08b48bb74d5253370d64b2fca647a25f89d82436
parent2d4e8135308d225ece8ca4badcef89929b5b228e (diff)
types/seat/wlr_seat.c: fix focused_client being null after seat_client recreation
-rw-r--r--types/seat/wlr_seat.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/types/seat/wlr_seat.c b/types/seat/wlr_seat.c
index f2fd04c1..5280bc46 100644
--- a/types/seat/wlr_seat.c
+++ b/types/seat/wlr_seat.c
@@ -7,6 +7,7 @@
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_primary_selection.h>
#include <wlr/types/wlr_seat.h>
+#include <wlr/types/wlr_compositor.h>
#include <wlr/util/log.h>
#include "types/wlr_seat.h"
#include "util/global.h"
@@ -142,6 +143,20 @@ static void seat_handle_bind(struct wl_client *client, void *_wlr_seat,
wl_signal_init(&seat_client->events.destroy);
wl_list_insert(&wlr_seat->clients, &seat_client->link);
+
+ struct wlr_surface *pointer_focus =
+ wlr_seat->pointer_state.focused_surface;
+ if (pointer_focus != NULL &&
+ wl_resource_get_client(pointer_focus->resource) == client) {
+ wlr_seat->pointer_state.focused_client = seat_client;
+ }
+
+ struct wlr_surface *keyboard_focus =
+ wlr_seat->keyboard_state.focused_surface;
+ if (keyboard_focus != NULL &&
+ wl_resource_get_client(keyboard_focus->resource) == client) {
+ wlr_seat->keyboard_state.focused_client = seat_client;
+ }
}
wl_resource_set_implementation(wl_resource, &seat_impl,