tinywl: send pointer frame events

Fixes https://github.com/swaywm/wlroots/issues/1544
This commit is contained in:
emersion 2019-03-02 11:41:03 +01:00 committed by Drew DeVault
parent 2e1dd4ae36
commit 755a1c9138
1 changed files with 14 additions and 0 deletions

View File

@ -45,6 +45,7 @@ struct tinywl_server {
struct wl_listener cursor_motion_absolute; struct wl_listener cursor_motion_absolute;
struct wl_listener cursor_button; struct wl_listener cursor_button;
struct wl_listener cursor_axis; struct wl_listener cursor_axis;
struct wl_listener cursor_frame;
struct wlr_seat *seat; struct wlr_seat *seat;
struct wl_listener new_input; 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); 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 /* Used to move all of the data necessary to render a surface from the top-level
* frame handler to the per-surface render function. */ * frame handler to the per-surface render function. */
struct render_data { struct render_data {
@ -876,6 +888,8 @@ int main(int argc, char *argv[]) {
wl_signal_add(&server.cursor->events.button, &server.cursor_button); wl_signal_add(&server.cursor->events.button, &server.cursor_button);
server.cursor_axis.notify = server_cursor_axis; server.cursor_axis.notify = server_cursor_axis;
wl_signal_add(&server.cursor->events.axis, &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 * Configures a seat, which is a single "seat" at which a user sits and