Mercurial > dwindows
comparison mac/dw.m @ 947:c9f6ba940453
On window sizes we need to flip the origin point on the frame too on the Mac.
Also set the size first in the combined function so we calculate frame size correctly.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 30 Apr 2011 21:49:11 +0000 |
parents | c64d3ca566f9 |
children | e48384ca49b7 |
comparison
equal
deleted
inserted
replaced
946:c64d3ca566f9 | 947:c9f6ba940453 |
---|---|
7537 point.y = [[NSScreen mainScreen] frame].size.height - y; | 7537 point.y = [[NSScreen mainScreen] frame].size.height - y; |
7538 | 7538 |
7539 if([ object isKindOfClass:[ NSWindow class ] ]) | 7539 if([ object isKindOfClass:[ NSWindow class ] ]) |
7540 { | 7540 { |
7541 NSWindow *window = handle; | 7541 NSWindow *window = handle; |
7542 point.y -= [window frame].size.height; | |
7543 NSLog(@"Setting position %dx%d screen height %d frame height %d new y %d", | |
7544 (int)x, (int)y, (int)[[NSScreen mainScreen] frame].size.height, (int)[window frame].size.height, (int)point.y); | |
7542 [window setFrameOrigin:point]; | 7545 [window setFrameOrigin:point]; |
7543 } | 7546 } |
7544 DW_MUTEX_UNLOCK; | 7547 DW_MUTEX_UNLOCK; |
7545 } | 7548 } |
7546 | 7549 |
7553 * width: Width of the widget. | 7556 * width: Width of the widget. |
7554 * height: Height of the widget. | 7557 * height: Height of the widget. |
7555 */ | 7558 */ |
7556 void API dw_window_set_pos_size(HWND handle, LONG x, LONG y, ULONG width, ULONG height) | 7559 void API dw_window_set_pos_size(HWND handle, LONG x, LONG y, ULONG width, ULONG height) |
7557 { | 7560 { |
7561 dw_window_set_size(handle, width, height); | |
7558 dw_window_set_pos(handle, x, y); | 7562 dw_window_set_pos(handle, x, y); |
7559 dw_window_set_size(handle, width, height); | |
7560 } | 7563 } |
7561 | 7564 |
7562 /* | 7565 /* |
7563 * Gets the position and size of a given window (widget). | 7566 * Gets the position and size of a given window (widget). |
7564 * Parameters: | 7567 * Parameters: |
7577 NSWindow *window = handle; | 7580 NSWindow *window = handle; |
7578 NSRect rect = [window frame]; | 7581 NSRect rect = [window frame]; |
7579 if(x) | 7582 if(x) |
7580 *x = rect.origin.x; | 7583 *x = rect.origin.x; |
7581 if(y) | 7584 if(y) |
7582 *y = [[NSScreen mainScreen] frame].size.height - rect.origin.y; | 7585 *y = [[NSScreen mainScreen] frame].size.height - rect.origin.y - rect.size.height; |
7583 if(width) | 7586 if(width) |
7584 *width = rect.size.width; | 7587 *width = rect.size.width; |
7585 if(height) | 7588 if(height) |
7586 *height = rect.size.height; | 7589 *height = rect.size.height; |
7587 return; | 7590 return; |