From 755a1c9138d82b5184f36d5373dac7cf8fc642da Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 2 Mar 2019 11:41:03 +0100 Subject: tinywl: send pointer frame events Fixes https://github.com/swaywm/wlroots/issues/1544 --- tinywl/tinywl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tinywl') diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c index 66e00c03..16c1f85c 100644 --- a/tinywl/tinywl.c +++ b/tinywl/tinywl.c @@ -45,6 +45,7 @@ struct tinywl_server { struct wl_listener cursor_motion_absolute; struct wl_listener cursor_button; struct wl_listener cursor_axis; + struct wl_listener cursor_frame; struct wlr_seat *seat; struct wl_listener new_input; @@ -499,6 +500,17 @@ static void server_cursor_axis(struct wl_listener *listener, void *data) { event->delta_discrete, event->source); } +static void server_cursor_frame(struct wl_listener *listener, void *data) { + /* This event is forwarded by the cursor when a pointer emits an frame + * event. Frame events are sent after regular pointer events to group + * multiple events together. For instance, two axis events may happen at the + * same time, in which case a frame event won't be sent in between. */ + struct tinywl_server *server = + wl_container_of(listener, server, cursor_frame); + /* Notify the client with pointer focus of the frame event. */ + wlr_seat_pointer_notify_frame(server->seat); +} + /* Used to move all of the data necessary to render a surface from the top-level * frame handler to the per-surface render function. */ struct render_data { @@ -876,6 +888,8 @@ int main(int argc, char *argv[]) { wl_signal_add(&server.cursor->events.button, &server.cursor_button); server.cursor_axis.notify = server_cursor_axis; wl_signal_add(&server.cursor->events.axis, &server.cursor_axis); + server.cursor_frame.notify = server_cursor_frame; + wl_signal_add(&server.cursor->events.frame, &server.cursor_frame); /* * Configures a seat, which is a single "seat" at which a user sits and -- cgit v1.2.3