summaryrefslogtreecommitdiff
path: root/compositor
diff options
context:
space:
mode:
authorAlexandros Frantzis <alexandros.frantzis@collabora.com>2017-11-16 18:20:57 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2017-11-27 11:42:07 +0200
commit47e79c860b3bd90de757230ff7db4822d95b9113 (patch)
treeae8f20b42c0e0f888ba36ddda8ced46e53463440 /compositor
parent80321942e769f89e76f5372d4283aaad8fb4bd9e (diff)
libweston: Use struct timespec for key events
Change code related to key events to use struct timespec to represent time. This commit is part of a larger effort to transition the Weston codebase to struct timespec. Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'compositor')
-rw-r--r--compositor/screen-share.c8
-rw-r--r--compositor/text-backend.c13
-rw-r--r--compositor/weston-screenshooter.c6
3 files changed, 18 insertions, 9 deletions
diff --git a/compositor/screen-share.c b/compositor/screen-share.c
index 8b2decfd..33de2b1f 100644
--- a/compositor/screen-share.c
+++ b/compositor/screen-share.c
@@ -277,9 +277,11 @@ ss_seat_handle_key(void *data, struct wl_keyboard *keyboard,
uint32_t key, uint32_t state)
{
struct ss_seat *seat = data;
+ struct timespec ts;
+ timespec_from_msec(&ts, time);
seat->key_serial = serial;
- notify_key(&seat->base, time, key,
+ notify_key(&seat->base, &ts, key,
state ? WL_KEYBOARD_KEY_STATE_PRESSED :
WL_KEYBOARD_KEY_STATE_RELEASED,
seat->keyboard_state_update);
@@ -1092,8 +1094,8 @@ weston_output_find(struct weston_compositor *c, int32_t x, int32_t y)
}
static void
-share_output_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key,
- void *data)
+share_output_binding(struct weston_keyboard *keyboard,
+ const struct timespec *time, uint32_t key, void *data)
{
struct weston_output *output;
struct weston_pointer *pointer;
diff --git a/compositor/text-backend.c b/compositor/text-backend.c
index bf5c45cc..5f6b5d80 100644
--- a/compositor/text-backend.c
+++ b/compositor/text-backend.c
@@ -38,6 +38,7 @@
#include "text-input-unstable-v1-server-protocol.h"
#include "input-method-unstable-v1-server-protocol.h"
#include "shared/helpers.h"
+#include "shared/timespec-util.h"
struct text_input_manager;
struct input_method;
@@ -607,11 +608,13 @@ unbind_keyboard(struct wl_resource *resource)
static void
input_method_context_grab_key(struct weston_keyboard_grab *grab,
- uint32_t time, uint32_t key, uint32_t state_w)
+ const struct timespec *time, uint32_t key,
+ uint32_t state_w)
{
struct weston_keyboard *keyboard = grab->keyboard;
struct wl_display *display;
uint32_t serial;
+ uint32_t msecs;
if (!keyboard->input_method_resource)
return;
@@ -619,8 +622,9 @@ input_method_context_grab_key(struct weston_keyboard_grab *grab,
display = wl_client_get_display(
wl_resource_get_client(keyboard->input_method_resource));
serial = wl_display_next_serial(display);
+ msecs = timespec_to_msec(time);
wl_keyboard_send_key(keyboard->input_method_resource,
- serial, time, key, state_w);
+ serial, msecs, key, state_w);
}
static void
@@ -693,8 +697,11 @@ input_method_context_key(struct wl_client *client,
struct weston_seat *seat = context->input_method->seat;
struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat);
struct weston_keyboard_grab *default_grab = &keyboard->default_grab;
+ struct timespec ts;
- default_grab->interface->key(default_grab, time, key, state_w);
+ timespec_from_msec(&ts, time);
+
+ default_grab->interface->key(default_grab, &ts, key, state_w);
}
static void
diff --git a/compositor/weston-screenshooter.c b/compositor/weston-screenshooter.c
index f874c3eb..f0bc0e1e 100644
--- a/compositor/weston-screenshooter.c
+++ b/compositor/weston-screenshooter.c
@@ -112,8 +112,8 @@ screenshooter_sigchld(struct weston_process *process, int status)
}
static void
-screenshooter_binding(struct weston_keyboard *keyboard, uint32_t time,
- uint32_t key, void *data)
+screenshooter_binding(struct weston_keyboard *keyboard,
+ const struct timespec *time, uint32_t key, void *data)
{
struct screenshooter *shooter = data;
char *screenshooter_exe;
@@ -135,7 +135,7 @@ screenshooter_binding(struct weston_keyboard *keyboard, uint32_t time,
}
static void
-recorder_binding(struct weston_keyboard *keyboard, uint32_t time,
+recorder_binding(struct weston_keyboard *keyboard, const struct timespec *time,
uint32_t key, void *data)
{
struct weston_compositor *ec = keyboard->seat->compositor;