mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-25 08:32:30 +00:00
seat/pointer: add support for axis_relative_direction event
This commit is contained in:
parent
88b16bac54
commit
00bb1b0f84
@ -101,7 +101,8 @@ struct wlr_pointer_grab_interface {
|
||||
uint32_t button, enum wlr_button_state state);
|
||||
void (*axis)(struct wlr_seat_pointer_grab *grab, uint32_t time_msec,
|
||||
enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete, enum wlr_axis_source source);
|
||||
int32_t value_discrete, enum wlr_axis_source source,
|
||||
enum wlr_axis_relative_direction relative_direction);
|
||||
void (*frame)(struct wlr_seat_pointer_grab *grab);
|
||||
void (*cancel)(struct wlr_seat_pointer_grab *grab);
|
||||
};
|
||||
@ -407,7 +408,8 @@ uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat,
|
||||
*/
|
||||
void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time_msec,
|
||||
enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete, enum wlr_axis_source source);
|
||||
int32_t value_discrete, enum wlr_axis_source source,
|
||||
enum wlr_axis_relative_direction relative_direction);
|
||||
|
||||
/**
|
||||
* Send a frame event to the surface with pointer focus. This function does not
|
||||
@ -458,7 +460,8 @@ uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat,
|
||||
*/
|
||||
void wlr_seat_pointer_notify_axis(struct wlr_seat *wlr_seat, uint32_t time_msec,
|
||||
enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete, enum wlr_axis_source source);
|
||||
int32_t value_discrete, enum wlr_axis_source source,
|
||||
enum wlr_axis_relative_direction relative_direction);
|
||||
|
||||
/**
|
||||
* Notify the seat of a frame event. Frame events are sent to end a group of
|
||||
|
@ -537,7 +537,7 @@ static void server_cursor_axis(struct wl_listener *listener, void *data) {
|
||||
/* Notify the client with pointer focus of the axis event. */
|
||||
wlr_seat_pointer_notify_axis(server->seat,
|
||||
event->time_msec, event->orientation, event->delta,
|
||||
event->delta_discrete, event->source);
|
||||
event->delta_discrete, event->source, event->relative_direction);
|
||||
}
|
||||
|
||||
static void server_cursor_frame(struct wl_listener *listener, void *data) {
|
||||
|
@ -235,7 +235,8 @@ static uint32_t drag_handle_pointer_button(struct wlr_seat_pointer_grab *grab,
|
||||
|
||||
static void drag_handle_pointer_axis(struct wlr_seat_pointer_grab *grab,
|
||||
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete, enum wlr_axis_source source) {
|
||||
int32_t value_discrete, enum wlr_axis_source source,
|
||||
enum wlr_axis_relative_direction relative_direction) {
|
||||
// This space is intentionally left blank
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "types/wlr_seat.h"
|
||||
#include "util/global.h"
|
||||
|
||||
#define SEAT_VERSION 8
|
||||
#define SEAT_VERSION 9
|
||||
|
||||
static void seat_handle_get_pointer(struct wl_client *client,
|
||||
struct wl_resource *seat_resource, uint32_t id) {
|
||||
|
@ -30,9 +30,10 @@ static uint32_t default_pointer_button(struct wlr_seat_pointer_grab *grab,
|
||||
|
||||
static void default_pointer_axis(struct wlr_seat_pointer_grab *grab,
|
||||
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete, enum wlr_axis_source source) {
|
||||
int32_t value_discrete, enum wlr_axis_source source,
|
||||
enum wlr_axis_relative_direction relative_direction) {
|
||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
||||
value_discrete, source);
|
||||
value_discrete, source, relative_direction);
|
||||
}
|
||||
|
||||
static void default_pointer_frame(struct wlr_seat_pointer_grab *grab) {
|
||||
@ -321,7 +322,8 @@ static void update_value120_accumulators(struct wlr_seat_client *client,
|
||||
|
||||
void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
||||
enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete, enum wlr_axis_source source) {
|
||||
int32_t value_discrete, enum wlr_axis_source source,
|
||||
enum wlr_axis_relative_direction relative_direction) {
|
||||
struct wlr_seat_client *client = wlr_seat->pointer_state.focused_client;
|
||||
if (client == NULL) {
|
||||
return;
|
||||
@ -361,6 +363,10 @@ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
||||
wl_pointer_send_axis_source(resource, source);
|
||||
}
|
||||
if (value) {
|
||||
if (version >= WL_POINTER_AXIS_RELATIVE_DIRECTION_SINCE_VERSION) {
|
||||
wl_pointer_send_axis_relative_direction(resource,
|
||||
orientation, relative_direction);
|
||||
}
|
||||
if (value_discrete) {
|
||||
if (version >= WL_POINTER_AXIS_VALUE120_SINCE_VERSION) {
|
||||
// High resolution discrete scrolling
|
||||
@ -479,11 +485,12 @@ uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat,
|
||||
|
||||
void wlr_seat_pointer_notify_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
||||
enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete, enum wlr_axis_source source) {
|
||||
int32_t value_discrete, enum wlr_axis_source source,
|
||||
enum wlr_axis_relative_direction relative_direction) {
|
||||
clock_gettime(CLOCK_MONOTONIC, &wlr_seat->last_event);
|
||||
struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab;
|
||||
grab->interface->axis(grab, time, orientation, value, value_discrete,
|
||||
source);
|
||||
source, relative_direction);
|
||||
}
|
||||
|
||||
void wlr_seat_pointer_notify_frame(struct wlr_seat *wlr_seat) {
|
||||
|
@ -82,9 +82,10 @@ static uint32_t xdg_pointer_grab_button(struct wlr_seat_pointer_grab *grab,
|
||||
|
||||
static void xdg_pointer_grab_axis(struct wlr_seat_pointer_grab *grab,
|
||||
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete, enum wlr_axis_source source) {
|
||||
int32_t value_discrete, enum wlr_axis_source source,
|
||||
enum wlr_axis_relative_direction relative_direction) {
|
||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
||||
value_discrete, source);
|
||||
value_discrete, source, relative_direction);
|
||||
}
|
||||
|
||||
static void xdg_pointer_grab_frame(struct wlr_seat_pointer_grab *grab) {
|
||||
|
Loading…
Reference in New Issue
Block a user