[PATCH 2/2] user32/combo: Fix listbox size when combobox is very small

Fabian Maurer dark.shadow4 at web.de
Fri Mar 1 12:41:21 CST 2019


Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
 dlls/user32/combo.c       | 6 ++++++
 dlls/user32/tests/combo.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c
index 59c2e6484c..678dd16b6b 100644
--- a/dlls/user32/combo.c
+++ b/dlls/user32/combo.c
@@ -396,6 +396,7 @@ static void CBCalcPlacement(
   }
   else
   {
+    int item_height;
     /*
      * Make sure the dropped width is as large as the combobox itself.
      */
@@ -413,6 +414,10 @@ static void CBCalcPlacement(
     }
     else
        lprLB->right = lprLB->left + lphc->droppedWidth;
+
+    item_height = (int)SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, 0, 0);
+    if (lprLB->bottom - lprLB->top < item_height + COMBO_YBORDERSIZE())
+      lprLB->bottom = lprLB->top + COMBO_YBORDERSIZE();
   }

   /* don't allow negative window width */
@@ -1521,6 +1526,7 @@ static void COMBO_Size( LPHEADCOMBO lphc )
             curComboHeight, newComboHeight, lphc->droppedRect.bottom,
             lphc->droppedRect.top);
       lphc->droppedRect.bottom = lphc->droppedRect.top + curComboHeight - newComboHeight;
+
     }
     /*
      * Restore original height
diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c
index b3f8486cd3..510be670e8 100644
--- a/dlls/user32/tests/combo.c
+++ b/dlls/user32/tests/combo.c
@@ -689,8 +689,8 @@ static void test_listbox_size(DWORD style)
         BOOL todo;
     } info_height[] = {
         {2, 24, FALSE},
-        {2, 30, TRUE},
-        {2, 40, TRUE},
+        {2, 30, FALSE},
+        {2, 40, FALSE},
         {2, 41, TRUE},
         {2, 42, FALSE},
         {2, 50, FALSE},
--
2.21.0




More information about the wine-devel mailing list