Author: gadamopoulos
Date: Fri Mar  3 13:56:49 2017
New Revision: 74037

URL: http://svn.reactos.org/svn/reactos?rev=74037&view=rev
Log:
[COMCTL32]: Fix all tests for BCM_GETIDEALSIZE that we have so far. (It still 
returns a wrong result for the start button with lautus).

Modified:
    trunk/reactos/dll/win32/comctl32/button.c

Modified: trunk/reactos/dll/win32/comctl32/button.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/button.c?rev=74037&r1=74036&r2=74037&view=diff
==============================================================================
--- trunk/reactos/dll/win32/comctl32/button.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/button.c   [iso-8859-1] Fri Mar  3 
13:56:49 2017
@@ -315,16 +315,13 @@
     WCHAR *text;
     HFONT hFont = 0, hPrevFont = 0;
     SIZE TextSize, ImageSize, ButtonSize;
+    BOOL ret = FALSE;
 
     pdata = _GetButtonData(hwnd);
     text = get_button_text( hwnd );
     hdc = GetDC(hwnd);
     if (!pdata || !text || !hdc || !text[0])
-    {
-        psize->cx = 100;
-        psize->cy = 100;
         goto cleanup;
-    }
 
     /* FIXME : Should use GetThemeTextExtent but unfortunately uses DrawTextW 
which is broken */
     if (theme)
@@ -381,6 +378,7 @@
     }
 
     *psize = ButtonSize;
+    ret = TRUE;
 
 cleanup:
     if (hFont)
@@ -390,7 +388,7 @@
     if (hdc)
         ReleaseDC(hwnd, hdc);
 
-    return TRUE;
+    return ret;
 }
 
 #endif
@@ -575,17 +573,24 @@
         case BCM_GETIDEALSIZE:
         {
             HTHEME theme = GetWindowTheme(hWnd);
-
-            if (btn_type != BS_PUSHBUTTON && btn_type != BS_DEFPUSHBUTTON)
+            BOOL ret = FALSE;
+            SIZE* pSize = (SIZE*)lParam;
+
+            if (btn_type == BS_PUSHBUTTON || 
+                btn_type == BS_DEFPUSHBUTTON ||
+                btn_type == BS_USERBUTTON)
             {
-                SIZE* pSize = (SIZE*)lParam;
+                ret = BUTTON_GetIdealSize(theme, hWnd, pSize);
+            }
+
+            if (!ret)
+            {
                 GetClientRect(hWnd, &rect);
                 pSize->cx = rect.right;
                 pSize->cy = rect.bottom;
-                return TRUE;
             }
 
-            return BUTTON_GetIdealSize(theme, hWnd, (SIZE*)lParam);
+            return TRUE;
         }
     }
 


Reply via email to