diff options
| author | Masatake YAMATO | 2012-07-20 07:32:30 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-07-20 07:32:30 -0400 |
| commit | bbf0e7d97893b9abfe6575a408f03e48543cb513 (patch) | |
| tree | 4c902d028a64bffea758f2c5e78817a1f853549c /lisp/mouse.el | |
| parent | c28662a8dc4fefae711b21fcb7a71e871e37d1e6 (diff) | |
| download | emacs-bbf0e7d97893b9abfe6575a408f03e48543cb513.tar.gz emacs-bbf0e7d97893b9abfe6575a408f03e48543cb513.zip | |
* 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.
Diffstat (limited to 'lisp/mouse.el')
| -rw-r--r-- | lisp/mouse.el | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index a0d10a64945..84b76e184a8 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -102,7 +102,8 @@ point at the click position." | |||
| 102 | MENU can be a keymap, an easymenu-style menu or a list of keymaps as for | 102 | MENU can be a keymap, an easymenu-style menu or a list of keymaps as for |
| 103 | `x-popup-menu'. | 103 | `x-popup-menu'. |
| 104 | POSITION can be a click event or ((XOFFSET YOFFSET) WINDOW) and defaults to | 104 | POSITION can be a click event or ((XOFFSET YOFFSET) WINDOW) and defaults to |
| 105 | the current mouse position. | 105 | the current mouse position. If POSITION is a symbol, `point' the current point |
| 106 | position is used. | ||
| 106 | PREFIX is the prefix argument (if any) to pass to the command." | 107 | PREFIX is the prefix argument (if any) to pass to the command." |
| 107 | (let* ((map (cond | 108 | (let* ((map (cond |
| 108 | ((keymapp menu) menu) | 109 | ((keymapp menu) menu) |
| @@ -112,9 +113,17 @@ PREFIX is the prefix argument (if any) to pass to the command." | |||
| 112 | (plist-get (get map 'menu-prop) :filter)))) | 113 | (plist-get (get map 'menu-prop) :filter)))) |
| 113 | (if filter (funcall filter (symbol-function map)) map))))) | 114 | (if filter (funcall filter (symbol-function map)) map))))) |
| 114 | event cmd) | 115 | event cmd) |
| 115 | (unless position | 116 | (setq position |
| 116 | (let ((mp (mouse-pixel-position))) | 117 | (cond |
| 117 | (setq position (list (list (cadr mp) (cddr mp)) (car mp))))) | 118 | ((eq position 'point) |
| 119 | (let* ((pp (posn-at-point pos window)) | ||
| 120 | (xy (posn-x-y pp))) | ||
| 121 | (list (list (car xy) (cdr xy)) (posn-window pp)))) | ||
| 122 | ((not position) | ||
| 123 | (let ((mp (mouse-pixel-position))) | ||
| 124 | (list (list (cadr mp) (cddr mp)) (car mp)))) | ||
| 125 | (t | ||
| 126 | position))) | ||
| 118 | ;; The looping behavior was taken from lmenu's popup-menu-popup | 127 | ;; The looping behavior was taken from lmenu's popup-menu-popup |
| 119 | (while (and map (setq event | 128 | (while (and map (setq event |
| 120 | ;; map could be a prefix key, in which case | 129 | ;; map could be a prefix key, in which case |