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 a62e77ec..f979bc68 100644
--- a/sway/input/tablet.c
+++ b/sway/input/tablet.c
@@ -342,14 +342,10 @@ static void handle_pad_tablet_surface_destroy(struct wl_listener *listener,
342 struct sway_tablet_pad *tablet_pad = 342 struct sway_tablet_pad *tablet_pad =
343 wl_container_of(listener, tablet_pad, surface_destroy); 343 wl_container_of(listener, tablet_pad, surface_destroy);
344 344
345 wlr_tablet_v2_tablet_pad_notify_leave(tablet_pad->tablet_v2_pad, 345 sway_tablet_pad_set_focus(tablet_pad, NULL);
346 tablet_pad->current_surface);
347 wl_list_remove(&tablet_pad->surface_destroy.link);
348 wl_list_init(&tablet_pad->surface_destroy.link);
349 tablet_pad->current_surface = NULL;
350} 346}
351 347
352void sway_tablet_pad_notify_enter(struct sway_tablet_pad *tablet_pad, 348void sway_tablet_pad_set_focus(struct sway_tablet_pad *tablet_pad,
353 struct wlr_surface *surface) { 349 struct wlr_surface *surface) {
354 if (!tablet_pad || !tablet_pad->tablet) { 350 if (!tablet_pad || !tablet_pad->tablet) {
355 return; 351 return;
@@ -368,7 +364,8 @@ void sway_tablet_pad_notify_enter(struct sway_tablet_pad *tablet_pad,
368 tablet_pad->current_surface = NULL; 364 tablet_pad->current_surface = NULL;
369 } 365 }
370 366
371 if (!wlr_surface_accepts_tablet_v2(tablet_pad->tablet->tablet_v2, surface)) { 367 if (surface == NULL ||
368 !wlr_surface_accepts_tablet_v2(tablet_pad->tablet->tablet_v2, surface)) {
372 return; 369 return;
373 } 370 }
374 371
@@ -376,7 +373,6 @@ void sway_tablet_pad_notify_enter(struct sway_tablet_pad *tablet_pad,
376 tablet_pad->tablet->tablet_v2, surface); 373 tablet_pad->tablet->tablet_v2, surface);
377 374
378 tablet_pad->current_surface = surface; 375 tablet_pad->current_surface = surface;
379 wl_list_remove(&tablet_pad->surface_destroy.link);
380 tablet_pad->surface_destroy.notify = handle_pad_tablet_surface_destroy; 376 tablet_pad->surface_destroy.notify = handle_pad_tablet_surface_destroy;
381 wl_signal_add(&surface->events.destroy, &tablet_pad->surface_destroy); 377 wl_signal_add(&surface->events.destroy, &tablet_pad->surface_destroy);
382} 378}