changeset 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 09fa437d6a5f
children b9577d1f0411
files readme win/dw.c
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/readme	Thu Dec 08 09:58:17 2011 +0000
+++ b/readme	Thu Dec 08 10:10:54 2011 +0000
@@ -47,6 +47,8 @@
    If you set the background color of a widget to DW_RGB_TRANSPARENT...
    it will attempt to use the background color of the parent.
    Several types of widgets have this set by default now.
+Added faster and less buggy layout engine 2.0 for OS/2, Windows and Mac.
+Fixed auto-sizing top-level windows on Windows; added on OS/2 and Mac.
 Fixed bubble help not being displayed on Windows.
 Fixed menu bar items remaining highlighted on Mac.
 
--- 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 */