emacs-devel
[Top][All Lists]
Advanced

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

Re: Should this package be included into the NS port?


From: Nick Helm
Subject: Re: Should this package be included into the NS port?
Date: Wed, 23 May 2018 16:55:50 +1200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (darwin)

On Sat, 19 May 2018 at 22:33:29 +1200, Alan Third wrote:

> On Sat, May 19, 2018 at 04:42:54PM +1200, Nick Helm wrote:
>> 
>> This is interesting. I think we could tweak the EmacsMenu side of things
>> to do this, even with the current code. We'd want to make sure to
>> include some kind of new frame command somewhere.
>> 
>> These menus are derived dynamically from Lisp though, and it might be
>> difficult to convince it to provide valid entries when no frame is
>> selected. 
>
> I’m not sure if the ‘Emacs’ menu is derived from lisp. If you turn off
> menus completely it still exists.

Sorry, I meant to say the mainMenu, which holds all the Lisp menu stuff.
Yes, the menu named 'Emacs' (the appMenu) is defined in nsterm.m and
doesn't change as far as I know.

>> One way around that might be to create a new menu containing
>> static NSMenu versions of File and Help, much like we do for the appMenu
>> now. When no frame is selected and there are no Lisp menu entries, we
>> switch mainMenu to this new menu. When a frame is created, we switch
>> back. 
>
> Perhaps we could modify ns_update_menubar to handle the case where
> there’s no frame?

Maybe, I'm not sure. At the moment, as soon as ns_update_menubar sees
that it's not acting on the selected frame it gives up. I tried a quick
hack that sets f (the frame) to nil, bypasses the Lisp menu update code
and switches in a different static menu, but I couldn't get it to work
at all.

BTW, if you toggle the menu display off with (menu-bar-mode -1), you can
switch between frames/windows without the Lisp menus updating. This
prevents set_frame_menubar (and ns_update_menubar) from being called at
all.

As soon as you click in the menu-bar though, x_activate_menubar is
called, which does an ns_update_menubar, which inserts the menus for the
selected frame/window. Not sure why this happens, maybe Lisp assumes the
menu-bar is un-clickable if it's not supposed to be displayed? (mac
always shows a menu-bar, however)

I only mention this because I wonder if there might be a way to handle
the no-frame case with set_frame_menubar and x_activate_menubar, and
avoid messing with ns_update_menubar at all?




reply via email to

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