From: Po Lu Date: Fri, 1 Sep 2023 06:50:28 +0000 (+0800) Subject: Display the OSK after touch screen drag-to-select X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6913612def9a6be851f26965554aff74f3bcc2bf;p=emacs.git Display the OSK after touch screen drag-to-select * lisp/touch-screen.el (touch-screen-handle-point-up) : New case. Activate the on screen keyboard should the window where the first touch screen event landed have selected a writable buffer in which the region is active. --- diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el index 577c993efcf..7c9a68306ad 100644 --- a/lisp/touch-screen.el +++ b/lisp/touch-screen.el @@ -1034,6 +1034,10 @@ If the fourth element of `touch-screen-current-tool' is 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 @@ -1064,8 +1068,8 @@ is not read-only." 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) @@ -1154,7 +1158,25 @@ is not read-only." ;; 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.