I was excited to discover mac-toggle-max-window/mac-toggle-full-
frame.  On my machine, which runs Mac OS 10.4.11, it didn't work
completely: The menu bar did not go away, even though mac-autohide-
menubar-on-maximize is t.  The reason was that SetSystemUIMode and
HideMenuBar had no effect on my system (they returned 0, but the menu
bar was still there, and GetSystemUIMode reported no change).  The
same happened in the CoreImage FunHouse demo that Apple ships with
XCode.  Out of curiosity, does anyone else have the same problem or
know why it occurs?  Are there certain MacOS versions that do not obey
HideMenuBar and SetSystemUIMode?

After looking at the source code for iTerm, which manages to hide the
menu bar, I was able to modify macfns.c and experience Emacs in
undistracting full-screen glory.  The trick was to increase the level
of Emacs's "window group" so that its frames are above the menu bar.

The possible levels are are follows (from CGWindowLevel.h):

enum _CGCommonWindowLevelKey {
    kCGBaseWindowLevelKey               = 0,
    kCGMinimumWindowLevelKey,
    kCGDesktopWindowLevelKey,
    kCGBackstopMenuLevelKey,
    kCGNormalWindowLevelKey,
    kCGFloatingWindowLevelKey,
    kCGTornOffMenuWindowLevelKey,
    kCGDockWindowLevelKey,
    kCGMainMenuWindowLevelKey,
    kCGStatusWindowLevelKey,
    kCGModalPanelWindowLevelKey,
    kCGPopUpMenuWindowLevelKey,
    kCGDraggingWindowLevelKey,
    kCGScreenSaverWindowLevelKey,
    kCGMaximumWindowLevelKey,
    kCGOverlayWindowLevelKey,
    kCGHelpWindowLevelKey,
    kCGUtilityWindowLevelKey,
    kCGDesktopIconWindowLevelKey,
    kCGCursorWindowLevelKey,
    kCGAssistiveTechHighWindowLevelKey,
    kCGNumberOfWindowLevelKeys  /* Internal bookkeeping; must be last
*/
};

I set Emacs's level to kCGScreenSaverWindowLevelKey - 1.  That way
there will be no distracting pop-ups from other programs, but the
screensaver will still work.  Of course, another call to mac-toggle-
max-window restores the original level as part of leaving full-screen
mode.

Here is a patch that can be applied to macfn.c _after_ the other
patches in SVN (i.e., after make patch):

http://www.ljosa.com/~ljosa/carbonemacs/fullscreen-patch-20080515.diff

Can someone please test that this works on MacOS X 10.5 also?  For
convenience, here is a build:

http://www.ljosa.com/~ljosa/carbonemacs/fullscreen-20080515.dmg

With my patch, one can Cmd-Tab to other applications, but they remain
below the full-screen Emacs frame.  It should be possible to register
handlers for when focus leaves and enters full-screen frame and change
the level at that point.  I'll wait to hear what people think before
attempting this.

A related question (also relevant for the current version, without my
patch): Should mac-toggle-max-window change the size of all frames, or
just the selected frame?

Finally, should we try to move the logic of switching to full-screen
mode and back into elisp so it's easier to customize and modify?

Vebjorn
--~--~---------~--~----~------------~-------~--~----~
Carbon Emacs User Group
http://groups.google.com/group/carbon-emacs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to