From 7614cb0373f5439807c1ec6de6ae7e13711e61bb Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 10 Dec 2015 08:32:56 -0500 Subject: [PATCH] Add keyboard handling shims to registry --- include/client/registry.h | 1 + wayland/registry.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/include/client/registry.h b/include/client/registry.h index a69019909..5e47b18e1 100644 --- a/include/client/registry.h +++ b/include/client/registry.h @@ -16,6 +16,7 @@ struct registry { struct wl_compositor *compositor; struct wl_display *display; struct wl_pointer *pointer; + struct wl_keyboard *keyboard; struct wl_seat *seat; struct wl_shell *shell; struct wl_shm *shm; diff --git a/wayland/registry.c b/wayland/registry.c index 11e6e51d3..883c69d34 100644 --- a/wayland/registry.c +++ b/wayland/registry.c @@ -38,6 +38,40 @@ static const struct wl_output_listener output_listener = { .scale = display_handle_scale }; +static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, + uint32_t format, int fd, uint32_t size) { +} + +static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, + uint32_t serial, struct wl_surface *surface, struct wl_array *keys) { +} + +static void keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, + uint32_t serial, struct wl_surface *surface) { +} + +static void keyboard_handle_key(void *data, struct wl_keyboard *keyboard, + uint32_t serial, uint32_t time, uint32_t key, uint32_t state_w) { +} + +static void keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, + uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, + uint32_t mods_locked, uint32_t group) { +} + +static void keyboard_handle_repeat_info(void *data, struct wl_keyboard *keyboard, + int32_t rate, int32_t delay) { +} + +static const struct wl_keyboard_listener keyboard_listener = { + .keymap = keyboard_handle_keymap, + .enter = keyboard_handle_enter, + .leave = keyboard_handle_leave, + .key = keyboard_handle_key, + .modifiers = keyboard_handle_modifiers, + .repeat_info = keyboard_handle_repeat_info +}; + static void registry_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version) { struct registry *reg = data; @@ -51,6 +85,10 @@ static void registry_global(void *data, struct wl_registry *registry, } else if (strcmp(interface, wl_seat_interface.name) == 0) { reg->seat = wl_registry_bind(registry, name, &wl_seat_interface, version); reg->pointer = wl_seat_get_pointer(reg->seat); + reg->keyboard = wl_seat_get_keyboard(reg->seat); + if (reg->keyboard) { + wl_keyboard_add_listener(reg->keyboard, &keyboard_listener, reg); + } } else if (strcmp(interface, wl_output_interface.name) == 0) { struct wl_output *output = wl_registry_bind(registry, name, &wl_output_interface, version); struct output_state *ostate = malloc(sizeof(struct output_state));