From 527ba13636c83f826d385de628d5e56556cfa021 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sun, 12 Sep 2021 12:42:11 +0100 Subject: [PATCH] Fix incorrectly appearing toolbar on NS (bug#50534) * src/nsterm.h (FRAME_TOOLBAR_P): Work out whether the frame should have a toolbar or not. * src/nsterm.m (ns_update_begin): ([EmacsView windowDidEnterFullScreen]): ([EmacsView windowDidExitFullScreen]): Use new FRAME_TOOLBAR_P instead of the apparently unreliable FRAME_EXTERNAL_TOOL_BAR. --- src/nsterm.h | 3 +++ src/nsterm.m | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/nsterm.h b/src/nsterm.h index 6d4ea77121..8fb9c0fda1 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1074,6 +1074,9 @@ #define FIRST_CHAR_POSITION(f) \ (! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0 \ : FRAME_SCROLL_BAR_COLS (f)) +#define FRAME_TOOLBAR_P(f) (FRAME_EXTERNAL_TOOL_BAR (f) \ + && FRAME_TOOL_BAR_LINES (f) > 0) + extern struct ns_display_info *ns_term_init (Lisp_Object display_name); extern void ns_term_shutdown (int sig); diff --git a/src/nsterm.m b/src/nsterm.m index 8d88f7bd3d..24a2383848 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1025,7 +1025,7 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) if ([view isFullscreen] && [view fsIsNative]) { // Fix reappearing tool bar in fullscreen for Mac OS X 10.7 - BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (f) ? YES : NO; + BOOL tbar_visible = FRAME_TOOLBAR_P (f); NSToolbar *toolbar = [[FRAME_NS_VIEW (f) window] toolbar]; if (! tbar_visible != ! [toolbar isVisible]) [toolbar setVisible: tbar_visible]; @@ -7403,7 +7403,7 @@ - (void)windowDidEnterFullScreen /* provided for direct calls */ } else { - BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (emacsframe) ? YES : NO; + BOOL tbar_visible = FRAME_TOOLBAR_P (emacsframe); #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 \ && MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 unsigned val = (unsigned)[NSApp presentationOptions]; @@ -7462,7 +7462,7 @@ - (void)windowDidExitFullScreen /* provided for direct calls */ #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 [self updateCollectionBehavior]; #endif - if (FRAME_EXTERNAL_TOOL_BAR (emacsframe)) + if (FRAME_TOOLBAR_P (emacsframe)) { [[[self window] toolbar] setVisible:YES]; update_frame_tool_bar (emacsframe); -- 2.30.2