mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-24 06:59:45 -05:00
Add support for discrete axis values
This commit is contained in:
parent
84609d347a
commit
0b58579564
12 changed files with 58 additions and 22 deletions
|
|
@ -191,7 +191,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) {
|
||||
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete) {
|
||||
// This space is intentionally left blank
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,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) {
|
||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value);
|
||||
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete) {
|
||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
||||
value_discrete);
|
||||
}
|
||||
|
||||
static void default_pointer_cancel(struct wlr_seat_pointer_grab *grab) {
|
||||
|
|
@ -224,7 +226,8 @@ 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,
|
||||
enum wlr_axis_orientation orientation, double value) {
|
||||
enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete) {
|
||||
struct wlr_seat_client *client = wlr_seat->pointer_state.focused_client;
|
||||
if (client == NULL) {
|
||||
return;
|
||||
|
|
@ -236,11 +239,18 @@ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
|||
continue;
|
||||
}
|
||||
|
||||
uint32_t version = wl_resource_get_version(resource);
|
||||
|
||||
if (value) {
|
||||
if (value_discrete &&
|
||||
version >= WL_POINTER_AXIS_DISCRETE_SINCE_VERSION) {
|
||||
wl_pointer_send_axis_discrete(resource, orientation,
|
||||
value_discrete);
|
||||
}
|
||||
|
||||
wl_pointer_send_axis(resource, time, orientation,
|
||||
wl_fixed_from_double(value));
|
||||
} else if (wl_resource_get_version(resource) >=
|
||||
WL_POINTER_AXIS_STOP_SINCE_VERSION) {
|
||||
} else if (version >= WL_POINTER_AXIS_STOP_SINCE_VERSION) {
|
||||
wl_pointer_send_axis_stop(resource, time, orientation);
|
||||
}
|
||||
pointer_send_frame(resource);
|
||||
|
|
@ -304,10 +314,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,
|
||||
enum wlr_axis_orientation orientation, double value) {
|
||||
enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete) {
|
||||
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);
|
||||
grab->interface->axis(grab, time, orientation, value, value_discrete);
|
||||
}
|
||||
|
||||
bool wlr_seat_pointer_has_grab(struct wlr_seat *seat) {
|
||||
|
|
|
|||
|
|
@ -93,8 +93,10 @@ static void shell_pointer_grab_cancel(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) {
|
||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value);
|
||||
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete) {
|
||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
||||
value_discrete);
|
||||
}
|
||||
|
||||
static const struct wlr_pointer_grab_interface shell_pointer_grab_impl = {
|
||||
|
|
|
|||
|
|
@ -77,8 +77,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) {
|
||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value);
|
||||
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete) {
|
||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
||||
value_discrete);
|
||||
}
|
||||
|
||||
static void xdg_pointer_grab_cancel(struct wlr_seat_pointer_grab *grab) {
|
||||
|
|
|
|||
|
|
@ -87,8 +87,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) {
|
||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value);
|
||||
uint32_t time, enum wlr_axis_orientation orientation, double value,
|
||||
int32_t value_discrete) {
|
||||
wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,
|
||||
value_discrete);
|
||||
}
|
||||
|
||||
static void xdg_pointer_grab_cancel(struct wlr_seat_pointer_grab *grab) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue