Merge pull request #1571 from acrisci/wlroots-modifiers-update

update for new wlr-keyboard modifiers
This commit is contained in:
Drew DeVault 2018-01-17 11:53:27 -05:00 committed by GitHub
commit 3dd915876d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View file

@ -401,7 +401,7 @@ static void handle_keyboard_modifiers(struct wl_listener *listener,
struct wlr_input_device *wlr_device = struct wlr_input_device *wlr_device =
keyboard->seat_device->input_device->wlr_device; keyboard->seat_device->input_device->wlr_device;
wlr_seat_set_keyboard(wlr_seat, wlr_device); wlr_seat_set_keyboard(wlr_seat, wlr_device);
wlr_seat_keyboard_notify_modifiers(wlr_seat); wlr_seat_keyboard_notify_modifiers(wlr_seat, &wlr_device->keyboard->modifiers);
} }
struct sway_keyboard *sway_keyboard_create(struct sway_seat *seat, struct sway_keyboard *sway_keyboard_create(struct sway_seat *seat,

View file

@ -67,13 +67,16 @@ static void seat_configure_keyboard(struct sway_seat *seat,
if (!seat_device->keyboard) { if (!seat_device->keyboard) {
sway_keyboard_create(seat, seat_device); sway_keyboard_create(seat, seat_device);
} }
struct wlr_keyboard *wlr_keyboard = seat_device->input_device->wlr_device->keyboard;
sway_keyboard_configure(seat_device->keyboard); sway_keyboard_configure(seat_device->keyboard);
wlr_seat_set_keyboard(seat->wlr_seat, wlr_seat_set_keyboard(seat->wlr_seat,
seat_device->input_device->wlr_device); seat_device->input_device->wlr_device);
if (seat->focus) { if (seat->focus) {
// force notify reenter to pick up the new configuration // force notify reenter to pick up the new configuration
wlr_seat_keyboard_clear_focus(seat->wlr_seat); wlr_seat_keyboard_clear_focus(seat->wlr_seat);
wlr_seat_keyboard_notify_enter(seat->wlr_seat, seat->focus->sway_view->surface); wlr_seat_keyboard_notify_enter(seat->wlr_seat,
seat->focus->sway_view->surface, wlr_keyboard->keycodes,
wlr_keyboard->num_keycodes, &wlr_keyboard->modifiers);
} }
} }
@ -214,7 +217,16 @@ void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container) {
view->iface.set_activated(view, true); view->iface.set_activated(view, true);
wl_signal_add(&container->events.destroy, &seat->focus_destroy); wl_signal_add(&container->events.destroy, &seat->focus_destroy);
seat->focus_destroy.notify = handle_focus_destroy; seat->focus_destroy.notify = handle_focus_destroy;
wlr_seat_keyboard_notify_enter(seat->wlr_seat, view->surface);
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat);
if (keyboard) {
wlr_seat_keyboard_notify_enter(seat->wlr_seat, view->surface,
keyboard->keycodes, keyboard->num_keycodes,
&keyboard->modifiers);
} else {
wlr_seat_keyboard_notify_enter(seat->wlr_seat, view->surface,
NULL, 0, NULL);
}
} }
seat->focus = container; seat->focus = container;