From 91943a68a6976ef7c4cc70afc07954a00fae678b Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Mon, 20 Jun 2022 16:57:29 +0200 Subject: wlr_input_device: remove anon union field This union is unnecessary since the recent input device refactor and can now be replaced by wlr_*_from_input_device() functions. --- examples/touch.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'examples/touch.c') diff --git a/examples/touch.c b/examples/touch.c index 765b41aa..d33e148a 100644 --- a/examples/touch.c +++ b/examples/touch.c @@ -41,7 +41,7 @@ struct touch_point { struct touch_state { struct sample_state *sample; - struct wlr_input_device *device; + struct wlr_touch *wlr_touch; struct wl_listener destroy; struct wl_listener down; struct wl_listener up; @@ -59,7 +59,7 @@ struct sample_output { struct sample_keyboard { struct sample_state *sample; - struct wlr_input_device *device; + struct wlr_keyboard *wlr_keyboard; struct wl_listener key; struct wl_listener destroy; }; @@ -175,7 +175,7 @@ static void keyboard_key_notify(struct wl_listener *listener, void *data) { struct wlr_keyboard_key_event *event = data; uint32_t keycode = event->keycode + 8; const xkb_keysym_t *syms; - int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state, + int nsyms = xkb_state_key_get_syms(keyboard->wlr_keyboard->xkb_state, keycode, &syms); for (int i = 0; i < nsyms; i++) { xkb_keysym_t sym = syms[i]; @@ -198,11 +198,11 @@ static void new_input_notify(struct wl_listener *listener, void *data) { switch (device->type) { case WLR_INPUT_DEVICE_KEYBOARD:; struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard)); - keyboard->device = device; + keyboard->wlr_keyboard = wlr_keyboard_from_input_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); + wl_signal_add(&keyboard->wlr_keyboard->events.key, &keyboard->key); keyboard->key.notify = keyboard_key_notify; struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); if (!context) { @@ -215,22 +215,22 @@ static void new_input_notify(struct wl_listener *listener, void *data) { wlr_log(WLR_ERROR, "Failed to create XKB keymap"); exit(1); } - wlr_keyboard_set_keymap(device->keyboard, keymap); + wlr_keyboard_set_keymap(keyboard->wlr_keyboard, keymap); xkb_keymap_unref(keymap); xkb_context_unref(context); break; case WLR_INPUT_DEVICE_TOUCH:; struct touch_state *tstate = calloc(sizeof(struct touch_state), 1); - tstate->device = device; + tstate->wlr_touch = wlr_touch_from_input_device(device); tstate->sample = sample; tstate->destroy.notify = touch_destroy_notify; wl_signal_add(&device->events.destroy, &tstate->destroy); tstate->down.notify = touch_down_notify; - wl_signal_add(&device->touch->events.down, &tstate->down); + wl_signal_add(&tstate->wlr_touch->events.down, &tstate->down); tstate->motion.notify = touch_motion_notify; - wl_signal_add(&device->touch->events.motion, &tstate->motion); + wl_signal_add(&tstate->wlr_touch->events.motion, &tstate->motion); tstate->up.notify = touch_up_notify; - wl_signal_add(&device->touch->events.up, &tstate->up); + wl_signal_add(&tstate->wlr_touch->events.up, &tstate->up); wl_list_insert(&sample->touch, &tstate->link); break; default: -- cgit v1.2.3