Mercurial > emacs
comparison src/nsterm.m @ 102427:03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
of setting toolbar height under Cocoa. (Bug#2546)
(EmacsView-windowWillUseStandardFrame:defaultFrame:): New method.
(EmacsView-drawRect:): Completely shortcircuit if ns_in_resize.
author | Adrian Robert <Adrian.B.Robert@gmail.com> |
---|---|
date | Fri, 06 Mar 2009 14:52:37 +0000 |
parents | b14d67d22033 |
children | 6ad9dc785e40 |
comparison
equal
deleted
inserted
replaced
102426:99e14dddbf65 | 102427:03f8a267cd56 |
---|---|
1150 compute_fringe_widths (f, 0); | 1150 compute_fringe_widths (f, 0); |
1151 | 1151 |
1152 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); | 1152 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); |
1153 pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); | 1153 pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); |
1154 | 1154 |
1155 /* If we have a change in toolbar display, calculate height */ | 1155 /* If we have a toolbar, take its height into account. */ |
1156 /* XXX: GNUstep has not yet implemented the first method below, added | |
1157 in Panther, however the second is incorrect under Cocoa. */ | |
1156 if (tb) | 1158 if (tb) |
1157 /* XXX: GNUstep has not yet implemented the first method below, added | 1159 FRAME_NS_TOOLBAR_HEIGHT (f) = |
1158 in Panther, however the second is incorrect under Cocoa. */ | 1160 #ifdef NS_IMPL_COCOA |
1159 #ifdef NS_IMPL_GNUSTEP | 1161 NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) |
1160 FRAME_NS_TOOLBAR_HEIGHT (f) | 1162 /* NOTE: previously this would generate wrong result if toolbar not |
1161 = NSHeight ([NSWindow frameRectForContentRect: NSMakeRect (0, 0, 0, 0) | 1163 yet displayed and fixing toolbar_height=32 helped, but |
1162 styleMask: [window styleMask]]) | 1164 now (200903) seems no longer needed */ |
1163 - FRAME_NS_TITLEBAR_HEIGHT (f); | |
1164 #else | 1165 #else |
1165 FRAME_NS_TOOLBAR_HEIGHT (f) = 32; | 1166 NSHeight ([NSWindow frameRectForContentRect: NSMakeRect (0, 0, 0, 0) |
1166 /* actually get wrong result here if toolbar not yet displayed | 1167 styleMask: [window styleMask]]) |
1167 NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) | |
1168 - FRAME_NS_TITLEBAR_HEIGHT (f); */ | |
1169 #endif | 1168 #endif |
1169 - FRAME_NS_TITLEBAR_HEIGHT (f); | |
1170 else | 1170 else |
1171 FRAME_NS_TOOLBAR_HEIGHT (f) = 0; | 1171 FRAME_NS_TOOLBAR_HEIGHT (f) = 0; |
1172 | 1172 |
1173 wr.size.width = pixelwidth + f->border_width; | 1173 wr.size.width = pixelwidth + f->border_width; |
1174 wr.size.height = pixelheight + FRAME_NS_TITLEBAR_HEIGHT (f) | 1174 wr.size.height = pixelheight + FRAME_NS_TITLEBAR_HEIGHT (f) |
5291 | 5291 |
5292 #ifdef NS_IMPL_COCOA | 5292 #ifdef NS_IMPL_COCOA |
5293 /* if we don't do this manually, the window will resize but not move */ | 5293 /* if we don't do this manually, the window will resize but not move */ |
5294 - (BOOL)windowShouldZoom: (NSWindow *)sender toFrame: (NSRect)newFrame | 5294 - (BOOL)windowShouldZoom: (NSWindow *)sender toFrame: (NSRect)newFrame |
5295 { | 5295 { |
5296 NSTRACE (windowShouldZoom); | |
5296 [[self window] setFrame: newFrame display: NO]; | 5297 [[self window] setFrame: newFrame display: NO]; |
5297 return YES; | 5298 return YES; |
5298 } | 5299 } |
5299 #endif | 5300 #endif |
5300 | 5301 |
5301 /* Implement this to control size of frame on zoom. | 5302 |
5303 /* Override to do something slightly nonstandard, but nice. First click on | |
5304 zoom button will zoom vertically. Second will zoom completely. Third | |
5305 returns to original. */ | |
5302 - (NSRect)windowWillUseStandardFrame:(NSWindow *)sender | 5306 - (NSRect)windowWillUseStandardFrame:(NSWindow *)sender |
5303 defaultFrame:(NSRect)defaultFrame; */ | 5307 defaultFrame:(NSRect)defaultFrame |
5308 { | |
5309 NSRect result = [sender frame]; | |
5310 NSTRACE (windowWillUseStandardFrame); | |
5311 | |
5312 if (result.size.height == defaultFrame.size.height) { | |
5313 result = defaultFrame; | |
5314 } else { | |
5315 result.size.height = defaultFrame.size.height; | |
5316 result.origin.y = defaultFrame.origin.y; | |
5317 } | |
5318 | |
5319 /* A windowWillResize does not get generated at least on Tiger. */ | |
5320 [self windowWillResize: sender toSize: result.size]; | |
5321 return result; | |
5322 } | |
5304 | 5323 |
5305 | 5324 |
5306 - (void)windowDidDeminiaturize: sender | 5325 - (void)windowDidDeminiaturize: sender |
5307 { | 5326 { |
5308 NSTRACE (windowDidDeminiaturize); | 5327 NSTRACE (windowDidDeminiaturize); |
5446 int x = NSMinX (rect), y = NSMinY (rect); | 5465 int x = NSMinX (rect), y = NSMinY (rect); |
5447 int width = NSWidth (rect), height = NSHeight (rect); | 5466 int width = NSWidth (rect), height = NSHeight (rect); |
5448 | 5467 |
5449 NSTRACE (drawRect); | 5468 NSTRACE (drawRect); |
5450 | 5469 |
5451 if (!emacsframe || !emacsframe->output_data.ns) | 5470 if (!emacsframe || !emacsframe->output_data.ns || ns_in_resize) |
5452 return; | 5471 return; |
5453 | 5472 |
5454 if (!ns_in_resize) | 5473 ns_clear_frame_area (emacsframe, x, y, width, height); |
5455 ns_clear_frame_area (emacsframe, x, y, width, height); | |
5456 expose_frame (emacsframe, x, y, width, height); | 5474 expose_frame (emacsframe, x, y, width, height); |
5457 | |
5458 emacsframe->async_visible = 1; | 5475 emacsframe->async_visible = 1; |
5459 emacsframe->async_iconified = 0; | 5476 emacsframe->async_iconified = 0; |
5460 | |
5461 /* SET_FRAME_GARBAGED (emacsframe); | |
5462 ns_send_appdefined (-1); */ | |
5463 } | 5477 } |
5464 | 5478 |
5465 | 5479 |
5466 /* NSDraggingDestination protocol methods. Actually this is not really a | 5480 /* NSDraggingDestination protocol methods. Actually this is not really a |
5467 protocol, but a category of Object. O well... */ | 5481 protocol, but a category of Object. O well... */ |