[PATCH] Add key grab to wl_grab_interface.

Scott Moreau oreaus at gmail.com
Thu Feb 2 10:47:27 PST 2012


---
 src/wayland-server.c |   16 +++++++++++++++-
 src/wayland-server.h |    2 ++
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/wayland-server.c b/src/wayland-server.c
index 70adf28..d932907 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -458,10 +458,24 @@ default_grab_button(struct wl_grab *grab,
 						  device->current_y);
 }
 
+static void
+default_grab_key(struct wl_grab *grab,
+		    uint32_t time, int32_t key, int32_t state)
+{
+	struct wl_input_device *device = grab->input_device;
+	struct wl_resource *resource;
+
+	resource = device->keyboard_focus_resource;
+	if (resource)
+		wl_resource_post_event(resource, WL_INPUT_DEVICE_KEY,
+				       time, key, state);
+}
+
 static const struct wl_grab_interface default_grab_interface = {
 	default_grab_focus,
 	default_grab_motion,
-	default_grab_button
+	default_grab_button,
+	default_grab_key
 };
 
 WL_EXPORT void
diff --git a/src/wayland-server.h b/src/wayland-server.h
index 53f918c..cf5ec92 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -153,6 +153,8 @@ struct wl_grab_interface {
 		       uint32_t time, int32_t x, int32_t y);
 	void (*button)(struct wl_grab *grab,
 		       uint32_t time, int32_t button, int32_t state);
+	void (*key)(struct wl_grab *grab,
+		       uint32_t time, int32_t key, int32_t state);
 };
 
 struct wl_grab {
-- 
1.7.4.1



More information about the wayland-devel mailing list