[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master d90be27: Use window height to determine wheel event pixel deltas
From: |
Po Lu |
Subject: |
master d90be27: Use window height to determine wheel event pixel deltas on XInput 2 |
Date: |
Sat, 11 Dec 2021 05:31:49 -0500 (EST) |
branch: master
commit d90be279958c093c4d3023ef553ea20508cf4c28
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Use window height to determine wheel event pixel deltas on XInput 2
* src/xterm.c (handle_one_xevent): Use window height instead of
frame height to determine the height of a scroll unit.
---
src/xterm.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/xterm.c b/src/xterm.c
index 41aa2b2..f212945 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master d90be27: Use window height to determine wheel event pixel deltas on XInput 2,
Po Lu <=