original position of the tool to display its bound keymap as a
menu.
+If the fourth element of `touch-screen-current-tool' is `drag',
+the region is active, and the tool's initial window's selected
+buffer isn't read-only, display the on screen keyboard.
+
If the command being executed is listed in
`touch-screen-set-point-commands' also display the on-screen
keyboard if the current buffer and the character at the new point
posn))
;; Look for the command bound to this event.
(command (key-binding (if prefix
- (vector prefix
- (car event))
+ (vector prefix
+ (car event))
(vector (car event)))
t nil posn)))
(deactivate-mark)
;; took place.
(throw 'input-event
(list 'down-mouse-1
- (nth 4 touch-screen-current-tool)))))))
+ (nth 4 touch-screen-current-tool))))
+ ((eq what 'drag)
+ ;; Display the on screen keyboard if the region is now
+ ;; active. Check this within the window where the tool was
+ ;; first place.
+ (setq window (nth 1 touch-screen-current-tool))
+ (when window
+ (with-selected-window window
+ (when (and (region-active-p)
+ (not buffer-read-only))
+ ;; Once the on-screen keyboard has been opened, add
+ ;; `touch-screen-window-selection-changed' as a window
+ ;; selection change function This then prevents it from
+ ;; being hidden after exiting the minibuffer.
+ (progn
+ (add-hook 'window-selection-change-functions
+ #'touch-screen-window-selection-changed)
+ (frame-toggle-on-screen-keyboard (selected-frame)
+ nil)))))))))
(defun touch-screen-handle-touch (event prefix &optional interactive)
"Handle a single touch EVENT, and perform associated actions.