relative_pointer: code formatting fixes
This commit is contained in:
parent
d020344675
commit
6fa1777f94
|
@ -12,13 +12,15 @@
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
|
|
||||||
|
|
||||||
/* This protocol specifies a set of interfaces used for making clients able to
|
/**
|
||||||
|
* This protocol specifies a set of interfaces used for making clients able to
|
||||||
* receive relative pointer events not obstructed by barriers (such as the
|
* receive relative pointer events not obstructed by barriers (such as the
|
||||||
* monitor edge or other pointer barriers).
|
* monitor edge or other pointer barriers).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* A global interface used for getting the relative pointer object for a given
|
/**
|
||||||
|
* A global interface used for getting the relative pointer object for a given
|
||||||
* pointer.
|
* pointer.
|
||||||
*
|
*
|
||||||
* Signals:
|
* Signals:
|
||||||
|
@ -41,7 +43,8 @@ struct wlr_relative_pointer_manager_v1 {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* A wp_relative_pointer object is an extension to the wl_pointer interface
|
/**
|
||||||
|
* A wp_relative_pointer object is an extension to the wl_pointer interface
|
||||||
* used for emitting relative pointer events. It shares the same focus as
|
* used for emitting relative pointer events. It shares the same focus as
|
||||||
* wl_pointer objects of the same seat and will only emit events when it has
|
* wl_pointer objects of the same seat and will only emit events when it has
|
||||||
* focus.
|
* focus.
|
||||||
|
@ -67,7 +70,6 @@ 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);
|
||||||
|
|
||||||
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, double dx_unaccel, double dy_unaccel);
|
||||||
dy_unaccel);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -314,7 +314,8 @@ void wlr_seat_pointer_clear_focus(struct wlr_seat *wlr_seat);
|
||||||
void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time,
|
void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
double sx, double sy);
|
double sx, double sy);
|
||||||
|
|
||||||
/** Send relative motion events to the surface with pointer focus. Coordinates
|
/**
|
||||||
|
* Send relative motion events to the surface with pointer focus. Coordinates
|
||||||
* for the motion event are relative to current pointer location, both
|
* for the motion event are relative to current pointer location, both
|
||||||
* accelerated and unaccelerated. Compositors should use
|
* accelerated and unaccelerated. Compositors should use
|
||||||
* `wlr_seat_pointer_notify_relative_motion()` to send relative motion events
|
* `wlr_seat_pointer_notify_relative_motion()` to send relative motion events
|
||||||
|
@ -323,8 +324,8 @@ void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
* Note that the timestamp is 64 bit, split into high 32 bits and low 32 bits.
|
* Note that the timestamp is 64 bit, split into high 32 bits and low 32 bits.
|
||||||
*/
|
*/
|
||||||
void wlr_seat_pointer_notify_relative_motion(struct wlr_seat *wlr_seat,
|
void wlr_seat_pointer_notify_relative_motion(struct wlr_seat *wlr_seat,
|
||||||
uint64_t time, double dx, double dy, double dx_unaccel,
|
uint64_t time, double dx, double dy,
|
||||||
double dy_unaccel);
|
double dx_unaccel, double dy_unaccel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a button event to the surface with pointer focus. Coordinates for the
|
* Send a button event to the surface with pointer focus. Coordinates for the
|
||||||
|
|
|
@ -310,8 +310,8 @@ void roots_cursor_handle_motion(struct roots_cursor *cursor,
|
||||||
double dx = event->delta_x;
|
double dx = event->delta_x;
|
||||||
double dy = event->delta_y;
|
double dy = event->delta_y;
|
||||||
|
|
||||||
wlr_seat_pointer_notify_relative_motion(cursor->seat->seat, (uint64_t)
|
wlr_seat_pointer_notify_relative_motion(cursor->seat->seat,
|
||||||
event->time_msec, dx, dy, dx, dy);
|
(uint64_t)event->time_msec, dx, dy, dx, dy);
|
||||||
|
|
||||||
if (cursor->active_constraint) {
|
if (cursor->active_constraint) {
|
||||||
struct roots_view *view = cursor->pointer_view->view;
|
struct roots_view *view = cursor->pointer_view->view;
|
||||||
|
@ -354,8 +354,8 @@ void roots_cursor_handle_motion_absolute(struct roots_cursor *cursor,
|
||||||
|
|
||||||
double dx = lx - cursor->cursor->x;
|
double dx = lx - cursor->cursor->x;
|
||||||
double dy = ly - cursor->cursor->y;
|
double dy = ly - cursor->cursor->y;
|
||||||
wlr_seat_pointer_notify_relative_motion(cursor->seat->seat, (uint64_t)
|
wlr_seat_pointer_notify_relative_motion(cursor->seat->seat,
|
||||||
event->time_msec, dx, dy, dx, dy);
|
(uint64_t)event->time_msec, dx, dy, dx, dy);
|
||||||
|
|
||||||
if (cursor->pointer_view) {
|
if (cursor->pointer_view) {
|
||||||
struct roots_view *view = cursor->pointer_view->view;
|
struct roots_view *view = cursor->pointer_view->view;
|
||||||
|
|
|
@ -306,7 +306,8 @@ void wlr_seat_pointer_notify_motion(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_seat_pointer_notify_relative_motion(struct wlr_seat *wlr_seat,
|
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) {
|
uint64_t time, double dx, double dy,
|
||||||
|
double dx_unaccel, double dy_unaccel) {
|
||||||
struct wlr_seat_client *client = wlr_seat->pointer_state.focused_client;
|
struct wlr_seat_client *client = wlr_seat->pointer_state.focused_client;
|
||||||
if (client == NULL) {
|
if (client == NULL) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue