Function: touch-screen-handle-timeout

touch-screen-handle-timeout is a byte-compiled function defined in touch-screen.el.gz.

Signature

(touch-screen-handle-timeout ARG)

Documentation

Start the touch screen timeout or handle it depending on ARG.

When ARG is nil, start the touch-screen-current-timer to go off in touch-screen-delay seconds, and call this function with ARG t.

When ARG is t, set the fourth element of touch-screen-current-tool to held, and generate a touchscreen-hold event at the original position of that tool.

Source Code

;; Defined in /usr/src/emacs/lisp/touch-screen.el.gz
;; Touch screen event translation.  The code here translates raw touch
;; screen events into `touchscreen-scroll' events and mouse events in
;; a ``DWIM'' fashion, consulting the keymaps at the position of the
;; mouse event to determine the best course of action, while also
;; recognizing drag-to-select and other gestures.

(defun touch-screen-handle-timeout (arg)
  "Start the touch screen timeout or handle it depending on ARG.
When ARG is nil, start the `touch-screen-current-timer' to go off
in `touch-screen-delay' seconds, and call this function with ARG
t.

When ARG is t, set the fourth element of
`touch-screen-current-tool' to `held', and generate a
`touchscreen-hold' event at the original position of that tool."
  (if (not arg)
      ;; Cancel the touch screen long-press timer, if it is still
      ;; there by any chance.
      (progn
        (when touch-screen-current-timer
          (cancel-timer touch-screen-current-timer))
        (setq touch-screen-current-timer
              (run-at-time touch-screen-delay nil
                           #'touch-screen-handle-timeout
                           t)))
    ;; Set touch-screen-current-timer to nil.
    (setq touch-screen-current-timer nil)
    (when touch-screen-current-tool
      ;; Set the state to `held'.
      (setcar (nthcdr 3 touch-screen-current-tool) 'held)
      ;; Generate an input event at the original position of the mark.
      ;; This assumes that the timer is running within
      ;; `touch-screen-translate-touch'.
      (let ((posn (nth 4 touch-screen-current-tool)))
        (throw 'input-event (list 'touchscreen-hold posn))))))