* 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:])
= [NSCursor arrowCursor];
f->output_data.ns->current_pointer = f->output_data.ns->text_cursor;
+ f->output_data.ns->in_animation = NO;
+
[[EmacsView alloc] initFrameFromEmacs: f];
x_icon (f, parms);
-------------------------------------------------------------------------- */
{
EmacsView *view = FRAME_NS_VIEW (f);
+
+ NSTRACE ("free_frame_tool_bar");
+
block_input ();
view->wait_for_tool_bar = NO;
- [[view toolbar] setVisible: NO];
+
FRAME_TOOLBAR_HEIGHT (f) = 0;
+
+ /* Note: This trigger an animation, which calls windowDidResize
+ repeatedly. */
+ f->output_data.ns->in_animation = 1;
+ [[view toolbar] setVisible: NO];
+ f->output_data.ns->in_animation = 0;
+
unblock_input ();
}
EmacsToolbar *toolbar = [view toolbar];
int oldh;
+ NSTRACE ("update_frame_tool_bar");
+
if (view == nil || toolbar == nil) return;
block_input ();
}
if (![toolbar isVisible])
+ {
+ f->output_data.ns->in_animation = 1;
[toolbar setVisible: YES];
+ f->output_data.ns->in_animation = 0;
+ }
#ifdef NS_IMPL_COCOA
if ([toolbar changed])
- initForView: (EmacsView *)view withIdentifier: (NSString *)identifier
{
+ NSTRACE ("[EmacsToolbar initForView: withIdentifier:]");
+
self = [super initWithIdentifier: identifier];
emacsView = view;
[self setDisplayMode: NSToolbarDisplayModeIconOnly];
- (void)dealloc
{
+ NSTRACE ("[EmacsToolbar dealloc]");
+
[prevIdentifiers release];
[activeIdentifiers release];
[identifierToItem release];
- (void) clearActive
{
+ NSTRACE ("[EmacsToolbar clearActive]");
+
[prevIdentifiers release];
prevIdentifiers = [activeIdentifiers copy];
[activeIdentifiers removeAllObjects];
- (void) clearAll
{
+ NSTRACE ("[EmacsToolbar clearAll]");
+
[self clearActive];
while ([[self items] count] > 0)
[self removeItemAtIndex: 0];
- (BOOL) changed
{
+ NSTRACE ("[EmacsToolbar changed]");
+
return [activeIdentifiers isEqualToArray: prevIdentifiers] &&
enablement == prevEnablement ? NO : YES;
}
helpText: (const char *)help
enabled: (BOOL)enabled
{
+ NSTRACE ("[EmacsToolbar addDisplayItemWithImage: ...]");
+
/* 1) come up w/identifier */
NSString *identifier
= [NSString stringWithFormat: @"%lu", (unsigned long)[img hash]];
all items to enabled state (for some reason). */
- (void)validateVisibleItems
{
+ NSTRACE ("[EmacsToolbar validateVisibleItems]");
}
itemForItemIdentifier: (NSString *)itemIdentifier
willBeInsertedIntoToolbar: (BOOL)flag
{
+ NSTRACE ("[EmacsToolbar toolbar: ...]");
+
/* look up NSToolbarItem by identifier and return... */
return [identifierToItem objectForKey: itemIdentifier];
}
- (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar
{
+ NSTRACE ("[EmacsToolbar toolbarDefaultItemIdentifiers:]");
+
/* return entire set.. */
return activeIdentifiers;
}
/* for configuration palette (not yet supported) */
- (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar
{
+ NSTRACE ("[EmacsToolbar toolbarAllowedItemIdentifiers:]");
+
/* return entire set... */
return activeIdentifiers;
//return [identifierToItem allKeys];
========================================================================== */
-/* Uncomment the following line to enable trace. */
+/* Uncomment the following line to enable trace.
-/* #define NSTRACE_ENABLED 1 */
+ Hint: keep the trailing whitespace -- the version control system
+ will reject accidental commits. */
+
+/* #define NSTRACE_ENABLED 1 */
/* Print a call tree containing all annotated functions.
/* Non-zero if we are zooming (maximizing) the frame. */
int zooming;
+
+ /* Non-zero if we are doing an animation, e.g. toggling the tool bar. */
+ int in_animation;
};
/* this dummy decl needed to support TTYs */
if (view == nil)
return;
- NSTRACE_RECT ("input", wr);
+ NSTRACE_RECT ("current", wr);
/*fprintf (stderr, "\tsetWindowSize: %d x %d, pixelwise %d, font size %d x %d\n", width, height, pixelwise, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f));*/
make_number (FRAME_NS_TITLEBAR_HEIGHT (f)),
make_number (FRAME_TOOLBAR_HEIGHT (f))));
- [view setRows: rows andColumns: cols];
NSTRACE_RECT ("setFrame", wr);
[window setFrame: wr display: YES];
NSTRACE ("updateFrameSize");
NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh));
NSTRACE_RECT ("Original frame", wr);
+ NSTRACE_MSG ("Original columns: %d", cols);
+ NSTRACE_MSG ("Original rows: %d", rows);
if (! [self isFullscreen])
{
if (wait_for_tool_bar)
{
if (FRAME_TOOLBAR_HEIGHT (emacsframe) == 0)
- return;
+ {
+ NSTRACE_MSG ("Waiting for toolbar");
+ return;
+ }
wait_for_tool_bar = NO;
}
neww = (int)wr.size.width - emacsframe->border_width;
newh = (int)wr.size.height - extra;
+ NSTRACE_SIZE ("New size", NSMakeSize (neww, newh));
+ NSTRACE_MSG ("tool_bar_height: %d", emacsframe->tool_bar_height);
+
cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, neww);
rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, newh);
if (rows < MINHEIGHT)
rows = MINHEIGHT;
+ NSTRACE_MSG ("New columns: %d", cols);
+ NSTRACE_MSG ("New rows: %d", rows);
+
if (oldr != rows || oldc != cols || neww != oldw || newh != oldh)
{
NSView *view = FRAME_NS_VIEW (emacsframe);
[view setFrame: wr];
[self windowDidMove:nil]; // Update top/left.
}
+ else
+ {
+ NSTRACE_MSG ("No change");
+ }
}
- (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize
{
NSTRACE ("windowDidResize");
+ if (emacsframe->output_data.ns->in_animation)
+ {
+ NSTRACE_MSG ("Ignored (in animation)");
+ return;
+ }
+
if (! [self fsIsNative])
{
NSWindow *theWindow = [notification object];
- (void) setRows: (int) r andColumns: (int) c
{
+ NSTRACE ("[EmacsView setRows:%d andColumns:%d]", r, c);
rows = r;
cols = c;
}