diff win/dw.c @ 1440:c50f445e891a

Fixed auto-sizing top-level Windows on Windows... Needed to take into account border and titlebar.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 08 Dec 2011 10:10:54 +0000
parents bde7ebced556
children b9577d1f0411
line wrap: on
line diff
--- a/win/dw.c	Thu Dec 08 09:58:17 2011 +0000
+++ b/win/dw.c	Thu Dec 08 10:10:54 2011 +0000
@@ -6555,14 +6555,14 @@
     */
    if ( (width < 1 || height < 1) && (thisbox = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA)) )
    {
-      int depth = 0;
+      int depth = 0, border = GetSystemMetrics(SM_CXSIZEFRAME) * 2;
             
       /* Calculate space requirements */
       _resize_box(thisbox, &depth, width, height, 1);
       
       /* Might need to take into account the window border here */
-      if ( width < 1 ) width = thisbox->minwidth;
-      if ( height < 1 ) height = thisbox->minheight;
+      if ( width < 1 ) width = thisbox->minwidth + border;
+      if ( height < 1 ) height = thisbox->minheight + GetSystemMetrics(SM_CYCAPTION) + border;
    }
    
    /* Finally set the size */
@@ -6642,14 +6642,14 @@
     */
    if ( (width < 1 || height < 1) && (thisbox = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA)) )
    {
-      int depth = 0;
+      int depth = 0, border = GetSystemMetrics(SM_CXSIZEFRAME) * 2;
             
       /* Calculate space requirements */
       _resize_box(thisbox, &depth, width, height, 1);
       
       /* Might need to take into account the window border here */
-      if ( width < 1 ) width = thisbox->minwidth;
-      if ( height < 1 ) height = thisbox->minheight;
+      if ( width < 1 ) width = thisbox->minwidth + border;
+      if ( height < 1 ) height = thisbox->minheight + GetSystemMetrics(SM_CYCAPTION) + border;
    }
    
    /* Finally set the size */