mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-19 06:47:02 -04:00
seat: simplify keyboard grabs
This commit is contained in:
parent
a7ff2e1751
commit
65b97d6e8a
8 changed files with 70 additions and 99 deletions
|
|
@ -5,8 +5,8 @@
|
|||
#include <wlr/types/wlr_seat.h>
|
||||
|
||||
extern const struct wlr_pointer_grab default_pointer_grab;
|
||||
extern const struct wlr_keyboard_grab default_keyboard_grab;
|
||||
|
||||
extern const struct wlr_keyboard_grab_interface default_keyboard_grab_impl;
|
||||
extern const struct wlr_touch_grab_interface default_touch_grab_impl;
|
||||
|
||||
void seat_client_create_pointer(struct wlr_seat_client *seat_client,
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ enum wlr_drag_grab_type {
|
|||
|
||||
struct wlr_drag {
|
||||
enum wlr_drag_grab_type grab_type;
|
||||
struct wlr_seat_keyboard_grab keyboard_grab;
|
||||
struct wlr_seat_touch_grab touch_grab;
|
||||
|
||||
struct wlr_seat *seat;
|
||||
|
|
|
|||
|
|
@ -103,18 +103,14 @@ struct wlr_pointer_grab {
|
|||
void (*cancel)(void *data);
|
||||
};
|
||||
|
||||
struct wlr_seat_keyboard_grab;
|
||||
|
||||
struct wlr_keyboard_grab_interface {
|
||||
void (*enter)(struct wlr_seat_keyboard_grab *grab,
|
||||
struct wlr_surface *surface, uint32_t keycodes[],
|
||||
size_t num_keycodes, struct wlr_keyboard_modifiers *modifiers);
|
||||
void (*clear_focus)(struct wlr_seat_keyboard_grab *grab);
|
||||
void (*key)(struct wlr_seat_keyboard_grab *grab, uint32_t time_msec,
|
||||
uint32_t key, uint32_t state);
|
||||
void (*modifiers)(struct wlr_seat_keyboard_grab *grab,
|
||||
struct wlr_keyboard_modifiers *modifiers);
|
||||
void (*cancel)(struct wlr_seat_keyboard_grab *grab);
|
||||
struct wlr_keyboard_grab {
|
||||
void (*enter)(void *data,
|
||||
struct wlr_surface *surface, uint32_t keycodes[],
|
||||
size_t num_keycodes, struct wlr_keyboard_modifiers *modifiers);
|
||||
void (*clear_focus)(void *data);
|
||||
void (*key)(void *data, uint32_t time_msec, uint32_t key, uint32_t state);
|
||||
void (*modifiers)(void *data, struct wlr_keyboard_modifiers *modifiers);
|
||||
void (*cancel)(void *data);
|
||||
};
|
||||
|
||||
struct wlr_seat_touch_grab;
|
||||
|
|
@ -146,16 +142,6 @@ struct wlr_seat_touch_grab {
|
|||
void *data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Passed to wlr_seat_keyboard_start_grab() to start a grab of the keyboard.
|
||||
* The grabber is responsible for handling keyboard events for the seat.
|
||||
*/
|
||||
struct wlr_seat_keyboard_grab {
|
||||
const struct wlr_keyboard_grab_interface *interface;
|
||||
struct wlr_seat *seat;
|
||||
void *data;
|
||||
};
|
||||
|
||||
#define WLR_POINTER_BUTTONS_CAP 16
|
||||
|
||||
struct wlr_seat_pointer_state {
|
||||
|
|
@ -197,8 +183,8 @@ struct wlr_seat_keyboard_state {
|
|||
|
||||
struct wl_listener surface_destroy;
|
||||
|
||||
struct wlr_seat_keyboard_grab *grab;
|
||||
struct wlr_seat_keyboard_grab *default_grab;
|
||||
const struct wlr_keyboard_grab *grab;
|
||||
void *grab_data;
|
||||
|
||||
struct {
|
||||
struct wl_signal focus_change; // struct wlr_seat_keyboard_focus_change_event
|
||||
|
|
@ -550,7 +536,7 @@ void wlr_seat_keyboard_notify_clear_focus(struct wlr_seat *wlr_seat);
|
|||
* handling all keyboard events until the grab ends.
|
||||
*/
|
||||
void wlr_seat_keyboard_start_grab(struct wlr_seat *wlr_seat,
|
||||
struct wlr_seat_keyboard_grab *grab);
|
||||
const struct wlr_keyboard_grab *grab, void *data);
|
||||
|
||||
/**
|
||||
* End the grab of the keyboard of this seat. This reverts the grab back to the
|
||||
|
|
|
|||
|
|
@ -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_keyboard_grab keyboard_grab;
|
||||
struct wlr_seat_touch_grab touch_grab;
|
||||
struct wlr_seat *seat;
|
||||
struct wl_list popups;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue