From: Po Lu Date: Wed, 8 Dec 2021 02:04:31 +0000 (+0800) Subject: Send scroll stop events to xwidgets correctly X-Git-Tag: emacs-29.0.90~3609^2~2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5671709590e778cb3af83b2aa33bd112e1fd66fe;p=emacs.git 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'. --- 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