[PATCH v2 1/2] comctl32/listbox: Update the size in SetColumnWidth before calling UpdatePage

Gabriel Ivăncescu gabrielopcode at gmail.com
Wed Sep 5 10:51:50 CDT 2018


Some applications don't forward WM_SIZE from DefWindowProc to the control,
but instead only send a LB_SETCOLUMNWIDTH message, even when the column
width doesn't change (but the listbox size does).

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=22440
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---

v2: Don't call UpdateSize, just update the width & height, and also call
UpdateScroll.

 dlls/comctl32/listbox.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index 252844e..2137ef8 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -1257,12 +1257,19 @@ static LRESULT LISTBOX_SetHorizontalExtent( LB_DESCR *descr, INT extent )
 /***********************************************************************
  *           LISTBOX_SetColumnWidth
  */
-static LRESULT LISTBOX_SetColumnWidth( LB_DESCR *descr, INT width)
+static LRESULT LISTBOX_SetColumnWidth( LB_DESCR *descr, INT column_width)
 {
-    if (width == descr->column_width) return LB_OKAY;
-    TRACE("[%p]: new column width = %d\n", descr->self, width );
-    descr->column_width = width;
-    LISTBOX_UpdatePage( descr );
+    RECT rect;
+
+    TRACE("[%p]: new column width = %d\n", descr->self, column_width);
+
+    GetClientRect(descr->self, &rect);
+    descr->width = rect.right - rect.left;
+    descr->height = rect.bottom - rect.top;
+    descr->column_width = column_width;
+
+    LISTBOX_UpdatePage(descr);
+    LISTBOX_UpdateScroll(descr);
     return LB_OKAY;
 }
 
-- 
1.9.1




More information about the wine-devel mailing list