mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
* lisp/term/x-win.el (x-menu-bar-open): Use `frame-parameter'
to check whether menu-bar is shown or not. If not shown, show the menu-bar as a popup menu instead of using tmm. * lisp/mouse.el (popup-menu): Accept `point' as `position' argument.
This commit is contained in:
parent
c28662a8dc
commit
bbf0e7d978
3 changed files with 31 additions and 9 deletions
|
|
@ -102,7 +102,8 @@ point at the click position."
|
|||
MENU can be a keymap, an easymenu-style menu or a list of keymaps as for
|
||||
`x-popup-menu'.
|
||||
POSITION can be a click event or ((XOFFSET YOFFSET) WINDOW) and defaults to
|
||||
the current mouse position.
|
||||
the current mouse position. If POSITION is a symbol, `point' the current point
|
||||
position is used.
|
||||
PREFIX is the prefix argument (if any) to pass to the command."
|
||||
(let* ((map (cond
|
||||
((keymapp menu) menu)
|
||||
|
|
@ -112,9 +113,17 @@ PREFIX is the prefix argument (if any) to pass to the command."
|
|||
(plist-get (get map 'menu-prop) :filter))))
|
||||
(if filter (funcall filter (symbol-function map)) map)))))
|
||||
event cmd)
|
||||
(unless position
|
||||
(let ((mp (mouse-pixel-position)))
|
||||
(setq position (list (list (cadr mp) (cddr mp)) (car mp)))))
|
||||
(setq position
|
||||
(cond
|
||||
((eq position 'point)
|
||||
(let* ((pp (posn-at-point pos window))
|
||||
(xy (posn-x-y pp)))
|
||||
(list (list (car xy) (cdr xy)) (posn-window pp))))
|
||||
((not position)
|
||||
(let ((mp (mouse-pixel-position)))
|
||||
(list (list (cadr mp) (cddr mp)) (car mp))))
|
||||
(t
|
||||
position)))
|
||||
;; The looping behavior was taken from lmenu's popup-menu-popup
|
||||
(while (and map (setq event
|
||||
;; map could be a prefix key, in which case
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue