From: Jan Djärv Date: Fri, 2 Aug 2013 09:42:23 +0000 (+0200) Subject: * nsterm.h (EmacsView): Add maximizing_resize, put it and old_title X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1688^2~27 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b19aa6365305cb04efddaef3236ae1619a5e6a69;p=emacs.git * 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 --- diff --git a/src/ChangeLog b/src/ChangeLog index 0b043a00112..dedbe08d914 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2013-08-02 Jan Djärv + + * 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 * insdel.c (adjust_after_replace, replace_range, del_range_2): diff --git a/src/nsterm.h b/src/nsterm.h index 745b8a4145b..065cc8d4bb7 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -109,7 +109,10 @@ typedef float EmacsCGFloat; @interface EmacsView : NSView #endif { +#ifdef NS_IMPL_COCOA char *old_title; + BOOL maximizing_resize; +#endif BOOL windowClosing; NSString *workingText; BOOL processingCompose; diff --git a/src/nsterm.m b/src/nsterm.m index 59aa7f317ab..be2de274c9e 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -5663,17 +5663,17 @@ not_in_argv (NSString *arg) 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 @@ not_in_argv (NSString *arg) 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 @@ not_in_argv (NSString *arg) 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 @@ not_in_argv (NSString *arg) 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 @@ not_in_argv (NSString *arg) 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; }