mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 09:14:18 +00:00
Improve treatment of aborted touch events in Speedbar and elsewhere
* lisp/dframe.el (dframe-popup-kludge): Mark as a mouse-1-menu-command. * lisp/touch-screen.el (touch-screen-handle-point-up): New argument CANCELED. Implement specific responses to cancellation for each tool state. (touch-screen-handle-touch): Adjust to match.
This commit is contained in:
parent
9e22cd30eb
commit
64eb4ce0af
2 changed files with 143 additions and 134 deletions
|
|
@ -684,6 +684,8 @@ Must be bound to event E."
|
|||
(sit-for 0)
|
||||
(popup-menu (mouse-menu-major-mode-map) e)))
|
||||
|
||||
(put 'dframe-popup-kludge 'mouse-1-menu-command t)
|
||||
|
||||
;;; Interactive user functions for the mouse
|
||||
;;
|
||||
(defun dframe-mouse-event-p (event)
|
||||
|
|
|
|||
|
|
@ -1254,17 +1254,20 @@ response to the minibuffer being closed."
|
|||
(cancel-timer minibuffer-on-screen-keyboard-timer)
|
||||
(setq minibuffer-on-screen-keyboard-timer nil)))))
|
||||
|
||||
(defun touch-screen-handle-point-up (point prefix)
|
||||
(defun touch-screen-handle-point-up (point prefix canceled)
|
||||
"Notice that POINT has been removed from the screen.
|
||||
POINT should be the point currently tracked as
|
||||
`touch-screen-current-tool'.
|
||||
PREFIX should be a virtual function key used to look up key
|
||||
bindings.
|
||||
CANCELED should indicate whether the touch point was removed by
|
||||
window-system intervention rather than user action.
|
||||
|
||||
If an ancillary touch point is being observed, transfer touch
|
||||
information from `touch-screen-aux-tool' to
|
||||
`touch-screen-current-tool' and set it to nil, thereby resuming
|
||||
gesture recognition with that tool replacing the tool removed.
|
||||
`touch-screen-current-tool' and set the former to nil, thereby
|
||||
resuming gesture recognition with that tool replacing the tool
|
||||
removed.
|
||||
|
||||
Otherwise:
|
||||
|
||||
|
|
@ -1315,6 +1318,9 @@ is not read-only."
|
|||
;; hasn't been moved, translate the sequence into a
|
||||
;; regular mouse click.
|
||||
(eq what 'restart-drag))
|
||||
;; Don't attempt to execute commands bound to mouse events
|
||||
;; if the touch sequence has been canceled.
|
||||
(unless canceled
|
||||
(when (windowp (posn-window posn))
|
||||
(setq point (posn-point posn)
|
||||
window (posn-window posn))
|
||||
|
|
@ -1380,9 +1386,12 @@ is not read-only."
|
|||
;; or some such, return it as a key sequence.
|
||||
(throw 'input-event event)))
|
||||
;; If not, return the event.
|
||||
(throw 'input-event event)))))
|
||||
(throw 'input-event event))))))
|
||||
((eq what 'mouse-drag)
|
||||
;; Generate a corresponding `mouse-1' event.
|
||||
;; Alternatively, quit if the touch sequence was canceled.
|
||||
(if canceled
|
||||
(keyboard-quit)
|
||||
(let* ((new-window (posn-window posn))
|
||||
(new-point (posn-point posn))
|
||||
(old-posn (nth 4 touch-screen-current-tool))
|
||||
|
|
@ -1416,17 +1425,19 @@ is not read-only."
|
|||
(list 'mouse-1 posn)
|
||||
;; ... otherwise, generate a drag-mouse-1
|
||||
;; event.
|
||||
(list 'drag-mouse-1 old-posn 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.
|
||||
;; took place, unless the touch sequence was canceled.
|
||||
(unless canceled
|
||||
(throw 'input-event
|
||||
(list 'down-mouse-1
|
||||
(nth 4 touch-screen-current-tool))))
|
||||
(nth 4 touch-screen-current-tool)))))
|
||||
((or (eq what 'drag)
|
||||
;; Merely initiating a drag is sufficient to select a
|
||||
;; word if word selection is enabled.
|
||||
(eq what 'held))
|
||||
(unless canceled
|
||||
;; Display the on screen keyboard if the region is now
|
||||
;; active. Check this within the window where the tool
|
||||
;; was first place.
|
||||
|
|
@ -1444,7 +1455,7 @@ is not read-only."
|
|||
(add-hook 'window-selection-change-functions
|
||||
#'touch-screen-window-selection-changed)
|
||||
(frame-toggle-on-screen-keyboard (selected-frame)
|
||||
nil))))))))))
|
||||
nil)))))))))))
|
||||
|
||||
(defun touch-screen-handle-touch (event prefix &optional interactive)
|
||||
"Handle a single touch EVENT, and perform associated actions.
|
||||
|
|
@ -1684,16 +1695,12 @@ functions undertaking event management themselves to call
|
|||
(setq touch-screen-current-timer nil))
|
||||
(let ((old-aux-tool touch-screen-aux-tool))
|
||||
(unwind-protect
|
||||
;; Don't perform any actions associated with releasing the
|
||||
;; tool if the touch sequence was intercepted by another
|
||||
;; program.
|
||||
(if (caddr event)
|
||||
(setq touch-screen-current-tool nil)
|
||||
(touch-screen-handle-point-up (cadr event) prefix))
|
||||
(touch-screen-handle-point-up (cadr event) prefix
|
||||
(caddr event))
|
||||
;; If an ancillary tool is present the function call above
|
||||
;; will merely transfer information from it into the current
|
||||
;; tool list, thereby rendering it the new current tool,
|
||||
;; until such time as it too is released.
|
||||
;; will simply transfer information from it into the current
|
||||
;; tool list, rendering the new current tool, until such
|
||||
;; time as it too is released.
|
||||
(when (not (and old-aux-tool (not touch-screen-aux-tool)))
|
||||
;; Make sure the tool list is cleared even if
|
||||
;; `touch-screen-handle-point-up' throws.
|
||||
|
|
|
|||
Loading…
Reference in a new issue