1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 11:00:45 -08:00

Adapt doc-view-set-slice-using-mouse to touch-screen input

* doc/lispref/commands.texi (Touchscreen Events): Document means
of unconditionally enabling simple conversion.

* lisp/doc-view.el (doc-view-set-slice-using-mouse): Bind
touch-screen-simple-mouse-conversion to t, and read translated
mouse events with read-key rather than read-event.

* lisp/subr.el (read-key): Don't permit idle timer to interfere
with reporting of translated mouse events.

* lisp/touch-screen.el (touch-screen-simple-mouse-conversion):
New variable.
(touch-screen-handle-point-up, touch-screen-handle-touch):
Unconditionally enable `mouse-drag' translation if set.  Decide
whether to send drag or mouse events by the values of the two
touchpoints' XY positions and point and double-click-fuzz, as in
make_lispy_event.
This commit is contained in:
Po Lu 2024-07-03 17:05:24 +08:00
parent 667ca66481
commit 65bd41d1cf
4 changed files with 90 additions and 66 deletions

View file

@ -1511,15 +1511,18 @@ to do that. To reset the slice use `doc-view-reset-slice'."
;; Redisplay
(doc-view-goto-page (doc-view-current-page)))
(defvar touch-screen-simple-mouse-conversion) ; Defined in touch-screen.el.
(defun doc-view-set-slice-using-mouse ()
"Set the slice of the images that should be displayed.
You set the slice by pressing mouse-1 at its top-left corner and
dragging it to its bottom-right corner. See also
`doc-view-set-slice' and `doc-view-reset-slice'."
(interactive)
(let (x y w h done)
(let ((touch-screen-simple-mouse-conversion t)
x y w h done)
(while (not done)
(let ((e (read-event
(let ((e (read-key
(concat "Press mouse-1 at the top-left corner and "
"drag it to the bottom-right corner!"))))
(when (eq (car e) 'drag-mouse-1)