mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-15 06:59:43 -05:00
Add focus change event for seats
This commit is contained in:
parent
50a8758313
commit
252bcce2f3
4 changed files with 44 additions and 1 deletions
|
|
@ -225,6 +225,8 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
|
|||
seat->pointer_state.default_grab = pointer_grab;
|
||||
seat->pointer_state.grab = pointer_grab;
|
||||
|
||||
wl_signal_init(&seat->pointer_state.events.focus_change);
|
||||
|
||||
// keyboard state
|
||||
struct wlr_seat_keyboard_grab *keyboard_grab =
|
||||
calloc(1, sizeof(struct wlr_seat_keyboard_grab));
|
||||
|
|
@ -241,6 +243,8 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
|
|||
seat->keyboard_state.seat = seat;
|
||||
wl_list_init(&seat->keyboard_state.surface_destroy.link);
|
||||
|
||||
wl_signal_init(&seat->keyboard_state.events.focus_change);
|
||||
|
||||
// touch state
|
||||
struct wlr_seat_touch_grab *touch_grab =
|
||||
calloc(1, sizeof(struct wlr_seat_touch_grab));
|
||||
|
|
|
|||
|
|
@ -291,6 +291,16 @@ void wlr_seat_keyboard_enter(struct wlr_seat *seat,
|
|||
// as it targets seat->keyboard_state.focused_client
|
||||
wlr_seat_keyboard_send_modifiers(seat, modifiers);
|
||||
}
|
||||
|
||||
struct wlr_seat_keyboard_focus_change_event event = {
|
||||
.seat = seat,
|
||||
.new_surface = surface,
|
||||
.old_surface = focused_surface,
|
||||
.num_keycodes = num_keycodes,
|
||||
.keycodes = keycodes,
|
||||
.modifiers = modifiers,
|
||||
};
|
||||
wlr_signal_emit_safe(&seat->keyboard_state.events.focus_change, &event);
|
||||
}
|
||||
|
||||
void wlr_seat_keyboard_notify_enter(struct wlr_seat *seat,
|
||||
|
|
|
|||
|
|
@ -183,7 +183,14 @@ void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
|
|||
wlr_seat->pointer_state.focused_client = client;
|
||||
wlr_seat->pointer_state.focused_surface = surface;
|
||||
|
||||
// TODO: send focus change event
|
||||
struct wlr_seat_pointer_focus_change_event event = {
|
||||
.seat = wlr_seat,
|
||||
.new_surface = surface,
|
||||
.old_surface = focused_surface,
|
||||
.sx = sx,
|
||||
.sy = sy,
|
||||
};
|
||||
wlr_signal_emit_safe(&wlr_seat->pointer_state.events.focus_change, &event);
|
||||
}
|
||||
|
||||
void wlr_seat_pointer_clear_focus(struct wlr_seat *wlr_seat) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue