seat: add wlr_seat_touch_notify_clear_focus

This is needed for cases where the touch operation goes over a region
where no surfaces are present. In this case, we'd want to notify the
touch grabs (for example DnD grabs) that no focus is currently focused.
This commit is contained in:
Ilia Bozhinov 2025-12-04 11:18:22 +01:00 committed by Simon Ser
parent 03b465f324
commit 0e9c6ddefa
4 changed files with 38 additions and 1 deletions

View file

@ -44,6 +44,12 @@ static void default_touch_wl_cancel(struct wlr_seat_touch_grab *grab,
wlr_seat_touch_send_cancel(grab->seat, seat_client);
}
static void default_touch_clear_focus(struct wlr_seat_touch_grab *grab, uint32_t time_msec,
struct wlr_touch_point *point) {
wlr_seat_touch_point_clear_focus(grab->seat, time_msec, point->touch_id);
}
const struct wlr_touch_grab_interface default_touch_grab_impl = {
.down = default_touch_down,
.up = default_touch_up,
@ -52,6 +58,7 @@ const struct wlr_touch_grab_interface default_touch_grab_impl = {
.frame = default_touch_frame,
.cancel = default_touch_cancel,
.wl_cancel = default_touch_wl_cancel,
.clear_focus = default_touch_clear_focus,
};
@ -256,6 +263,19 @@ void wlr_seat_touch_notify_cancel(struct wlr_seat *seat,
}
}
void wlr_seat_touch_notify_clear_focus(struct wlr_seat *seat,
uint32_t time, int32_t touch_id) {
struct wlr_seat_touch_grab *grab = seat->touch_state.grab;
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
if (!point) {
return;
}
if (grab->interface->clear_focus) {
grab->interface->clear_focus(grab, time, point);
}
}
static void handle_point_focus_destroy(struct wl_listener *listener,
void *data) {
struct wlr_touch_point *point =