diff options
| author | Anders Lindgren | 2015-10-28 12:06:39 +0100 |
|---|---|---|
| committer | Anders Lindgren | 2015-10-28 12:06:39 +0100 |
| commit | 590449f3d87f8f43eb0a852233e8945ecbe1c6aa (patch) | |
| tree | 7c3c96ae80d72318be524f475ea7a84e98870166 /src/nsmenu.m | |
| parent | 934bfb933f4981b2edaa208186e2f8781ab6cb9f (diff) | |
| download | emacs-590449f3d87f8f43eb0a852233e8945ecbe1c6aa.tar.gz emacs-590449f3d87f8f43eb0a852233e8945ecbe1c6aa.zip | |
Fix incorrect NextStep tool-bar-mode -- wrong number of rows in frame.
* nsterm.h (struct ns_output): New flag, in_animation.
* nsfns.m (Fx_create_frame): Initialize in_animation flag.
* nsmenu.m (free_frame_tool_bar, update_frame_tool_bar): Set
in_animation flag around call to "setVisible". Set new tool bar
height before call to setVisible.
* nsterm.m (x_set_window_size): Don't call [view setRow:
andColumns:] as this fools the subsequent call to updateFrameSize
from performing the real resize.
(windowDidResize): Don't update anything when in_animation is
non-zero.
Trace output.
* nsmenu.m (free_frame_tool_bar, update_frame_tool_bar)
(EmacsToolbar):
* nsterm.m (x_set_window_size, updateFrameSize)
([EmacsView setRows: andColumns:])
Diffstat (limited to 'src/nsmenu.m')
| -rw-r--r-- | src/nsmenu.m | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/nsmenu.m b/src/nsmenu.m index 2ef12234960..ddc5dc20a82 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -998,10 +998,20 @@ free_frame_tool_bar (struct frame *f) | |||
| 998 | -------------------------------------------------------------------------- */ | 998 | -------------------------------------------------------------------------- */ |
| 999 | { | 999 | { |
| 1000 | EmacsView *view = FRAME_NS_VIEW (f); | 1000 | EmacsView *view = FRAME_NS_VIEW (f); |
| 1001 | |||
| 1002 | NSTRACE ("free_frame_tool_bar"); | ||
| 1003 | |||
| 1001 | block_input (); | 1004 | block_input (); |
| 1002 | view->wait_for_tool_bar = NO; | 1005 | view->wait_for_tool_bar = NO; |
| 1003 | [[view toolbar] setVisible: NO]; | 1006 | |
| 1004 | FRAME_TOOLBAR_HEIGHT (f) = 0; | 1007 | FRAME_TOOLBAR_HEIGHT (f) = 0; |
| 1008 | |||
| 1009 | /* Note: This trigger an animation, which calls windowDidResize | ||
| 1010 | repeatedly. */ | ||
| 1011 | f->output_data.ns->in_animation = 1; | ||
| 1012 | [[view toolbar] setVisible: NO]; | ||
| 1013 | f->output_data.ns->in_animation = 0; | ||
| 1014 | |||
| 1005 | unblock_input (); | 1015 | unblock_input (); |
| 1006 | } | 1016 | } |
| 1007 | 1017 | ||
| @@ -1017,6 +1027,8 @@ update_frame_tool_bar (struct frame *f) | |||
| 1017 | EmacsToolbar *toolbar = [view toolbar]; | 1027 | EmacsToolbar *toolbar = [view toolbar]; |
| 1018 | int oldh; | 1028 | int oldh; |
| 1019 | 1029 | ||
| 1030 | NSTRACE ("update_frame_tool_bar"); | ||
| 1031 | |||
| 1020 | if (view == nil || toolbar == nil) return; | 1032 | if (view == nil || toolbar == nil) return; |
| 1021 | block_input (); | 1033 | block_input (); |
| 1022 | 1034 | ||
| @@ -1096,7 +1108,11 @@ update_frame_tool_bar (struct frame *f) | |||
| 1096 | } | 1108 | } |
| 1097 | 1109 | ||
| 1098 | if (![toolbar isVisible]) | 1110 | if (![toolbar isVisible]) |
| 1111 | { | ||
| 1112 | f->output_data.ns->in_animation = 1; | ||
| 1099 | [toolbar setVisible: YES]; | 1113 | [toolbar setVisible: YES]; |
| 1114 | f->output_data.ns->in_animation = 0; | ||
| 1115 | } | ||
| 1100 | 1116 | ||
| 1101 | #ifdef NS_IMPL_COCOA | 1117 | #ifdef NS_IMPL_COCOA |
| 1102 | if ([toolbar changed]) | 1118 | if ([toolbar changed]) |
| @@ -1150,6 +1166,8 @@ update_frame_tool_bar (struct frame *f) | |||
| 1150 | 1166 | ||
| 1151 | - initForView: (EmacsView *)view withIdentifier: (NSString *)identifier | 1167 | - initForView: (EmacsView *)view withIdentifier: (NSString *)identifier |
| 1152 | { | 1168 | { |
| 1169 | NSTRACE ("[EmacsToolbar initForView: withIdentifier:]"); | ||
| 1170 | |||
| 1153 | self = [super initWithIdentifier: identifier]; | 1171 | self = [super initWithIdentifier: identifier]; |
| 1154 | emacsView = view; | 1172 | emacsView = view; |
| 1155 | [self setDisplayMode: NSToolbarDisplayModeIconOnly]; | 1173 | [self setDisplayMode: NSToolbarDisplayModeIconOnly]; |
| @@ -1164,6 +1182,8 @@ update_frame_tool_bar (struct frame *f) | |||
| 1164 | 1182 | ||
| 1165 | - (void)dealloc | 1183 | - (void)dealloc |
| 1166 | { | 1184 | { |
| 1185 | NSTRACE ("[EmacsToolbar dealloc]"); | ||
| 1186 | |||
| 1167 | [prevIdentifiers release]; | 1187 | [prevIdentifiers release]; |
| 1168 | [activeIdentifiers release]; | 1188 | [activeIdentifiers release]; |
| 1169 | [identifierToItem release]; | 1189 | [identifierToItem release]; |
| @@ -1172,6 +1192,8 @@ update_frame_tool_bar (struct frame *f) | |||
| 1172 | 1192 | ||
| 1173 | - (void) clearActive | 1193 | - (void) clearActive |
| 1174 | { | 1194 | { |
| 1195 | NSTRACE ("[EmacsToolbar clearActive]"); | ||
| 1196 | |||
| 1175 | [prevIdentifiers release]; | 1197 | [prevIdentifiers release]; |
| 1176 | prevIdentifiers = [activeIdentifiers copy]; | 1198 | prevIdentifiers = [activeIdentifiers copy]; |
| 1177 | [activeIdentifiers removeAllObjects]; | 1199 | [activeIdentifiers removeAllObjects]; |
| @@ -1181,6 +1203,8 @@ update_frame_tool_bar (struct frame *f) | |||
| 1181 | 1203 | ||
| 1182 | - (void) clearAll | 1204 | - (void) clearAll |
| 1183 | { | 1205 | { |
| 1206 | NSTRACE ("[EmacsToolbar clearAll]"); | ||
| 1207 | |||
| 1184 | [self clearActive]; | 1208 | [self clearActive]; |
| 1185 | while ([[self items] count] > 0) | 1209 | while ([[self items] count] > 0) |
| 1186 | [self removeItemAtIndex: 0]; | 1210 | [self removeItemAtIndex: 0]; |
| @@ -1188,6 +1212,8 @@ update_frame_tool_bar (struct frame *f) | |||
| 1188 | 1212 | ||
| 1189 | - (BOOL) changed | 1213 | - (BOOL) changed |
| 1190 | { | 1214 | { |
| 1215 | NSTRACE ("[EmacsToolbar changed]"); | ||
| 1216 | |||
| 1191 | return [activeIdentifiers isEqualToArray: prevIdentifiers] && | 1217 | return [activeIdentifiers isEqualToArray: prevIdentifiers] && |
| 1192 | enablement == prevEnablement ? NO : YES; | 1218 | enablement == prevEnablement ? NO : YES; |
| 1193 | } | 1219 | } |
| @@ -1198,6 +1224,8 @@ update_frame_tool_bar (struct frame *f) | |||
| 1198 | helpText: (const char *)help | 1224 | helpText: (const char *)help |
| 1199 | enabled: (BOOL)enabled | 1225 | enabled: (BOOL)enabled |
| 1200 | { | 1226 | { |
| 1227 | NSTRACE ("[EmacsToolbar addDisplayItemWithImage: ...]"); | ||
| 1228 | |||
| 1201 | /* 1) come up w/identifier */ | 1229 | /* 1) come up w/identifier */ |
| 1202 | NSString *identifier | 1230 | NSString *identifier |
| 1203 | = [NSString stringWithFormat: @"%lu", (unsigned long)[img hash]]; | 1231 | = [NSString stringWithFormat: @"%lu", (unsigned long)[img hash]]; |
| @@ -1231,6 +1259,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 1231 | all items to enabled state (for some reason). */ | 1259 | all items to enabled state (for some reason). */ |
| 1232 | - (void)validateVisibleItems | 1260 | - (void)validateVisibleItems |
| 1233 | { | 1261 | { |
| 1262 | NSTRACE ("[EmacsToolbar validateVisibleItems]"); | ||
| 1234 | } | 1263 | } |
| 1235 | 1264 | ||
| 1236 | 1265 | ||
| @@ -1240,12 +1269,16 @@ update_frame_tool_bar (struct frame *f) | |||
| 1240 | itemForItemIdentifier: (NSString *)itemIdentifier | 1269 | itemForItemIdentifier: (NSString *)itemIdentifier |
| 1241 | willBeInsertedIntoToolbar: (BOOL)flag | 1270 | willBeInsertedIntoToolbar: (BOOL)flag |
| 1242 | { | 1271 | { |
| 1272 | NSTRACE ("[EmacsToolbar toolbar: ...]"); | ||
| 1273 | |||
| 1243 | /* look up NSToolbarItem by identifier and return... */ | 1274 | /* look up NSToolbarItem by identifier and return... */ |
| 1244 | return [identifierToItem objectForKey: itemIdentifier]; | 1275 | return [identifierToItem objectForKey: itemIdentifier]; |
| 1245 | } | 1276 | } |
| 1246 | 1277 | ||
| 1247 | - (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar | 1278 | - (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar |
| 1248 | { | 1279 | { |
| 1280 | NSTRACE ("[EmacsToolbar toolbarDefaultItemIdentifiers:]"); | ||
| 1281 | |||
| 1249 | /* return entire set.. */ | 1282 | /* return entire set.. */ |
| 1250 | return activeIdentifiers; | 1283 | return activeIdentifiers; |
| 1251 | } | 1284 | } |
| @@ -1253,6 +1286,8 @@ update_frame_tool_bar (struct frame *f) | |||
| 1253 | /* for configuration palette (not yet supported) */ | 1286 | /* for configuration palette (not yet supported) */ |
| 1254 | - (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar | 1287 | - (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar |
| 1255 | { | 1288 | { |
| 1289 | NSTRACE ("[EmacsToolbar toolbarAllowedItemIdentifiers:]"); | ||
| 1290 | |||
| 1256 | /* return entire set... */ | 1291 | /* return entire set... */ |
| 1257 | return activeIdentifiers; | 1292 | return activeIdentifiers; |
| 1258 | //return [identifierToItem allKeys]; | 1293 | //return [identifierToItem allKeys]; |