emacs-diffs
[Top][All Lists]
Advanced

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

master 643c7fc8510: Correct generation of touchscreen-pinch events


From: Po Lu
Subject: master 643c7fc8510: Correct generation of touchscreen-pinch events
Date: Thu, 16 Nov 2023 22:16:37 -0500 (EST)

branch: master
commit 643c7fc85101b26625f8dc547a7fd09e9bc3df77
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Correct generation of touchscreen-pinch events
    
    * lisp/touch-screen.el (touch-screen-pinch): Check that posn-x-y
    is available before scrolling to it.
    (touch-screen-handle-aux-point-update): Don't provide posns for
    windows besides the window where the touch sequence started in
    touchscreen-pinch events.
---
 lisp/touch-screen.el | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el
index cc6f30bccbe..3e1a994402d 100644
--- a/lisp/touch-screen.el
+++ b/lisp/touch-screen.el
@@ -925,7 +925,8 @@ text scale by the ratio therein."
         ;; position.
         (if (and (not (eq current-scale
                           text-scale-mode-amount))
-                 (posn-point posn))
+                 (posn-point posn)
+                 (cdr (posn-x-y posn)))
             (touch-screen-scroll-point-to-y (posn-point posn)
                                             (cdr (posn-x-y posn)))
           ;; Rather than scroll POSN's point to its old row, scroll the
@@ -1224,11 +1225,22 @@ last such event."
             (throw 'input-event (list 'touchscreen-pinch
                                       (if (or (<= (car centrum) 0)
                                               (<= (cdr centrum) 0))
-                                          (list window centrum nil nil nil
-                                                nil nil nil)
-                                        (posn-at-x-y (car centrum)
-                                                     (cdr centrum)
-                                                     window))
+                                          (list window nil centrum nil nil
+                                                nil nil nil nil nil)
+                                        (let ((posn (posn-at-x-y (car centrum)
+                                                                 (cdr centrum)
+                                                                 window)))
+                                          (if (eq (posn-window posn)
+                                                  window)
+                                              posn
+                                            ;; Return a placeholder
+                                            ;; outside the window if
+                                            ;; the centrum has moved
+                                            ;; beyond the confines of
+                                            ;; the window where the
+                                            ;; gesture commenced.
+                                            (list window nil centrum nil nil
+                                                  nil nil nil nil nil))))
                                       ratio
                                       (- (car centrum)
                                          (car initial-centrum))



reply via email to

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