]> git.eshelyaron.com Git - emacs.git/commitdiff
Use window height to determine wheel event pixel deltas on XInput 2
authorPo Lu <luangruo@yahoo.com>
Sat, 11 Dec 2021 10:30:01 +0000 (18:30 +0800)
committerPo Lu <luangruo@yahoo.com>
Sat, 11 Dec 2021 10:30:01 +0000 (18:30 +0800)
* src/xterm.c (handle_one_xevent): Use window height instead of
frame height to determine the height of a scroll unit.

src/xterm.c

index 41aa2b268c1a2862f5d8799fd098eb14039cb0fd..f2129458e16a5ec6f07729cd236c3942e23d81d0 100644 (file)
@@ -9990,6 +9990,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                  {
                    struct xi_scroll_valuator_t *val;
                    double delta, scroll_unit;
+                   int scroll_height;
+                   Lisp_Object window;
 
 
                    /* See the comment on top of
@@ -10056,7 +10058,19 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                                                         xev->mods.effective);
                          }
 
-                       scroll_unit = pow (FRAME_PIXEL_HEIGHT (f), 2.0 / 3.0);
+                       window = window_from_coordinates (f, xev->event_x,
+                                                         xev->event_y, NULL,
+                                                         false, false);
+
+                       if (WINDOWP (window))
+                         scroll_height = XWINDOW (window)->pixel_height;
+                       else
+                         /* EVENT_X and EVENT_Y can be outside the
+                            frame if F holds the input grab, so fall
+                            back to the height of the frame instead.  */
+                         scroll_height = FRAME_PIXEL_HEIGHT (f);
+
+                       scroll_unit = pow (scroll_height, 2.0 / 3.0);
 
                        if (NUMBERP (Vx_scroll_event_delta_factor))
                          scroll_unit *= XFLOATINT (Vx_scroll_event_delta_factor);