Mercurial > dwindows
changeset 1497:99a53823079f
On Mac lets just use the shown flag and not worry about the actual window position.
The shown flag should get set in dw_window_set_pos() not _set_size().
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 25 Dec 2011 06:58:53 +0000 |
parents | 8b84b752a363 |
children | f8b4d6075cac |
files | mac/dw.m |
diffstat | 1 files changed, 25 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/mac/dw.m Sun Dec 25 05:26:38 2011 +0000 +++ b/mac/dw.m Sun Dec 25 06:58:53 2011 +0000 @@ -7592,33 +7592,30 @@ /* Determine the contents size */ dw_window_set_size(handle, 0, 0); } + /* If the position was not set... generate a default + * default one in a similar pattern to SHELLPOSITION. + */ if(![window shown]) { + static int defaultx = 0, defaulty = 0; + int cx = dw_screen_width(), cy = dw_screen_height(); + int maxx = cx / 4, maxy = cy / 4; + NSPoint point; + rect = [window frame]; - /* If the position was not set... generate a default - * default one in a similar pattern to SHELLPOSITION. - */ - if(rect.origin.x <= 1 && rect.origin.y <= 1) - { - static int defaultx = 0, defaulty; - int cx = dw_screen_width(), cy = dw_screen_height(); - int maxx = cx / 4, maxy = cy / 4; - NSPoint point; - - defaultx += 20; - defaulty += 20; - if(defaultx > maxx) - defaultx = 20; - if(defaulty > maxy) - defaulty = 20; - - point.x = defaultx; - /* Take into account menu bar and inverted Y */ - point.y = cy - defaulty - (int)rect.size.height - 20; - - [window setFrameOrigin:point]; - } + defaultx += 20; + defaulty += 20; + if(defaultx > maxx) + defaultx = 20; + if(defaulty > maxy) + defaulty = 20; + + point.x = defaultx; + /* Take into account menu bar and inverted Y */ + point.y = cy - defaulty - (int)rect.size.height - 22; + + [window setFrameOrigin:point]; [window setShown:YES]; } [[window contentView] showWindow]; @@ -8501,8 +8498,6 @@ /* Finally set the size */ [window setContentSize:content.size]; - /* Size set manually... don't auto-position */ - [window setShown:YES]; } DW_MUTEX_UNLOCK; } @@ -8596,9 +8591,9 @@ DW_MUTEX_LOCK; NSObject *object = handle; - if([ object isKindOfClass:[ NSWindow class ] ]) - { - NSWindow *window = handle; + if([ object isMemberOfClass:[ DWWindow class ] ]) + { + DWWindow *window = handle; NSPoint point; NSSize size = [window frame].size; @@ -8608,6 +8603,8 @@ point.y = y; [window setFrameOrigin:point]; + /* Position set manually... don't auto-position */ + [window setShown:YES]; } DW_MUTEX_UNLOCK; }