emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: menu-bar: disable items when no frame visible


From: Juri Linkov
Subject: Re: menu-bar: disable items when no frame visible
Date: Fri, 16 Dec 2005 11:04:59 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>> This problem exists not only on non-toolkit X builds, but also
>> for toolbars and pop-up menus of all X toolkits, and perhaps also
>> on Mac and Windows.  Could you try to evaluate on Windows
>> 
>>   (define-key global-map [down-mouse-3] menu-bar-file-menu)
>> 
>> and to click [mouse-3] on a buffer.  Do you see "Save As..." disabled?
>
> Yes.

Below is a fix that sets menu-updating-frame correctly for three
platforms (X, Mac, W32), and also doesn't disable menu items
permanently on tty and non-toolkit X builds:

Index: src/xmenu.c
===================================================================
RCS file: /sources/emacs/emacs/src/xmenu.c,v
retrieving revision 1.296
diff -c -r1.296 xmenu.c
*** src/xmenu.c 12 Dec 2005 08:08:43 -0000      1.296
--- src/xmenu.c 16 Dec 2005 09:02:32 -0000
***************
*** 899,906 ****
  
        xpos += XINT (x);
        ypos += XINT (y);
      }
!   Vmenu_updating_frame = Qnil;
  #endif /* HAVE_MENUS */
  
    record_unwind_protect (unuse_menu_items, Qnil);
--- 899,909 ----
  
        xpos += XINT (x);
        ypos += XINT (y);
+ 
+       XSETFRAME (Vmenu_updating_frame, f);
      }
!   else
!     Vmenu_updating_frame = Qnil;
  #endif /* HAVE_MENUS */
  
    record_unwind_protect (unuse_menu_items, Qnil);

Index: src/w32menu.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32menu.c,v
retrieving revision 1.77
diff -c -r1.77 w32menu.c
*** src/w32menu.c       31 Aug 2005 15:22:15 -0000      1.77
--- src/w32menu.c       16 Dec 2005 09:02:33 -0000
***************
*** 738,744 ****
  
        XSETFRAME (Vmenu_updating_frame, f);
      }
!   Vmenu_updating_frame = Qnil;
  #endif /* HAVE_MENUS */
  
    title = Qnil;
--- 738,745 ----
  
        XSETFRAME (Vmenu_updating_frame, f);
      }
!   else
!     Vmenu_updating_frame = Qnil;
  #endif /* HAVE_MENUS */
  
    title = Qnil;

Index: src/macmenu.c
===================================================================
RCS file: /sources/emacs/emacs/src/macmenu.c,v
retrieving revision 1.32
diff -c -r1.32 macmenu.c
*** src/macmenu.c       7 Aug 2005 12:33:17 -0000       1.32
--- src/macmenu.c       16 Dec 2005 09:02:34 -0000
***************
*** 746,752 ****
  
        XSETFRAME (Vmenu_updating_frame, f);
      }
!   Vmenu_updating_frame = Qnil;
  #endif /* HAVE_MENUS */
  
    title = Qnil;
--- 746,753 ----
  
        XSETFRAME (Vmenu_updating_frame, f);
      }
!   else
!     Vmenu_updating_frame = Qnil;
  #endif /* HAVE_MENUS */
  
    title = Qnil;

Index: lisp/menu-bar.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/menu-bar.el,v
retrieving revision 1.284
diff -c -r1.284 menu-bar.el
*** lisp/menu-bar.el    13 Dec 2005 11:07:50 -0000      1.284
--- lisp/menu-bar.el    16 Dec 2005 09:02:43 -0000
***************
*** 1418,1425 ****
  (defun menu-bar-menu-frame-live-and-visible-p ()
    "Return non-nil if the menu frame is alive and visible.
  The menu frame is the frame for which we are updating the menu."
!   (let ((menu-frame (if (display-multi-frame-p) menu-updating-frame
!                     (selected-frame))))
      (and (frame-live-p menu-frame)
         (frame-visible-p menu-frame))))
  
--- 1418,1424 ----
  (defun menu-bar-menu-frame-live-and-visible-p ()
    "Return non-nil if the menu frame is alive and visible.
  The menu frame is the frame for which we are updating the menu."
!   (let ((menu-frame (or menu-updating-frame (selected-frame))))
      (and (frame-live-p menu-frame)
         (frame-visible-p menu-frame))))
  
***************
*** 1428,1435 ****
  
  See the documentation of `menu-bar-menu-frame-live-and-visible-p'
  for the definition of the menu frame."
!   (let ((menu-frame (if (display-multi-frame-p) menu-updating-frame
!                     (selected-frame))))
      (not (window-minibuffer-p (frame-selected-window menu-frame)))))
  
  (defun kill-this-buffer ()    ; for the menubar
--- 1427,1433 ----
  
  See the documentation of `menu-bar-menu-frame-live-and-visible-p'
  for the definition of the menu frame."
!   (let ((menu-frame (or menu-updating-frame (selected-frame))))
      (not (window-minibuffer-p (frame-selected-window menu-frame)))))
  
  (defun kill-this-buffer ()    ; for the menubar

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]