From c47719902e0ed8d5fc8e0c7dc4d4cba78b0486f9 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 28 Jun 2017 11:41:43 -0500 Subject: [PATCH weston 1/2] input: add weston_keyboard_send_keymap helper function We've always had "send_keymap" internally, but some places failed to use it. Since we also use this in the text backend, export it. Reviewed-by: Daniel Stone Signed-off-by: Derek Foreman --- compositor/text-backend.c | 4 +--- libweston/compositor.h | 4 ++++ libweston/input.c | 14 +++++++------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/compositor/text-backend.c b/compositor/text-backend.c index bf5c45cc..d27009f8 100644 --- a/compositor/text-backend.c +++ b/compositor/text-backend.c @@ -669,9 +669,7 @@ input_method_context_grab_keyboard(struct wl_client *client, context->keyboard = cr; - wl_keyboard_send_keymap(cr, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, - keyboard->xkb_info->keymap_fd, - keyboard->xkb_info->keymap_size); + weston_keyboard_send_keymap(keyboard, cr); if (keyboard->grab != &keyboard->default_grab) { weston_keyboard_end_grab(keyboard); diff --git a/libweston/compositor.h b/libweston/compositor.h index 21c4046d..2c3358c5 100644 --- a/libweston/compositor.h +++ b/libweston/compositor.h @@ -1918,6 +1918,10 @@ void weston_seat_set_keyboard_focus(struct weston_seat *seat, struct weston_surface *surface); +void +weston_keyboard_send_keymap(struct weston_keyboard *kbd, + struct wl_resource *resource); + int weston_compositor_load_xwayland(struct weston_compositor *compositor); diff --git a/libweston/input.c b/libweston/input.c index 81a94a92..001d7b19 100644 --- a/libweston/input.c +++ b/libweston/input.c @@ -1852,9 +1852,11 @@ update_modifier_state(struct weston_seat *seat, uint32_t serial, uint32_t key, notify_modifiers(seat, serial); } -static void -send_keymap(struct wl_resource *resource, struct weston_xkb_info *xkb_info) +WL_EXPORT void +weston_keyboard_send_keymap(struct weston_keyboard *kbd, struct wl_resource *resource) { + struct weston_xkb_info *xkb_info = kbd->xkb_info; + wl_keyboard_send_keymap(resource, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, xkb_info->keymap_fd, @@ -1918,9 +1920,9 @@ update_keymap(struct weston_seat *seat) keyboard->xkb_state.state = state; wl_resource_for_each(resource, &keyboard->resource_list) - send_keymap(resource, xkb_info); + weston_keyboard_send_keymap(keyboard, resource); wl_resource_for_each(resource, &keyboard->focus_resource_list) - send_keymap(resource, xkb_info); + weston_keyboard_send_keymap(keyboard, resource); notify_modifiers(seat, wl_display_next_serial(seat->compositor->wl_display)); @@ -2460,9 +2462,7 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource, seat->compositor->kb_repeat_delay); } - wl_keyboard_send_keymap(cr, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, - keyboard->xkb_info->keymap_fd, - keyboard->xkb_info->keymap_size); + weston_keyboard_send_keymap(keyboard, cr); if (should_send_modifiers_to_client(seat, client)) { send_modifiers_to_resource(keyboard, -- 2.13.1