Commit 47e79c86 authored by Alexandros Frantzis's avatar Alexandros Frantzis Committed by Pekka Paalanen

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's avatarAlexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
parent 80321942
...@@ -277,9 +277,11 @@ ss_seat_handle_key(void *data, struct wl_keyboard *keyboard, ...@@ -277,9 +277,11 @@ ss_seat_handle_key(void *data, struct wl_keyboard *keyboard,
uint32_t key, uint32_t state) uint32_t key, uint32_t state)
{ {
struct ss_seat *seat = data; struct ss_seat *seat = data;
struct timespec ts;
timespec_from_msec(&ts, time);
seat->key_serial = serial; seat->key_serial = serial;
notify_key(&seat->base, time, key, notify_key(&seat->base, &ts, key,
state ? WL_KEYBOARD_KEY_STATE_PRESSED : state ? WL_KEYBOARD_KEY_STATE_PRESSED :
WL_KEYBOARD_KEY_STATE_RELEASED, WL_KEYBOARD_KEY_STATE_RELEASED,
seat->keyboard_state_update); seat->keyboard_state_update);
...@@ -1092,8 +1094,8 @@ weston_output_find(struct weston_compositor *c, int32_t x, int32_t y) ...@@ -1092,8 +1094,8 @@ weston_output_find(struct weston_compositor *c, int32_t x, int32_t y)
} }
static void static void
share_output_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key, share_output_binding(struct weston_keyboard *keyboard,
void *data) const struct timespec *time, uint32_t key, void *data)
{ {
struct weston_output *output; struct weston_output *output;
struct weston_pointer *pointer; struct weston_pointer *pointer;
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "text-input-unstable-v1-server-protocol.h" #include "text-input-unstable-v1-server-protocol.h"
#include "input-method-unstable-v1-server-protocol.h" #include "input-method-unstable-v1-server-protocol.h"
#include "shared/helpers.h" #include "shared/helpers.h"
#include "shared/timespec-util.h"
struct text_input_manager; struct text_input_manager;
struct input_method; struct input_method;
...@@ -607,11 +608,13 @@ unbind_keyboard(struct wl_resource *resource) ...@@ -607,11 +608,13 @@ unbind_keyboard(struct wl_resource *resource)
static void static void
input_method_context_grab_key(struct weston_keyboard_grab *grab, 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 weston_keyboard *keyboard = grab->keyboard;
struct wl_display *display; struct wl_display *display;
uint32_t serial; uint32_t serial;
uint32_t msecs;
if (!keyboard->input_method_resource) if (!keyboard->input_method_resource)
return; return;
...@@ -619,8 +622,9 @@ input_method_context_grab_key(struct weston_keyboard_grab *grab, ...@@ -619,8 +622,9 @@ input_method_context_grab_key(struct weston_keyboard_grab *grab,
display = wl_client_get_display( display = wl_client_get_display(
wl_resource_get_client(keyboard->input_method_resource)); wl_resource_get_client(keyboard->input_method_resource));
serial = wl_display_next_serial(display); serial = wl_display_next_serial(display);
msecs = timespec_to_msec(time);
wl_keyboard_send_key(keyboard->input_method_resource, wl_keyboard_send_key(keyboard->input_method_resource,
serial, time, key, state_w); serial, msecs, key, state_w);
} }
static void static void
...@@ -693,8 +697,11 @@ input_method_context_key(struct wl_client *client, ...@@ -693,8 +697,11 @@ input_method_context_key(struct wl_client *client,
struct weston_seat *seat = context->input_method->seat; struct weston_seat *seat = context->input_method->seat;
struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat); struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat);
struct weston_keyboard_grab *default_grab = &keyboard->default_grab; 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 static void
......
...@@ -112,8 +112,8 @@ screenshooter_sigchld(struct weston_process *process, int status) ...@@ -112,8 +112,8 @@ screenshooter_sigchld(struct weston_process *process, int status)
} }
static void static void
screenshooter_binding(struct weston_keyboard *keyboard, uint32_t time, screenshooter_binding(struct weston_keyboard *keyboard,
uint32_t key, void *data) const struct timespec *time, uint32_t key, void *data)
{ {
struct screenshooter *shooter = data; struct screenshooter *shooter = data;
char *screenshooter_exe; char *screenshooter_exe;
...@@ -135,7 +135,7 @@ screenshooter_binding(struct weston_keyboard *keyboard, uint32_t time, ...@@ -135,7 +135,7 @@ screenshooter_binding(struct weston_keyboard *keyboard, uint32_t time,
} }
static void 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) uint32_t key, void *data)
{ {
struct weston_compositor *ec = keyboard->seat->compositor; struct weston_compositor *ec = keyboard->seat->compositor;
......
...@@ -442,8 +442,8 @@ exposay_maybe_move(struct desktop_shell *shell, int row, int column) ...@@ -442,8 +442,8 @@ exposay_maybe_move(struct desktop_shell *shell, int row, int column)
} }
static void static void
exposay_key(struct weston_keyboard_grab *grab, uint32_t time, uint32_t key, exposay_key(struct weston_keyboard_grab *grab, const struct timespec *time,
uint32_t state_w) uint32_t key, uint32_t state_w)
{ {
struct weston_seat *seat = grab->keyboard->seat; struct weston_seat *seat = grab->keyboard->seat;
struct desktop_shell *shell = struct desktop_shell *shell =
......
...@@ -3232,7 +3232,7 @@ move_binding(struct weston_pointer *pointer, const struct timespec *time, ...@@ -3232,7 +3232,7 @@ move_binding(struct weston_pointer *pointer, const struct timespec *time,
} }
static void static void
maximize_binding(struct weston_keyboard *keyboard, uint32_t time, maximize_binding(struct weston_keyboard *keyboard, const struct timespec *time,
uint32_t button, void *data) uint32_t button, void *data)
{ {
struct weston_surface *focus = keyboard->focus; struct weston_surface *focus = keyboard->focus;
...@@ -3251,8 +3251,8 @@ maximize_binding(struct weston_keyboard *keyboard, uint32_t time, ...@@ -3251,8 +3251,8 @@ maximize_binding(struct weston_keyboard *keyboard, uint32_t time,
} }
static void static void
fullscreen_binding(struct weston_keyboard *keyboard, uint32_t time, fullscreen_binding(struct weston_keyboard *keyboard,
uint32_t button, void *data) const struct timespec *time, uint32_t button, void *data)
{ {
struct weston_surface *focus = keyboard->focus; struct weston_surface *focus = keyboard->focus;
struct weston_surface *surface; struct weston_surface *surface;
...@@ -3434,18 +3434,14 @@ zoom_axis_binding(struct weston_pointer *pointer, const struct timespec *time, ...@@ -3434,18 +3434,14 @@ zoom_axis_binding(struct weston_pointer *pointer, const struct timespec *time,
} }
static void static void
zoom_key_binding(struct weston_keyboard *keyboard, uint32_t time, zoom_key_binding(struct weston_keyboard *keyboard, const struct timespec *time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct timespec ts; do_zoom(keyboard->seat, time, key, 0, 0);
timespec_from_msec(&ts, time);
do_zoom(keyboard->seat, &ts, key, 0, 0);
} }
static void static void
terminate_binding(struct weston_keyboard *keyboard, uint32_t time, terminate_binding(struct weston_keyboard *keyboard, const struct timespec *time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;
...@@ -4421,7 +4417,7 @@ switcher_destroy(struct switcher *switcher) ...@@ -4421,7 +4417,7 @@ switcher_destroy(struct switcher *switcher)
static void static void
switcher_key(struct weston_keyboard_grab *grab, switcher_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 switcher *switcher = container_of(grab, struct switcher, grab); struct switcher *switcher = container_of(grab, struct switcher, grab);
enum wl_keyboard_key_state state = state_w; enum wl_keyboard_key_state state = state_w;
...@@ -4457,7 +4453,7 @@ static const struct weston_keyboard_grab_interface switcher_grab = { ...@@ -4457,7 +4453,7 @@ static const struct weston_keyboard_grab_interface switcher_grab = {
}; };
static void static void
switcher_binding(struct weston_keyboard *keyboard, uint32_t time, switcher_binding(struct weston_keyboard *keyboard, const struct timespec *time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
...@@ -4478,7 +4474,7 @@ switcher_binding(struct weston_keyboard *keyboard, uint32_t time, ...@@ -4478,7 +4474,7 @@ switcher_binding(struct weston_keyboard *keyboard, uint32_t time,
} }
static void static void
backlight_binding(struct weston_keyboard *keyboard, uint32_t time, backlight_binding(struct weston_keyboard *keyboard, const struct timespec *time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;
...@@ -4511,8 +4507,8 @@ backlight_binding(struct weston_keyboard *keyboard, uint32_t time, ...@@ -4511,8 +4507,8 @@ backlight_binding(struct weston_keyboard *keyboard, uint32_t time,
} }
static void static void
force_kill_binding(struct weston_keyboard *keyboard, uint32_t time, force_kill_binding(struct weston_keyboard *keyboard,
uint32_t key, void *data) const struct timespec *time, uint32_t key, void *data)
{ {
struct weston_surface *focus_surface; struct weston_surface *focus_surface;
struct wl_client *client; struct wl_client *client;
...@@ -4538,8 +4534,8 @@ force_kill_binding(struct weston_keyboard *keyboard, uint32_t time, ...@@ -4538,8 +4534,8 @@ force_kill_binding(struct weston_keyboard *keyboard, uint32_t time,
} }
static void static void
workspace_up_binding(struct weston_keyboard *keyboard, uint32_t time, workspace_up_binding(struct weston_keyboard *keyboard,
uint32_t key, void *data) const struct timespec *time, uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
unsigned int new_index = shell->workspaces.current; unsigned int new_index = shell->workspaces.current;
...@@ -4553,8 +4549,8 @@ workspace_up_binding(struct weston_keyboard *keyboard, uint32_t time, ...@@ -4553,8 +4549,8 @@ workspace_up_binding(struct weston_keyboard *keyboard, uint32_t time,
} }
static void static void
workspace_down_binding(struct weston_keyboard *keyboard, uint32_t time, workspace_down_binding(struct weston_keyboard *keyboard,
uint32_t key, void *data) const struct timespec *time, uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
unsigned int new_index = shell->workspaces.current; unsigned int new_index = shell->workspaces.current;
...@@ -4568,8 +4564,8 @@ workspace_down_binding(struct weston_keyboard *keyboard, uint32_t time, ...@@ -4568,8 +4564,8 @@ workspace_down_binding(struct weston_keyboard *keyboard, uint32_t time,
} }
static void static void
workspace_f_binding(struct weston_keyboard *keyboard, uint32_t time, workspace_f_binding(struct weston_keyboard *keyboard,
uint32_t key, void *data) const struct timespec *time, uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
unsigned int new_index; unsigned int new_index;
...@@ -4585,7 +4581,8 @@ workspace_f_binding(struct weston_keyboard *keyboard, uint32_t time, ...@@ -4585,7 +4581,8 @@ workspace_f_binding(struct weston_keyboard *keyboard, uint32_t time,
static void static void
workspace_move_surface_up_binding(struct weston_keyboard *keyboard, workspace_move_surface_up_binding(struct weston_keyboard *keyboard,
uint32_t time, uint32_t key, void *data) const struct timespec *time, uint32_t key,
void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
unsigned int new_index = shell->workspaces.current; unsigned int new_index = shell->workspaces.current;
...@@ -4601,7 +4598,8 @@ workspace_move_surface_up_binding(struct weston_keyboard *keyboard, ...@@ -4601,7 +4598,8 @@ workspace_move_surface_up_binding(struct weston_keyboard *keyboard,
static void static void
workspace_move_surface_down_binding(struct weston_keyboard *keyboard, workspace_move_surface_down_binding(struct weston_keyboard *keyboard,
uint32_t time, uint32_t key, void *data) const struct timespec *time, uint32_t key,
void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
unsigned int new_index = shell->workspaces.current; unsigned int new_index = shell->workspaces.current;
......
...@@ -376,7 +376,7 @@ shell_destroy(struct wl_listener *listener, void *data) ...@@ -376,7 +376,7 @@ shell_destroy(struct wl_listener *listener, void *data)
} }
static void static void
terminate_binding(struct weston_keyboard *keyboard, uint32_t time, terminate_binding(struct weston_keyboard *keyboard, const struct timespec *time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;
......
...@@ -54,7 +54,8 @@ static void weston_desktop_seat_popup_grab_end(struct weston_desktop_seat *seat) ...@@ -54,7 +54,8 @@ static void weston_desktop_seat_popup_grab_end(struct weston_desktop_seat *seat)
static void static void
weston_desktop_seat_popup_grab_keyboard_key(struct weston_keyboard_grab *grab, weston_desktop_seat_popup_grab_keyboard_key(struct weston_keyboard_grab *grab,
uint32_t time, uint32_t key, const struct timespec *time,
uint32_t key,
enum wl_keyboard_key_state state) enum wl_keyboard_key_state state)
{ {
weston_keyboard_send_key(grab->keyboard, time, key, state); weston_keyboard_send_key(grab->keyboard, time, key, state);
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "compositor.h" #include "compositor.h"
#include "shared/helpers.h" #include "shared/helpers.h"
#include "shared/timespec-util.h"
struct weston_binding { struct weston_binding {
uint32_t key; uint32_t key;
...@@ -192,7 +193,7 @@ struct binding_keyboard_grab { ...@@ -192,7 +193,7 @@ struct binding_keyboard_grab {
static void static void
binding_key(struct weston_keyboard_grab *grab, binding_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 binding_keyboard_grab *b = struct binding_keyboard_grab *b =
container_of(grab, struct binding_keyboard_grab, grab); container_of(grab, struct binding_keyboard_grab, grab);
...@@ -201,6 +202,7 @@ binding_key(struct weston_keyboard_grab *grab, ...@@ -201,6 +202,7 @@ binding_key(struct weston_keyboard_grab *grab,
uint32_t serial; uint32_t serial;
struct weston_keyboard *keyboard = grab->keyboard; struct weston_keyboard *keyboard = grab->keyboard;
struct wl_display *display = keyboard->seat->compositor->wl_display; struct wl_display *display = keyboard->seat->compositor->wl_display;
uint32_t msecs;
if (key == b->key) { if (key == b->key) {
if (state == WL_KEYBOARD_KEY_STATE_RELEASED) { if (state == WL_KEYBOARD_KEY_STATE_RELEASED) {
...@@ -215,10 +217,11 @@ binding_key(struct weston_keyboard_grab *grab, ...@@ -215,10 +217,11 @@ binding_key(struct weston_keyboard_grab *grab,
} }
if (!wl_list_empty(&keyboard->focus_resource_list)) { if (!wl_list_empty(&keyboard->focus_resource_list)) {
serial = wl_display_next_serial(display); serial = wl_display_next_serial(display);
msecs = timespec_to_msec(time);
wl_resource_for_each(resource, &keyboard->focus_resource_list) { wl_resource_for_each(resource, &keyboard->focus_resource_list) {
wl_keyboard_send_key(resource, wl_keyboard_send_key(resource,
serial, serial,
time, msecs,
key, key,
state); state);
} }
...@@ -255,8 +258,9 @@ static const struct weston_keyboard_grab_interface binding_grab = { ...@@ -255,8 +258,9 @@ static const struct weston_keyboard_grab_interface binding_grab = {
}; };
static void static void
install_binding_grab(struct weston_keyboard *keyboard, uint32_t time, install_binding_grab(struct weston_keyboard *keyboard,
uint32_t key, struct weston_surface *focus) const struct timespec *time, uint32_t key,
struct weston_surface *focus)
{ {
struct binding_keyboard_grab *grab; struct binding_keyboard_grab *grab;
...@@ -282,7 +286,7 @@ install_binding_grab(struct weston_keyboard *keyboard, uint32_t time, ...@@ -282,7 +286,7 @@ install_binding_grab(struct weston_keyboard *keyboard, uint32_t time,
void void
weston_compositor_run_key_binding(struct weston_compositor *compositor, weston_compositor_run_key_binding(struct weston_compositor *compositor,
struct weston_keyboard *keyboard, struct weston_keyboard *keyboard,
uint32_t time, uint32_t key, const struct timespec *time, uint32_t key,
enum wl_keyboard_key_state state) enum wl_keyboard_key_state state)
{ {
struct weston_binding *b, *tmp; struct weston_binding *b, *tmp;
...@@ -416,7 +420,7 @@ weston_compositor_run_axis_binding(struct weston_compositor *compositor, ...@@ -416,7 +420,7 @@ weston_compositor_run_axis_binding(struct weston_compositor *compositor,
int int
weston_compositor_run_debug_binding(struct weston_compositor *compositor, weston_compositor_run_debug_binding(struct weston_compositor *compositor,
struct weston_keyboard *keyboard, struct weston_keyboard *keyboard,
uint32_t time, uint32_t key, const struct timespec *time, uint32_t key,
enum wl_keyboard_key_state state) enum wl_keyboard_key_state state)
{ {
weston_key_binding_handler_t handler; weston_key_binding_handler_t handler;
...@@ -443,7 +447,7 @@ struct debug_binding_grab { ...@@ -443,7 +447,7 @@ struct debug_binding_grab {
}; };
static void static void
debug_binding_key(struct weston_keyboard_grab *grab, uint32_t time, debug_binding_key(struct weston_keyboard_grab *grab, const struct timespec *time,
uint32_t key, uint32_t state) uint32_t key, uint32_t state)
{ {
struct debug_binding_grab *db = (struct debug_binding_grab *) grab; struct debug_binding_grab *db = (struct debug_binding_grab *) grab;
...@@ -455,6 +459,7 @@ debug_binding_key(struct weston_keyboard_grab *grab, uint32_t time, ...@@ -455,6 +459,7 @@ debug_binding_key(struct weston_keyboard_grab *grab, uint32_t time,
int check_binding = 1; int check_binding = 1;
int i; int i;
struct wl_list *resource_list; struct wl_list *resource_list;
uint32_t msecs;
if (state == WL_KEYBOARD_KEY_STATE_RELEASED) { if (state == WL_KEYBOARD_KEY_STATE_RELEASED) {
/* Do not run bindings on key releases */ /* Do not run bindings on key releases */
...@@ -503,8 +508,9 @@ debug_binding_key(struct weston_keyboard_grab *grab, uint32_t time, ...@@ -503,8 +508,9 @@ debug_binding_key(struct weston_keyboard_grab *grab, uint32_t time,
if (send) { if (send) {
serial = wl_display_next_serial(display); serial = wl_display_next_serial(display);
resource_list = &grab->keyboard->focus_resource_list; resource_list = &grab->keyboard->focus_resource_list;
msecs = timespec_to_msec(time);
wl_resource_for_each(resource, resource_list) { wl_resource_for_each(resource, resource_list) {
wl_keyboard_send_key(resource, serial, time, key, state); wl_keyboard_send_key(resource, serial, msecs, key, state);
} }
} }
...@@ -548,7 +554,7 @@ struct weston_keyboard_grab_interface debug_binding_keyboard_grab = { ...@@ -548,7 +554,7 @@ struct weston_keyboard_grab_interface debug_binding_keyboard_grab = {
}; };
static void static void
debug_binding(struct weston_keyboard *keyboard, uint32_t time, debug_binding(struct weston_keyboard *keyboard, const struct timespec *time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct debug_binding_grab *grab; struct debug_binding_grab *grab;
......
...@@ -3804,8 +3804,8 @@ find_primary_gpu(struct drm_backend *b, const char *seat) ...@@ -3804,8 +3804,8 @@ find_primary_gpu(struct drm_backend *b, const char *seat)
} }
static void static void
planes_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key, planes_binding(struct weston_keyboard *keyboard, const struct timespec *time,
void *data) uint32_t key, void *data)
{ {
struct drm_backend *b = data; struct drm_backend *b = data;
...@@ -3885,8 +3885,8 @@ create_recorder(struct drm_backend *b, int width, int height, ...@@ -3885,8 +3885,8 @@ create_recorder(struct drm_backend *b, int width, int height,
} }
static void static void
recorder_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key, recorder_binding(struct weston_keyboard *keyboard, const struct timespec *time,
void *data) uint32_t key, void *data)
{ {
struct drm_backend *b = data; struct drm_backend *b = data;
struct drm_output *output; struct drm_output *output;
...@@ -3927,8 +3927,8 @@ recorder_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key, ...@@ -3927,8 +3927,8 @@ recorder_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key,
} }
#else #else
static void static void
recorder_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key, recorder_binding(struct weston_keyboard *keyboard, const struct timespec *time,
void *data) uint32_t key, void *data)
{ {
weston_log("Compiled without libva support\n"); weston_log("Compiled without libva support\n");
} }
...@@ -3979,8 +3979,8 @@ switch_to_gl_renderer(struct drm_backend *b) ...@@ -3979,8 +3979,8 @@ switch_to_gl_renderer(struct drm_backend *b)
} }
static void static void
renderer_switch_binding(struct weston_keyboard *keyboard, uint32_t time, renderer_switch_binding(struct weston_keyboard *keyboard,
uint32_t key, void *data) const struct timespec *time, uint32_t key, void *data)
{ {
struct drm_backend *b = struct drm_backend *b =
to_drm_backend(keyboard->seat->compositor); to_drm_backend(keyboard->seat->compositor);
......
...@@ -1135,6 +1135,7 @@ xf_input_keyboard_event(rdpInput *input, UINT16 flags, UINT16 code) ...@@ -1135,6 +1135,7 @@ xf_input_keyboard_event(rdpInput *input, UINT16 flags, UINT16 code)
enum wl_keyboard_key_state keyState; enum wl_keyboard_key_state keyState;
RdpPeerContext *peerContext = (RdpPeerContext *)input->context; RdpPeerContext *peerContext = (RdpPeerContext *)input->context;
int notify = 0; int notify = 0;
struct timespec time;
if (!(peerContext->item.flags & RDP_PEER_ACTIVATED)) if (!(peerContext->item.flags & RDP_PEER_ACTIVATED))
FREERDP_CB_RETURN(TRUE); FREERDP_CB_RETURN(TRUE);
...@@ -1160,7 +1161,8 @@ xf_input_keyboard_event(rdpInput *input, UINT16 flags, UINT16 code) ...@@ -1160,7 +1161,8 @@ xf_input_keyboard_event(rdpInput *input, UINT16 flags, UINT16 code)
/*weston_log("code=%x ext=%d vk_code=%x scan_code=%x\n", code, (flags & KBD_FLAGS_EXTENDED) ? 1 : 0, /*weston_log("code=%x ext=%d vk_code=%x scan_code=%x\n", code, (flags & KBD_FLAGS_EXTENDED) ? 1 : 0,
vk_code, scan_code);*/ vk_code, scan_code);*/
notify_key(peerContext->item.seat, weston_compositor_get_time(), timespec_from_msec(&time, weston_compositor_get_time());
notify_key(peerContext->item.seat, &time,
scan_code - 8, keyState, STATE_UPDATE_AUTOMATIC); scan_code - 8, keyState, STATE_UPDATE_AUTOMATIC);
} }
......
...@@ -1905,9 +1905,12 @@ input_handle_key(void *data, struct wl_keyboard *keyboard, ...@@ -1905,9 +1905,12 @@ input_handle_key(void *data, struct wl_keyboard *keyboard,
uint32_t serial, uint32_t time, uint32_t key, uint32_t state) uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
{ {
struct wayland_input *input = data; struct wayland_input *input = data;
struct timespec ts;
timespec_from_msec(&ts, time);
input->key_serial = serial; input->key_serial = serial;
notify_key(&input->base, time, key, notify_key(&input->base, &ts, key,
state ? WL_KEYBOARD_KEY_STATE_PRESSED : state ? WL_KEYBOARD_KEY_STATE_PRESSED :
WL_KEYBOARD_KEY_STATE_RELEASED, WL_KEYBOARD_KEY_STATE_RELEASED,
input->keyboard_state_update); input->keyboard_state_update);
...@@ -2515,8 +2518,8 @@ create_cursor(struct wayland_backend *b, ...@@ -2515,8 +2518,8 @@ create_cursor(struct wayland_backend *b,
} }
static void static void
fullscreen_binding(struct weston_keyboard *keyboard, uint32_t time, fullscreen_binding(struct weston_keyboard *keyboard,
uint32_t key, void *data) const struct timespec *time, uint32_t key, void *data)
{ {
struct wayland_backend *b = data; struct wayland_backend *b = data;
struct wayland_input *input = NULL; struct wayland_input *input = NULL;
......
...@@ -1325,6 +1325,7 @@ x11_backend_handle_event(int fd, uint32_t mask, void *data) ...@@ -1325,6 +1325,7 @@ x11_backend_handle_event(int fd, uint32_t mask, void *data)
uint32_t i, set; uint32_t i, set;
uint8_t response_type; uint8_t response_type;
int count; int count;
struct timespec time;
prev = NULL; prev = NULL;
count = 0; count = 0;
...@@ -1351,8 +1352,10 @@ x11_backend_handle_event(int fd, uint32_t mask, void *data) ...@@ -1351,8 +1352,10 @@ x11_backend_handle_event(int fd, uint32_t mask, void *data)
* and fall through and handle the new * and fall through and handle the new
* event below. */ * event below. */
update_xkb_state_from_core(b, key_release->state); update_xkb_state_from_core(b, key_release->state);
timespec_from_msec(&time,
weston_compositor_get_time());
notify_key(&b->core_seat, notify_key(&b->core_seat,
weston_compositor_get_time(), &time,
key_release->detail - 8, key_release->detail - 8,
WL_KEYBOARD_KEY_STATE_RELEASED, WL_KEYBOARD_KEY_STATE_RELEASED,
STATE_UPDATE_AUTOMATIC); STATE_UPDATE_AUTOMATIC);
...@@ -1395,8 +1398,9 @@ x11_backend_handle_event(int fd, uint32_t mask, void *data) ...@@ -1395,8 +1398,9 @@ x11_backend_handle_event(int fd, uint32_t mask, void *data)
key_press = (xcb_key_press_event_t *) event; key_press = (xcb_key_press_event_t *) event;
if (!b->has_xkb) if (!b->has_xkb)
update_xkb_state_from_core(b, key_press->state); update_xkb_state_from_core(b, key_press->state);
timespec_from_msec(&time, weston_compositor_get_time());
notify_key(&b->core_seat, notify_key(&b->core_seat,
weston_compositor_get_time(), &time,
key_press->detail - 8, key_press->detail - 8,
WL_KEYBOARD_KEY_STATE_PRESSED, WL_KEYBOARD_KEY_STATE_PRESSED,
b->has_xkb ? STATE_UPDATE_NONE : b->has_xkb ? STATE_UPDATE_NONE :
...@@ -1410,8 +1414,9 @@ x11_backend_handle_event(int fd, uint32_t mask, void *data) ...@@ -1410,8 +1414,9 @@ x11_backend_handle_event(int fd, uint32_t mask, void *data)
break; break;
} }
key_release = (xcb_key_press_event_t *) event; key_release = (xcb_key_press_event_t *) event;
timespec_from_msec(&time, weston_compositor_get_time());
notify_key(&b->core_seat, notify_key(&b->core_seat,
weston_compositor_get_time(), &time,
key_release->detail - 8, key_release->detail - 8,
WL_KEYBOARD_KEY_STATE_RELEASED, WL_KEYBOARD_KEY_STATE_RELEASED,
STATE_UPDATE_NONE); STATE_UPDATE_NONE);
...@@ -1517,8 +1522,9 @@ x11_backend_handle_event(int fd, uint32_t mask, void *data) ...@@ -1517,8 +1522,9 @@ x11_backend_handle_event(int fd, uint32_t mask, void *data)
case XCB_KEY_RELEASE: