summaryrefslogtreecommitdiffstats
path: root/wayland-system-compositor.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2009-02-23 22:30:29 -0500
committerKristian Høgsberg <krh@redhat.com>2009-02-23 22:30:29 -0500
commit3c38fa0c3e55893911f85edeb0a0eaa4460e59ca (patch)
tree0f3d0c98eee039bfbc6a69ebdb809a357dc8f09e /wayland-system-compositor.c
parent7e3e860031282d439e4f2da5477a6c96392ea09d (diff)
downloadwayland-3c38fa0c3e55893911f85edeb0a0eaa4460e59ca.tar.gz
wayland-3c38fa0c3e55893911f85edeb0a0eaa4460e59ca.tar.xz
wayland-3c38fa0c3e55893911f85edeb0a0eaa4460e59ca.zip
Include the currently pressed keys in keyboard focus event.
Diffstat (limited to 'wayland-system-compositor.c')
-rw-r--r--wayland-system-compositor.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/wayland-system-compositor.c b/wayland-system-compositor.c
index d0674ec..5524dbb 100644
--- a/wayland-system-compositor.c
+++ b/wayland-system-compositor.c
@@ -88,6 +88,7 @@ struct wlsc_input_device {
struct wlsc_surface *grab_surface;
struct wlsc_surface *pointer_focus;
struct wlsc_surface *keyboard_focus;
+ struct wl_array keys;
};
struct wlsc_compositor {
@@ -870,14 +871,13 @@ wlsc_input_device_set_keyboard_focus(struct wlsc_input_device *device,
(!surface || device->keyboard_focus->base.client != surface->base.client))
wl_surface_post_event(&device->keyboard_focus->base,
&device->base,
- WL_INPUT_KEYBOARD_FOCUS, NULL);
+ WL_INPUT_KEYBOARD_FOCUS, NULL, NULL);
- /* FIXME: We need to send the currently held down keys in the
- * keyboard focus event. */
if (surface)
wl_surface_post_event(&surface->base,
&device->base,
- WL_INPUT_KEYBOARD_FOCUS, &surface->base);
+ WL_INPUT_KEYBOARD_FOCUS,
+ &surface->base, &device->keys);
device->keyboard_focus = surface;
}
@@ -1051,6 +1051,10 @@ notify_key(struct wlsc_input_device *device,
uint32_t key, uint32_t state)
{
struct wlsc_compositor *ec = device->ec;
+ uint32_t *k, *end;
+
+ if (!ec->vt_active)
+ return;
switch (key | ec->meta_state) {
case KEY_EJECTCD | META_DOWN:
@@ -1083,8 +1087,16 @@ notify_key(struct wlsc_input_device *device,
return;
}
- if (!ec->vt_active)
- return;
+ end = device->keys.data + device->keys.size;
+ for (k = device->keys.data; k < end; k++) {
+ if (*k == key)
+ *k = *--end;
+ }
+ device->keys.size = (void *) end - device->keys.data;
+ if (state) {
+ k = wl_array_add(&device->keys, sizeof *k);
+ *k = key;
+ }
if (device->keyboard_focus != NULL)
wl_surface_post_event(&device->keyboard_focus->base,