From 28c760996e94d41321d33b97237e491659516bd0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Sun, 6 Oct 2013 17:53:30 +0200 Subject: [PATCH] * nsterm.m (ns_update_begin): If native fullscreen and no toolbar, hide toolbar. (windowDidEnterFullScreen:): If presentation options are zero, set them here (Bug#15388). --- src/ChangeLog | 7 +++++++ src/nsterm.m | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 83ef0f55906..af5dbb8924d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2013-10-06 Jan Djärv + + * nsterm.m (ns_update_begin): If native fullscreen and no toolbar, + hide toolbar (Bug#15388). + (windowDidEnterFullScreen:): If presentation options are zero, + set them here (Bug#15388). + 2013-10-05 Xue Fuqiao * editfns.c (message): Mention batch mode in doc string. diff --git a/src/nsterm.m b/src/nsterm.m index 4a486aa4018..be660d99e8a 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -673,11 +673,22 @@ ns_update_begin (struct frame *f) external (RIF) call; whole frame, called before update_window_begin -------------------------------------------------------------------------- */ { - NSView *view = FRAME_NS_VIEW (f); + EmacsView *view = FRAME_NS_VIEW (f); NSTRACE (ns_update_begin); ns_update_auto_hide_menu_bar (); +#ifdef NS_IMPL_COCOA + if ([view isFullscreen] && [view fsIsNative]) + { + // Fix reappearing tool bar in fullscreen for OSX 10.7 + BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (f) ? YES : NO; + NSToolbar *toolbar = [FRAME_NS_VIEW (f) toolbar]; + if (! tbar_visible != ! [toolbar isVisible]) + [toolbar setVisible: tbar_visible]; + } +#endif + ns_updating_frame = f; [view lockFocus]; @@ -6115,8 +6126,27 @@ if (cols > 0 && rows > 0) [self windowDidBecomeKey:notification]; [nonfs_window orderOut:self]; } - else if (! FRAME_EXTERNAL_TOOL_BAR (emacsframe)) - [toolbar setVisible:NO]; + else + { + BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (emacsframe) ? YES : NO; +#ifdef NS_IMPL_COCOA + unsigned val = (unsigned)[NSApp presentationOptions]; + + // OSX 10.7 bug fix, the menu won't appear without this. + // val is non-zero on other OSX versions. + if (val == 0) + { + NSApplicationPresentationOptions options + = NSApplicationPresentationAutoHideDock + | NSApplicationPresentationAutoHideMenuBar + | NSApplicationPresentationFullScreen + | NSApplicationPresentationAutoHideToolbar; + + [NSApp setPresentationOptions: options]; + } +#endif + [toolbar setVisible:tbar_visible]; + } } - (void)windowWillExitFullScreen:(NSNotification *)notification -- 2.39.2