summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-06-05 09:56:42 -0400
committerKristian Høgsberg <krh@bitplanet.net>2012-06-05 09:56:42 -0400
commitaa792ad3d657853a24faa5a6d5ae09830490087f (patch)
treee3b64242b1bb65f29b383c1f288eb9eb765162e6
parent3fd1e128e95770526d2c247aef9544a6abdb7848 (diff)
Add a focus change signal for wl_pointer and wl_keyboard
-rw-r--r--src/wayland-server.c4
-rw-r--r--src/wayland-server.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/wayland-server.c b/src/wayland-server.c
index ec0d0e8..ed9f001 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -565,6 +565,7 @@ wl_pointer_init(struct wl_pointer *pointer)
pointer->default_grab.interface = &default_pointer_grab_interface;
pointer->default_grab.pointer = pointer;
pointer->grab = &pointer->default_grab;
+ wl_signal_init(&pointer->focus_signal);
/* FIXME: Pick better co-ords. */
pointer->x = wl_fixed_from_int(100);
@@ -589,6 +590,7 @@ wl_keyboard_init(struct wl_keyboard *keyboard)
keyboard->default_grab.interface = &default_keyboard_grab_interface;
keyboard->default_grab.keyboard = keyboard;
keyboard->grab = &keyboard->default_grab;
+ wl_signal_init(&keyboard->focus_signal);
}
WL_EXPORT void
@@ -747,6 +749,7 @@ wl_pointer_set_focus(struct wl_pointer *pointer, struct wl_surface *surface,
pointer->focus_resource = resource;
pointer->focus = surface;
pointer->default_grab.focus = surface;
+ wl_signal_emit(&pointer->focus_signal, pointer);
}
WL_EXPORT void
@@ -778,6 +781,7 @@ wl_keyboard_set_focus(struct wl_keyboard *keyboard, struct wl_surface *surface)
keyboard->focus_resource = resource;
keyboard->focus = surface;
+ wl_signal_emit(&keyboard->focus_signal, keyboard);
}
WL_EXPORT void
diff --git a/src/wayland-server.h b/src/wayland-server.h
index fc38cd1..a447c6d 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -247,6 +247,7 @@ struct wl_pointer {
struct wl_resource *focus_resource;
struct wl_listener focus_listener;
uint32_t focus_serial;
+ struct wl_signal focus_signal;
struct wl_pointer_grab *grab;
struct wl_pointer_grab default_grab;
@@ -270,6 +271,7 @@ struct wl_keyboard {
struct wl_resource *focus_resource;
struct wl_listener focus_listener;
uint32_t focus_serial;
+ struct wl_signal focus_signal;
struct wl_keyboard_grab *grab;
struct wl_keyboard_grab default_grab;