aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2013-08-02 11:42:23 +0200
committerJan Djärv2013-08-02 11:42:23 +0200
commitb19aa6365305cb04efddaef3236ae1619a5e6a69 (patch)
treec050a0ef7c697e05d6b6c224fdb39e43ec167bdb /src
parent707c77c122f6817dbf6ad2551de3a16792ceafcd (diff)
downloademacs-b19aa6365305cb04efddaef3236ae1619a5e6a69.tar.gz
emacs-b19aa6365305cb04efddaef3236ae1619a5e6a69.zip
* 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
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/nsterm.h3
-rw-r--r--src/nsterm.m40
3 files changed, 42 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0b043a00112..dedbe08d914 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12013-08-02 Jan Djärv <jan.h.d@swipnet.se>
2
3 * nsterm.m (windowWillResize:toSize:): Only change title if
4 ! maximizing_resize && FULLSCREEN_NONE (Bug#15005). strdup title before
5 modifying it.
6 (viewDidEndLiveResize): New method.
7
8 * nsterm.h (EmacsView): Add maximizing_resize, put it and old_title
9 inside NS_IMPL_COCOA.
10
12013-08-02 Dmitry Antipov <dmantipov@yandex.ru> 112013-08-02 Dmitry Antipov <dmantipov@yandex.ru>
2 12
3 * insdel.c (adjust_after_replace, replace_range, del_range_2): 13 * 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;
109@interface EmacsView : NSView <NSTextInput> 109@interface EmacsView : NSView <NSTextInput>
110#endif 110#endif
111 { 111 {
112#ifdef NS_IMPL_COCOA
112 char *old_title; 113 char *old_title;
114 BOOL maximizing_resize;
115#endif
113 BOOL windowClosing; 116 BOOL windowClosing;
114 NSString *workingText; 117 NSString *workingText;
115 BOOL processingCompose; 118 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)
5663 old_title = 0; 5663 old_title = 0;
5664 } 5664 }
5665 } 5665 }
5666 else 5666 else if (fs_state == FULLSCREEN_NONE && ! maximizing_resize)
5667 { 5667 {
5668 char *size_title; 5668 char *size_title;
5669 NSWindow *window = [self window]; 5669 NSWindow *window = [self window];
5670 if (old_title == 0) 5670 if (old_title == 0)
5671 { 5671 {
5672 const char *t = [[[self window] title] UTF8String]; 5672 char *t = strdup ([[[self window] title] UTF8String]);
5673 char *pos = strstr (t, " — "); 5673 char *pos = strstr (t, " — ");
5674 if (pos) 5674 if (pos)
5675 *pos = '\0'; 5675 *pos = '\0';
5676 old_title = xstrdup (t); 5676 old_title = t;
5677 } 5677 }
5678 size_title = xmalloc (strlen (old_title) + 40); 5678 size_title = xmalloc (strlen (old_title) + 40);
5679 esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows); 5679 esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows);
@@ -5712,21 +5712,27 @@ not_in_argv (NSString *arg)
5712 NSTRACE (windowDidResize); 5712 NSTRACE (windowDidResize);
5713/*fprintf (stderr,"windowDidResize: %.0f\n",[theWindow frame].size.height); */ 5713/*fprintf (stderr,"windowDidResize: %.0f\n",[theWindow frame].size.height); */
5714 5714
5715if (cols > 0 && rows > 0)
5716 {
5717 [self updateFrameSize: YES];
5718 }
5719
5720 ns_send_appdefined (-1);
5721}
5722
5715#ifdef NS_IMPL_COCOA 5723#ifdef NS_IMPL_COCOA
5724- (void)viewDidEndLiveResize
5725{
5726 [super viewDidEndLiveResize];
5716 if (old_title != 0) 5727 if (old_title != 0)
5717 { 5728 {
5729 [[self window] setTitle: [NSString stringWithUTF8String: old_title]];
5718 xfree (old_title); 5730 xfree (old_title);
5719 old_title = 0; 5731 old_title = 0;
5720 } 5732 }
5721#endif /* NS_IMPL_COCOA */ 5733 maximizing_resize = NO;
5722
5723 if (cols > 0 && rows > 0)
5724 {
5725 [self updateFrameSize: YES];
5726 }
5727
5728 ns_send_appdefined (-1);
5729} 5734}
5735#endif /* NS_IMPL_COCOA */
5730 5736
5731 5737
5732- (void)windowDidBecomeKey: (NSNotification *)notification 5738- (void)windowDidBecomeKey: (NSNotification *)notification
@@ -5831,7 +5837,10 @@ not_in_argv (NSString *arg)
5831 5837
5832 FRAME_NS_VIEW (f) = self; 5838 FRAME_NS_VIEW (f) = self;
5833 emacsframe = f; 5839 emacsframe = f;
5840#ifdef NS_IMPL_COCOA
5834 old_title = 0; 5841 old_title = 0;
5842 maximizing_resize = NO;
5843#endif
5835 5844
5836 win = [[EmacsWindow alloc] 5845 win = [[EmacsWindow alloc]
5837 initWithContentRect: r 5846 initWithContentRect: r
@@ -5974,6 +5983,9 @@ not_in_argv (NSString *arg)
5974 maximized_width = -1; 5983 maximized_width = -1;
5975 result.origin.y = defaultFrame.origin.y; 5984 result.origin.y = defaultFrame.origin.y;
5976 [self setFSValue: FULLSCREEN_HEIGHT]; 5985 [self setFSValue: FULLSCREEN_HEIGHT];
5986#ifdef NS_IMPL_COCOA
5987 maximizing_resize = YES;
5988#endif
5977 } 5989 }
5978 else if (next_maximized == FULLSCREEN_WIDTH) 5990 else if (next_maximized == FULLSCREEN_WIDTH)
5979 { 5991 {
@@ -5992,12 +6004,18 @@ not_in_argv (NSString *arg)
5992 maximized_width = result.size.width; 6004 maximized_width = result.size.width;
5993 maximized_height = result.size.height; 6005 maximized_height = result.size.height;
5994 [self setFSValue: FULLSCREEN_MAXIMIZED]; 6006 [self setFSValue: FULLSCREEN_MAXIMIZED];
6007#ifdef NS_IMPL_COCOA
6008 maximizing_resize = YES;
6009#endif
5995 } 6010 }
5996 else 6011 else
5997 { 6012 {
5998 /* restore */ 6013 /* restore */
5999 result = ns_userRect.size.height ? ns_userRect : result; 6014 result = ns_userRect.size.height ? ns_userRect : result;
6000 ns_userRect = NSMakeRect (0, 0, 0, 0); 6015 ns_userRect = NSMakeRect (0, 0, 0, 0);
6016#ifdef NS_IMPL_COCOA
6017 maximizing_resize = fs_state != FULLSCREEN_NONE;
6018#endif
6001 [self setFSValue: FULLSCREEN_NONE]; 6019 [self setFSValue: FULLSCREEN_NONE];
6002 maximized_width = maximized_height = -1; 6020 maximized_width = maximized_height = -1;
6003 } 6021 }