diff options
author | Isaac Freund <mail@isaacfreund.com> | 2022-06-20 16:57:29 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-06-21 18:42:07 +0000 |
commit | 91943a68a6976ef7c4cc70afc07954a00fae678b (patch) | |
tree | 4202f4951479425da05e387604266de73b91a2f8 /examples | |
parent | 5c4384a1330faedf975c8b8644881d50390f3613 (diff) |
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.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/multi-pointer.c | 10 | ||||
-rw-r--r-- | examples/output-layout.c | 10 | ||||
-rw-r--r-- | examples/pointer.c | 10 | ||||
-rw-r--r-- | examples/quads.c | 10 | ||||
-rw-r--r-- | examples/rotation.c | 10 | ||||
-rw-r--r-- | examples/simple.c | 10 | ||||
-rw-r--r-- | examples/tablet.c | 30 | ||||
-rw-r--r-- | examples/touch.c | 20 |
8 files changed, 55 insertions, 55 deletions
diff --git a/examples/multi-pointer.c b/examples/multi-pointer.c index d6189f29..26311319 100644 --- a/examples/multi-pointer.c +++ b/examples/multi-pointer.c @@ -64,7 +64,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; }; @@ -188,7 +188,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]; @@ -211,11 +211,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) { @@ -228,7 +228,7 @@ 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; diff --git a/examples/output-layout.c b/examples/output-layout.c index a057ca78..97939953 100644 --- a/examples/output-layout.c +++ b/examples/output-layout.c @@ -45,7 +45,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; }; @@ -186,7 +186,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]; @@ -229,11 +229,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) { @@ -246,7 +246,7 @@ 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; diff --git a/examples/pointer.c b/examples/pointer.c index 1197386e..6eb328ac 100644 --- a/examples/pointer.c +++ b/examples/pointer.c @@ -70,7 +70,7 @@ struct sample_output { struct sample_keyboard { struct sample_state *state; - struct wlr_input_device *device; + struct wlr_keyboard *wlr_keyboard; struct wl_listener key; struct wl_listener destroy; }; @@ -231,7 +231,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]; @@ -297,11 +297,11 @@ static void new_input_notify(struct wl_listener *listener, void *data) { 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->state = state; 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) { @@ -314,7 +314,7 @@ 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; diff --git a/examples/quads.c b/examples/quads.c index 88c59f7c..a9c7a14b 100644 --- a/examples/quads.c +++ b/examples/quads.c @@ -39,7 +39,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; }; @@ -132,7 +132,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]; @@ -155,11 +155,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) { @@ -172,7 +172,7 @@ 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; diff --git a/examples/rotation.c b/examples/rotation.c index a2e868af..087fa8d1 100644 --- a/examples/rotation.c +++ b/examples/rotation.c @@ -44,7 +44,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; }; @@ -137,7 +137,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]; @@ -176,11 +176,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) { @@ -193,7 +193,7 @@ 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; diff --git a/examples/simple.c b/examples/simple.c index e46093be..5a41d19e 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -35,7 +35,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; }; @@ -112,7 +112,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]; @@ -137,11 +137,11 @@ static void new_input_notify(struct wl_listener *listener, void *data) { 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) { @@ -154,7 +154,7 @@ 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; diff --git a/examples/tablet.c b/examples/tablet.c index 35def700..1fb0233b 100644 --- a/examples/tablet.c +++ b/examples/tablet.c @@ -43,7 +43,7 @@ struct sample_state { struct tablet_tool_state { struct sample_state *sample; - struct wlr_input_device *device; + struct wlr_tablet *wlr_tablet; struct wl_listener destroy; struct wl_listener axis; struct wl_listener proximity; @@ -55,7 +55,7 @@ struct tablet_tool_state { struct tablet_pad_state { struct sample_state *sample; - struct wlr_input_device *device; + struct wlr_tablet_pad *wlr_tablet_pad; struct wl_listener destroy; struct wl_listener button; struct wl_listener ring; @@ -72,7 +72,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; }; @@ -264,7 +264,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]; @@ -287,11 +287,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) { @@ -304,40 +304,40 @@ 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_TABLET_PAD:; struct tablet_pad_state *pstate = calloc(sizeof(struct tablet_pad_state), 1); - pstate->device = device; + pstate->wlr_tablet_pad = wlr_tablet_pad_from_input_device(device); pstate->sample = sample; pstate->destroy.notify = tablet_pad_destroy_notify; wl_signal_add(&device->events.destroy, &pstate->destroy); pstate->button.notify = tablet_pad_button_notify; - wl_signal_add(&device->tablet_pad->events.button, &pstate->button); + wl_signal_add(&pstate->wlr_tablet_pad->events.button, &pstate->button); pstate->ring.notify = tablet_pad_ring_notify; - wl_signal_add(&device->tablet_pad->events.ring, &pstate->ring); + wl_signal_add(&pstate->wlr_tablet_pad->events.ring, &pstate->ring); wl_list_insert(&sample->tablet_pads, &pstate->link); break; case WLR_INPUT_DEVICE_TABLET_TOOL:; - struct wlr_tablet *tablet = device->tablet; + struct wlr_tablet *tablet = wlr_tablet_from_input_device(device); sample->width_mm = tablet->width_mm == 0 ? 20 : tablet->width_mm; sample->height_mm = tablet->height_mm == 0 ? 10 : tablet->height_mm; struct tablet_tool_state *tstate = calloc(sizeof(struct tablet_tool_state), 1); - tstate->device = device; + tstate->wlr_tablet = tablet; tstate->sample = sample; tstate->destroy.notify = tablet_tool_destroy_notify; wl_signal_add(&device->events.destroy, &tstate->destroy); tstate->axis.notify = tablet_tool_axis_notify; - wl_signal_add(&device->tablet->events.axis, &tstate->axis); + wl_signal_add(&tablet->events.axis, &tstate->axis); tstate->proximity.notify = tablet_tool_proximity_notify; - wl_signal_add(&device->tablet->events.proximity, &tstate->proximity); + wl_signal_add(&tablet->events.proximity, &tstate->proximity); tstate->button.notify = tablet_tool_button_notify; - wl_signal_add(&device->tablet->events.button, &tstate->button); + wl_signal_add(&tablet->events.button, &tstate->button); wl_list_insert(&sample->tablet_tools, &tstate->link); break; default: 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: |