mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
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.
This commit is contained in:
parent
5c4384a133
commit
91943a68a6
31 changed files with 216 additions and 130 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue