From 0ef2df21f2943c3985fcc86f5f6c3289036be491 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Fri, 5 Jan 2018 07:00:50 -0500 Subject: compositor modifier hook --- rootston/keyboard.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'rootston/keyboard.c') diff --git a/rootston/keyboard.c b/rootston/keyboard.c index 7b281308..29409dd7 100644 --- a/rootston/keyboard.c +++ b/rootston/keyboard.c @@ -279,7 +279,8 @@ void roots_keyboard_handle_key(struct roots_keyboard *keyboard, 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); + wlr_seat_keyboard_notify_modifiers(seat, + r_keyboard->device->keyboard->modifiers); } static void keyboard_config_merge(struct roots_keyboard_config *config, -- cgit v1.2.3 From b6f29e87e85b599170a0ffd1f4c94c46c216d51a Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Wed, 17 Jan 2018 08:31:15 -0500 Subject: dont use pointer for modifiers --- include/wlr/types/wlr_keyboard.h | 2 +- rootston/keyboard.c | 2 +- rootston/seat.c | 2 +- types/wlr_keyboard.c | 20 +++++++++----------- types/wlr_seat.c | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) (limited to 'rootston/keyboard.c') diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h index b37797c8..c67cc4c2 100644 --- a/include/wlr/types/wlr_keyboard.h +++ b/include/wlr/types/wlr_keyboard.h @@ -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; diff --git a/rootston/keyboard.c b/rootston/keyboard.c index 09adea5a..f1123599 100644 --- a/rootston/keyboard.c +++ b/rootston/keyboard.c @@ -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, diff --git a/rootston/seat.c b/rootston/seat.c index ed58e294..1a0e6253 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -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); diff --git a/types/wlr_keyboard.c b/types/wlr_keyboard.c index 5a90e6b2..b0dc97aa 100644 --- a/types/wlr_keyboard.c +++ b/types/wlr_keyboard.c @@ -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 && diff --git a/types/wlr_seat.c b/types/wlr_seat.c index 4378675c..019cb567 100644 --- a/types/wlr_seat.c +++ b/types/wlr_seat.c @@ -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; } -- cgit v1.2.3