Remove touchscreen pinch event generation threshold

* lisp/touch-screen.el (touch-screen-handle-aux-point-update):
Remove the said threshold.
This commit is contained in:
Po Lu 2024-06-08 14:25:22 +08:00
parent bef514de4d
commit 4fa38af7c2

View file

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