Signed-off-by: Jonas Ådahl <[email protected]>
---
 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 130618c..3eb10c6 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1403,6 +1403,11 @@ touch_move_grab_motion(struct weston_touch_grab *grab, 
uint32_t time,
 }
 
 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 @@ 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 af41b00..03d8992 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 483e22e..6a81bc8 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -497,6 +497,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)
 {
        struct weston_touch_drag *touch_drag =
@@ -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 9c51468..2c799f4 100644
--- a/src/input.c
+++ b/src/input.c
@@ -287,6 +287,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 c8a6443..0b851fb 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)
 {
@@ -227,6 +238,10 @@ evdev_device_process_event(struct libinput_event *event)
        case LIBINPUT_EVENT_TOUCH_UP:
                handle_touch_up(libinput_device,
                                libinput_event_get_touch_event(event));
+       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",
-- 
1.8.3.2

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to