pointer: add a frame event

Frame events group logically connected pointer events. It makes sense to make
the backend responsible for sending frame events, since once the events are
split (ie. once the frame events are stripped) it's not easy to figure out
which events belongs to which frame again.

This is also how Weston handles frame events.

Fixes https://github.com/swaywm/wlroots/issues/1468
This commit is contained in:
emersion 2019-01-26 11:04:05 +01:00
parent 209210d307
commit 5de26ad8ed
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
14 changed files with 96 additions and 21 deletions

View file

@ -38,6 +38,7 @@ struct roots_cursor {
struct wl_listener motion_absolute;
struct wl_listener button;
struct wl_listener axis;
struct wl_listener frame;
struct wl_listener touch_down;
struct wl_listener touch_up;
@ -71,6 +72,8 @@ void roots_cursor_handle_button(struct roots_cursor *cursor,
void roots_cursor_handle_axis(struct roots_cursor *cursor,
struct wlr_event_pointer_axis *event);
void roots_cursor_handle_frame(struct roots_cursor *cursor);
void roots_cursor_handle_touch_down(struct roots_cursor *cursor,
struct wlr_event_touch_down *event);

View file

@ -51,6 +51,7 @@ struct wlr_cursor {
struct wl_signal motion_absolute;
struct wl_signal button;
struct wl_signal axis;
struct wl_signal frame;
struct wl_signal touch_up;
struct wl_signal touch_down;

View file

@ -23,6 +23,7 @@ struct wlr_pointer {
struct wl_signal motion_absolute;
struct wl_signal button;
struct wl_signal axis;
struct wl_signal frame;
} events;
void *data;

View file

@ -68,6 +68,7 @@ struct wlr_pointer_grab_interface {
void (*axis)(struct wlr_seat_pointer_grab *grab, uint32_t time,
enum wlr_axis_orientation orientation, double value,
int32_t value_discrete, enum wlr_axis_source source);
void (*frame)(struct wlr_seat_pointer_grab *grab);
void (*cancel)(struct wlr_seat_pointer_grab *grab);
};
@ -348,6 +349,13 @@ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
enum wlr_axis_orientation orientation, double value,
int32_t value_discrete, enum wlr_axis_source source);
/**
* Send a frame event to the surface with pointer focus. Compositors should use
* `wlr_seat_pointer_notify_frame()` to send axis events to respect pointer
* grabs.
*/
void wlr_seat_pointer_send_frame(struct wlr_seat *wlr_seat);
/**
* Start a grab of the pointer of this seat. The grabber is responsible for
* handling all pointer events until the grab ends.
@ -390,6 +398,13 @@ void wlr_seat_pointer_notify_axis(struct wlr_seat *wlr_seat, uint32_t time,
enum wlr_axis_orientation orientation, double value,
int32_t value_discrete, enum wlr_axis_source source);
/**
* Notify the seat of a frame event. Frame events are sent to end a group of
* events that logically belong together. Motion, button and axis events should
* all be followed by a frame event.
*/
void wlr_seat_pointer_notify_frame(struct wlr_seat *wlr_seat);
/**
* Whether or not the pointer has a grab other than the default grab.
*/