libweston: Introduce input-timestamps support

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@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Alexandros Frantzis 7 years ago committed by Pekka Paalanen
parent c3b5d78c1d
commit 538749de7b
  1. 4
      Makefile.am
  2. 67
      libweston/input.c

@ -166,7 +166,9 @@ nodist_libweston_@LIBWESTON_MAJOR@_la_SOURCES = \
protocol/relative-pointer-unstable-v1-protocol.c \ protocol/relative-pointer-unstable-v1-protocol.c \
protocol/relative-pointer-unstable-v1-server-protocol.h \ protocol/relative-pointer-unstable-v1-server-protocol.h \
protocol/pointer-constraints-unstable-v1-protocol.c \ 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_@LIBWESTON_MAJOR@_la_SOURCES) BUILT_SOURCES += $(nodist_libweston_@LIBWESTON_MAJOR@_la_SOURCES)

@ -42,6 +42,7 @@
#include "compositor.h" #include "compositor.h"
#include "relative-pointer-unstable-v1-server-protocol.h" #include "relative-pointer-unstable-v1-server-protocol.h"
#include "pointer-constraints-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 { enum pointer_constraint_type {
POINTER_CONSTRAINT_TYPE_LOCK, POINTER_CONSTRAINT_TYPE_LOCK,
@ -4569,6 +4570,67 @@ bind_pointer_constraints(struct wl_client *client, void *data,
NULL, NULL); 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 int
weston_input_init(struct weston_compositor *compositor) weston_input_init(struct weston_compositor *compositor)
{ {
@ -4582,5 +4644,10 @@ weston_input_init(struct weston_compositor *compositor)
NULL, bind_pointer_constraints)) NULL, bind_pointer_constraints))
return -1; 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; return 0;
} }

Loading…
Cancel
Save