diff options
-rw-r--r-- | tinywl/tinywl.c | 14 |
1 files changed, 14 insertions, 0 deletions
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 |