mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-19 06:59:48 -05:00
Implement pointer-constraints protocol in wlroots and rootston
This commit is contained in:
parent
437f538772
commit
fa2e6e7d9d
23 changed files with 1134 additions and 20 deletions
|
|
@ -299,6 +299,22 @@ static void handle_request_set_cursor(struct wl_listener *listener,
|
|||
roots_cursor_handle_request_set_cursor(cursor, event);
|
||||
}
|
||||
|
||||
static void handle_pointer_focus_change(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct roots_cursor *cursor =
|
||||
wl_container_of(listener, cursor, focus_change);
|
||||
struct wlr_seat_pointer_focus_change_event *event = data;
|
||||
roots_cursor_handle_focus_change(cursor, event);
|
||||
}
|
||||
|
||||
static void handle_constraint_commit(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct roots_cursor *cursor =
|
||||
wl_container_of(listener, cursor, constraint_commit);
|
||||
assert(cursor->active_constraint->surface == data);
|
||||
roots_cursor_handle_constraint_commit(cursor);
|
||||
}
|
||||
|
||||
static void seat_reset_device_mappings(struct roots_seat *seat,
|
||||
struct wlr_input_device *device) {
|
||||
struct wlr_cursor *cursor = seat->cursor->cursor;
|
||||
|
|
@ -434,6 +450,13 @@ static void roots_seat_init_cursor(struct roots_seat *seat) {
|
|||
wl_signal_add(&seat->seat->events.request_set_cursor,
|
||||
&seat->cursor->request_set_cursor);
|
||||
seat->cursor->request_set_cursor.notify = handle_request_set_cursor;
|
||||
|
||||
wl_signal_add(&seat->seat->pointer_state.events.focus_change,
|
||||
&seat->cursor->focus_change);
|
||||
seat->cursor->focus_change.notify = handle_pointer_focus_change;
|
||||
|
||||
wl_list_init(&seat->cursor->constraint_commit.link);
|
||||
seat->cursor->constraint_commit.notify = handle_constraint_commit;
|
||||
}
|
||||
|
||||
static void roots_drag_icon_handle_surface_commit(struct wl_listener *listener,
|
||||
|
|
@ -1188,7 +1211,9 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
|
|||
NULL, 0, NULL);
|
||||
}
|
||||
|
||||
roots_cursor_update_focus(seat->cursor);
|
||||
if (seat->cursor) {
|
||||
roots_cursor_update_focus(seat->cursor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1224,7 +1249,10 @@ void roots_seat_set_focus_layer(struct roots_seat *seat,
|
|||
NULL, 0, NULL);
|
||||
}
|
||||
|
||||
roots_cursor_update_focus(seat->cursor);
|
||||
|
||||
if (seat->cursor) {
|
||||
roots_cursor_update_focus(seat->cursor);
|
||||
}
|
||||
}
|
||||
|
||||
void roots_seat_set_exclusive_client(struct roots_seat *seat,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue