|
|
@ -13,17 +13,16 @@ static const struct zwp_relative_pointer_manager_v1_interface relative_pointer_m
|
|
|
|
static const struct zwp_relative_pointer_v1_interface relative_pointer_v1_impl;
|
|
|
|
static const struct zwp_relative_pointer_v1_interface relative_pointer_v1_impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Callback functions
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Callback functions
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
static void relative_pointer_manager_v1_handle_resource_destroy(struct wl_resource *resource)
|
|
|
|
static void relative_pointer_manager_v1_handle_resource_destroy(struct wl_resource *resource) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wl_list_remove(wl_resource_get_link(resource));
|
|
|
|
wl_list_remove(wl_resource_get_link(resource));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void relative_pointer_v1_handle_resource_destroy(struct wl_resource *resource)
|
|
|
|
static void relative_pointer_v1_handle_resource_destroy(struct wl_resource *resource) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wl_list_remove(wl_resource_get_link(resource));
|
|
|
|
wl_list_remove(wl_resource_get_link(resource));
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_relative_pointer_v1 *relative_pointer = wl_resource_get_user_data(resource);
|
|
|
|
struct wlr_relative_pointer_v1 *relative_pointer = wl_resource_get_user_data(resource);
|
|
|
@ -32,18 +31,16 @@ static void relative_pointer_v1_handle_resource_destroy(struct wl_resource *reso
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void relative_pointer_manager_v1_handle_destroy(struct wl_client *client,
|
|
|
|
static void relative_pointer_manager_v1_handle_destroy(struct wl_client *client,
|
|
|
|
struct wl_resource *resource)
|
|
|
|
struct wl_resource *resource) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wl_resource_destroy(resource);
|
|
|
|
wl_resource_destroy(resource);
|
|
|
|
|
|
|
|
|
|
|
|
wlr_log(WLR_DEBUG, "relative_pointer_v1 manager unbound from client 0x%" PRIXPTR,
|
|
|
|
wlr_log(WLR_DEBUG, "relative_pointer_v1 manager unbound from client %p",
|
|
|
|
(uintptr_t) client);
|
|
|
|
client);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void relative_pointer_manager_v1_handle_get_relative_pointer(struct wl_client *client,
|
|
|
|
static void relative_pointer_manager_v1_handle_get_relative_pointer(struct wl_client *client,
|
|
|
|
struct wl_resource *resource, uint32_t id, struct wl_resource *pointer)
|
|
|
|
struct wl_resource *resource, uint32_t id, struct wl_resource *pointer) {
|
|
|
|
{
|
|
|
|
|
|
|
|
struct wlr_seat_client *seat_client =
|
|
|
|
struct wlr_seat_client *seat_client =
|
|
|
|
wlr_seat_client_from_pointer_resource(pointer);
|
|
|
|
wlr_seat_client_from_pointer_resource(pointer);
|
|
|
|
assert(seat_client->client == client);
|
|
|
|
assert(seat_client->client == client);
|
|
|
@ -80,28 +77,24 @@ static void relative_pointer_manager_v1_handle_get_relative_pointer(struct wl_cl
|
|
|
|
wlr_signal_emit_safe(&relative_pointer_manager->events.new_relative_pointer,
|
|
|
|
wlr_signal_emit_safe(&relative_pointer_manager->events.new_relative_pointer,
|
|
|
|
relative_pointer);
|
|
|
|
relative_pointer);
|
|
|
|
|
|
|
|
|
|
|
|
wlr_log(WLR_DEBUG,
|
|
|
|
wlr_log(WLR_DEBUG, "relative_pointer_v1 %p created for client %p",
|
|
|
|
"relative_pointer_v1 0x%" PRIXPTR " created for client 0x%" PRIXPTR,
|
|
|
|
relative_pointer, client);
|
|
|
|
(uintptr_t) relative_pointer, (uintptr_t) client);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void relative_pointer_v1_handle_destroy(struct wl_client *client,
|
|
|
|
static void relative_pointer_v1_handle_destroy(struct wl_client *client,
|
|
|
|
struct wl_resource *resource)
|
|
|
|
struct wl_resource *resource) {
|
|
|
|
{
|
|
|
|
|
|
|
|
struct wlr_relative_pointer_v1 *relative_pointer =
|
|
|
|
struct wlr_relative_pointer_v1 *relative_pointer =
|
|
|
|
wl_resource_get_user_data(resource);
|
|
|
|
wl_resource_get_user_data(resource);
|
|
|
|
wlr_log(WLR_DEBUG,
|
|
|
|
wlr_log(WLR_DEBUG, "relative_pointer_v1 %p released by client %p",
|
|
|
|
"relative_pointer_v1 0x%" PRIXPTR " released by client 0x%" PRIXPTR,
|
|
|
|
relative_pointer, client);
|
|
|
|
(uintptr_t) relative_pointer, (uintptr_t) client);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wl_resource_destroy(resource);
|
|
|
|
wl_resource_destroy(resource);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void relative_pointer_manager_v1_bind(struct wl_client *wl_client, void *data,
|
|
|
|
static void relative_pointer_manager_v1_bind(struct wl_client *wl_client, void *data,
|
|
|
|
uint32_t version, uint32_t id)
|
|
|
|
uint32_t version, uint32_t id) {
|
|
|
|
{
|
|
|
|
|
|
|
|
struct wlr_relative_pointer_manager_v1 *relative_pointer_manager = data;
|
|
|
|
struct wlr_relative_pointer_manager_v1 *relative_pointer_manager = data;
|
|
|
|
|
|
|
|
|
|
|
|
struct wl_resource *manager_resource = wl_resource_create(wl_client,
|
|
|
|
struct wl_resource *manager_resource = wl_resource_create(wl_client,
|
|
|
@ -117,12 +110,13 @@ static void relative_pointer_manager_v1_bind(struct wl_client *wl_client, void *
|
|
|
|
wl_resource_set_implementation(manager_resource, &relative_pointer_manager_v1_impl,
|
|
|
|
wl_resource_set_implementation(manager_resource, &relative_pointer_manager_v1_impl,
|
|
|
|
relative_pointer_manager, relative_pointer_manager_v1_handle_resource_destroy);
|
|
|
|
relative_pointer_manager, relative_pointer_manager_v1_handle_resource_destroy);
|
|
|
|
|
|
|
|
|
|
|
|
wlr_log(WLR_DEBUG, "relative_pointer_v1 manager bound to client 0x%" PRIXPTR,
|
|
|
|
wlr_log(WLR_DEBUG, "relative_pointer_v1 manager bound to client %p",
|
|
|
|
(uintptr_t) wl_client);
|
|
|
|
wl_client);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Implementations
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Implementations
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
static const struct zwp_relative_pointer_manager_v1_interface relative_pointer_manager_v1_impl = {
|
|
|
|
static const struct zwp_relative_pointer_manager_v1_interface relative_pointer_manager_v1_impl = {
|
|
|
@ -136,11 +130,11 @@ static const struct zwp_relative_pointer_v1_interface relative_pointer_v1_impl =
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Public functions
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Public functions
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_relative_pointer_manager_v1 *wlr_relative_pointer_v1_create(struct wl_display *display)
|
|
|
|
struct wlr_relative_pointer_manager_v1 *wlr_relative_pointer_v1_create(struct wl_display *display) {
|
|
|
|
{
|
|
|
|
|
|
|
|
struct wlr_relative_pointer_manager_v1 *relative_pointer_manager =
|
|
|
|
struct wlr_relative_pointer_manager_v1 *relative_pointer_manager =
|
|
|
|
calloc(1, sizeof(struct wlr_relative_pointer_manager_v1));
|
|
|
|
calloc(1, sizeof(struct wlr_relative_pointer_manager_v1));
|
|
|
|
|
|
|
|
|
|
|
@ -168,8 +162,7 @@ struct wlr_relative_pointer_manager_v1 *wlr_relative_pointer_v1_create(struct wl
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_relative_pointer_v1_destroy(struct wlr_relative_pointer_manager_v1 *relative_pointer_manager)
|
|
|
|
void wlr_relative_pointer_v1_destroy(struct wlr_relative_pointer_manager_v1 *relative_pointer_manager) {
|
|
|
|
{
|
|
|
|
|
|
|
|
if (relative_pointer_manager == NULL) {
|
|
|
|
if (relative_pointer_manager == NULL) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -190,13 +183,12 @@ void wlr_relative_pointer_v1_destroy(struct wlr_relative_pointer_manager_v1 *rel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_relative_pointer_v1_send_relative_motion(struct wl_resource *resource,
|
|
|
|
void wlr_relative_pointer_v1_send_relative_motion(struct wl_resource *resource,
|
|
|
|
uint64_t time, double dx, double dy, double dx_unaccel, double
|
|
|
|
uint64_t time, double dx, double dy,
|
|
|
|
dy_unaccel)
|
|
|
|
double dx_unaccel, double dy_unaccel) {
|
|
|
|
{
|
|
|
|
|
|
|
|
assert(wl_resource_instance_of(resource, &zwp_relative_pointer_v1_interface,
|
|
|
|
assert(wl_resource_instance_of(resource, &zwp_relative_pointer_v1_interface,
|
|
|
|
&relative_pointer_v1_impl));
|
|
|
|
&relative_pointer_v1_impl));
|
|
|
|
zwp_relative_pointer_v1_send_relative_motion(resource,
|
|
|
|
zwp_relative_pointer_v1_send_relative_motion(resource,
|
|
|
|
(uint32_t) (time >> 32), (uint32_t) time, wl_fixed_from_double(dx),
|
|
|
|
(uint32_t)(time >> 32), (uint32_t)time,
|
|
|
|
wl_fixed_from_double(dy), wl_fixed_from_double(dx_unaccel),
|
|
|
|
wl_fixed_from_double(dx), wl_fixed_from_double(dy),
|
|
|
|
wl_fixed_from_double(dy_unaccel));
|
|
|
|
wl_fixed_from_double(dx_unaccel), wl_fixed_from_double(dy_unaccel));
|
|
|
|
}
|
|
|
|
}
|
|
|
|