Zhiyi Zhang : comctl32/button: Do not set BS_PUSHBUTTON and BS_DEFPUSHBUTTON style directly to Split Buttons and Command Links.

Alexandre Julliard julliard at winehq.org
Wed May 6 15:34:28 CDT 2020


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

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Wed May  6 16:47:58 2020 +0800

comctl32/button: Do not set BS_PUSHBUTTON and BS_DEFPUSHBUTTON style directly to Split Buttons and Command Links.

For Split Buttons and Command Links of common control version 6, setting
BS_PUSHBUTTON and BS_DEFPUSHBUTTON style toggles their default bit.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47621
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/button.c       | 12 +++++++++---
 dlls/comctl32/tests/button.c |  1 -
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index b615df4a16..4f7a3052b1 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -847,8 +847,14 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
         break;
 
     case BM_SETSTYLE:
-        btn_type = wParam & BS_TYPEMASK;
-        style = (style & ~BS_TYPEMASK) | btn_type;
+    {
+        DWORD new_btn_type;
+
+        new_btn_type= wParam & BS_TYPEMASK;
+        if (btn_type >= BS_SPLITBUTTON && new_btn_type <= BS_DEFPUSHBUTTON)
+            new_btn_type = (btn_type & ~BS_DEFPUSHBUTTON) | new_btn_type;
+
+        style = (style & ~BS_TYPEMASK) | new_btn_type;
         SetWindowLongW( hWnd, GWL_STYLE, style );
 
         /* Only redraw if lParam flag is set.*/
@@ -856,7 +862,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
             InvalidateRect( hWnd, NULL, TRUE );
 
         break;
-
+    }
     case BM_CLICK:
 	SendMessageW( hWnd, WM_LBUTTONDOWN, 0, 0 );
 	SendMessageW( hWnd, WM_LBUTTONUP, 0, 0 );
diff --git a/dlls/comctl32/tests/button.c b/dlls/comctl32/tests/button.c
index 933db6e982..716850073f 100644
--- a/dlls/comctl32/tests/button.c
+++ b/dlls/comctl32/tests/button.c
@@ -2303,7 +2303,6 @@ static void test_style(void)
             else
                 expected_type = j;
 
-            todo_wine_if(i >= BS_SPLITBUTTON && j <= BS_DEFPUSHBUTTON)
             ok(type == expected_type || broken(type == j), /* XP */
                     "Original type %#x, expected new type %#x, got %#x.\n", i, expected_type, type);
         }




More information about the wine-cvs mailing list