From b1f14e94ada90c266e3e6683d401e567397c4910 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Mon, 25 Jul 2022 09:23:15 +0800 Subject: [PATCH] ; Rename misnamed function in xterm.c * src/xterm.c (x_init_master_valuators): Rename to `x_cache_xi_devices'. Update comment accordingly. All callers changed. --- src/xterm.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 67a7de42134..da909f337f9 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -5373,12 +5373,16 @@ xi_populate_device_from_info (struct xi_device_t *xi_device, #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 @@ -5392,20 +5396,13 @@ xi_populate_device_from_info (struct xi_device_t *xi_device, 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; @@ -19847,9 +19844,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, 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++; @@ -21711,7 +21708,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, 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. */ @@ -27338,7 +27335,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) if (rc == Success) { dpyinfo->supports_xi2 = true; - x_init_master_valuators (dpyinfo); + x_cache_xi_devices (dpyinfo); } } -- 2.39.2