summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2020-06-17 01:43:57 +0300
committerKirill Chibisov <contact@kchibisov.com>2020-07-09 17:47:11 +0300
commitc46c70dac84a4b3030cd05b380f9f410536690fc (patch)
tree12c3ca06c80f48b635ef34d8a68a0b44779051ce
parentf7f8f5f1a87dd697ad6de74a885493bcca920cde (diff)
downloadweston-c46c70dac84a4b3030cd05b380f9f410536690fc.tar.gz
libweston: Send wl_keyboard.modifiers after wl_keyboard.enter
The core Wayland protocol explicitly states that wl_keyboard.modifiers must be send after wl_keyboard.enter. This commit also changes the behavior of `seat_get_keyboard` to not send `wl_keyboard.modifiers` in case where seat had pointer focus, but not keyboard one. Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
-rw-r--r--libweston/input.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/libweston/input.c b/libweston/input.c
index e348a56b..b4e2c66f 100644
--- a/libweston/input.c
+++ b/libweston/input.c
@@ -1518,10 +1518,10 @@ send_enter_to_resource_list(struct wl_list *list,
struct wl_resource *resource;
wl_resource_for_each(resource, list) {
- send_modifiers_to_resource(keyboard, resource, serial);
wl_keyboard_send_enter(resource, serial,
surface->resource,
&keyboard->keys);
+ send_modifiers_to_resource(keyboard, resource, serial);
}
}
@@ -2848,28 +2848,6 @@ static const struct wl_keyboard_interface keyboard_interface = {
keyboard_release
};
-static bool
-should_send_modifiers_to_client(struct weston_seat *seat,
- struct wl_client *client)
-{
- struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat);
- struct weston_pointer *pointer = weston_seat_get_pointer(seat);
-
- if (keyboard &&
- keyboard->focus &&
- keyboard->focus->resource &&
- wl_resource_get_client(keyboard->focus->resource) == client)
- return true;
-
- if (pointer &&
- pointer->focus &&
- pointer->focus->surface->resource &&
- wl_resource_get_client(pointer->focus->surface->resource) == client)
- return true;
-
- return false;
-}
-
static void
seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
uint32_t id)
@@ -2915,12 +2893,6 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
weston_keyboard_send_keymap(keyboard, cr);
- if (should_send_modifiers_to_client(seat, client)) {
- send_modifiers_to_resource(keyboard,
- cr,
- keyboard->focus_serial);
- }
-
if (keyboard->focus && keyboard->focus->resource &&
wl_resource_get_client(keyboard->focus->resource) == client) {
struct weston_surface *surface =
@@ -2934,6 +2906,10 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
surface->resource,
&keyboard->keys);
+ send_modifiers_to_resource(keyboard,
+ cr,
+ keyboard->focus_serial);
+
/* If this is the first keyboard resource for this
* client... */
if (keyboard->focus_resource_list.prev ==