emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5671709: Send scroll stop events to xwidgets correctly


From: Po Lu
Subject: master 5671709: Send scroll stop events to xwidgets correctly
Date: Tue, 7 Dec 2021 21:05:26 -0500 (EST)

branch: master
commit 5671709590e778cb3af83b2aa33bd112e1fd66fe
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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'.
---
 src/xterm.c   | 9 +++++++--
 src/xwidget.c | 7 +++----
 src/xwidget.h | 2 +-
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 3f7b956..ae0daa7 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 9b9f364..d8510ef 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 f2d497c..a03006f 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]