From 922ef5af3a7a324520c5a0f98f375f2590f2b8e9 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 8 Jun 2024 14:25:22 +0800 Subject: [PATCH] Remove touchscreen pinch event generation threshold * lisp/touch-screen.el (touch-screen-handle-aux-point-update): Remove the said threshold. (cherry picked from commit 4fa38af7c2dc1070e67530871a013abfaeee48c7) --- lisp/touch-screen.el | 69 ++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 41 deletions(-) diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el index 828810e7b33..dd6bbf8ccce 100644 --- a/lisp/touch-screen.el +++ b/lisp/touch-screen.el @@ -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. -- 2.39.5