aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/keyboard.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-08-11 14:22:02 -0400
committerGitHub <noreply@github.com>2017-08-11 14:22:02 -0400
commit9f103ca71e798d9676e6bdc9c62ce8efdc9ad5d2 (patch)
treec207b96c6f1c9eb8786349423a630a9fddc5e7cc /backend/libinput/keyboard.c
parent62d8b252c093b3bd71362b1c76cb70b16a6cd63a (diff)
parent1c7dd71208169248e7fe9c7d86cce13955497017 (diff)
Merge pull request #66 from martinetd/leak_plumbing
Leak plumbing
Diffstat (limited to 'backend/libinput/keyboard.c')
-rw-r--r--backend/libinput/keyboard.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/backend/libinput/keyboard.c b/backend/libinput/keyboard.c
index 957cc3f2..f15b6362 100644
--- a/backend/libinput/keyboard.c
+++ b/backend/libinput/keyboard.c
@@ -45,20 +45,19 @@ void handle_keyboard_key(struct libinput_event *event,
}
struct libinput_event_keyboard *kbevent =
libinput_event_get_keyboard_event(event);
- struct wlr_event_keyboard_key *wlr_event =
- calloc(1, sizeof(struct wlr_event_keyboard_key));
- wlr_event->time_sec = libinput_event_keyboard_get_time(kbevent);
- wlr_event->time_usec = libinput_event_keyboard_get_time_usec(kbevent);
- wlr_event->keycode = libinput_event_keyboard_get_key(kbevent);
+ struct wlr_event_keyboard_key wlr_event = { 0 };
+ wlr_event.time_sec = libinput_event_keyboard_get_time(kbevent);
+ wlr_event.time_usec = libinput_event_keyboard_get_time_usec(kbevent);
+ wlr_event.keycode = libinput_event_keyboard_get_key(kbevent);
enum libinput_key_state state =
libinput_event_keyboard_get_key_state(kbevent);
switch (state) {
case LIBINPUT_KEY_STATE_RELEASED:
- wlr_event->state = WLR_KEY_RELEASED;
+ wlr_event.state = WLR_KEY_RELEASED;
break;
case LIBINPUT_KEY_STATE_PRESSED:
- wlr_event->state = WLR_KEY_PRESSED;
+ wlr_event.state = WLR_KEY_PRESSED;
break;
}
- wl_signal_emit(&dev->keyboard->events.key, wlr_event);
+ wl_signal_emit(&dev->keyboard->events.key, &wlr_event);
}