changeset 1487:5e4ced521696

Changed auto-size behavior on Windows... if no window size is set on a window... It will now automatically size the window based on the packing information... instead of letting windows pick a default size... Auto positioning is unchanged.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 24 Dec 2011 15:18:00 +0000
parents 5cfbf2715eec
children 6771fa426ba4
files win/dw.c
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Sat Dec 24 13:18:03 2011 +0000
+++ b/win/dw.c	Sat Dec 24 15:18:00 2011 +0000
@@ -3926,7 +3926,16 @@
  */
 int API dw_window_show(HWND handle)
 {
-   int rc = ShowWindow(handle, SW_SHOW);
+   int rc;
+   RECT rect;
+   
+   GetClientRect(handle, &rect);
+   
+   /* If the client area is 0x0 then call the autosize routine */
+   if((rect.bottom - rect.top) == 0 || (rect.right - rect.left) == 0)
+      dw_window_set_size(handle, 0, 0);
+      
+   rc = ShowWindow(handle, SW_SHOW);
    SetFocus(handle);
    _initial_focus(handle);
    return rc;
@@ -4606,14 +4615,14 @@
       ULONG newflags = (flStyle | WS_CLIPCHILDREN) & ~DW_FCF_TASKLIST;
 
       hwndframe = CreateWindowEx(flStyleEx, ClassName, title, newflags, CW_USEDEFAULT, CW_USEDEFAULT,
-                           CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner, NULL, DWInstance, NULL);
+                           0, 0, hwndOwner, NULL, DWInstance, NULL);
    }
    else
    {
       flStyleEx |= WS_EX_TOOLWINDOW;
 
       hwndframe = CreateWindowEx(flStyleEx, ClassName, title, flStyle | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT,
-                           CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner, NULL, DWInstance, NULL);
+                           0, 0, hwndOwner, NULL, DWInstance, NULL);
    }
    SetWindowLongPtr(hwndframe, GWLP_USERDATA, (LONG_PTR)newbox);