[PATCH weston v2 3/6] libweston: Introduce input-timestamps support

Alexandros Frantzis alexandros.frantzis at collabora.com
Fri Feb 16 16:44:16 UTC 2018


Introduce code to support the implementation of the
input_timestamps_unstable_v1 protocol in libweston. This commit does not
implement the actual timestamp subscriptions, but sets up the
zwp_input_timestamps_manager_v1 object and introduces dummy request
handling functions for it, laying the foundation for timestamp
subscriptions for keyboard/pointer/touch to be added cleanly in upcoming
commits.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis at collabora.com>
---
Changes in v2:
 - Move unused helper functions to next patch to avoid warnings, keep
   only zwp_input_timestamps_manager_v1 code in this patch.

 Makefile.am       |  4 +++-
 libweston/input.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 679e6b78..e028a2a1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -166,7 +166,9 @@ nodist_libweston_ at LIBWESTON_MAJOR@_la_SOURCES =				\
 	protocol/relative-pointer-unstable-v1-protocol.c		\
 	protocol/relative-pointer-unstable-v1-server-protocol.h		\
 	protocol/pointer-constraints-unstable-v1-protocol.c		\
-	protocol/pointer-constraints-unstable-v1-server-protocol.h
+	protocol/pointer-constraints-unstable-v1-server-protocol.h      \
+	protocol/input-timestamps-unstable-v1-protocol.c		\
+	protocol/input-timestamps-unstable-v1-server-protocol.h
 
 BUILT_SOURCES += $(nodist_libweston_ at LIBWESTON_MAJOR@_la_SOURCES)
 
diff --git a/libweston/input.c b/libweston/input.c
index da002548..2e8bd088 100644
--- a/libweston/input.c
+++ b/libweston/input.c
@@ -42,6 +42,7 @@
 #include "compositor.h"
 #include "relative-pointer-unstable-v1-server-protocol.h"
 #include "pointer-constraints-unstable-v1-server-protocol.h"
+#include "input-timestamps-unstable-v1-server-protocol.h"
 
 enum pointer_constraint_type {
 	POINTER_CONSTRAINT_TYPE_LOCK,
@@ -4569,6 +4570,67 @@ bind_pointer_constraints(struct wl_client *client, void *data,
 				       NULL, NULL);
 }
 
+static void
+input_timestamps_manager_destroy(struct wl_client *client,
+				 struct wl_resource *resource)
+{
+	wl_resource_destroy(resource);
+}
+
+static void
+input_timestamps_manager_get_keyboard_timestamps(struct wl_client *client,
+						 struct wl_resource *resource,
+						 uint32_t id,
+						 struct wl_resource *keyboard_resource)
+{
+	wl_client_post_no_memory(client);
+}
+
+static void
+input_timestamps_manager_get_pointer_timestamps(struct wl_client *client,
+						struct wl_resource *resource,
+						uint32_t id,
+						struct wl_resource *pointer_resource)
+{
+	wl_client_post_no_memory(client);
+}
+
+static void
+input_timestamps_manager_get_touch_timestamps(struct wl_client *client,
+					      struct wl_resource *resource,
+					      uint32_t id,
+					      struct wl_resource *touch_resource)
+{
+	wl_client_post_no_memory(client);
+}
+
+static const struct zwp_input_timestamps_manager_v1_interface
+				input_timestamps_manager_interface = {
+	input_timestamps_manager_destroy,
+	input_timestamps_manager_get_keyboard_timestamps,
+	input_timestamps_manager_get_pointer_timestamps,
+	input_timestamps_manager_get_touch_timestamps,
+};
+
+static void
+bind_input_timestamps_manager(struct wl_client *client, void *data,
+			      uint32_t version, uint32_t id)
+{
+	struct wl_resource *resource =
+		wl_resource_create(client,
+				   &zwp_input_timestamps_manager_v1_interface,
+				   1, id);
+
+	if (resource == NULL) {
+		wl_client_post_no_memory(client);
+		return;
+	}
+
+	wl_resource_set_implementation(resource,
+				       &input_timestamps_manager_interface,
+				       NULL, NULL);
+}
+
 int
 weston_input_init(struct weston_compositor *compositor)
 {
@@ -4582,5 +4644,10 @@ weston_input_init(struct weston_compositor *compositor)
 			      NULL, bind_pointer_constraints))
 		return -1;
 
+	if (!wl_global_create(compositor->wl_display,
+			      &zwp_input_timestamps_manager_v1_interface, 1,
+			      NULL, bind_input_timestamps_manager))
+		return -1;
+
 	return 0;
 }
-- 
2.14.1



More information about the wayland-devel mailing list