aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-02-11 13:28:33 +0100
committerKirill Primak <vyivel@eclair.cafe>2024-01-23 08:37:29 +0000
commit00bb1b0f84991a100ae420ee413dd861c25c43fb (patch)
tree04272b8dd0d90ff9d28b1fd1ff2a26bcc849506b
parent88b16bac54d9995196ace3823c4b81ffc84d7d9e (diff)
seat/pointer: add support for axis_relative_direction event
-rw-r--r--include/wlr/types/wlr_seat.h9
-rw-r--r--tinywl/tinywl.c2
-rw-r--r--types/data_device/wlr_drag.c3
-rw-r--r--types/seat/wlr_seat.c2
-rw-r--r--types/seat/wlr_seat_pointer.c17
-rw-r--r--types/xdg_shell/wlr_xdg_popup.c5
6 files changed, 25 insertions, 13 deletions
diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h
index 70cc0782..bafd00ad 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -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
diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c
index 603e4692..bb1d9f57 100644
--- a/tinywl/tinywl.c
+++ b/tinywl/tinywl.c
@@ -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) {
diff --git a/types/data_device/wlr_drag.c b/types/data_device/wlr_drag.c
index c6e9e59e..42691116 100644
--- a/types/data_device/wlr_drag.c
+++ b/types/data_device/wlr_drag.c
@@ -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
}
diff --git a/types/seat/wlr_seat.c b/types/seat/wlr_seat.c
index 9e91c9b0..73e30786 100644
--- a/types/seat/wlr_seat.c
+++ b/types/seat/wlr_seat.c
@@ -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) {
diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c
index d5f0f9ff..5e4401f9 100644
--- a/types/seat/wlr_seat_pointer.c
+++ b/types/seat/wlr_seat_pointer.c
@@ -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) {
diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c
index 27627984..1e744a8a 100644
--- a/types/xdg_shell/wlr_xdg_popup.c
+++ b/types/xdg_shell/wlr_xdg_popup.c
@@ -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) {