diff options
| author | Daniel Stone <daniel@fooishbar.org> | 2012-06-22 13:21:26 +0100 |
|---|---|---|
| committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-06-22 11:06:44 -0400 |
| commit | bcefacb89d14c5f98c0fe2b12e2baf50e216496e (patch) | |
| tree | 886fad82a800f424c86343ab4326c20a6a68d543 /src | |
| parent | wayland-cursor: Plug leak of filename on load_all_cursors_from_dir() (diff) | |
| download | wayland-bcefacb89d14c5f98c0fe2b12e2baf50e216496e.tar wayland-bcefacb89d14c5f98c0fe2b12e2baf50e216496e.tar.gz wayland-bcefacb89d14c5f98c0fe2b12e2baf50e216496e.tar.bz2 wayland-bcefacb89d14c5f98c0fe2b12e2baf50e216496e.tar.lz wayland-bcefacb89d14c5f98c0fe2b12e2baf50e216496e.tar.xz wayland-bcefacb89d14c5f98c0fe2b12e2baf50e216496e.tar.zst wayland-bcefacb89d14c5f98c0fe2b12e2baf50e216496e.zip | |
Maintain keyboard modifier state in wayland-server
Provide a slot for keyboard modifier state inside wl_keyboard for
implementations to update, and use this to send wl_keyboard:;modifier
events whenever the keyboard or pointer focus changes.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/wayland-server.c | 20 | ||||
| -rw-r--r-- | src/wayland-server.h | 7 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/wayland-server.c b/src/wayland-server.c index 010d9ca..39b3b59 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -724,7 +724,8 @@ WL_EXPORT void wl_pointer_set_focus(struct wl_pointer *pointer, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy) { - struct wl_resource *resource; + struct wl_keyboard *kbd = pointer->seat->keyboard; + struct wl_resource *resource, *kr; uint32_t serial; resource = pointer->focus_resource; @@ -741,6 +742,18 @@ wl_pointer_set_focus(struct wl_pointer *pointer, struct wl_surface *surface, (pointer->focus != surface || pointer->focus_resource != resource)) { serial = wl_display_next_serial(resource->client->display); + if (kbd) { + kr = find_resource_for_surface(&kbd->resource_list, + surface); + if (kr) { + wl_keyboard_send_modifiers(resource, + serial, + kbd->modifiers.mods_depressed, + kbd->modifiers.mods_latched, + kbd->modifiers.mods_locked, + kbd->modifiers.group); + } + } wl_pointer_send_enter(resource, serial, &surface->resource, sx, sy); wl_signal_add(&resource->destroy_signal, @@ -774,6 +787,11 @@ wl_keyboard_set_focus(struct wl_keyboard *keyboard, struct wl_surface *surface) (keyboard->focus != surface || keyboard->focus_resource != resource)) { serial = wl_display_next_serial(resource->client->display); + wl_keyboard_send_modifiers(resource, serial, + keyboard->modifiers.mods_depressed, + keyboard->modifiers.mods_latched, + keyboard->modifiers.mods_locked, + keyboard->modifiers.group); wl_keyboard_send_enter(resource, serial, &surface->resource, &keyboard->keys); wl_signal_add(&resource->destroy_signal, diff --git a/src/wayland-server.h b/src/wayland-server.h index a7bc7b4..18a8beb 100644 --- a/src/wayland-server.h +++ b/src/wayland-server.h @@ -280,6 +280,13 @@ struct wl_keyboard { uint32_t grab_time; struct wl_array keys; + + struct { + uint32_t mods_depressed; + uint32_t mods_latched; + uint32_t mods_locked; + uint32_t group; + } modifiers; }; struct wl_touch { |
