mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01:00
Send axis source event
This commit is contained in:
parent
0b58579564
commit
db84379242
7 changed files with 20 additions and 16 deletions
|
@ -61,7 +61,7 @@ struct wlr_pointer_grab_interface {
|
||||||
uint32_t button, uint32_t state);
|
uint32_t button, uint32_t state);
|
||||||
void (*axis)(struct wlr_seat_pointer_grab *grab, uint32_t time,
|
void (*axis)(struct wlr_seat_pointer_grab *grab, uint32_t time,
|
||||||
enum wlr_axis_orientation orientation, double value,
|
enum wlr_axis_orientation orientation, double value,
|
||||||
int32_t value_discrete);
|
int32_t value_discrete, enum wlr_axis_source source);
|
||||||
void (*cancel)(struct wlr_seat_pointer_grab *grab);
|
void (*cancel)(struct wlr_seat_pointer_grab *grab);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
**/
|
**/
|
||||||
void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
enum wlr_axis_orientation orientation, double value,
|
enum wlr_axis_orientation orientation, double value,
|
||||||
int32_t value_discrete);
|
int32_t value_discrete, enum wlr_axis_source source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a grab of the pointer of this seat. The grabber is responsible for
|
* Start a grab of the pointer of this seat. The grabber is responsible for
|
||||||
|
@ -344,7 +344,7 @@ 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,
|
void wlr_seat_pointer_notify_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
enum wlr_axis_orientation orientation, double value,
|
enum wlr_axis_orientation orientation, double value,
|
||||||
int32_t value_discrete);
|
int32_t value_discrete, enum wlr_axis_source source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the pointer has a grab other than the default grab.
|
* Whether or not the pointer has a grab other than the default grab.
|
||||||
|
|
|
@ -313,7 +313,7 @@ void roots_cursor_handle_button(struct roots_cursor *cursor,
|
||||||
void roots_cursor_handle_axis(struct roots_cursor *cursor,
|
void roots_cursor_handle_axis(struct roots_cursor *cursor,
|
||||||
struct wlr_event_pointer_axis *event) {
|
struct wlr_event_pointer_axis *event) {
|
||||||
wlr_seat_pointer_notify_axis(cursor->seat->seat, event->time_msec,
|
wlr_seat_pointer_notify_axis(cursor->seat->seat, event->time_msec,
|
||||||
event->orientation, event->delta, event->delta_discrete);
|
event->orientation, event->delta, event->delta_discrete, event->source);
|
||||||
}
|
}
|
||||||
|
|
||||||
void roots_cursor_handle_touch_down(struct roots_cursor *cursor,
|
void roots_cursor_handle_touch_down(struct roots_cursor *cursor,
|
||||||
|
|
|
@ -192,7 +192,7 @@ 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,
|
static void drag_handle_pointer_axis(struct wlr_seat_pointer_grab *grab,
|
||||||
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
||||||
int32_t value_discrete) {
|
int32_t value_discrete, enum wlr_axis_source source) {
|
||||||
// This space is intentionally left blank
|
// This space is intentionally left blank
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,9 @@ static uint32_t default_pointer_button(struct wlr_seat_pointer_grab *grab,
|
||||||
|
|
||||||
static void default_pointer_axis(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,
|
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
||||||
int32_t value_discrete) {
|
int32_t value_discrete, enum wlr_axis_source source) {
|
||||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
||||||
value_discrete);
|
value_discrete, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void default_pointer_cancel(struct wlr_seat_pointer_grab *grab) {
|
static void default_pointer_cancel(struct wlr_seat_pointer_grab *grab) {
|
||||||
|
@ -227,7 +227,7 @@ uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
|
|
||||||
void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
enum wlr_axis_orientation orientation, double value,
|
enum wlr_axis_orientation orientation, double value,
|
||||||
int32_t value_discrete) {
|
int32_t value_discrete, enum wlr_axis_source source) {
|
||||||
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;
|
||||||
|
@ -241,6 +241,9 @@ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
|
|
||||||
uint32_t version = wl_resource_get_version(resource);
|
uint32_t version = wl_resource_get_version(resource);
|
||||||
|
|
||||||
|
if (version >= WL_POINTER_AXIS_SOURCE_SINCE_VERSION) {
|
||||||
|
wl_pointer_send_axis_source(resource, source);
|
||||||
|
}
|
||||||
if (value) {
|
if (value) {
|
||||||
if (value_discrete &&
|
if (value_discrete &&
|
||||||
version >= WL_POINTER_AXIS_DISCRETE_SINCE_VERSION) {
|
version >= WL_POINTER_AXIS_DISCRETE_SINCE_VERSION) {
|
||||||
|
@ -315,10 +318,11 @@ 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,
|
void wlr_seat_pointer_notify_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
enum wlr_axis_orientation orientation, double value,
|
enum wlr_axis_orientation orientation, double value,
|
||||||
int32_t value_discrete) {
|
int32_t value_discrete, enum wlr_axis_source source) {
|
||||||
clock_gettime(CLOCK_MONOTONIC, &wlr_seat->last_event);
|
clock_gettime(CLOCK_MONOTONIC, &wlr_seat->last_event);
|
||||||
struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab;
|
struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab;
|
||||||
grab->interface->axis(grab, time, orientation, value, value_discrete);
|
grab->interface->axis(grab, time, orientation, value, value_discrete,
|
||||||
|
source);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wlr_seat_pointer_has_grab(struct wlr_seat *seat) {
|
bool wlr_seat_pointer_has_grab(struct wlr_seat *seat) {
|
||||||
|
|
|
@ -94,9 +94,9 @@ static void shell_pointer_grab_cancel(struct wlr_seat_pointer_grab *grab) {
|
||||||
|
|
||||||
static void shell_pointer_grab_axis(struct wlr_seat_pointer_grab *grab,
|
static void shell_pointer_grab_axis(struct wlr_seat_pointer_grab *grab,
|
||||||
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
||||||
int32_t value_discrete) {
|
int32_t value_discrete, enum wlr_axis_source source) {
|
||||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
||||||
value_discrete);
|
value_discrete, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wlr_pointer_grab_interface shell_pointer_grab_impl = {
|
static const struct wlr_pointer_grab_interface shell_pointer_grab_impl = {
|
||||||
|
|
|
@ -78,9 +78,9 @@ 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,
|
static void xdg_pointer_grab_axis(struct wlr_seat_pointer_grab *grab,
|
||||||
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
||||||
int32_t value_discrete) {
|
int32_t value_discrete, enum wlr_axis_source source) {
|
||||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
||||||
value_discrete);
|
value_discrete, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_pointer_grab_cancel(struct wlr_seat_pointer_grab *grab) {
|
static void xdg_pointer_grab_cancel(struct wlr_seat_pointer_grab *grab) {
|
||||||
|
|
|
@ -88,9 +88,9 @@ 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,
|
static void xdg_pointer_grab_axis(struct wlr_seat_pointer_grab *grab,
|
||||||
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
||||||
int32_t value_discrete) {
|
int32_t value_discrete, enum wlr_axis_source source) {
|
||||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
||||||
value_discrete);
|
value_discrete, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_pointer_grab_cancel(struct wlr_seat_pointer_grab *grab) {
|
static void xdg_pointer_grab_cancel(struct wlr_seat_pointer_grab *grab) {
|
||||||
|
|
Loading…
Reference in a new issue