aboutsummaryrefslogtreecommitdiffstats
path: root/src/nsmenu.m
diff options
context:
space:
mode:
authorAlan Third2021-09-26 11:12:48 +0100
committerAlan Third2021-09-27 11:00:30 +0100
commit86bf8afa45f8d8fe19c82a9351ca445bc6f0e12e (patch)
treef34ed0d181ca604f8b4d98089fa556a344561655 /src/nsmenu.m
parent3d2d7e8ea235a13543ed475836f8f7ea4c88520e (diff)
downloademacs-86bf8afa45f8d8fe19c82a9351ca445bc6f0e12e.tar.gz
emacs-86bf8afa45f8d8fe19c82a9351ca445bc6f0e12e.zip
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)
995 /* Note: This triggers an animation, which calls windowDidResize 995 /* Note: This triggers an animation, which calls windowDidResize
996 repeatedly. */ 996 repeatedly. */
997 f->output_data.ns->in_animation = 1; 997 f->output_data.ns->in_animation = 1;
998 [[[view window] toolbar] setVisible: NO]; 998 [[[view window] toolbar] setVisible:NO];
999 f->output_data.ns->in_animation = 0; 999 f->output_data.ns->in_animation = 0;
1000 1000
1001 [[view window] setToolbar:nil];
1002
1001 unblock_input (); 1003 unblock_input ();
1002} 1004}
1003 1005
1004void 1006void
1005update_frame_tool_bar (struct frame *f) 1007update_frame_tool_bar_1 (struct frame *f, EmacsToolbar *toolbar)
1006/* -------------------------------------------------------------------------- 1008/* --------------------------------------------------------------------------
1007 Update toolbar contents. 1009 Update toolbar contents.
1008 -------------------------------------------------------------------------- */ 1010 -------------------------------------------------------------------------- */
1009{ 1011{
1010 int i, k = 0; 1012 int i, k = 0;
1011 NSWindow *window = [FRAME_NS_VIEW (f) window];
1012 EmacsToolbar *toolbar = (EmacsToolbar *)[window toolbar];
1013 1013
1014 NSTRACE ("update_frame_tool_bar"); 1014 NSTRACE ("update_frame_tool_bar");
1015 1015
1016 if (window == nil || toolbar == nil) return;
1017 block_input (); 1016 block_input ();
1018 1017
1019#ifdef NS_IMPL_COCOA 1018#ifdef NS_IMPL_COCOA
@@ -1094,13 +1093,6 @@ update_frame_tool_bar (struct frame *f)
1094#undef TOOLPROP 1093#undef TOOLPROP
1095 } 1094 }
1096 1095
1097 if (![toolbar isVisible] != !FRAME_EXTERNAL_TOOL_BAR (f))
1098 {
1099 f->output_data.ns->in_animation = 1;
1100 [toolbar setVisible: FRAME_EXTERNAL_TOOL_BAR (f)];
1101 f->output_data.ns->in_animation = 0;
1102 }
1103
1104#ifdef NS_IMPL_COCOA 1096#ifdef NS_IMPL_COCOA
1105 if ([toolbar changed]) 1097 if ([toolbar changed])
1106 { 1098 {
@@ -1124,9 +1116,28 @@ update_frame_tool_bar (struct frame *f)
1124 [newDict release]; 1116 [newDict release];
1125 } 1117 }
1126#endif 1118#endif
1119
1120 [toolbar setVisible:YES];
1127 unblock_input (); 1121 unblock_input ();
1128} 1122}
1129 1123
1124void
1125update_frame_tool_bar (struct frame *f)
1126{
1127 EmacsWindow *window = (EmacsWindow *)[FRAME_NS_VIEW (f) window];
1128 EmacsToolbar *toolbar = (EmacsToolbar *)[window toolbar];
1129
1130 if (!toolbar)
1131 {
1132 [window createToolbar:f];
1133 return;
1134 }
1135
1136 if (window == nil || toolbar == nil) return;
1137
1138 update_frame_tool_bar_1 (f, toolbar);
1139}
1140
1130 1141
1131/* ========================================================================== 1142/* ==========================================================================
1132 1143