emacs-diffs
[Top][All Lists]
Advanced

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

master cca14e0253c 2/2: Correct touch screen event translation


From: Po Lu
Subject: master cca14e0253c 2/2: Correct touch screen event translation
Date: Mon, 14 Aug 2023 04:46:06 -0400 (EDT)

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

    Correct touch screen event translation
    
    * lisp/touch-screen.el (touch-screen-handle-point-up)
    <mouse-drag>: Provide for situations where both the old and new
    posns land on a special area of the window by comparing their
    nominal row, column, and area.
---
 lisp/touch-screen.el | 37 +++++++++++++++++++++++++++----------
 1 file changed, 27 insertions(+), 10 deletions(-)

diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el
index 0914071f2a0..577c993efcf 100644
--- a/lisp/touch-screen.el
+++ b/lisp/touch-screen.el
@@ -1122,16 +1122,33 @@ is not read-only."
                     ;; If the position of the touch point hasn't
                     ;; changed, or it doesn't start or end on a
                     ;; window...
-                    (if (and (eq new-window old-window)
-                             (eq new-point old-point)
-                             (windowp new-window)
-                             (windowp old-window))
-                        ;; ... generate a mouse-1 event...
-                        (list 'mouse-1 posn)
-                      ;; ... otherwise, generate a drag-mouse-1 event.
-                      (list 'drag-mouse-1 (cons old-window
-                                                old-posn)
-                            (cons new-window posn))))))
+                    (if (and (not old-point) (not new-point))
+                        ;; Should old-point and new-point both equal
+                        ;; nil, compare the posn areas and nominal
+                        ;; column position.  If either are different,
+                        ;; generate a drag event.
+                        (let ((new-col-row (posn-col-row posn))
+                              (new-area (posn-area posn))
+                              (old-col-row (posn-col-row old-posn))
+                              (old-area (posn-area old-posn)))
+                          (if (and (equal new-col-row old-col-row)
+                                   (eq new-area old-area))
+                              ;; ... generate a mouse-1 event...
+                              (list 'mouse-1 posn)
+                            ;; ... otherwise, generate a drag-mouse-1 event.
+                            (list 'drag-mouse-1 (cons old-window
+                                                      old-posn)
+                                  (cons new-window posn))))
+                      (if (and (eq new-window old-window)
+                               (eq new-point old-point)
+                               (windowp new-window)
+                               (windowp old-window))
+                          ;; ... generate a mouse-1 event...
+                          (list 'mouse-1 posn)
+                        ;; ... otherwise, generate a drag-mouse-1 event.
+                        (list 'drag-mouse-1 (cons old-window
+                                                  old-posn)
+                              (cons new-window posn)))))))
           ((eq what 'mouse-1-menu)
            ;; Generate a `down-mouse-1' event at the position the tap
            ;; took place.



reply via email to

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