summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2008-12-10 13:25:00 -0500
committerKristian Høgsberg <krh@redhat.com>2008-12-10 13:25:00 -0500
commit7fdff04cdc92f9db58f11c19e93af7e8ef68f62c (patch)
treeafdf28460b4ad7520342a102a722f7f22fa53298
parent5a75c90d0153eb8f57993d17a3a0884ed8eb6907 (diff)
downloadwayland-7fdff04cdc92f9db58f11c19e93af7e8ef68f62c.tar.gz
wayland-7fdff04cdc92f9db58f11c19e93af7e8ef68f62c.tar.xz
wayland-7fdff04cdc92f9db58f11c19e93af7e8ef68f62c.zip
Only send key events to toplevel surface.
-rw-r--r--egl-compositor.c10
-rw-r--r--wayland.c23
2 files changed, 10 insertions, 23 deletions
diff --git a/egl-compositor.c b/egl-compositor.c
index 917364f..069d675 100644
--- a/egl-compositor.c
+++ b/egl-compositor.c
@@ -798,6 +798,7 @@ notify_key(struct wl_compositor *compositor,
struct wl_object *source, uint32_t key, uint32_t state)
{
struct egl_compositor *ec = (struct egl_compositor *) compositor;
+ struct egl_surface *es;
if (key == KEY_ESC && state == 1) {
if (ec->overlay_target == ec->height)
@@ -805,6 +806,15 @@ notify_key(struct wl_compositor *compositor,
else
ec->overlay_target += 200;
schedule_repaint(ec);
+ } else if (!wl_list_empty(&ec->surface_list)) {
+ /* FIXME: The event source device should track which
+ * surface has its key focus and send the event there.
+ * For now, just send it to the top surface, which
+ * effectively gives us click to focus behavior. */
+ es = container_of(ec->surface_list.prev,
+ struct egl_surface, link);
+ wl_surface_post_event(es->wl_surface, source,
+ WL_INPUT_KEY, key, state);
}
}
diff --git a/wayland.c b/wayland.c
index 8f03d10..4f41ebd 100644
--- a/wayland.c
+++ b/wayland.c
@@ -621,21 +621,6 @@ wl_display_add_global(struct wl_display *display, struct wl_object *object)
return 0;
}
-static void
-wl_display_send_event(struct wl_display *display, uint32_t *data, size_t size)
-{
- struct wl_client *client;
-
- client = container_of(display->client_list.next,
- struct wl_client, link);
- while (&client->link != &display->client_list) {
- wl_connection_write(client->connection, data, size);
-
- client = container_of(client->link.next,
- struct wl_client, link);
- }
-}
-
WL_EXPORT void
wl_surface_post_event(struct wl_surface *surface,
struct wl_object *sender,
@@ -692,17 +677,9 @@ wl_display_post_key_event(struct wl_display *display,
struct wl_object *source, int key, int state)
{
const struct wl_compositor_interface *interface;
- uint32_t p[4];
interface = display->compositor->interface;
interface->notify_key(display->compositor, source, key, state);
-
- p[0] = source->id;
- p[1] = (sizeof p << 16) | WL_INPUT_KEY;
- p[2] = key;
- p[3] = state;
-
- wl_display_send_event(display, p, sizeof p);
}
WL_EXPORT void