[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch v3] showing menu bar temporarily when f10 is pressed
From: |
Masatake YAMATO |
Subject: |
Re: [patch v3] showing menu bar temporarily when f10 is pressed |
Date: |
Wed, 18 Jul 2012 20:29:01 +0900 (JST) |
Hi,
If no objection, please, install this patch to the official source tree.
I've attached the latest version.
(I'm using this patch on gnome-shell, which provides generic(?) full-screen
mode. The full-screen mode with this patch is quite nice.)
Masatake YAMATO
>>> + (unless visible
>>> + (menu-bar-mode 1))
>>
>> Here we have a problem: if you have several frames, some of which have
>> a menu-bar and some don't, this will add a menu-bar to all of them, and
>> then (menu-bar-mode -1) will remove it from all the frames.
>
> Thank you for reviewing.
> I've revised my patch to handle the case you pointed out.
> In the new patch, I deal with only frame local parameter.
> I don't touch the minor mode.
> I have still one un solved(TODO) item.
>
>> Why do you need the menu-bar? Why not pop up the menu usually bound to
>> C-mouse-3?
>
> To be honest, I didn't know that.
> I've just tried C-mouse-3; and found some advantages of C-mouse-3
> comparing with f10 for KEYBOARD USER.
>
> 1. With C-mouse-3, the menu is pop up where mouse pointer is.
> With f10, the menu is appeared at the top of frame.
> With f10, the position is predictable.
>
> Following the cases user may lost the mouse pointer:
>
> * using large display,
> * editing text with keyboard long time, and/or
> * turning on mouse-avoidance-mode.
>
> In addition it seems that emacs hides the mouse pointer
> while the user editing text continuously.
>
> So with C-moues-3, the user have to search the menu
> popup'ed. Time taking searching is very short but
> some user may feel frustration when the menu appeared
> on somewhere far away from (point).
>
> In other hand, with f10, the user can predict the
> place where menu appears. No mental overload.
>
> 2. With C-mouse-3, the contents of menu is chosen based
> on the window where the mouse pointer is.
>
> Consider a frame is splited into two windows.
> Each window holds different buffer. And different
> major modes are activated on buffers:
>
> Window A -> Buffer B -> Major mode C.
> Window D -> Buffer D -> Major mode E.
>
> Consider the following situation:
> You are editing text on buffer B, and
> Mouse pointer is at D.
>
> When C-mouse-3 is operated in this situation, a popup menu(P0)
> which includes a menu entry for major mode E will be appeared. But
> user may exepct a popup menu(P1) which includes a menu entry for
> major mode C is appeared.
>
> To show P1 in this situation, the user must move the
> mouse pointer to somewhere Window A.
> It doesn't take long time to move the mouse pointer to
> Window A. some user may feel frustration.
>
> Moving the mouse cursor to (point) automatically before
> C-mouse-3 may convers two disadvantage of C-mouse-3 with
> keyboard operation. This is interesting idea, However, I
> feel extending [f10] is natural.
>
> Masatake YAMATO
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog 2012-06-24 15:06:24 +0000
+++ lisp/ChangeLog 2012-07-04 17:42:24 +0000
@@ -1,3 +1,15 @@
+2012-06-19 Masatake YAMATO <address@hidden>
+
+ * term/x-win.el (x-menu-bar-temorary-visibility): New custom var.
+ (x-menu-bar-open): Show menu bar temporarily if
`x-menu-bar-temorary-visibility'.
+ (x-accelerate-menu-with-temporary-visible-menu-bar): New function.
+
2012-06-24 Chong Yidong <address@hidden>
* xml.el (xml-parse-tag): Correctly handle comment embedded in
=== modified file 'src/ChangeLog'
--- src/ChangeLog 2012-06-25 10:28:47 +0000
+++ src/ChangeLog 2012-06-25 12:38:35 +0000
@@ -1,3 +1,11 @@
+2012-06-19 Masatake YAMATO <address@hidden>
+
+ * xmenu.c (popup_deactivate_callback): Run Qdeactivate_menubar_hook.
+
+ * keyboard.c (Qdeactivate_menubar_hook): Define a new hook.
+
+ * keyboard.h (Qdeactivate_menubar_hook): Declare the new hook.
+
2012-06-25 Andreas Schwab <address@hidden>
* keyboard.c (menu_bar_items, menu_bar_item, read_key_sequence):
=== modified file 'lisp/term/x-win.el'
--- lisp/term/x-win.el 2012-04-27 05:40:46 +0000
+++ lisp/term/x-win.el 2012-06-20 07:23:03 +0000
@@ -1,4 +1,4 @@
-;;; x-win.el --- parse relevant switches and set up for X -*-coding:
iso-2022-7bit;-*-
+;;; x-win.el --- parse relevant switches and set up for X -*-coding:
iso-2022-7bit; lexical-binding: t; -*-
;; Copyright (C) 1993-1994, 2001-2012 Free Software Foundation, Inc.
@@ -1190,6 +1190,15 @@
(const TEXT)))
:group 'killing)
+(defcustom x-menu-bar-temorary-visibility t
+ "Control whether use menu bar or `tmm-menubar' when `x-menu-bar-open' is
invoked.
+Non-nil means showing menu bar temporarily even if `menu-bar-mode' is turned
off.
+If nil, the behavior is changed whether `menu-bar-mode' is on or off. See
`x-menu-bar-open'
+for more detail."
+ :type 'boolean
+ :group 'x
+ :version "24.2")
+
;; Get a selection value of type TYPE by calling x-get-selection with
;; an appropriate DATA-TYPE argument decided by `x-select-request-type'.
;; The return value is already decoded. If x-get-selection causes an
@@ -1304,12 +1313,38 @@
(declare-function accelerate-menu "xmenu.c" (&optional frame) t)
+(defun x-accelerate-menu-with-temporary-visible-menu-bar (frame)
+ "Do `accelerate-menu' with temporarily visible menu bar of FRAME."
+ (let ((old-menu-bar-lines (frame-parameter frame 'menu-bar-lines))
+ (old-frame (or frame (selected-frame)))
+ (old-menu-bar-mode menu-bar-mode))
+ (if (menu-bar-positive-p old-menu-bar-lines)
+ (accelerate-menu frame)
+ (letrec ((hide (lambda ()
+ (remove-hook 'deactivate-menubar-hook hide)
+ (when (or (frame-live-p old-frame)
+ ;; Handle the case that if menu-bar-mode is
+ ;; turned on/off with choosing a menu item for
controling the mode.
+ (or (eq old-menu-bar-mode menu-bar-mode)
+ (not menu-bar-mode)))
+ (set-frame-parameter old-frame
+ 'menu-bar-lines
old-menu-bar-lines)))))
+ (set-frame-parameter old-frame 'menu-bar-lines 1)
+ (prog1
+ (accelerate-menu frame)
+ (add-hook 'deactivate-menubar-hook hide))))))
+
(defun x-menu-bar-open (&optional frame)
- "Open the menu bar if `menu-bar-mode' is on, otherwise call `tmm-menubar'."
+ "Open the menu bar if `menu-bar-mode' is on or
`x-menu-bar-temorary-visibility' is non-nil, otherwise call `tmm-menubar'."
(interactive "i")
- (if (and menu-bar-mode
- (fboundp 'accelerate-menu))
- (accelerate-menu frame)
+ (if (fboundp 'accelerate-menu)
+ (cond
+ (x-menu-bar-temorary-visibility
+ (x-accelerate-menu-with-temporary-visible-menu-bar frame))
+ (menu-bar-mode
+ (accelerate-menu frame))
+ (t
+ (tmm-menubar)))
(tmm-menubar)))
=== modified file 'src/keyboard.c'
--- src/keyboard.c 2012-06-25 10:28:47 +0000
+++ src/keyboard.c 2012-06-25 12:37:36 +0000
@@ -257,6 +257,7 @@
static Lisp_Object Qdeactivate_mark;
Lisp_Object Qrecompute_lucid_menubar, Qactivate_menubar_hook;
+Lisp_Object Qdeactivate_menubar_hook;
static Lisp_Object Qecho_area_clear_hook;
@@ -11527,6 +11528,7 @@
DEFSYM (Qrecompute_lucid_menubar, "recompute-lucid-menubar");
DEFSYM (Qactivate_menubar_hook, "activate-menubar-hook");
+ DEFSYM (Qdeactivate_menubar_hook, "deactivate-menubar-hook");
DEFSYM (Qpolling_period, "polling-period");
=== modified file 'src/keyboard.h'
--- src/keyboard.h 2012-02-10 18:58:48 +0000
+++ src/keyboard.h 2012-06-19 17:08:30 +0000
@@ -212,6 +212,7 @@
extern Lisp_Object internal_last_event_frame;
extern Lisp_Object Qrecompute_lucid_menubar, Qactivate_menubar_hook;
+extern Lisp_Object Qdeactivate_menubar_hook;
/* This holds a Lisp vector that holds the properties of a single
menu item while decoding it in parse_menu_item.
=== modified file 'src/xmenu.c'
--- src/xmenu.c 2012-06-25 04:05:48 +0000
+++ src/xmenu.c 2012-06-25 12:37:36 +0000
@@ -684,12 +684,14 @@
static void
popup_deactivate_callback (GtkWidget *widget, gpointer client_data)
{
+ safe_run_hooks (Qdeactivate_menubar_hook);
popup_activated_flag = 0;
}
#else
static void
popup_deactivate_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
{
+ safe_run_hooks (Qdeactivate_menubar_hook);
popup_activated_flag = 0;
}
#endif
- Re: [patch v3] showing menu bar temporarily when f10 is pressed,
Masatake YAMATO <=
- Re: [patch v3] showing menu bar temporarily when f10 is pressed, Stefan Monnier, 2012/07/19
- Where the menu should be appeared when C-mouse-3 is triggered (Was: [patch v3] showing menu bar temporarily when f10 is pressed), Masatake YAMATO, 2012/07/19
- Re: Where the menu should be appeared when C-mouse-3 is triggered, Stefan Monnier, 2012/07/19
- Re: Where the menu should be appeared when C-mouse-3 is triggered, Masatake YAMATO, 2012/07/20
- Re: Where the menu should be appeared when C-mouse-3 is triggered, Stefan Monnier, 2012/07/20
- Re: Where the menu should be appeared when C-mouse-3 is triggered, Masatake YAMATO, 2012/07/20
- Re: Where the menu should be appeared when C-mouse-3 is triggered, Masatake YAMATO, 2012/07/28
- Re: Where the menu should be appeared when C-mouse-3 is triggered, Masatake YAMATO, 2012/07/20