aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/mouse.el17
-rw-r--r--lisp/term/x-win.el16
3 files changed, 31 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d7cb05c0664..969f36c8457 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12012-07-20 Masatake YAMATO <yamato@redhat.com>
2
3 * term/x-win.el (x-menu-bar-open): Use `frame-parameter'
4 to check whether menu-bar is shown or not. If not shown,
5 show the menu-bar as a popup menu instead of using tmm.
6 * mouse.el (popup-menu): Accept `point' as `position' argument.
7
12012-07-20 Dmitry Gutov <dgutov@yandex.ru> 82012-07-20 Dmitry Gutov <dgutov@yandex.ru>
2 9
3 * progmodes/ruby-mode.el (ruby-parse-partial): No error when end 10 * progmodes/ruby-mode.el (ruby-parse-partial): No error when end
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."
102MENU can be a keymap, an easymenu-style menu or a list of keymaps as for 102MENU can be a keymap, an easymenu-style menu or a list of keymaps as for
103`x-popup-menu'. 103`x-popup-menu'.
104POSITION can be a click event or ((XOFFSET YOFFSET) WINDOW) and defaults to 104POSITION 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
106position is used.
106PREFIX is the prefix argument (if any) to pass to the command." 107PREFIX 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
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 498cc01fe22..fb7389b856c 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -1305,12 +1305,18 @@ Request data types in the order specified by `x-select-request-type'."
1305(declare-function accelerate-menu "xmenu.c" (&optional frame) t) 1305(declare-function accelerate-menu "xmenu.c" (&optional frame) t)
1306 1306
1307(defun x-menu-bar-open (&optional frame) 1307(defun x-menu-bar-open (&optional frame)
1308 "Open the menu bar if `menu-bar-mode' is on, otherwise call `tmm-menubar'." 1308 "Open the menu bar if it is shown.
1309`popup-menu' is used if it is off "
1309 (interactive "i") 1310 (interactive "i")
1310 (if (and menu-bar-mode 1311 (cond
1311 (fboundp 'accelerate-menu)) 1312 ((and (not (zerop (or (frame-parameter nil 'menu-bar-lines) 0)))
1312 (accelerate-menu frame) 1313 (fboundp 'accelerate-menu))
1313 (tmm-menubar))) 1314 (accelerate-menu frame))
1315 (t
1316 (popup-menu (mouse-menu-bar-map)
1317 (if (listp last-nonmenu-event)
1318 nil
1319 'point)))))
1314 1320
1315 1321
1316;;; Window system initialization. 1322;;; Window system initialization.