#include "weston.h"
#include "shared/helpers.h"
#include "shared/os-compatibility.h"
+#include "shared/timespec-util.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
struct shared_output {
uint32_t time, wl_fixed_t x, wl_fixed_t y)
{
struct ss_seat *seat = data;
+ struct timespec ts;
+
+ timespec_from_msec(&ts, time);
/* No transformation of input position is required here because we are
* always receiving the input in the same coordinates as the output. */
- notify_motion_absolute(&seat->base, time,
+ notify_motion_absolute(&seat->base, &ts,
wl_fixed_to_double(x), wl_fixed_to_double(y));
notify_pointer_frame(&seat->base);
}
}
static void
-exposay_motion(struct weston_pointer_grab *grab, uint32_t time,
+exposay_motion(struct weston_pointer_grab *grab,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
struct desktop_shell *shell =
}
static void
-move_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
+move_grab_motion(struct weston_pointer_grab *grab,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
struct weston_move_grab *move = (struct weston_move_grab *) grab;
};
static void
-resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
+resize_grab_motion(struct weston_pointer_grab *grab,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
}
static void
-busy_cursor_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
+busy_cursor_grab_motion(struct weston_pointer_grab *grab,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
weston_pointer_move(grab->pointer, event);
}
static void
-rotate_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
+rotate_grab_motion(struct weston_pointer_grab *grab,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
struct rotate_grab *rotate =
}
static void
-pointer_move_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
+pointer_move_grab_motion(struct weston_pointer_grab *grab,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
struct pointer_move_grab *pnt_move_grab =
static void
weston_desktop_seat_popup_grab_pointer_motion(struct weston_pointer_grab *grab,
- uint32_t time,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
weston_pointer_send_motion(grab->pointer, time, event);
#endif
#include "shared/helpers.h"
+#include "shared/timespec-util.h"
#include "compositor.h"
#include "compositor-rdp.h"
#include "pixman-renderer.h"
struct rdp_output *output;
uint32_t button = 0;
bool need_frame = false;
+ struct timespec time;
if (flags & PTR_FLAGS_MOVE) {
output = peerContext->rdpBackend->output;
if (x < output->base.width && y < output->base.height) {
- notify_motion_absolute(peerContext->item.seat, weston_compositor_get_time(),
+ timespec_from_msec(&time, weston_compositor_get_time());
+ notify_motion_absolute(peerContext->item.seat, &time,
x, y);
need_frame = true;
}
{
RdpPeerContext *peerContext = (RdpPeerContext *)input->context;
struct rdp_output *output;
+ struct timespec time;
output = peerContext->rdpBackend->output;
if (x < output->base.width && y < output->base.height) {
- notify_motion_absolute(peerContext->item.seat, weston_compositor_get_time(),
- x, y);
+ timespec_from_msec(&time, weston_compositor_get_time());
+ notify_motion_absolute(peerContext->item.seat, &time, x, y);
}
FREERDP_CB_RETURN(TRUE);
#include "shared/image-loader.h"
#include "shared/os-compatibility.h"
#include "shared/cairo-util.h"
+#include "shared/timespec-util.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#include "xdg-shell-unstable-v6-client-protocol.h"
#include "presentation-time-server-protocol.h"
enum theme_location location;
bool want_frame = false;
double x, y;
+ struct timespec ts;
if (!input->output)
return;
}
if (location == THEME_LOCATION_CLIENT_AREA) {
- notify_motion_absolute(&input->base, time, x, y);
+ timespec_from_msec(&ts, time);
+ notify_motion_absolute(&input->base, &ts, x, y);
want_frame = true;
}
#include "shared/config-parser.h"
#include "shared/helpers.h"
#include "shared/image-loader.h"
+#include "shared/timespec-util.h"
#include "gl-renderer.h"
#include "weston-egl-ext.h"
#include "pixman-renderer.h"
struct weston_pointer_motion_event motion_event = { 0 };
xcb_motion_notify_event_t *motion_notify =
(xcb_motion_notify_event_t *) event;
+ struct timespec time;
if (!b->has_xkb)
update_xkb_state_from_core(b, motion_notify->state);
.dy = y - b->prev_y
};
- notify_motion(&b->core_seat, weston_compositor_get_time(),
- &motion_event);
+ timespec_from_msec(&time, weston_compositor_get_time());
+ notify_motion(&b->core_seat, &time, &motion_event);
notify_pointer_frame(&b->core_seat);
b->prev_x = x;
struct weston_pointer_motion_event {
uint32_t mask;
- uint64_t time_usec;
+ struct timespec time;
double x;
double y;
double dx;
struct weston_pointer_grab;
struct weston_pointer_grab_interface {
void (*focus)(struct weston_pointer_grab *grab);
- void (*motion)(struct weston_pointer_grab *grab, uint32_t time,
+ void (*motion)(struct weston_pointer_grab *grab,
+ const struct timespec *time,
struct weston_pointer_motion_event *event);
void (*button)(struct weston_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state);
void
weston_pointer_destroy(struct weston_pointer *pointer);
void
-weston_pointer_send_motion(struct weston_pointer *pointer, uint32_t time,
+weston_pointer_send_motion(struct weston_pointer *pointer,
+ const struct timespec *time,
struct weston_pointer_motion_event *event);
bool
weston_pointer_has_focus_resource(struct weston_pointer *pointer);
uint32_t flags);
void
-notify_motion(struct weston_seat *seat, uint32_t time,
+notify_motion(struct weston_seat *seat, const struct timespec *time,
struct weston_pointer_motion_event *event);
void
-notify_motion_absolute(struct weston_seat *seat, uint32_t time,
+notify_motion_absolute(struct weston_seat *seat, const struct timespec *time,
double x, double y);
void
notify_button(struct weston_seat *seat, uint32_t time, int32_t button,
#include "compositor.h"
#include "shared/helpers.h"
+#include "shared/timespec-util.h"
struct weston_drag {
struct wl_client *client;
}
static void
-drag_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
+drag_grab_motion(struct weston_pointer_grab *grab,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
struct weston_pointer_drag *drag =
struct weston_pointer *pointer = drag->grab.pointer;
float fx, fy;
wl_fixed_t sx, sy;
+ uint32_t msecs;
weston_pointer_move(pointer, event);
}
if (drag->base.focus_resource) {
+ msecs = timespec_to_msec(time);
weston_view_from_global_fixed(drag->base.focus,
pointer->x, pointer->y,
&sx, &sy);
- wl_data_device_send_motion(drag->base.focus_resource, time, sx, sy);
+ wl_data_device_send_motion(drag->base.focus_resource, msecs, sx, sy);
}
}
#include "shared/helpers.h"
#include "shared/os-compatibility.h"
+#include "shared/timespec-util.h"
#include "compositor.h"
#include "relative-pointer-unstable-v1-server-protocol.h"
#include "pointer-constraints-unstable-v1-server-protocol.h"
static void
pointer_send_relative_motion(struct weston_pointer *pointer,
- uint32_t time,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
uint64_t time_usec;
return;
resource_list = &pointer->focus_client->relative_pointer_resources;
- time_usec = event->time_usec;
+ time_usec = timespec_to_usec(&event->time);
if (time_usec == 0)
- time_usec = time * 1000ULL;
+ time_usec = timespec_to_usec(time);
dxf = wl_fixed_from_double(dx);
dyf = wl_fixed_from_double(dy);
}
static void
-pointer_send_motion(struct weston_pointer *pointer, uint32_t time,
+pointer_send_motion(struct weston_pointer *pointer,
+ const struct timespec *time,
wl_fixed_t sx, wl_fixed_t sy)
{
struct wl_list *resource_list;
struct wl_resource *resource;
+ uint32_t msecs;
if (!pointer->focus_client)
return;
resource_list = &pointer->focus_client->pointer_resources;
+ msecs = timespec_to_msec(time);
wl_resource_for_each(resource, resource_list)
- wl_pointer_send_motion(resource, time, sx, sy);
+ wl_pointer_send_motion(resource, msecs, sx, sy);
}
WL_EXPORT void
-weston_pointer_send_motion(struct weston_pointer *pointer, uint32_t time,
+weston_pointer_send_motion(struct weston_pointer *pointer,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
wl_fixed_t x, y;
}
static void
-default_grab_pointer_motion(struct weston_pointer_grab *grab, uint32_t time,
+default_grab_pointer_motion(struct weston_pointer_grab *grab,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
weston_pointer_send_motion(grab->pointer, time, event);
WL_EXPORT void
notify_motion(struct weston_seat *seat,
- uint32_t time,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
struct weston_compositor *ec = seat->compositor;
}
WL_EXPORT void
-notify_motion_absolute(struct weston_seat *seat,
- uint32_t time, double x, double y)
+notify_motion_absolute(struct weston_seat *seat, const struct timespec *time,
+ double x, double y)
{
struct weston_compositor *ec = seat->compositor;
struct weston_pointer *pointer = weston_seat_get_pointer(seat);
static void
locked_pointer_grab_pointer_motion(struct weston_pointer_grab *grab,
- uint32_t time,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
pointer_send_relative_motion(grab->pointer, time, event);
static void
confined_pointer_grab_pointer_motion(struct weston_pointer_grab *grab,
- uint32_t time,
+ const struct timespec *time,
struct weston_pointer_motion_event *event)
{
struct weston_pointer_constraint *constraint =
#include "compositor.h"
#include "libinput-device.h"
#include "shared/helpers.h"
+#include "shared/timespec-util.h"
void
evdev_led_update(struct evdev_device *device, enum weston_led weston_leds)
struct evdev_device *device =
libinput_device_get_user_data(libinput_device);
struct weston_pointer_motion_event event = { 0 };
- uint64_t time_usec =
- libinput_event_pointer_get_time_usec(pointer_event);
+ struct timespec time;
double dx_unaccel, dy_unaccel;
+ timespec_from_usec(&time,
+ libinput_event_pointer_get_time_usec(pointer_event));
dx_unaccel = libinput_event_pointer_get_dx_unaccelerated(pointer_event);
dy_unaccel = libinput_event_pointer_get_dy_unaccelerated(pointer_event);
event = (struct weston_pointer_motion_event) {
.mask = WESTON_POINTER_MOTION_REL |
WESTON_POINTER_MOTION_REL_UNACCEL,
- .time_usec = time_usec,
+ .time = time,
.dx = libinput_event_pointer_get_dx(pointer_event),
.dy = libinput_event_pointer_get_dy(pointer_event),
.dx_unaccel = dx_unaccel,
.dy_unaccel = dy_unaccel,
};
- notify_motion(device->seat,
- libinput_event_pointer_get_time(pointer_event),
- &event);
+ notify_motion(device->seat, &time, &event);
return true;
}
struct evdev_device *device =
libinput_device_get_user_data(libinput_device);
struct weston_output *output = device->output;
- uint32_t time;
+ struct timespec time;
double x, y;
uint32_t width, height;
if (!output)
return false;
- time = libinput_event_pointer_get_time(pointer_event);
+ timespec_from_usec(&time,
+ libinput_event_pointer_get_time_usec(pointer_event));
width = device->output->current_mode->width;
height = device->output->current_mode->height;
height);
weston_output_transform_coordinate(device->output, x, y, &x, &y);
- notify_motion_absolute(device->seat, time, x, y);
+ notify_motion_absolute(device->seat, &time, x, y);
return true;
}
#endif /* ENABLE_EGL */
#include "shared/helpers.h"
+#include "shared/timespec-util.h"
struct weston_test {
struct weston_compositor *compositor;
struct weston_seat *seat = get_seat(test);
struct weston_pointer *pointer = weston_seat_get_pointer(seat);
struct weston_pointer_motion_event event = { 0 };
+ struct timespec time;
event = (struct weston_pointer_motion_event) {
.mask = WESTON_POINTER_MOTION_REL,
.dy = wl_fixed_to_double(wl_fixed_from_int(y) - pointer->y),
};
- notify_motion(seat, 100, &event);
+ timespec_from_msec(&time, 100);
+
+ notify_motion(seat, &time, &event);
notify_pointer_position(test, resource);
}