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. --- backend/libinput/backend.c | 12 ++++++------ backend/libinput/events.c | 18 ++++++++++++------ backend/wayland/seat.c | 10 +++++----- backend/x11/input_device.c | 6 +++--- 4 files changed, 26 insertions(+), 20 deletions(-) (limited to 'backend') diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 60f456cc..f47121db 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -228,22 +228,22 @@ struct libinput_device *wlr_libinput_get_device_handle( struct wlr_libinput_input_device *dev = NULL; switch (wlr_dev->type) { case WLR_INPUT_DEVICE_KEYBOARD: - dev = device_from_keyboard(wlr_dev->keyboard); + dev = device_from_keyboard(wlr_keyboard_from_input_device(wlr_dev)); break; case WLR_INPUT_DEVICE_POINTER: - dev = device_from_pointer(wlr_dev->pointer); + dev = device_from_pointer(wlr_pointer_from_input_device(wlr_dev)); break; case WLR_INPUT_DEVICE_SWITCH: - dev = device_from_switch(wlr_dev->switch_device); + dev = device_from_switch(wlr_switch_from_input_device(wlr_dev)); break; case WLR_INPUT_DEVICE_TOUCH: - dev = device_from_touch(wlr_dev->touch); + dev = device_from_touch(wlr_touch_from_input_device(wlr_dev)); break; case WLR_INPUT_DEVICE_TABLET_TOOL: - dev = device_from_tablet(wlr_dev->tablet); + dev = device_from_tablet(wlr_tablet_from_input_device(wlr_dev)); break; case WLR_INPUT_DEVICE_TABLET_PAD: - dev = device_from_tablet_pad(wlr_dev->tablet_pad); + dev = device_from_tablet_pad(wlr_tablet_pad_from_input_device(wlr_dev)); break; } return dev->handle; diff --git a/backend/libinput/events.c b/backend/libinput/events.c index e52dbd95..b9f2f43c 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -41,17 +41,23 @@ void destroy_libinput_input_device(struct wlr_libinput_input_device *dev) { bool wlr_input_device_is_libinput(struct wlr_input_device *wlr_dev) { switch (wlr_dev->type) { case WLR_INPUT_DEVICE_KEYBOARD: - return wlr_dev->keyboard->impl == &libinput_keyboard_impl; + return wlr_keyboard_from_input_device(wlr_dev)->impl == + &libinput_keyboard_impl; case WLR_INPUT_DEVICE_POINTER: - return wlr_dev->pointer->impl == &libinput_pointer_impl; + return wlr_pointer_from_input_device(wlr_dev)->impl == + &libinput_pointer_impl; case WLR_INPUT_DEVICE_TOUCH: - return wlr_dev->touch->impl == &libinput_touch_impl; + return wlr_touch_from_input_device(wlr_dev)->impl == + &libinput_touch_impl; case WLR_INPUT_DEVICE_TABLET_TOOL: - return wlr_dev->tablet->impl == &libinput_tablet_impl; + return wlr_tablet_from_input_device(wlr_dev)-> impl == + &libinput_tablet_impl; case WLR_INPUT_DEVICE_TABLET_PAD: - return wlr_dev->tablet_pad->impl == &libinput_tablet_pad_impl; + return wlr_tablet_pad_from_input_device(wlr_dev)->impl == + &libinput_tablet_pad_impl; case WLR_INPUT_DEVICE_SWITCH: - return wlr_dev->switch_device->impl == &libinput_switch_impl; + return wlr_switch_from_input_device(wlr_dev)->impl == + &libinput_switch_impl; default: return false; } diff --git a/backend/wayland/seat.c b/backend/wayland/seat.c index c05591aa..d1c75b39 100644 --- a/backend/wayland/seat.c +++ b/backend/wayland/seat.c @@ -280,15 +280,15 @@ void destroy_wl_seats(struct wlr_wl_backend *wl) { bool wlr_input_device_is_wl(struct wlr_input_device *dev) { switch (dev->type) { case WLR_INPUT_DEVICE_KEYBOARD: - return dev->keyboard->impl == &keyboard_impl; + return wlr_keyboard_from_input_device(dev)->impl == &keyboard_impl; case WLR_INPUT_DEVICE_POINTER: - return dev->pointer->impl == &wl_pointer_impl; + return wlr_pointer_from_input_device(dev)->impl == &wl_pointer_impl; case WLR_INPUT_DEVICE_TOUCH: - return dev->touch->impl == &touch_impl; + return wlr_touch_from_input_device(dev)->impl == &touch_impl; case WLR_INPUT_DEVICE_TABLET_TOOL: - return dev->tablet->impl == &wl_tablet_impl; + return wlr_tablet_from_input_device(dev)-> impl == &wl_tablet_impl; case WLR_INPUT_DEVICE_TABLET_PAD: - return dev->tablet_pad->impl == &wl_tablet_pad_impl; + return wlr_tablet_pad_from_input_device(dev)->impl == &wl_tablet_pad_impl; default: return false; } diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c index d1f5c2c1..41168222 100644 --- a/backend/x11/input_device.c +++ b/backend/x11/input_device.c @@ -317,11 +317,11 @@ void update_x11_pointer_position(struct wlr_x11_output *output, bool wlr_input_device_is_x11(struct wlr_input_device *wlr_dev) { switch (wlr_dev->type) { case WLR_INPUT_DEVICE_KEYBOARD: - return wlr_dev->keyboard->impl == &x11_keyboard_impl; + return wlr_keyboard_from_input_device(wlr_dev)->impl == &x11_keyboard_impl; case WLR_INPUT_DEVICE_POINTER: - return wlr_dev->pointer->impl == &x11_pointer_impl; + return wlr_pointer_from_input_device(wlr_dev)->impl == &x11_pointer_impl; case WLR_INPUT_DEVICE_TOUCH: - return wlr_dev->touch->impl == &x11_touch_impl; + return wlr_touch_from_input_device(wlr_dev)->impl == &x11_touch_impl; default: return false; } -- cgit v1.2.3