mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-31 22:25:21 -04:00
relative_pointer: implement protocol events
Implement zwp_relative_pointer_v1.relative_motion event, along with some glue code in wlr_seat_pointer and rootston.
This commit is contained in:
parent
ba5b1676df
commit
d020344675
5 changed files with 52 additions and 0 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include <time.h>
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/types/wlr_relative_pointer_v1.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "types/wlr_seat.h"
|
||||
#include "util/signal.h"
|
||||
|
|
@ -304,6 +305,20 @@ void wlr_seat_pointer_notify_motion(struct wlr_seat *wlr_seat, uint32_t time,
|
|||
grab->interface->motion(grab, time, sx, sy);
|
||||
}
|
||||
|
||||
void wlr_seat_pointer_notify_relative_motion(struct wlr_seat *wlr_seat,
|
||||
uint64_t time, double dx, double dy, double dx_unaccel, double dy_unaccel) {
|
||||
struct wlr_seat_client *client = wlr_seat->pointer_state.focused_client;
|
||||
if (client == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &client->relative_pointers) {
|
||||
wlr_relative_pointer_v1_send_relative_motion(resource, time, dx, dy,
|
||||
dx_unaccel, dy_unaccel);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat,
|
||||
uint32_t time, uint32_t button, uint32_t state) {
|
||||
clock_gettime(CLOCK_MONOTONIC, &wlr_seat->last_event);
|
||||
|
|
|
|||
|
|
@ -187,3 +187,16 @@ void wlr_relative_pointer_v1_destroy(struct wlr_relative_pointer_manager_v1 *rel
|
|||
|
||||
wlr_log(WLR_DEBUG, "relative_pointer_v1 manager destroyed");
|
||||
}
|
||||
|
||||
|
||||
void wlr_relative_pointer_v1_send_relative_motion(struct wl_resource *resource,
|
||||
uint64_t time, double dx, double dy, double dx_unaccel, double
|
||||
dy_unaccel)
|
||||
{
|
||||
assert(wl_resource_instance_of(resource, &zwp_relative_pointer_v1_interface,
|
||||
&relative_pointer_v1_impl));
|
||||
zwp_relative_pointer_v1_send_relative_motion(resource,
|
||||
(uint32_t) (time >> 32), (uint32_t) time, wl_fixed_from_double(dx),
|
||||
wl_fixed_from_double(dy), wl_fixed_from_double(dx_unaccel),
|
||||
wl_fixed_from_double(dy_unaccel));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue