diff options
| author | Adrian Robert | 2009-09-18 21:27:11 +0000 |
|---|---|---|
| committer | Adrian Robert | 2009-09-18 21:27:11 +0000 |
| commit | 6516d10a4964bbf40fa98fa8530de95e7fba4a72 (patch) | |
| tree | 7b01a10e72fe9278007dbc29513ed40ec0d91820 /src | |
| parent | 7107c29e11f8372115fb9933bafd12e40be69163 (diff) | |
| download | emacs-6516d10a4964bbf40fa98fa8530de95e7fba4a72.tar.gz emacs-6516d10a4964bbf40fa98fa8530de95e7fba4a72.zip | |
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
don't update the NSWindow itself.
(EmacsView-windowWillUseStandardFrame:defaultFrame:): Improve
state detection and store user rect ourselves. (Bug #3581)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/nsterm.m | 44 |
2 files changed, 33 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c40dc4cfdf4..ad7ab0b6544 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -9,6 +9,10 @@ | |||
| 9 | * nsterm.m (ns_no_defaults): Remove. | 9 | * nsterm.m (ns_no_defaults): Remove. |
| 10 | (ns_term_init): Switch ns_no_defaults -> inhibit_x_resources. | 10 | (ns_term_init): Switch ns_no_defaults -> inhibit_x_resources. |
| 11 | (ns_use_qd_smoothing): Remove legacy variable. | 11 | (ns_use_qd_smoothing): Remove legacy variable. |
| 12 | (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and | ||
| 13 | don't update the NSWindow itself. | ||
| 14 | (EmacsView-windowWillUseStandardFrame:defaultFrame:): Improve | ||
| 15 | state detection and store user rect ourselves. (Bug #3581) | ||
| 12 | 16 | ||
| 13 | * nsfont.m (nsfont_draw) [NS_IMPL_COCOA]: Don't use | 17 | * nsfont.m (nsfont_draw) [NS_IMPL_COCOA]: Don't use |
| 14 | ns_use_qd_smoothing. | 18 | ns_use_qd_smoothing. |
diff --git a/src/nsterm.m b/src/nsterm.m index 81049fcf112..71040a756ad 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -1089,6 +1089,7 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_grav) | |||
| 1089 | if (xoff < 100) | 1089 | if (xoff < 100) |
| 1090 | f->left_pos = 100; /* don't overlap menu */ | 1090 | f->left_pos = 100; /* don't overlap menu */ |
| 1091 | #endif | 1091 | #endif |
| 1092 | |||
| 1092 | if (view != nil && (screen = [[view window] screen])) | 1093 | if (view != nil && (screen = [[view window] screen])) |
| 1093 | [[view window] setFrameTopLeftPoint: | 1094 | [[view window] setFrameTopLeftPoint: |
| 1094 | NSMakePoint (SCREENMAXBOUND (f->left_pos), | 1095 | NSMakePoint (SCREENMAXBOUND (f->left_pos), |
| @@ -5191,7 +5192,6 @@ extern void update_window_cursor (struct window *w, int on); | |||
| 5191 | NSWindow *win = [self window]; | 5192 | NSWindow *win = [self window]; |
| 5192 | NSRect r = [win frame]; | 5193 | NSRect r = [win frame]; |
| 5193 | NSScreen *screen = [win screen]; | 5194 | NSScreen *screen = [win screen]; |
| 5194 | NSRect sr = [screen frame]; | ||
| 5195 | 5195 | ||
| 5196 | NSTRACE (windowDidMove); | 5196 | NSTRACE (windowDidMove); |
| 5197 | 5197 | ||
| @@ -5199,21 +5199,24 @@ extern void update_window_cursor (struct window *w, int on); | |||
| 5199 | return; | 5199 | return; |
| 5200 | if (screen != nil) | 5200 | if (screen != nil) |
| 5201 | { | 5201 | { |
| 5202 | emacsframe->left_pos = r.origin.x; /* - sr.origin.x; */ | 5202 | emacsframe->left_pos = r.origin.x; |
| 5203 | emacsframe->top_pos = sr.size.height - | 5203 | emacsframe->top_pos = |
| 5204 | (r.origin.y + r.size.height); /* + sr.origin.y; */ | 5204 | [screen frame].size.height - (r.origin.y + r.size.height); |
| 5205 | } | 5205 | } |
| 5206 | } | 5206 | } |
| 5207 | 5207 | ||
| 5208 | #ifdef NS_IMPL_COCOA | 5208 | |
| 5209 | /* if we don't do this manually, the window will resize but not move */ | 5209 | /* Called AFTER method below, but before our windowWillResize call there leads |
| 5210 | to windowDidResize -> x_set_window_size. Update emacs' notion of frame | ||
| 5211 | location so set_window_size moves the frame. */ | ||
| 5210 | - (BOOL)windowShouldZoom: (NSWindow *)sender toFrame: (NSRect)newFrame | 5212 | - (BOOL)windowShouldZoom: (NSWindow *)sender toFrame: (NSRect)newFrame |
| 5211 | { | 5213 | { |
| 5212 | NSTRACE (windowShouldZoom); | 5214 | NSTRACE (windowShouldZoom); |
| 5213 | [[self window] setFrame: newFrame display: NO]; | 5215 | emacsframe->left_pos = (int)newFrame.origin.x; |
| 5216 | emacsframe->top_pos = [[sender screen] frame].size.height | ||
| 5217 | - (newFrame.origin.y+newFrame.size.height); | ||
| 5214 | return YES; | 5218 | return YES; |
| 5215 | } | 5219 | } |
| 5216 | #endif | ||
| 5217 | 5220 | ||
| 5218 | 5221 | ||
| 5219 | /* Override to do something slightly nonstandard, but nice. First click on | 5222 | /* Override to do something slightly nonstandard, but nice. First click on |
| @@ -5223,16 +5226,27 @@ extern void update_window_cursor (struct window *w, int on); | |||
| 5223 | defaultFrame:(NSRect)defaultFrame | 5226 | defaultFrame:(NSRect)defaultFrame |
| 5224 | { | 5227 | { |
| 5225 | NSRect result = [sender frame]; | 5228 | NSRect result = [sender frame]; |
| 5229 | static NSRect ns_userRect = { 0, 0, 0, 0 }; | ||
| 5230 | |||
| 5226 | NSTRACE (windowWillUseStandardFrame); | 5231 | NSTRACE (windowWillUseStandardFrame); |
| 5227 | 5232 | ||
| 5228 | if (result.size.height == defaultFrame.size.height) { | 5233 | if (abs (defaultFrame.size.height - result.size.height) |
| 5229 | result = defaultFrame; | 5234 | > FRAME_LINE_HEIGHT (emacsframe)) |
| 5230 | } else { | 5235 | { |
| 5231 | result.size.height = defaultFrame.size.height; | 5236 | /* first click */ |
| 5232 | result.origin.y = defaultFrame.origin.y; | 5237 | ns_userRect = result; |
| 5233 | } | 5238 | result.size.height = defaultFrame.size.height; |
| 5239 | result.origin.y = defaultFrame.origin.y; | ||
| 5240 | } | ||
| 5241 | else | ||
| 5242 | { | ||
| 5243 | if (abs (defaultFrame.size.width - result.size.width) | ||
| 5244 | > FRAME_COLUMN_WIDTH (emacsframe)) | ||
| 5245 | result = defaultFrame; /* second click */ | ||
| 5246 | else | ||
| 5247 | result = ns_userRect.size.height ? ns_userRect : result; /* restore */ | ||
| 5248 | } | ||
| 5234 | 5249 | ||
| 5235 | /* A windowWillResize does not get generated on Tiger or Leopard. */ | ||
| 5236 | [self windowWillResize: sender toSize: result.size]; | 5250 | [self windowWillResize: sender toSize: result.size]; |
| 5237 | return result; | 5251 | return result; |
| 5238 | } | 5252 | } |