Nikolay Sivov : comctl32/button: Improve repainting on WM_SETFOCUS.

Alexandre Julliard julliard at winehq.org
Tue Apr 23 17:39:54 CDT 2019


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Apr 23 12:20:47 2019 +0300

comctl32/button: Improve repainting on WM_SETFOCUS.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/button.c       | 7 ++++++-
 dlls/comctl32/tests/button.c | 3 +--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index 0a8bdf1..0078bd0 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -815,7 +815,12 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
     case WM_SETFOCUS:
         TRACE("WM_SETFOCUS %p\n",hWnd);
         infoPtr->state |= BST_FOCUS;
-        paint_button( infoPtr, btn_type, ODA_FOCUS );
+
+        if (btn_type == BS_OWNERDRAW)
+            paint_button( infoPtr, btn_type, ODA_FOCUS );
+        else
+            InvalidateRect(hWnd, NULL, FALSE);
+
         if (style & BS_NOTIFY)
             BUTTON_NOTIFY_PARENT(hWnd, BN_SETFOCUS);
         break;
diff --git a/dlls/comctl32/tests/button.c b/dlls/comctl32/tests/button.c
index e7789dc..dd05a98 100644
--- a/dlls/comctl32/tests/button.c
+++ b/dlls/comctl32/tests/button.c
@@ -782,12 +782,11 @@ static void test_button_messages(void)
         set_test_cd_ret(CDRF_DODEFAULT);
         set_test_cd_state(CDIS_FOCUS);
 
-        todo = button[i].style != BS_OWNERDRAW;
         ok(GetFocus() == 0, "expected focus 0, got %p\n", GetFocus());
         SetFocus(hwnd);
         SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
         while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
-        ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setfocus, "SetFocus(hwnd) on a button", todo);
+        ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setfocus, "SetFocus(hwnd) on a button", FALSE);
         check_cd_seq(cd_setfocus_type, "SetFocus(hwnd)");
 
         set_test_cd_state(0);




More information about the wine-cvs mailing list