dont use pointer for modifiers
This commit is contained in:
parent
43896af90f
commit
b6f29e87e8
|
@ -52,7 +52,7 @@ struct wlr_keyboard {
|
|||
|
||||
uint32_t keycodes[WLR_KEYBOARD_KEYS_CAP];
|
||||
size_t num_keycodes;
|
||||
struct wlr_keyboard_modifiers *modifiers;
|
||||
struct wlr_keyboard_modifiers modifiers;
|
||||
|
||||
struct {
|
||||
int32_t rate;
|
||||
|
|
|
@ -289,7 +289,7 @@ void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard) {
|
|||
struct wlr_seat *seat = r_keyboard->seat->seat;
|
||||
wlr_seat_set_keyboard(seat, r_keyboard->device);
|
||||
wlr_seat_keyboard_notify_modifiers(seat,
|
||||
r_keyboard->device->keyboard->modifiers);
|
||||
&r_keyboard->device->keyboard->modifiers);
|
||||
}
|
||||
|
||||
static void keyboard_config_merge(struct roots_keyboard_config *config,
|
||||
|
|
|
@ -667,7 +667,7 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
|
|||
if (keyboard != NULL) {
|
||||
wlr_seat_keyboard_notify_enter(seat->seat, view->wlr_surface,
|
||||
keyboard->keycodes, keyboard->num_keycodes,
|
||||
keyboard->modifiers);
|
||||
&keyboard->modifiers);
|
||||
} else {
|
||||
wlr_seat_keyboard_notify_enter(seat->seat, view->wlr_surface,
|
||||
NULL, 0, NULL);
|
||||
|
|
|
@ -42,17 +42,17 @@ static bool keyboard_modifier_update(struct wlr_keyboard *keyboard) {
|
|||
XKB_STATE_MODS_LOCKED);
|
||||
xkb_mod_mask_t group = xkb_state_serialize_layout(keyboard->xkb_state,
|
||||
XKB_STATE_LAYOUT_EFFECTIVE);
|
||||
if (depressed == keyboard->modifiers->depressed &&
|
||||
latched == keyboard->modifiers->latched &&
|
||||
locked == keyboard->modifiers->locked &&
|
||||
group == keyboard->modifiers->group) {
|
||||
if (depressed == keyboard->modifiers.depressed &&
|
||||
latched == keyboard->modifiers.latched &&
|
||||
locked == keyboard->modifiers.locked &&
|
||||
group == keyboard->modifiers.group) {
|
||||
return false;
|
||||
}
|
||||
|
||||
keyboard->modifiers->depressed = depressed;
|
||||
keyboard->modifiers->latched = latched;
|
||||
keyboard->modifiers->locked = locked;
|
||||
keyboard->modifiers->group = group;
|
||||
keyboard->modifiers.depressed = depressed;
|
||||
keyboard->modifiers.latched = latched;
|
||||
keyboard->modifiers.locked = locked;
|
||||
keyboard->modifiers.group = group;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -138,7 +138,6 @@ void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
|
|||
void wlr_keyboard_init(struct wlr_keyboard *kb,
|
||||
struct wlr_keyboard_impl *impl) {
|
||||
kb->impl = impl;
|
||||
kb->modifiers = calloc(1, sizeof(struct wlr_keyboard_modifiers));
|
||||
wl_signal_init(&kb->events.key);
|
||||
wl_signal_init(&kb->events.modifiers);
|
||||
wl_signal_init(&kb->events.keymap);
|
||||
|
@ -161,7 +160,6 @@ void wlr_keyboard_destroy(struct wlr_keyboard *kb) {
|
|||
xkb_state_unref(kb->xkb_state);
|
||||
xkb_keymap_unref(kb->keymap);
|
||||
close(kb->keymap_fd);
|
||||
free(kb->modifiers);
|
||||
free(kb);
|
||||
}
|
||||
|
||||
|
@ -259,7 +257,7 @@ void wlr_keyboard_set_repeat_info(struct wlr_keyboard *kb, int32_t rate,
|
|||
}
|
||||
|
||||
uint32_t wlr_keyboard_get_modifiers(struct wlr_keyboard *kb) {
|
||||
xkb_mod_mask_t mask = kb->modifiers->depressed | kb->modifiers->latched;
|
||||
xkb_mod_mask_t mask = kb->modifiers.depressed | kb->modifiers.latched;
|
||||
uint32_t modifiers = 0;
|
||||
for (size_t i = 0; i < WLR_MODIFIER_COUNT; ++i) {
|
||||
if (kb->mod_indexes[i] != XKB_MOD_INVALID &&
|
||||
|
|
|
@ -794,7 +794,7 @@ void wlr_seat_set_keyboard(struct wlr_seat *seat,
|
|||
seat_client_send_repeat_info(client, keyboard);
|
||||
}
|
||||
|
||||
wlr_seat_keyboard_send_modifiers(seat, keyboard->modifiers);
|
||||
wlr_seat_keyboard_send_modifiers(seat, &keyboard->modifiers);
|
||||
} else {
|
||||
seat->keyboard_state.keyboard = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue