Commit b19aa636 authored by Jan Djärv's avatar Jan Djärv

* nsterm.h (EmacsView): Add maximizing_resize, put it and old_title

inside NS_IMPL_COCOA.

* nsterm.m (windowWillResize:toSize:): Only change title if
! maximizing_resize && FULLSCREEN_NONE.  strdup title before
modifying it.
(viewDidEndLiveResize): New method.

Fixes: debbugs:15005
parent 707c77c1
2013-08-02 Jan Djärv <jan.h.d@swipnet.se>
* nsterm.m (windowWillResize:toSize:): Only change title if
! maximizing_resize && FULLSCREEN_NONE (Bug#15005). strdup title before
modifying it.
(viewDidEndLiveResize): New method.
* nsterm.h (EmacsView): Add maximizing_resize, put it and old_title
inside NS_IMPL_COCOA.
2013-08-02 Dmitry Antipov <dmantipov@yandex.ru>
* insdel.c (adjust_after_replace, replace_range, del_range_2):
......
......@@ -109,7 +109,10 @@ typedef float EmacsCGFloat;
@interface EmacsView : NSView <NSTextInput>
#endif
{
#ifdef NS_IMPL_COCOA
char *old_title;
BOOL maximizing_resize;
#endif
BOOL windowClosing;
NSString *workingText;
BOOL processingCompose;
......
......@@ -5663,17 +5663,17 @@ - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize
old_title = 0;
}
}
else
else if (fs_state == FULLSCREEN_NONE && ! maximizing_resize)
{
char *size_title;
NSWindow *window = [self window];
if (old_title == 0)
{
const char *t = [[[self window] title] UTF8String];
char *t = strdup ([[[self window] title] UTF8String]);
char *pos = strstr (t, " — ");
if (pos)
*pos = '\0';
old_title = xstrdup (t);
old_title = t;
}
size_title = xmalloc (strlen (old_title) + 40);
esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows);
......@@ -5712,21 +5712,27 @@ - (void)windowDidResize: (NSNotification *)notification
NSTRACE (windowDidResize);
/*fprintf (stderr,"windowDidResize: %.0f\n",[theWindow frame].size.height); */
if (cols > 0 && rows > 0)
{
[self updateFrameSize: YES];
}
ns_send_appdefined (-1);
}
#ifdef NS_IMPL_COCOA
- (void)viewDidEndLiveResize
{
[super viewDidEndLiveResize];
if (old_title != 0)
{
[[self window] setTitle: [NSString stringWithUTF8String: old_title]];
xfree (old_title);
old_title = 0;
}
#endif /* NS_IMPL_COCOA */
if (cols > 0 && rows > 0)
{
[self updateFrameSize: YES];
}
ns_send_appdefined (-1);
maximizing_resize = NO;
}
#endif /* NS_IMPL_COCOA */
- (void)windowDidBecomeKey: (NSNotification *)notification
......@@ -5831,7 +5837,10 @@ - (BOOL)isOpaque
FRAME_NS_VIEW (f) = self;
emacsframe = f;
#ifdef NS_IMPL_COCOA
old_title = 0;
maximizing_resize = NO;
#endif
win = [[EmacsWindow alloc]
initWithContentRect: r
......@@ -5974,6 +5983,9 @@ - (NSRect)windowWillUseStandardFrame:(NSWindow *)sender
maximized_width = -1;
result.origin.y = defaultFrame.origin.y;
[self setFSValue: FULLSCREEN_HEIGHT];
#ifdef NS_IMPL_COCOA
maximizing_resize = YES;
#endif
}
else if (next_maximized == FULLSCREEN_WIDTH)
{
......@@ -5992,12 +6004,18 @@ - (NSRect)windowWillUseStandardFrame:(NSWindow *)sender
maximized_width = result.size.width;
maximized_height = result.size.height;
[self setFSValue: FULLSCREEN_MAXIMIZED];
#ifdef NS_IMPL_COCOA
maximizing_resize = YES;
#endif
}
else
{
/* restore */
result = ns_userRect.size.height ? ns_userRect : result;
ns_userRect = NSMakeRect (0, 0, 0, 0);
#ifdef NS_IMPL_COCOA
maximizing_resize = fs_state != FULLSCREEN_NONE;
#endif
[self setFSValue: FULLSCREEN_NONE];
maximized_width = maximized_height = -1;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment