]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove touchscreen pinch event generation threshold
authorPo Lu <luangruo@yahoo.com>
Sat, 8 Jun 2024 06:25:22 +0000 (14:25 +0800)
committerEshel Yaron <me@eshelyaron.com>
Sat, 8 Jun 2024 13:01:01 +0000 (15:01 +0200)
* lisp/touch-screen.el (touch-screen-handle-aux-point-update):
Remove the said threshold.

(cherry picked from commit 4fa38af7c2dc1070e67530871a013abfaeee48c7)

lisp/touch-screen.el

index 828810e7b3379b7147829e49069bc3438f6e2438..dd6bbf8ccce1f23c6f1c1651add9203a75735700 100644 (file)
@@ -1211,48 +1211,35 @@ last such event."
             (initial-distance (aref touch-screen-aux-tool 4))
             (initial-centrum (aref touch-screen-aux-tool 5)))
         (let* ((ratio (/ distance initial-distance))
-               (ratio-diff (- ratio (aref touch-screen-aux-tool 6)))
-               (diff (abs (- ratio (aref touch-screen-aux-tool 6))))
-               (centrum-diff (+ (abs (- (car initial-centrum)
-                                        (car centrum)))
-                                (abs (- (cdr initial-centrum)
-                                        (cdr centrum))))))
-          ;; If the difference in ratio has surpassed a threshold of
-          ;; 0.2 or the centrum difference exceeds the frame's char
-          ;; width, send a touchscreen-pinch event with this
-          ;; information and update that saved in
-          ;; touch-screen-aux-tool.
-          (when (or (> diff 0.2)
-                    (> centrum-diff
-                       (/ (frame-char-width) 2)))
-            (aset touch-screen-aux-tool 5 centrum)
-            (aset touch-screen-aux-tool 6 ratio)
-            (throw 'input-event
-                   (list 'touchscreen-pinch
-                         (if (or (<= (car centrum) 0)
-                                 (<= (cdr centrum) 0))
+               (ratio-diff (- ratio (aref touch-screen-aux-tool 6))))
+          ;; Update the internal record of its position and generate an
+          ;; event.
+          (aset touch-screen-aux-tool 5 centrum)
+          (aset touch-screen-aux-tool 6 ratio)
+          (throw 'input-event
+                 (list 'touchscreen-pinch
+                       (if (or (<= (car centrum) 0)
+                               (<= (cdr centrum) 0))
+                           (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)
-                           (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))
-                         (- (cdr centrum)
-                            (cdr initial-centrum))
-                         ratio-diff))))))))
+                                   nil nil nil nil nil))))
+                       ratio
+                       (- (car centrum)
+                          (car initial-centrum))
+                       (- (cdr centrum)
+                          (cdr initial-centrum))
+                       ratio-diff)))))))
 
 (defun touch-screen-window-selection-changed (frame)
   "Notice that FRAME's selected window has changed.