summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2021-12-08 10:04:31 +0800
committerPo Lu <luangruo@yahoo.com>2021-12-08 10:04:31 +0800
commit5671709590e778cb3af83b2aa33bd112e1fd66fe (patch)
tree88de24ea921f7efc74215a3088e172ed947ff762 /src
parent176c63287ffdf56634984494f6610102737f393e (diff)
Send scroll stop events to xwidgets correctly
* src/xterm.c (handle_one_xevent): Record stop events manually. * src/xwidget.h (xwidget_scroll): * src/xwidget.c (xwidget_scroll): New parameter `stop_p'.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c9
-rw-r--r--src/xwidget.c7
-rw-r--r--src/xwidget.h2
3 files changed, 11 insertions, 7 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 3f7b9560345..ae0daa79f31 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9851,6 +9851,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
XIValuatorState *states;
double *values;
bool found_valuator = false;
+ bool any_stop_p = false;
/* A fake XMotionEvent for x_note_mouse_movement. */
XMotionEvent ev;
@@ -10003,9 +10004,13 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (val->horizontal)
xv_total_x += delta;
else
- xv_total_y += -delta;
+ xv_total_y += delta;
found_valuator = true;
+
+ if (delta == 0.0)
+ any_stop_p = true;
+
continue;
}
#endif
@@ -10092,7 +10097,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (found_valuator)
xwidget_scroll (xv, xev->event_x, xev->event_y,
xv_total_x, xv_total_y, xev->mods.effective,
- xev->time);
+ xev->time, any_stop_p);
else
xwidget_motion_notify (xv, xev->event_x, xev->event_y,
xev->mods.effective, xev->time);
diff --git a/src/xwidget.c b/src/xwidget.c
index 9b9f364ce40..d8510ef9286 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -1062,7 +1062,8 @@ xwidget_motion_notify (struct xwidget_view *view,
void
xwidget_scroll (struct xwidget_view *view, double x, double y,
- double dx, double dy, uint state, Time time)
+ double dx, double dy, uint state, Time time,
+ bool stop_p)
{
GdkEvent *xg_event;
GtkWidget *target;
@@ -1097,9 +1098,7 @@ xwidget_scroll (struct xwidget_view *view, double x, double y,
xg_event->scroll.delta_x = dx;
xg_event->scroll.delta_y = dy;
xg_event->scroll.device = find_suitable_pointer (view->frame);
-
- if (!(fabs (dx) > 0) || !(fabs (dy) > 0))
- xg_event->scroll.is_stop = TRUE;
+ xg_event->scroll.is_stop = stop_p;
g_object_ref (xg_event->any.window);
diff --git a/src/xwidget.h b/src/xwidget.h
index f2d497c0920..a03006fde9a 100644
--- a/src/xwidget.h
+++ b/src/xwidget.h
@@ -199,7 +199,7 @@ extern void xwidget_motion_or_crossing (struct xwidget_view *,
extern void xwidget_motion_notify (struct xwidget_view *, double,
double, uint, Time);
extern void xwidget_scroll (struct xwidget_view *, double, double,
- double, double, uint, Time);
+ double, double, uint, Time, bool);
#endif
#endif
#else