unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: david.reitter@gmail.com, jan.h.d@swipnet.se, emacs-devel@gnu.org
Subject: Re: menu-bar: disable items when no frame visible
Date: Fri, 16 Dec 2005 11:04:59 +0200	[thread overview]
Message-ID: <87irtpbata.fsf@jurta.org> (raw)
In-Reply-To: <uek4fqy4n.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 14 Dec 2005 21:25:44 +0200")

>> 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	other threads:[~2005-12-16  9:04 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-10 15:57 menu-bar: disable items when no frame visible David Reitter
2005-11-10 16:03 ` David Reitter
2005-11-10 21:12   ` David Reitter
2005-11-12  3:38     ` Richard M. Stallman
2005-11-12  7:11       ` Eli Zaretskii
2005-11-12 21:21         ` Richard M. Stallman
2005-11-12 22:44           ` Eli Zaretskii
2005-11-28  0:21         ` David Reitter
2005-11-28  5:32           ` Eli Zaretskii
2005-11-28 20:23             ` Juri Linkov
2005-11-28 21:00             ` Richard M. Stallman
2005-11-28 22:20               ` David Reitter
2005-11-28 22:46               ` Jason Rumney
2005-11-29 10:32                 ` Reiner Steib
2005-11-29 21:48                 ` Richard M. Stallman
2005-12-06  0:54                   ` Juri Linkov
2005-12-06 16:43                     ` Richard M. Stallman
2005-12-07  0:45                       ` Juri Linkov
2005-12-07 22:58                         ` Richard M. Stallman
2005-12-12  8:23                           ` Jan D.
2005-12-12 21:14                             ` Eli Zaretskii
2005-12-13  7:19                               ` Jan Djärv
2005-12-13 20:24                                 ` Eli Zaretskii
2005-12-14 17:03                                   ` Juri Linkov
2005-12-14 19:25                                     ` Eli Zaretskii
2005-12-16  9:04                                       ` Juri Linkov [this message]
2005-12-16 11:29                                         ` Eli Zaretskii
2005-12-16 12:55                                           ` Juri Linkov
2005-12-16 13:14                                             ` Eli Zaretskii
2005-12-16 14:27                                               ` Juri Linkov
2005-12-16 15:24                                                 ` Eli Zaretskii
2005-12-17 10:54                                                   ` Juri Linkov
2005-12-14 21:25                                     ` Drew Adams
2005-12-15  4:33                                       ` Eli Zaretskii
2005-12-13  3:15                             ` Richard M. Stallman
2005-12-16  9:05                             ` Juri Linkov
2005-12-16 17:40                               ` Jan Djärv
2005-12-17 10:47                                 ` Juri Linkov
2005-12-20 21:55       ` Juri Linkov
2005-12-23 20:43         ` Juri Linkov
2005-12-24 12:15           ` David Reitter
2005-12-24 20:07             ` Juri Linkov
2005-12-24 22:59               ` David Reitter
2005-12-25 16:54                 ` Stefan Monnier
2005-12-25  2:51             ` Richard M. Stallman
2005-12-25  6:44               ` Eli Zaretskii
2005-12-26  2:19                 ` Richard M. Stallman
2005-12-26  5:06                   ` Eli Zaretskii
2005-12-25  9:54               ` David Reitter
2005-12-26  2:19                 ` Richard M. Stallman
2005-12-25 16:58               ` Stefan Monnier
     [not found]               ` <87x6v29lvv.fsf-monnier+emacs@gnu.org>
2005-12-26  2:20                 ` Richard M. Stallman
2005-12-26 16:02                   ` Stefan Monnier
2005-12-26 21:56                     ` Richard M. Stallman
2005-12-27 19:01                       ` Juri Linkov
2005-12-27 19:55                         ` Stefan Monnier
2005-12-24 16:32           ` Richard M. Stallman
2005-12-24 20:12             ` Juri Linkov
2005-11-10 19:34 ` Eli Zaretskii
2005-11-10 19:39   ` David Reitter
2005-11-11  8:33     ` Eli Zaretskii
2005-11-12  3:38       ` Richard M. Stallman
2005-11-28 20:23 ` Juri Linkov
2005-11-28 22:17   ` David Reitter
2005-11-28 22:44     ` Juri Linkov
2005-11-29  0:08       ` David Reitter
2005-11-29  9:03         ` Juri Linkov
2005-11-29  9:02       ` Juri Linkov
2005-11-29  3:10   ` Richard M. Stallman
2005-11-29  9:01     ` Juri Linkov
2005-11-29 21:47       ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87irtpbata.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=david.reitter@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=jan.h.d@swipnet.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).