diff win/dw.c @ 1498:f8b4d6075cac

Added auto-size support during dw_window_set_pos() on OS/2, Mac and Windows. Since dw_window_set_pos() can have unexpected results on unsized windows... if a window is unsized attempt to auto-size at that point. Auto-sizing during dw_window_set_pos() will cause auto-sizing not to happen during dw_window_show() so make sure it is completely packed before setting the position.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 25 Dec 2011 13:56:30 +0000
parents ac43d9a9eee7
children 97002721c4ca
line wrap: on
line diff
--- a/win/dw.c	Sun Dec 25 06:58:53 2011 +0000
+++ b/win/dw.c	Sun Dec 25 13:56:30 2011 +0000
@@ -6714,7 +6714,14 @@
 void API dw_window_set_pos(HWND handle, long x, long y)
 {
    unsigned long width, height;
-   
+   RECT rect;
+
+   GetClientRect(handle, &rect);
+
+   /* Can't position an unsized window, so attempt to auto-size */
+   if((rect.bottom - rect.top) == 0 || (rect.right - rect.left) == 0)
+      dw_window_set_size(handle, 0, 0);
+
    dw_window_get_pos_size(handle, NULL, NULL, &width, &height);
    _handle_gravity(handle, &x, &y, width, height);
    SetWindowPos(handle, (HWND)NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);