1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Properly translate touch screen events into mouse drag ones

* doc/lispref/commands.texi (Drag Events): Correct misleading
example form and reword subsequent elaboration.

* lisp/touch-screen.el (touch-screen-handle-point-up)
<mouse-drag>: Set posns representing drag start and terminus to
mouse position lists, in lieu of pairs between windows and posns
employed previously.
This commit is contained in:
Po Lu 2023-10-02 15:38:30 +08:00
parent db704687bb
commit ad2bb3e9f3
2 changed files with 10 additions and 15 deletions

View file

@ -1854,20 +1854,19 @@ represented in Lisp as lists. The lists record both the starting mouse
position and the final position, like this:
@example
(@var{event-type}
(@var{window1} START-POSITION)
(@var{window2} END-POSITION))
(@var{event-type} @var{start-position} @var{end-position})
@end example
For a drag event, the name of the symbol @var{event-type} contains the
prefix @samp{drag-}. For example, dragging the mouse with button 2
held down generates a @code{drag-mouse-2} event. The second and third
elements of the event give the starting and ending position of the
drag, as mouse position lists (@pxref{Click Events}). You can access
the second element of any mouse event in the same way. However, the
drag event may end outside the boundaries of the frame that was
initially selected. In that case, the third element's position list
contains that frame in place of a window.
elements of the event, @var{start-position} and @var{end-position} in
the foregoing illustration, are set to the start and end positions of
the drag as mouse position lists (@pxref{Click Events}). You can
access the second element of any mouse event in the same way.
However, the drag event may end outside the boundaries of the frame
that was initially selected. In that case, the third element's
position list contains that frame in place of a window.
The @samp{drag-} prefix follows the modifier key prefixes such as
@samp{C-} and @samp{M-}.

View file

@ -1140,9 +1140,7 @@ is not read-only."
;; ... 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))))
(list 'drag-mouse-1 old-posn posn)))
(if (and (eq new-window old-window)
(eq new-point old-point)
(windowp new-window)
@ -1150,9 +1148,7 @@ is not read-only."
;; ... 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)))))))
(list 'drag-mouse-1 old-posn posn))))))
((eq what 'mouse-1-menu)
;; Generate a `down-mouse-1' event at the position the tap
;; took place.