#endif
}
-/* The code below handles the tracking of scroll valuators on XInput
- 2, in order to support scroll wheels that report information more
- granular than a screen line.
+/* Populate our client-side record of all devices, which includes
+ basic information about the device and also touchscreen tracking
+ information and scroll valuators.
- On X, when the XInput 2 extension is being utilized, the states of
- the mouse wheels in each axis are stored as absolute values inside
+ Keeping track of scroll valuators is required in order to support
+ scroll wheels that report information in a fashion more detailed
+ than a single turn of a "step" in the wheel.
+
+ When the input extension is being utilized, the states of the mouse
+ wheels on each axis are stored as absolute values inside
"valuators" attached to each mouse device. To obtain the delta of
the scroll wheel from a motion event (which is used to report that
some valuator has changed), it is necessary to iterate over every
This delta however is still intermediate, to make driver
implementations easier. The XInput developers recommend (and most
programs use) the following algorithm to convert from scroll unit
- deltas to pixel deltas:
+ deltas to pixel deltas by which the display must actually be
+ scrolled:
pixels_scrolled = pow (window_height, 2.0 / 3.0) * delta; */
-/* Setup valuator tracking for XI2 master devices on
- DPYINFO->display. */
-
-/* This function's name is a misnomer: these days, it keeps a
- client-side record of all devices, which includes basic information
- about the device and also touchscreen tracking information, instead
- of just scroll valuators. */
-
static void
-x_init_master_valuators (struct x_display_info *dpyinfo)
+x_cache_xi_devices (struct x_display_info *dpyinfo)
{
int ndevices, actual_devices;
XIDeviceInfo *infos;
bar = NULL;
- /* See the comment on top of
- x_init_master_valuators for more details on how
- scroll wheel movement is reported on XInput 2. */
+ /* See the comment on top of x_cache_xi_devices
+ for more details on how scroll wheel movement
+ is reported on XInput 2. */
delta = x_get_scroll_valuator_delta (dpyinfo, device,
i, *values, &val);
values++;
if (!device)
{
/* An existing device might have been enabled. */
- x_init_master_valuators (dpyinfo);
+ x_cache_xi_devices (dpyinfo);
/* Now try to find the device again, in case it was
just enabled. */
if (rc == Success)
{
dpyinfo->supports_xi2 = true;
- x_init_master_valuators (dpyinfo);
+ x_cache_xi_devices (dpyinfo);
}
}