diff options
author | xdavidwu <xdavidwuph@gmail.com> | 2020-07-08 10:46:28 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-07-08 11:21:57 +0200 |
commit | 61e2ebac908c33cfaf06a53a09e829ac97eca400 (patch) | |
tree | cb2cc5a016aeb99e74564401775bb9eb4c28dcb5 | |
parent | b6377b59ff70342e4e33b67c9733fe80d7e87cac (diff) |
virtual-keyboard: add wlr_input_device_get_virtual_keyboard
-rw-r--r-- | include/wlr/types/wlr_virtual_keyboard_v1.h | 5 | ||||
-rw-r--r-- | types/wlr_virtual_keyboard_v1.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/include/wlr/types/wlr_virtual_keyboard_v1.h b/include/wlr/types/wlr_virtual_keyboard_v1.h index 78f80fbb..a3f4e452 100644 --- a/include/wlr/types/wlr_virtual_keyboard_v1.h +++ b/include/wlr/types/wlr_virtual_keyboard_v1.h @@ -26,8 +26,8 @@ struct wlr_virtual_keyboard_manager_v1 { }; struct wlr_virtual_keyboard_v1 { - struct wl_resource *resource; struct wlr_input_device input_device; + struct wl_resource *resource; struct wlr_seat *seat; bool has_keymap; @@ -41,4 +41,7 @@ struct wlr_virtual_keyboard_v1 { struct wlr_virtual_keyboard_manager_v1* wlr_virtual_keyboard_manager_v1_create( struct wl_display *display); +struct wlr_virtual_keyboard_v1 *wlr_input_device_get_virtual_keyboard( + struct wlr_input_device *wlr_dev); + #endif diff --git a/types/wlr_virtual_keyboard_v1.c b/types/wlr_virtual_keyboard_v1.c index 258a08cb..7ae030ee 100644 --- a/types/wlr_virtual_keyboard_v1.c +++ b/types/wlr_virtual_keyboard_v1.c @@ -40,6 +40,14 @@ static struct wlr_virtual_keyboard_v1 *virtual_keyboard_from_resource( return wl_resource_get_user_data(resource); } +struct wlr_virtual_keyboard_v1 *wlr_input_device_get_virtual_keyboard( + struct wlr_input_device *wlr_dev) { + if (wlr_dev->impl != &input_device_impl) { + return NULL; + } + return (struct wlr_virtual_keyboard_v1 *)wlr_dev; +} + static void virtual_keyboard_keymap(struct wl_client *client, struct wl_resource *resource, uint32_t format, int32_t fd, uint32_t size) { |