aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/tablet.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/tablet.c')
-rw-r--r--sway/input/tablet.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sway/input/tablet.c b/sway/input/tablet.c
index 92ede3fa..884eba74 100644
--- a/sway/input/tablet.c
+++ b/sway/input/tablet.c
@@ -334,14 +334,10 @@ static void handle_pad_tablet_surface_destroy(struct wl_listener *listener,
334 struct sway_tablet_pad *tablet_pad = 334 struct sway_tablet_pad *tablet_pad =
335 wl_container_of(listener, tablet_pad, surface_destroy); 335 wl_container_of(listener, tablet_pad, surface_destroy);
336 336
337 wlr_tablet_v2_tablet_pad_notify_leave(tablet_pad->tablet_v2_pad, 337 sway_tablet_pad_set_focus(tablet_pad, NULL);
338 tablet_pad->current_surface);
339 wl_list_remove(&tablet_pad->surface_destroy.link);
340 wl_list_init(&tablet_pad->surface_destroy.link);
341 tablet_pad->current_surface = NULL;
342} 338}
343 339
344void sway_tablet_pad_notify_enter(struct sway_tablet_pad *tablet_pad, 340void sway_tablet_pad_set_focus(struct sway_tablet_pad *tablet_pad,
345 struct wlr_surface *surface) { 341 struct wlr_surface *surface) {
346 if (!tablet_pad || !tablet_pad->tablet) { 342 if (!tablet_pad || !tablet_pad->tablet) {
347 return; 343 return;
@@ -360,7 +356,8 @@ void sway_tablet_pad_notify_enter(struct sway_tablet_pad *tablet_pad,
360 tablet_pad->current_surface = NULL; 356 tablet_pad->current_surface = NULL;
361 } 357 }
362 358
363 if (!wlr_surface_accepts_tablet_v2(tablet_pad->tablet->tablet_v2, surface)) { 359 if (surface == NULL ||
360 !wlr_surface_accepts_tablet_v2(tablet_pad->tablet->tablet_v2, surface)) {
364 return; 361 return;
365 } 362 }
366 363
@@ -368,7 +365,6 @@ void sway_tablet_pad_notify_enter(struct sway_tablet_pad *tablet_pad,
368 tablet_pad->tablet->tablet_v2, surface); 365 tablet_pad->tablet->tablet_v2, surface);
369 366
370 tablet_pad->current_surface = surface; 367 tablet_pad->current_surface = surface;
371 wl_list_remove(&tablet_pad->surface_destroy.link);
372 tablet_pad->surface_destroy.notify = handle_pad_tablet_surface_destroy; 368 tablet_pad->surface_destroy.notify = handle_pad_tablet_surface_destroy;
373 wl_signal_add(&surface->events.destroy, &tablet_pad->surface_destroy); 369 wl_signal_add(&surface->events.destroy, &tablet_pad->surface_destroy);
374} 370}