From 1679f232e541489eedd94774bcfaec9752fdea64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Sat, 12 Apr 2014 09:39:51 +0200 Subject: [PATCH] libinput: Forward frame events to clients MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77353 Signed-off-by: Jonas Ã…dahl --- desktop-shell/shell.c | 6 ++++++ src/compositor.h | 3 +++ src/data-device.c | 6 ++++++ src/input.c | 19 +++++++++++++++++++ src/libinput-device.c | 15 +++++++++++++++ 5 files changed, 49 insertions(+) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 07327890..bc4a2585 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -1402,6 +1402,11 @@ touch_move_grab_motion(struct weston_touch_grab *grab, uint32_t time, weston_compositor_schedule_repaint(es->compositor); } +static void +touch_move_grab_frame(struct weston_touch_grab *grab) +{ +} + static void touch_move_grab_cancel(struct weston_touch_grab *grab) { @@ -1417,6 +1422,7 @@ static const struct weston_touch_grab_interface touch_move_grab_interface = { 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 af41b008..03d89922 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -278,6 +278,7 @@ struct weston_touch_grab_interface { 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 @@ notify_keyboard_focus_out(struct weston_seat *seat); 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 483e22e9..6a81bc8e 100644 --- a/src/data-device.c +++ b/src/data-device.c @@ -496,6 +496,11 @@ drag_grab_touch_motion(struct weston_touch_grab *grab, uint32_t time, } } +static void +drag_grab_touch_frame(struct weston_touch_grab *grab) +{ +} + static void drag_grab_touch_cancel(struct weston_touch_grab *grab) { @@ -511,6 +516,7 @@ static const struct weston_touch_grab_interface touch_drag_grab_interface = { 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 9c514689..2c799f43 100644 --- a/src/input.c +++ b/src/input.c @@ -286,6 +286,15 @@ default_grab_touch_motion(struct weston_touch_grab *grab, uint32_t time, } } +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 @@ static const struct weston_touch_grab_interface default_touch_grab_interface = { default_grab_touch_down, default_grab_touch_up, default_grab_touch_motion, + default_grab_touch_frame, default_grab_touch_cancel, }; @@ -1512,6 +1522,15 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id, } } +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 6a321a4c..0ca6c4ba 100644 --- a/src/libinput-device.c +++ b/src/libinput-device.c @@ -187,6 +187,17 @@ handle_touch_up(struct libinput_device *libinput_device, 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 @@ evdev_device_process_event(struct libinput_event *event) 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",