diff options
author | Timidger <APragmaticPlace@gmail.com> | 2018-04-29 20:16:29 -0400 |
---|---|---|
committer | Timidger <APragmaticPlace@gmail.com> | 2018-05-10 19:03:58 -0700 |
commit | 7da50d065b298b74e16c86065c19cfe22e157c6f (patch) | |
tree | c41207da8bb05190082208a80eadd1d0b8bf36dd /examples/pointer.c | |
parent | 7f1230fe7881d343e83da30affcbae80e494da08 (diff) |
Fixed style issues
Diffstat (limited to 'examples/pointer.c')
-rw-r--r-- | examples/pointer.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/examples/pointer.c b/examples/pointer.c index 00002921..96c07667 100644 --- a/examples/pointer.c +++ b/examples/pointer.c @@ -74,7 +74,6 @@ struct sample_keyboard { struct wl_listener destroy; }; - static void warp_to_touch(struct sample_state *sample, struct wlr_input_device *dev) { if (wl_list_empty(&sample->touch_points)) { @@ -235,8 +234,8 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) { for (int i = 0; i < nsyms; i++) { xkb_keysym_t sym = syms[i]; if (sym == XKB_KEY_Escape) { - wl_display_terminate(sample->display); - } + wl_display_terminate(sample->display); + } } } @@ -282,9 +281,6 @@ void keyboard_destroy_notify(struct wl_listener *listener, void *data) { void new_input_notify(struct wl_listener *listener, void *data) { struct wlr_input_device *device = data; struct sample_state *sample = wl_container_of(listener, sample, new_input); - struct sample_keyboard *keyboard; - struct xkb_rule_names rules; - struct xkb_context *context; switch (device->type) { case WLR_INPUT_DEVICE_POINTER: case WLR_INPUT_DEVICE_TOUCH: @@ -292,21 +288,21 @@ void new_input_notify(struct wl_listener *listener, void *data) { wlr_cursor_attach_input_device(sample->cursor, device); break; - case WLR_INPUT_DEVICE_KEYBOARD: - keyboard = calloc(1, sizeof(struct sample_keyboard)); + case WLR_INPUT_DEVICE_KEYBOARD:; + struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard)); keyboard->device = device; keyboard->sample = sample; wl_signal_add(&device->events.destroy, &keyboard->destroy); keyboard->destroy.notify = keyboard_destroy_notify; wl_signal_add(&device->keyboard->events.key, &keyboard->key); keyboard->key.notify = keyboard_key_notify; - memset(&rules, 0, sizeof(rules)); + struct xkb_rule_names rules = { 0 }; rules.rules = getenv("XKB_DEFAULT_RULES"); rules.model = getenv("XKB_DEFAULT_MODEL"); rules.layout = getenv("XKB_DEFAULT_LAYOUT"); rules.variant = getenv("XKB_DEFAULT_VARIANT"); rules.options = getenv("XKB_DEFAULT_OPTIONS"); - context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); + struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); if (!context) { wlr_log(L_ERROR, "Failed to create XKB context"); exit(1); |