* 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.
/* 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
#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])
{
[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);
+}
+
/* ==========================================================================
- (instancetype)initWithEmacsFrame:(struct frame *)f;
- (instancetype)initWithEmacsFrame:(struct frame *)f fullscreen:(BOOL)fullscreen screen:(NSScreen *)screen;
+- (void)createToolbar:(struct frame *)f;
- (void)setParentChildRelationships;
- (NSInteger)borderWidth;
- (BOOL)restackWindow:(NSWindow *)win above:(BOOL)above;
/* in nsmenu */
extern void update_frame_tool_bar (struct frame *f);
+#ifdef __OBJC__
+extern void update_frame_tool_bar_1 (struct frame *f, EmacsToolbar *toolbar);
+#endif
+
extern void free_frame_tool_bar (struct frame *f);
extern Lisp_Object find_and_return_menu_selection (struct frame *f,
bool keymaps,
ns_update_auto_hide_menu_bar ();
- NSToolbar *toolbar = [[FRAME_NS_VIEW (f) window] toolbar];
- if (toolbar)
- {
- /* Ensure the toolbars visibility is set correctly. */
- BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (f) ? YES : NO;
- if (! tbar_visible != ! [toolbar isVisible])
- [toolbar setVisible: tbar_visible];
- }
-
ns_updating_frame = f;
[view lockFocus];
}
}
else
{
- BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (emacsframe) ? YES : NO;
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 \
&& MAC_OS_X_VERSION_MIN_REQUIRED <= 1070
unsigned val = (unsigned)[NSApp presentationOptions];
[NSApp setPresentationOptions: options];
}
#endif
- [[[self window]toolbar] setVisible:tbar_visible];
}
}
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
[self updateCollectionBehavior];
#endif
- if (FRAME_EXTERNAL_TOOL_BAR (emacsframe))
- {
- [[[self window] toolbar] setVisible:YES];
- update_frame_tool_bar (emacsframe);
- [[self window] display];
- }
- else
- [[[self window] toolbar] setVisible:NO];
if (next_maximized != -1)
[[self window] performZoom:self];
[self setOpaque:NO];
/* toolbar support */
- if (! FRAME_UNDECORATED (f))
- [self createToolbar:f];
+ [self createToolbar:f];
/* macOS Sierra automatically enables tabbed windows. We can't
allow this to be enabled until it's available on a Free system.
- (void)createToolbar: (struct frame *)f
{
+ if (FRAME_UNDECORATED (f) || !FRAME_EXTERNAL_TOOL_BAR (f))
+ return;
+
EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
EmacsToolbar *toolbar = [[EmacsToolbar alloc]
initForView:view
withIdentifier:[NSString stringWithLispString:f->name]];
- [toolbar setVisible:NO];
+
[self setToolbar:toolbar];
+ update_frame_tool_bar_1 (f, toolbar);
#ifdef NS_IMPL_COCOA
{