]> git.eshelyaron.com Git - emacs.git/commitdiff
Correct touch screen event translation
authorPo Lu <luangruo@yahoo.com>
Mon, 14 Aug 2023 08:45:27 +0000 (16:45 +0800)
committerPo Lu <luangruo@yahoo.com>
Mon, 14 Aug 2023 08:45:44 +0000 (16:45 +0800)
* 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

index 0914071f2a08c7e50aab078efacf0256a1d3dec6..577c993efcfea33b7419a108fe1db996f11973c5 100644 (file)
@@ -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.