From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: menu-bar: disable items when no frame visible Date: Fri, 16 Dec 2005 11:04:59 +0200 Organization: JURTA Message-ID: <87irtpbata.fsf@jurta.org> References: <708F3D2D-A87C-4F80-BC27-171D82653F4D@gmail.com> <069BF3EB-C5E4-4042-91E9-0DFB37C58E99@gmail.com> <36F6CF11-E742-4175-A995-E5A62EC2A335@gmail.com> <87psobhwo5.fsf@jurta.org> <87u0dl3gpy.fsf@jurta.org> <439D3397.1020404@swipnet.se> <439E75F8.4050201@swipnet.se> <877ja71vyq.fsf@jurta.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1134750083 12100 80.91.229.2 (16 Dec 2005 16:21:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 16 Dec 2005 16:21:23 +0000 (UTC) Cc: david.reitter@gmail.com, jan.h.d@swipnet.se, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 16 17:21:21 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EnIJn-0000f1-LK for ged-emacs-devel@m.gmane.org; Fri, 16 Dec 2005 17:20:28 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EnIKU-0006r5-Vs for ged-emacs-devel@m.gmane.org; Fri, 16 Dec 2005 11:21:11 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EnEyX-0002mo-7Q for emacs-devel@gnu.org; Fri, 16 Dec 2005 07:46:17 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EnEku-00008J-40 for emacs-devel@gnu.org; Fri, 16 Dec 2005 07:32:13 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EnD2B-0000l7-Cp for emacs-devel@gnu.org; Fri, 16 Dec 2005 05:41:57 -0500 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EnD4X-0005sc-75; Fri, 16 Dec 2005 05:44:21 -0500 Original-Received: from mail.neti.ee (80-235-33-94-dsl.mus.estpak.ee [80.235.33.94]) by Relayhost1.neti.ee (Postfix) with ESMTP id 138081A85; Fri, 16 Dec 2005 12:41:24 +0200 (EET) Original-To: Eli Zaretskii In-Reply-To: (Eli Zaretskii's message of "Wed, 14 Dec 2005 21:25:44 +0200") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:47860 Archived-At: >> 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/