aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-01-17 08:31:15 -0500
committerTony Crisci <tony@dubstepdish.com>2018-01-17 08:31:15 -0500
commitb6f29e87e85b599170a0ffd1f4c94c46c216d51a (patch)
tree819b483e84497623a7c5454f1dd0e7aef9b60f9b
parent43896af90fbd6c743be1e54a0659d7c0f89eaa00 (diff)
dont use pointer for modifiers
-rw-r--r--include/wlr/types/wlr_keyboard.h2
-rw-r--r--rootston/keyboard.c2
-rw-r--r--rootston/seat.c2
-rw-r--r--types/wlr_keyboard.c20
-rw-r--r--types/wlr_seat.c2
5 files changed, 13 insertions, 15 deletions
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;
}