summaryrefslogtreecommitdiff
path: root/src/nsmenu.m
diff options
context:
space:
mode:
authorAlan Third <alan@idiocy.org>2021-09-26 11:12:48 +0100
committerAlan Third <alan@idiocy.org>2021-09-27 11:00:30 +0100
commit86bf8afa45f8d8fe19c82a9351ca445bc6f0e12e (patch)
treef34ed0d181ca604f8b4d98089fa556a344561655 /src/nsmenu.m
parent3d2d7e8ea235a13543ed475836f8f7ea4c88520e (diff)
Fix NS toolbar again (bug#50534)
* src/nsmenu.m (free_frame_tool_bar): Remove toolbar. (update_frame_tool_bar_1): New function. (update_frame_tool_bar): Move most of the functionality to update_frame_tool_bar_1. * src/nsterm.h: Definitions of functions and methods. * src/nsterm.m (ns_update_begin): ([EmacsView windowDidEnterFullScreen]): ([EmacsView windowDidExitFullScreen]): We no longer need to reset the toolbar visibility as that's done when we create the new fullscreen window. ([EmacsWindow initWithEmacsFrame:fullscreen:screen:]): Move the check for undecorated frames into createToolbar:. ([EmacsWindow createToolbar:]): Check whether a toolbar should be created, and run the toolbar update immediately.
Diffstat (limited to 'src/nsmenu.m')
-rw-r--r--src/nsmenu.m35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/nsmenu.m b/src/nsmenu.m
index f0c5bb24e63..9b78643d56a 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -995,25 +995,24 @@ free_frame_tool_bar (struct frame *f)
/* Note: This triggers an animation, which calls windowDidResize
repeatedly. */
f->output_data.ns->in_animation = 1;
- [[[view window] toolbar] setVisible: NO];
+ [[[view window] toolbar] setVisible:NO];
f->output_data.ns->in_animation = 0;
+ [[view window] setToolbar:nil];
+
unblock_input ();
}
void
-update_frame_tool_bar (struct frame *f)
+update_frame_tool_bar_1 (struct frame *f, EmacsToolbar *toolbar)
/* --------------------------------------------------------------------------
Update toolbar contents.
-------------------------------------------------------------------------- */
{
int i, k = 0;
- NSWindow *window = [FRAME_NS_VIEW (f) window];
- EmacsToolbar *toolbar = (EmacsToolbar *)[window toolbar];
NSTRACE ("update_frame_tool_bar");
- if (window == nil || toolbar == nil) return;
block_input ();
#ifdef NS_IMPL_COCOA
@@ -1094,13 +1093,6 @@ update_frame_tool_bar (struct frame *f)
#undef TOOLPROP
}
- if (![toolbar isVisible] != !FRAME_EXTERNAL_TOOL_BAR (f))
- {
- f->output_data.ns->in_animation = 1;
- [toolbar setVisible: FRAME_EXTERNAL_TOOL_BAR (f)];
- f->output_data.ns->in_animation = 0;
- }
-
#ifdef NS_IMPL_COCOA
if ([toolbar changed])
{
@@ -1124,9 +1116,28 @@ update_frame_tool_bar (struct frame *f)
[newDict release];
}
#endif
+
+ [toolbar setVisible:YES];
unblock_input ();
}
+void
+update_frame_tool_bar (struct frame *f)
+{
+ EmacsWindow *window = (EmacsWindow *)[FRAME_NS_VIEW (f) window];
+ EmacsToolbar *toolbar = (EmacsToolbar *)[window toolbar];
+
+ if (!toolbar)
+ {
+ [window createToolbar:f];
+ return;
+ }
+
+ if (window == nil || toolbar == nil) return;
+
+ update_frame_tool_bar_1 (f, toolbar);
+}
+
/* ==========================================================================