seat: simplify touch grabs

This commit is contained in:
Kirill Primak 2023-01-16 22:45:44 +03:00
parent 65b97d6e8a
commit 4d9ea9919f
8 changed files with 92 additions and 118 deletions

View file

@ -6,8 +6,7 @@
extern const struct wlr_pointer_grab default_pointer_grab;
extern const struct wlr_keyboard_grab default_keyboard_grab;
extern const struct wlr_touch_grab_interface default_touch_grab_impl;
extern const struct wlr_touch_grab default_touch_grab;
void seat_client_create_pointer(struct wlr_seat_client *seat_client,
uint32_t version, uint32_t id);

View file

@ -109,7 +109,6 @@ enum wlr_drag_grab_type {
struct wlr_drag {
enum wlr_drag_grab_type grab_type;
struct wlr_seat_touch_grab touch_grab;
struct wlr_seat *seat;
struct wlr_seat_client *seat_client;

View file

@ -115,31 +115,20 @@ struct wlr_keyboard_grab {
struct wlr_seat_touch_grab;
struct wlr_touch_grab_interface {
uint32_t (*down)(struct wlr_seat_touch_grab *grab, uint32_t time_msec,
struct wlr_touch_point *point);
void (*up)(struct wlr_seat_touch_grab *grab, uint32_t time_msec,
struct wlr_touch_point *point);
void (*motion)(struct wlr_seat_touch_grab *grab, uint32_t time_msec,
struct wlr_touch_point *point);
void (*enter)(struct wlr_seat_touch_grab *grab, uint32_t time_msec,
struct wlr_touch_point *point);
void (*frame)(struct wlr_seat_touch_grab *grab);
struct wlr_touch_grab {
uint32_t (*down)(void *data, uint32_t time_msec,
struct wlr_touch_point *point);
void (*up)(void *data, uint32_t time_msec,
struct wlr_touch_point *point);
void (*motion)(void *data, uint32_t time_msec,
struct wlr_touch_point *point);
void (*enter)(void *data, uint32_t time_msec,
struct wlr_touch_point *point);
void (*frame)(void *data);
// Cancel grab
void (*cancel)(struct wlr_seat_touch_grab *grab);
void (*cancel)(void *data);
// Send wl_touch::cancel
void (*wl_cancel)(struct wlr_seat_touch_grab *grab,
struct wlr_surface *surface);
};
/**
* Passed to wlr_seat_touch_start_grab() to start a grab of the touch device.
* The grabber is responsible for handling touch events for the seat.
*/
struct wlr_seat_touch_grab {
const struct wlr_touch_grab_interface *interface;
struct wlr_seat *seat;
void *data;
void (*wl_cancel)(void *data, struct wlr_surface *surface);
};
#define WLR_POINTER_BUTTONS_CAP 16
@ -198,8 +187,8 @@ struct wlr_seat_touch_state {
uint32_t grab_serial;
uint32_t grab_id;
struct wlr_seat_touch_grab *grab;
struct wlr_seat_touch_grab *default_grab;
const struct wlr_touch_grab *grab;
void *grab_data;
};
struct wlr_primary_selection_source;
@ -654,7 +643,7 @@ int wlr_seat_touch_num_points(struct wlr_seat *seat);
* handling all touch events until the grab ends.
*/
void wlr_seat_touch_start_grab(struct wlr_seat *wlr_seat,
struct wlr_seat_touch_grab *grab);
const struct wlr_touch_grab *grab, void *data);
/**
* End the grab of the touch device of this seat. This reverts the grab back to

View file

@ -117,7 +117,6 @@ struct wlr_xdg_popup {
// each seat gets a popup grab
struct wlr_xdg_popup_grab {
struct wl_client *client;
struct wlr_seat_touch_grab touch_grab;
struct wlr_seat *seat;
struct wl_list popups;
struct wl_list link; // wlr_xdg_shell.popup_grabs