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 /include/wlr | |
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 'include/wlr')
-rw-r--r-- | include/wlr/types/wlr_input_device.h | 11 | ||||
-rw-r--r-- | include/wlr/types/wlr_keyboard.h | 8 | ||||
-rw-r--r-- | include/wlr/types/wlr_pointer.h | 8 | ||||
-rw-r--r-- | include/wlr/types/wlr_switch.h | 8 | ||||
-rw-r--r-- | include/wlr/types/wlr_tablet_pad.h | 8 | ||||
-rw-r--r-- | include/wlr/types/wlr_tablet_tool.h | 8 | ||||
-rw-r--r-- | include/wlr/types/wlr_touch.h | 8 |
7 files changed, 48 insertions, 11 deletions
diff --git a/include/wlr/types/wlr_input_device.h b/include/wlr/types/wlr_input_device.h index 8c360aab..0bbf517b 100644 --- a/include/wlr/types/wlr_input_device.h +++ b/include/wlr/types/wlr_input_device.h @@ -30,17 +30,6 @@ struct wlr_input_device { unsigned int vendor, product; char *name; - /* wlr_input_device.type determines which of these is valid */ - union { - void *_device; - struct wlr_keyboard *keyboard; - struct wlr_pointer *pointer; - struct wlr_switch *switch_device; - struct wlr_touch *touch; - struct wlr_tablet *tablet; - struct wlr_tablet_pad *tablet_pad; - }; - struct { struct wl_signal destroy; } events; diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h index 6a7eff81..39449aea 100644 --- a/include/wlr/types/wlr_keyboard.h +++ b/include/wlr/types/wlr_keyboard.h @@ -101,6 +101,14 @@ struct wlr_keyboard_key_event { enum wl_keyboard_key_state state; }; +/** + * Get a struct wlr_keyboard from a struct wlr_input_device. + * + * Asserts that the input device is a keyboard. + */ +struct wlr_keyboard *wlr_keyboard_from_input_device( + struct wlr_input_device *input_device); + bool wlr_keyboard_set_keymap(struct wlr_keyboard *kb, struct xkb_keymap *keymap); diff --git a/include/wlr/types/wlr_pointer.h b/include/wlr/types/wlr_pointer.h index 17ab258a..73e641fc 100644 --- a/include/wlr/types/wlr_pointer.h +++ b/include/wlr/types/wlr_pointer.h @@ -145,4 +145,12 @@ struct wlr_pointer_hold_end_event { bool cancelled; }; +/** + * Get a struct wlr_pointer from a struct wlr_input_device. + * + * Asserts that the input device is a pointer. + */ +struct wlr_pointer *wlr_pointer_from_input_device( + struct wlr_input_device *input_device); + #endif diff --git a/include/wlr/types/wlr_switch.h b/include/wlr/types/wlr_switch.h index e26c9a3f..b560f0ba 100644 --- a/include/wlr/types/wlr_switch.h +++ b/include/wlr/types/wlr_switch.h @@ -43,4 +43,12 @@ struct wlr_switch_toggle_event { enum wlr_switch_state switch_state; }; +/** + * Get a struct wlr_switch from a struct wlr_input_device. + * + * Asserts that the input device is a switch. + */ +struct wlr_switch *wlr_switch_from_input_device( + struct wlr_input_device *input_device); + #endif diff --git a/include/wlr/types/wlr_tablet_pad.h b/include/wlr/types/wlr_tablet_pad.h index 32a3231d..f19505a9 100644 --- a/include/wlr/types/wlr_tablet_pad.h +++ b/include/wlr/types/wlr_tablet_pad.h @@ -92,4 +92,12 @@ struct wlr_tablet_pad_strip_event { unsigned int mode; }; +/** + * Get a struct wlr_tablet_pad from a struct wlr_input_device. + * + * Asserts that the input device is a tablet pad. + */ +struct wlr_tablet_pad *wlr_tablet_pad_from_input_device( + struct wlr_input_device *); + #endif diff --git a/include/wlr/types/wlr_tablet_tool.h b/include/wlr/types/wlr_tablet_tool.h index ec0fc42a..495c7094 100644 --- a/include/wlr/types/wlr_tablet_tool.h +++ b/include/wlr/types/wlr_tablet_tool.h @@ -144,4 +144,12 @@ struct wlr_tablet_tool_button_event { enum wlr_button_state state; }; +/** + * Get a struct wlr_tablet from a struct wlr_input_device. + * + * Asserts that the input device is a tablet tool. + */ +struct wlr_tablet *wlr_tablet_from_input_device( + struct wlr_input_device *input_device); + #endif diff --git a/include/wlr/types/wlr_touch.h b/include/wlr/types/wlr_touch.h index 0d2a27b6..da294f76 100644 --- a/include/wlr/types/wlr_touch.h +++ b/include/wlr/types/wlr_touch.h @@ -62,4 +62,12 @@ struct wlr_touch_cancel_event { int32_t touch_id; }; +/** + * Get a struct wlr_touch from a struct wlr_input_device. + * + * Asserts that the input device is a touch device. + */ +struct wlr_touch *wlr_touch_from_input_device( + struct wlr_input_device *input_device); + #endif |