From: Po Lu Date: Tue, 23 Jul 2024 12:44:06 +0000 (+0800) Subject: Better reproduce mouse event coalescence during touch event translation X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=976909f6a981e6ed8fa19c762f6f485b2fd0889d;p=emacs.git Better reproduce mouse event coalescence during touch event translation * lisp/touch-screen.el (touch-screen-handle-touch): Save the confines of the current mouse glyph before initiating simple translation. (cherry picked from commit f521235656040dbae8406682976233f771c0c81c) --- diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el index ce9a5146bba..756c82d5abe 100644 --- a/lisp/touch-screen.el +++ b/lisp/touch-screen.el @@ -1728,8 +1728,26 @@ functions undertaking event management themselves to call ;; `mouse-1-menu' instead and wait for the up ;; event to display the menu. (setcar (nthcdr 3 tool-list) 'mouse-1-menu) - (progn (setcar (nthcdr 3 tool-list) 'mouse-drag) - (throw 'input-event (list 'down-mouse-1 position)))) + (progn + (setcar (nthcdr 3 tool-list) 'mouse-drag) + ;; Record the extents of the glyph beneath this + ;; touch point to avoid generating extraneous events + ;; when it next moves. + (setcar + (nthcdr 5 touch-screen-current-tool) + (let* ((edges (window-inside-pixel-edges window)) + (point (posn-x-y position)) + (frame-offsets (if (framep window) + '(0 . 0) + (cons (car edges) + (cadr edges))))) + (remember-mouse-glyph (or (and (framep window) window) + (window-frame window)) + (+ (car point) + (car frame-offsets)) + (+ (cdr point) + (cdr frame-offsets))))) + (throw 'input-event (list 'down-mouse-1 position)))) (and point ;; Start the long-press timer. (touch-screen-handle-timeout nil)))))))