mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-05 11:21:04 -08:00
Update Android port
* doc/lispref/commands.texi (Touchscreen Events): Document meaning of `mouse-1-menu-command'. * lisp/mouse.el (minor-mode-menu-from-indicator): New arg EVENT. Give it to popup-menu. (mouse-minor-mode-menu): Use posn specified within EVENT. * lisp/touch-screen.el (touch-screen-handle-touch): Fix interactive translation. Treat commands labeled `mouse-1-menu-command' like ordinary keymaps.
This commit is contained in:
parent
51a06388b7
commit
85e39e86b0
3 changed files with 44 additions and 27 deletions
|
|
@ -2066,19 +2066,20 @@ However, some commands bound to
|
||||||
conflict with defined touch screen gestures (such as ``long-press to
|
conflict with defined touch screen gestures (such as ``long-press to
|
||||||
drag''), or with user expectations for touch input, and shouldn't
|
drag''), or with user expectations for touch input, and shouldn't
|
||||||
subject the touch sequence to simple translation. If a command whose
|
subject the touch sequence to simple translation. If a command whose
|
||||||
name contains the property @code{ignored-mouse-command} is encountered
|
name contains the property (@pxref{Symbol Properties})
|
||||||
or there is no command bound to @code{down-mouse-1}, a more irregular
|
@code{ignored-mouse-command} is encountered or there is no command
|
||||||
form of translation takes place: here, Emacs processes touch screen
|
bound to @code{down-mouse-1}, a more irregular form of translation
|
||||||
gestures (@pxref{Touchscreens,,, emacs, The GNU Emacs Manual}) first,
|
takes place: here, Emacs processes touch screen gestures
|
||||||
and finally attempts to translate touch screen events into mouse
|
(@pxref{Touchscreens,,, emacs, The GNU Emacs Manual}) first, and
|
||||||
events if no gesture was detected prior to a closing
|
finally attempts to translate touch screen events into mouse events if
|
||||||
@code{touchscreen-end} event and a command is bound to @code{mouse-1}
|
no gesture was detected prior to a closing @code{touchscreen-end}
|
||||||
at the location of that event. Before generating the @code{mouse-1}
|
event and a command is bound to @code{mouse-1} at the location of that
|
||||||
event, point is also set to the location of the @code{touchscreen-end}
|
event. Before generating the @code{mouse-1} event, point is also set
|
||||||
event, and the window containing the position of that event is
|
to the location of the @code{touchscreen-end} event, and the window
|
||||||
selected, as a compromise for packages which assume
|
containing the position of that event is selected, as a compromise for
|
||||||
@code{mouse-drag-region} has already set point to the location of any
|
packages which assume @code{mouse-drag-region} has already set point
|
||||||
mouse click and selected the window where it took place.
|
to the location of any mouse click and selected the window where it
|
||||||
|
took place.
|
||||||
|
|
||||||
To prevent unwanted @code{mouse-1} events arriving after a mouse menu
|
To prevent unwanted @code{mouse-1} events arriving after a mouse menu
|
||||||
is dismissed (@pxref{Mouse Menus}), Emacs also avoids simple
|
is dismissed (@pxref{Mouse Menus}), Emacs also avoids simple
|
||||||
|
|
@ -2088,6 +2089,13 @@ prefix key. In lieu of simple translation, it translates the closing
|
||||||
starting position of the touch sequence, consequentially displaying
|
starting position of the touch sequence, consequentially displaying
|
||||||
the mouse menu.
|
the mouse menu.
|
||||||
|
|
||||||
|
@cindex @code{mouse-1-menu-command}, a symbol property
|
||||||
|
Since certain commands are also bound to @code{down-mouse-1} for the
|
||||||
|
purpose of displaying pop-up menus, Emacs additionally behaves as
|
||||||
|
illustrated in the last paragraph if @code{down-mouse-1} is bound to a
|
||||||
|
command whose name has the property @code{mouse-1-menu-command}.
|
||||||
|
|
||||||
|
@cindex touchscreen gesture events
|
||||||
If touch gestures are detected during translation, one of the
|
If touch gestures are detected during translation, one of the
|
||||||
following input events may be generated:
|
following input events may be generated:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,8 +206,11 @@ always return a positive integer or zero."
|
||||||
|
|
||||||
;; Provide a mode-specific menu on a mouse button.
|
;; Provide a mode-specific menu on a mouse button.
|
||||||
|
|
||||||
(defun minor-mode-menu-from-indicator (indicator)
|
(defun minor-mode-menu-from-indicator (indicator &optional event)
|
||||||
"Show menu for minor mode specified by INDICATOR.
|
"Show menu for minor mode specified by INDICATOR.
|
||||||
|
EVENT may be the mouse event that is causing this menu to be
|
||||||
|
displayed.
|
||||||
|
|
||||||
Interactively, INDICATOR is read using completion.
|
Interactively, INDICATOR is read using completion.
|
||||||
If there is no menu defined for the minor mode, then create one with
|
If there is no menu defined for the minor mode, then create one with
|
||||||
items `Turn Off' and `Help'."
|
items `Turn Off' and `Help'."
|
||||||
|
|
@ -234,14 +237,17 @@ items `Turn Off' and `Help'."
|
||||||
,(lambda () (interactive)
|
,(lambda () (interactive)
|
||||||
(describe-function mm-fun)))))))
|
(describe-function mm-fun)))))))
|
||||||
(if menu
|
(if menu
|
||||||
(popup-menu menu)
|
(popup-menu menu event)
|
||||||
(message "No menu available")))))
|
(message "No menu available")))))
|
||||||
|
|
||||||
(defun mouse-minor-mode-menu (event)
|
(defun mouse-minor-mode-menu (event)
|
||||||
"Show minor-mode menu for EVENT on minor modes area of the mode line."
|
"Show minor-mode menu for EVENT on minor modes area of the mode line."
|
||||||
(interactive "@e")
|
(interactive "@e")
|
||||||
(let ((indicator (car (nth 4 (car (cdr event))))))
|
(let ((indicator (car (nth 4 (car (cdr event))))))
|
||||||
(minor-mode-menu-from-indicator indicator)))
|
(minor-mode-menu-from-indicator indicator event)))
|
||||||
|
|
||||||
|
;; See (elisp)Touchscreen Events.
|
||||||
|
(put 'mouse-minor-mode-menu 'mouse-1-menu-command t)
|
||||||
|
|
||||||
(defun mouse-menu-major-mode-map ()
|
(defun mouse-menu-major-mode-map ()
|
||||||
(run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
|
(run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
|
||||||
|
|
|
||||||
|
|
@ -767,12 +767,13 @@ the place of EVENT within the key sequence being translated, or
|
||||||
(if interactive
|
(if interactive
|
||||||
;; Called interactively (probably from wid-edit.el.)
|
;; Called interactively (probably from wid-edit.el.)
|
||||||
;; Add any event generated to `unread-command-events'.
|
;; Add any event generated to `unread-command-events'.
|
||||||
(let ((event (catch 'input-event
|
(let ((event1
|
||||||
(touch-screen-translate-touch nil) nil)))
|
(let ((current-key-remap-sequence (vector event)))
|
||||||
(when (vectorp event)
|
(touch-screen-translate-touch nil))))
|
||||||
|
(when (vectorp event1)
|
||||||
(setq unread-command-events
|
(setq unread-command-events
|
||||||
(nconc unread-command-events
|
(nconc unread-command-events
|
||||||
(nreverse (append event nil))))))
|
(nreverse (append event1 nil))))))
|
||||||
(cond
|
(cond
|
||||||
((eq (car event) 'touchscreen-begin)
|
((eq (car event) 'touchscreen-begin)
|
||||||
;; A tool was just pressed against the screen. Figure out the
|
;; A tool was just pressed against the screen. Figure out the
|
||||||
|
|
@ -816,13 +817,15 @@ the place of EVENT within the key sequence being translated, or
|
||||||
t nil position))
|
t nil position))
|
||||||
(not (and (symbolp binding)
|
(not (and (symbolp binding)
|
||||||
(get binding 'ignored-mouse-command))))))
|
(get binding 'ignored-mouse-command))))))
|
||||||
(if (keymapp binding)
|
(if (or (keymapp binding)
|
||||||
;; binding is a keymap. If a `mouse-1' event is
|
(and (symbolp binding)
|
||||||
;; generated after the keyboard command loop displays
|
(get binding 'mouse-1-menu-command)))
|
||||||
;; it as a menu, that event could cause unwanted
|
;; binding is a keymap, or a command that does almost
|
||||||
;; commands to be run. Set what to `mouse-1-menu'
|
;; the same thing. If a `mouse-1' event is generated
|
||||||
;; instead and wait for the up event to display the
|
;; after the keyboard command loop displays it as a
|
||||||
;; menu.
|
;; menu, that event could cause unwanted commands to
|
||||||
|
;; be run. Set what to `mouse-1-menu' instead and
|
||||||
|
;; wait for the up event to display the menu.
|
||||||
(setcar (nthcdr 3 touch-screen-current-tool)
|
(setcar (nthcdr 3 touch-screen-current-tool)
|
||||||
'mouse-1-menu)
|
'mouse-1-menu)
|
||||||
(progn (setcar (nthcdr 3 touch-screen-current-tool)
|
(progn (setcar (nthcdr 3 touch-screen-current-tool)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue