Don't try to guess a delta if a scroll valuator's state is unknown
authorPo Lu <luangruo@yahoo.com>
Mon, 3 Jan 2022 03:21:16 +0000 (11:21 +0800)
committerPo Lu <luangruo@yahoo.com>
Mon, 3 Jan 2022 03:21:16 +0000 (11:21 +0800)
* src/xterm.c (x_get_scroll_valuator_delta): Return DBL_MAX if
the scroll valuator's value is unknown.

src/xterm.c

index c9120638a73f3da347b70bcdf2707fb008949f26..31e39280b36ca51140c3091f3a14a56821a990a6 100644 (file)
@@ -502,9 +502,10 @@ x_init_master_valuators (struct x_display_info *dpyinfo)
 /* Return the delta of the scroll valuator VALUATOR_NUMBER under
    DEVICE_ID in the display DPYINFO with VALUE.  The valuator's
    valuator will be set to VALUE afterwards.  In case no scroll
-   valuator is found, or if device_id is not known to Emacs, DBL_MAX
-   is returned.  Otherwise, the valuator is returned in
-   VALUATOR_RETURN.  */
+   valuator is found, or if the valuator state is invalid (see the
+   comment under XI_Enter in handle_one_xevent), or if device_id is
+   not known to Emacs, DBL_MAX is returned.  Otherwise, the valuator
+   is returned in VALUATOR_RETURN.  */
 static double
 x_get_scroll_valuator_delta (struct x_display_info *dpyinfo, int device_id,
                             int valuator_number, double value,
@@ -531,7 +532,7 @@ x_get_scroll_valuator_delta (struct x_display_info *dpyinfo, int device_id,
                      *valuator_return = sv;
 
                      unblock_input ();
-                     return 0.0;
+                     return DBL_MAX;
                    }
                  else
                    {