(message nil)
(use-global-map old-global-map))))
+(defvar touch-screen-events-received nil
+ "Whether a touch screen event has ever been translated.
+The value of this variable governs whether
+`read--potential-mouse-event' calls read-key or read-event.")
+
;; FIXME: Once there's a safe way to transition away from read-event,
;; callers to this function should be updated to that way and this
;; function should be deleted.
(defun read--potential-mouse-event ()
- "Read an event that might be a mouse event.
+ "Read an event that might be a mouse event.
This function exists for backward compatibility in code packaged
with Emacs. Do not call it directly in your own packages."
- ;; `xterm-mouse-mode' events must go through `read-key' as they
- ;; are decoded via `input-decode-map'.
- (if xterm-mouse-mode
- (read-key nil
- ;; Normally `read-key' discards all mouse button
- ;; down events. However, we want them here.
- t)
- (read-event)))
+ ;; `xterm-mouse-mode' events must go through `read-key' as they
+ ;; are decoded via `input-decode-map'.
+ (if (or xterm-mouse-mode
+ ;; If a touch screen is being employed, then mouse events
+ ;; are subject to translation as well.
+ touch-screen-events-received)
+ (read-key nil
+ ;; Normally `read-key' discards all mouse button
+ ;; down events. However, we want them here.
+ t)
+ (read-event)))
(defvar read-passwd-map
;; BEWARE: `defconst' would purecopy it, breaking the sharing with
generated instead of throwing `input-event'. Otherwise, throw
`input-event' with a single input event if that event should take
the place of EVENT within the key sequence being translated, or
-`nil' if all tools have been released."
+`nil' if all tools have been released.
+
+Set `touch-screen-events-received' to `t' to indicate that touch
+screen events have been received, and thus by extension require
+functions undertaking event management themselves to call
+`read-key' rather than `read-event'."
(interactive "e\ni\np")
+ (unless touch-screen-events-received
+ (setq touch-screen-events-received t))
(if interactive
;; Called interactively (probably from wid-edit.el.)
;; Add any event generated to `unread-command-events'.
(cancel-timer touch-screen-current-timer)
(setq touch-screen-current-timer nil))
;; If a tool already exists...
- (if touch-screen-current-tool
+ (if (and touch-screen-current-tool
+ ;; ..and the number of this tool is at variance with
+ ;; that of the current tool: if a `touchscreen-end'
+ ;; event is delivered that is somehow withheld from
+ ;; this function and the system does not assign
+ ;; monotonically increasing touch point identifiers,
+ ;; then the ancillary tool will be set to a tool
+ ;; bearing the same number as the current tool, and
+ ;; consequently the mechanism for detecting
+ ;; erroneously retained touch points upon the
+ ;; registration of `touchscreen-update' events will
+ ;; not be activated.
+ (not (eq touchpoint (car touch-screen-current-tool))))
;; Then record this tool as the ``auxiliary tool''.
;; Updates to the auxiliary tool are considered in unison
;; with those to the current tool; the distance between