Francois Gouget : comctl32/listbox: Do no limit item height to 255.

Alexandre Julliard julliard at winehq.org
Thu Nov 7 16:16:02 CST 2019


Module: wine
Branch: master
Commit: f37d912215bef35d403fc7cc68713d3d6d2cbe30
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f37d912215bef35d403fc7cc68713d3d6d2cbe30

Author: Francois Gouget <fgouget at free.fr>
Date:   Thu Nov  7 12:37:29 2019 +0300

comctl32/listbox: Do no limit item height to 255.

The change happened between Windows 10 1607 and 1709 in comctl32 v6.

Signed-off-by: Francois Gouget <fgouget at free.fr>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/listbox.c       |  2 +-
 dlls/comctl32/tests/listbox.c | 22 +++++++++++++++++++---
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index ab4c481aab..0d6dcd6a0b 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -1280,7 +1280,7 @@ static LRESULT LISTBOX_GetItemHeight( const LB_DESCR *descr, INT index )
  */
 static LRESULT LISTBOX_SetItemHeight( LB_DESCR *descr, INT index, INT height, BOOL repaint )
 {
-    if (height > MAXBYTE)
+    if (height > MAXWORD)
         return -1;
 
     if (!height) height = 1;
diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c
index 70e212892a..dc3b247fb6 100644
--- a/dlls/comctl32/tests/listbox.c
+++ b/dlls/comctl32/tests/listbox.c
@@ -769,11 +769,27 @@ static void test_listbox_height(void)
     r = SendMessageA(hList, LB_GETITEMHEIGHT, 0, 0 );
     ok( r == 20, "height wrong\n");
 
+    /* Before Windows 10 1709 (or 1703?) the item height was limited to 255.
+     * Since then, with comctl32 V6 the limit is 65535.
+     */
     r = SendMessageA( hList, LB_SETITEMHEIGHT, 0, MAKELPARAM( 256, 0 ));
-    ok( r == -1, "Failed to set item height, %d.\n", r);
+    ok(r == 0 || broken(r == -1), "Failed to set item height, %d.\n", r);
+    if (r == -1)
+    {
+        r = SendMessageA(hList, LB_GETITEMHEIGHT, 0, 0 );
+        ok( r == 20, "Unexpected item height %d.\n", r);
+    }
+    else
+    {
+        r = SendMessageA(hList, LB_GETITEMHEIGHT, 0, 0 );
+        ok( r == 256, "Unexpected item height %d.\n", r);
 
-    r = SendMessageA(hList, LB_GETITEMHEIGHT, 0, 0 );
-    ok( r == 20, "Unexpected item height %d.\n", r);
+        r = SendMessageA( hList, LB_SETITEMHEIGHT, 0, MAKELPARAM( 65535, 0 ));
+        ok(r == 0, "Failed to set item height, %d.\n", r);
+
+        r = SendMessageA(hList, LB_GETITEMHEIGHT, 0, 0 );
+        ok( r == 65535, "Unexpected item height %d.\n", r);
+    }
 
     r = SendMessageA( hList, LB_SETITEMHEIGHT, 0, MAKELPARAM( 0xff, 0 ));
     ok( r == 0, "send message failed\n");




More information about the wine-cvs mailing list