forked from 12to11/12to11
Improve scroll axis reporting behavior
* seat.c (InterpolateAxes): New function. (HandleValuatorMotion): Do not report discreet scroll events for version 8 clients when the event comes from a finger scrolling source.
This commit is contained in:
parent
276445926e
commit
b0db38043a
1 changed files with 21 additions and 3 deletions
24
seat.c
24
seat.c
|
@ -3704,6 +3704,18 @@ FindScrollValuator (Seat *seat, int number)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
InterpolateAxes (Surface *surface, double movement_x,
|
||||||
|
double movement_y, double *x_out,
|
||||||
|
double *y_out)
|
||||||
|
{
|
||||||
|
/* This is the algorithm used by most programs. */
|
||||||
|
*x_out = movement_x * pow (ViewWidth (surface->view),
|
||||||
|
2.0 / 3.0);
|
||||||
|
*x_out = movement_y * pow (ViewHeight (surface->view),
|
||||||
|
2.0 / 3.0);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SendScrollAxis (Seat *seat, Surface *surface, Time time,
|
SendScrollAxis (Seat *seat, Surface *surface, Time time,
|
||||||
double x, double y, double axis_x, double axis_y,
|
double x, double y, double axis_x, double axis_y,
|
||||||
|
@ -3734,8 +3746,16 @@ SendScrollAxis (Seat *seat, Surface *surface, Time time,
|
||||||
pointer->info->last_enter_serial = serial;
|
pointer->info->last_enter_serial = serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wl_resource_get_version (pointer->resource) < 8)
|
if (wl_resource_get_version (pointer->resource) < 8
|
||||||
|
/* Send pixel-wise axis events from devices that are most
|
||||||
|
likely touchpads. */
|
||||||
|
|| (deviceinfo->flags & DeviceCanFingerScroll
|
||||||
|
|| deviceinfo->flags & DeviceCanEdgeScroll))
|
||||||
{
|
{
|
||||||
|
/* Interpolate the increment-relative axis values to pixel
|
||||||
|
values. */
|
||||||
|
InterpolateAxes (surface, axis_x, axis_y, &axis_x, &axis_y);
|
||||||
|
|
||||||
if (axis_x != 0.0)
|
if (axis_x != 0.0)
|
||||||
wl_pointer_send_axis (pointer->resource, time,
|
wl_pointer_send_axis (pointer->resource, time,
|
||||||
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
||||||
|
@ -3843,8 +3863,6 @@ HandleValuatorMotion (Seat *seat, Surface *dispatch, double x, double y,
|
||||||
|
|
||||||
if (value && dispatch)
|
if (value && dispatch)
|
||||||
SendScrollAxis (seat, dispatch, event->time, x, y,
|
SendScrollAxis (seat, dispatch, event->time, x, y,
|
||||||
/* FIXME: this is how GTK converts those values,
|
|
||||||
but is it really right? */
|
|
||||||
total_x * 10, total_y * 10, flags,
|
total_x * 10, total_y * 10, flags,
|
||||||
/* Also pass the event source device ID, which is
|
/* Also pass the event source device ID, which is
|
||||||
used in an attempt to determine the axis
|
used in an attempt to determine the axis
|
||||||
|
|
Loading…
Add table
Reference in a new issue