mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 11:55:59 +01:00
rootston: handle grab end
This commit is contained in:
parent
4657f10dd2
commit
48ae4fc588
4 changed files with 21 additions and 2 deletions
|
@ -105,6 +105,8 @@ struct roots_input {
|
|||
struct wl_listener cursor_axis;
|
||||
struct wl_listener cursor_tool_axis;
|
||||
struct wl_listener cursor_tool_tip;
|
||||
|
||||
struct wl_listener pointer_grab_end;
|
||||
};
|
||||
|
||||
struct roots_input *input_create(struct roots_server *server,
|
||||
|
|
|
@ -94,6 +94,9 @@ struct wlr_seat {
|
|||
struct {
|
||||
struct wl_signal client_bound;
|
||||
struct wl_signal client_unbound;
|
||||
|
||||
struct wl_signal pointer_grab_begin;
|
||||
struct wl_signal pointer_grab_end;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
|
|
|
@ -265,6 +265,12 @@ static void handle_tool_tip(struct wl_listener *listener, void *data) {
|
|||
(uint32_t)(event->time_usec / 1000), BTN_LEFT, event->state);
|
||||
}
|
||||
|
||||
static void handle_pointer_grab_end(struct wl_listener *listener, void *data) {
|
||||
struct roots_input *input =
|
||||
wl_container_of(listener, input, pointer_grab_end);
|
||||
cursor_update_position(input, 0);
|
||||
}
|
||||
|
||||
void cursor_initialize(struct roots_input *input) {
|
||||
struct wlr_cursor *cursor = input->cursor;
|
||||
|
||||
|
@ -292,6 +298,9 @@ void cursor_initialize(struct roots_input *input) {
|
|||
wl_list_init(&input->cursor_tool_tip.link);
|
||||
wl_signal_add(&cursor->events.tablet_tool_tip, &input->cursor_tool_tip);
|
||||
input->cursor_tool_tip.notify = handle_tool_tip;
|
||||
|
||||
wl_signal_add(&input->wl_seat->events.pointer_grab_end, &input->pointer_grab_end);
|
||||
input->pointer_grab_end.notify = handle_pointer_grab_end;
|
||||
}
|
||||
|
||||
static void reset_device_mappings(struct roots_config *config,
|
||||
|
|
|
@ -246,6 +246,9 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
|
|||
wl_signal_init(&wlr_seat->events.client_bound);
|
||||
wl_signal_init(&wlr_seat->events.client_unbound);
|
||||
|
||||
wl_signal_init(&wlr_seat->events.pointer_grab_begin);
|
||||
wl_signal_init(&wlr_seat->events.pointer_grab_end);
|
||||
|
||||
return wlr_seat;
|
||||
}
|
||||
|
||||
|
@ -438,12 +441,14 @@ void wlr_seat_pointer_start_grab(struct wlr_seat *wlr_seat,
|
|||
struct wlr_seat_pointer_grab *grab) {
|
||||
grab->seat = wlr_seat;
|
||||
wlr_seat->pointer_state.grab = grab;
|
||||
// TODO: replay the last enter
|
||||
|
||||
wl_signal_emit(&wlr_seat->events.pointer_grab_begin, grab);
|
||||
}
|
||||
|
||||
void wlr_seat_pointer_end_grab(struct wlr_seat *wlr_seat) {
|
||||
struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab;
|
||||
wlr_seat->pointer_state.grab = wlr_seat->pointer_state.default_grab;
|
||||
// TODO: replay the last enter
|
||||
wl_signal_emit(&wlr_seat->events.pointer_grab_end, grab);
|
||||
}
|
||||
|
||||
void wlr_seat_pointer_notify_enter(struct wlr_seat *wlr_seat,
|
||||
|
|
Loading…
Reference in a new issue