1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

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.
This commit is contained in:
Po Lu 2024-07-23 20:44:06 +08:00
parent cc6324d9dc
commit f521235656

View File

@ -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)))))))