libinput: Forward frame events to clients
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77353
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 0732789..bc4a258 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1403,6 +1403,11 @@
}
static void
+touch_move_grab_frame(struct weston_touch_grab *grab)
+{
+}
+
+static void
touch_move_grab_cancel(struct weston_touch_grab *grab)
{
struct weston_touch_move_grab *move =
@@ -1417,6 +1422,7 @@
touch_move_grab_down,
touch_move_grab_up,
touch_move_grab_motion,
+ touch_move_grab_frame,
touch_move_grab_cancel,
};
diff --git a/src/compositor.h b/src/compositor.h
index af41b00..03d8992 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -278,6 +278,7 @@
int touch_id,
wl_fixed_t sx,
wl_fixed_t sy);
+ void (*frame)(struct weston_touch_grab *grab);
void (*cancel)(struct weston_touch_grab *grab);
};
@@ -1008,6 +1009,8 @@
void
notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
wl_fixed_t x, wl_fixed_t y, int touch_type);
+void
+notify_touch_frame(struct weston_seat *seat);
void
weston_layer_init(struct weston_layer *layer, struct wl_list *below);
diff --git a/src/data-device.c b/src/data-device.c
index 483e22e..6a81bc8 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -497,6 +497,11 @@
}
static void
+drag_grab_touch_frame(struct weston_touch_grab *grab)
+{
+}
+
+static void
drag_grab_touch_cancel(struct weston_touch_grab *grab)
{
struct weston_touch_drag *touch_drag =
@@ -511,6 +516,7 @@
drag_grab_touch_down,
drag_grab_touch_up,
drag_grab_touch_motion,
+ drag_grab_touch_frame,
drag_grab_touch_cancel
};
diff --git a/src/input.c b/src/input.c
index 9c51468..2c799f4 100644
--- a/src/input.c
+++ b/src/input.c
@@ -287,6 +287,15 @@
}
static void
+default_grab_touch_frame(struct weston_touch_grab *grab)
+{
+ struct wl_resource *resource;
+
+ wl_resource_for_each(resource, &grab->touch->focus_resource_list)
+ wl_touch_send_frame(resource);
+}
+
+static void
default_grab_touch_cancel(struct weston_touch_grab *grab)
{
}
@@ -295,6 +304,7 @@
default_grab_touch_down,
default_grab_touch_up,
default_grab_touch_motion,
+ default_grab_touch_frame,
default_grab_touch_cancel,
};
@@ -1512,6 +1522,15 @@
}
}
+WL_EXPORT void
+notify_touch_frame(struct weston_seat *seat)
+{
+ struct weston_touch *touch = seat->touch;
+ struct weston_touch_grab *grab = touch->grab;
+
+ grab->interface->frame(grab);
+}
+
static void
pointer_cursor_surface_configure(struct weston_surface *es,
int32_t dx, int32_t dy)
diff --git a/src/libinput-device.c b/src/libinput-device.c
index 6a321a4..0ca6c4b 100644
--- a/src/libinput-device.c
+++ b/src/libinput-device.c
@@ -187,6 +187,17 @@
notify_touch(device->seat, time, slot, 0, 0, WL_TOUCH_UP);
}
+static void
+handle_touch_frame(struct libinput_device *libinput_device,
+ struct libinput_event_touch *touch_event)
+{
+ struct evdev_device *device =
+ libinput_device_get_user_data(libinput_device);
+ struct weston_seat *seat = device->seat;
+
+ notify_touch_frame(seat);
+}
+
int
evdev_device_process_event(struct libinput_event *event)
{
@@ -228,6 +239,10 @@
handle_touch_up(libinput_device,
libinput_event_get_touch_event(event));
break;
+ case LIBINPUT_EVENT_TOUCH_FRAME:
+ handle_touch_frame(libinput_device,
+ libinput_event_get_touch_event(event));
+ break;
default:
handled = 0;
weston_log("unknown libinput event %d\n",