From: Po Lu Date: Mon, 14 Aug 2023 08:45:27 +0000 (+0800) Subject: Correct touch screen event translation X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cca14e0253c0b93ad65ffe1e212bf2a21b26020f;p=emacs.git Correct touch screen event translation * lisp/touch-screen.el (touch-screen-handle-point-up) : Provide for situations where both the old and new posns land on a special area of the window by comparing their nominal row, column, and area. --- diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el index 0914071f2a0..577c993efcf 100644 --- a/lisp/touch-screen.el +++ b/lisp/touch-screen.el @@ -1122,16 +1122,33 @@ is not read-only." ;; If the position of the touch point hasn't ;; changed, or it doesn't start or end on a ;; window... - (if (and (eq new-window old-window) - (eq new-point old-point) - (windowp new-window) - (windowp old-window)) - ;; ... generate a mouse-1 event... - (list 'mouse-1 posn) - ;; ... otherwise, generate a drag-mouse-1 event. - (list 'drag-mouse-1 (cons old-window - old-posn) - (cons new-window posn)))))) + (if (and (not old-point) (not new-point)) + ;; Should old-point and new-point both equal + ;; nil, compare the posn areas and nominal + ;; column position. If either are different, + ;; generate a drag event. + (let ((new-col-row (posn-col-row posn)) + (new-area (posn-area posn)) + (old-col-row (posn-col-row old-posn)) + (old-area (posn-area old-posn))) + (if (and (equal new-col-row old-col-row) + (eq new-area old-area)) + ;; ... generate a mouse-1 event... + (list 'mouse-1 posn) + ;; ... otherwise, generate a drag-mouse-1 event. + (list 'drag-mouse-1 (cons old-window + old-posn) + (cons new-window posn)))) + (if (and (eq new-window old-window) + (eq new-point old-point) + (windowp new-window) + (windowp old-window)) + ;; ... generate a mouse-1 event... + (list 'mouse-1 posn) + ;; ... otherwise, generate a drag-mouse-1 event. + (list 'drag-mouse-1 (cons old-window + old-posn) + (cons new-window posn))))))) ((eq what 'mouse-1-menu) ;; Generate a `down-mouse-1' event at the position the tap ;; took place.