[PATCH 2/5] comctl32: Repaint after the WM_THEMECHANGED message is received.

Zhiyi Zhang zzhang at codeweavers.com
Mon Apr 26 22:35:01 CDT 2021


Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/comctl32/button.c          |  1 +
 dlls/comctl32/combo.c           |  1 +
 dlls/comctl32/datetime.c        |  1 +
 dlls/comctl32/edit.c            |  1 +
 dlls/comctl32/header.c          |  2 +-
 dlls/comctl32/ipaddress.c       |  1 +
 dlls/comctl32/listbox.c         |  1 +
 dlls/comctl32/listview.c        |  1 +
 dlls/comctl32/monthcal.c        |  1 +
 dlls/comctl32/pager.c           |  9 +++++++++
 dlls/comctl32/progress.c        |  2 +-
 dlls/comctl32/static.c          |  4 ++++
 dlls/comctl32/status.c          |  1 +
 dlls/comctl32/tab.c             |  1 +
 dlls/comctl32/tests/misc.c      | 36 ++++++++++++++++-----------------
 dlls/comctl32/theme_scrollbar.c |  1 +
 dlls/comctl32/toolbar.c         |  1 +
 dlls/comctl32/trackbar.c        |  1 +
 dlls/comctl32/treeview.c        |  1 +
 dlls/comctl32/updown.c          |  2 +-
 20 files changed, 48 insertions(+), 21 deletions(-)

diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index b5a9ee7f7f6..d3dcc67b169 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -534,6 +534,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
         theme = GetWindowTheme( hWnd );
         CloseThemeData( theme );
         OpenThemeData( hWnd, WC_BUTTONW );
+        InvalidateRect( hWnd, NULL, TRUE );
         break;
 
     case WM_ERASEBKGND:
diff --git a/dlls/comctl32/combo.c b/dlls/comctl32/combo.c
index 887587a053b..074f54f0937 100644
--- a/dlls/comctl32/combo.c
+++ b/dlls/comctl32/combo.c
@@ -1698,6 +1698,7 @@ static LRESULT CALLBACK COMBO_WindowProc( HWND hwnd, UINT message, WPARAM wParam
         theme = GetWindowTheme( hwnd );
         CloseThemeData( theme );
         OpenThemeData( hwnd, WC_COMBOBOXW );
+        InvalidateRect( hwnd, NULL, TRUE );
         break;
 
     case WM_PRINTCLIENT:
diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c
index 93bca8c2f5c..ac5268f146c 100644
--- a/dlls/comctl32/datetime.c
+++ b/dlls/comctl32/datetime.c
@@ -1544,6 +1544,7 @@ static LRESULT DATETIME_ThemeChanged (DATETIME_INFO *infoPtr)
     theme = GetWindowTheme(infoPtr->hwndSelf);
     CloseThemeData(theme);
     OpenThemeData(infoPtr->hwndSelf, themeClass);
+    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     return 0;
 }
 
diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c
index 639443bc338..d9354a107b1 100644
--- a/dlls/comctl32/edit.c
+++ b/dlls/comctl32/edit.c
@@ -5097,6 +5097,7 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
     case WM_THEMECHANGED:
         CloseThemeData(GetWindowTheme(hwnd));
         OpenThemeData(hwnd, WC_EDITW);
+        InvalidateRect(hwnd, NULL, TRUE);
         break;
 
     default:
diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c
index 085549fed65..8bb39261dd1 100644
--- a/dlls/comctl32/header.c
+++ b/dlls/comctl32/header.c
@@ -2110,7 +2110,7 @@ static LRESULT HEADER_ThemeChanged(const HEADER_INFO *infoPtr)
     HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
     CloseThemeData(theme);
     OpenThemeData(infoPtr->hwndSelf, themeClass);
-    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
+    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     return 0;
 }
 
diff --git a/dlls/comctl32/ipaddress.c b/dlls/comctl32/ipaddress.c
index b6302a89ba6..f24fb4a9335 100644
--- a/dlls/comctl32/ipaddress.c
+++ b/dlls/comctl32/ipaddress.c
@@ -462,6 +462,7 @@ static LRESULT IPADDRESS_ThemeChanged (const IPADDRESS_INFO *infoPtr)
     HTHEME theme = GetWindowTheme (infoPtr->Self);
     CloseThemeData (theme);
     theme = OpenThemeData (theme, WC_EDITW);
+    InvalidateRect (infoPtr->Self, NULL, TRUE);
     return 0;
 }
 
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index 239f54aafab..f9283f45282 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -3136,6 +3136,7 @@ static LRESULT CALLBACK LISTBOX_WindowProc( HWND hwnd, UINT msg, WPARAM wParam,
         theme = GetWindowTheme( hwnd );
         CloseThemeData( theme );
         OpenThemeData( hwnd, WC_LISTBOXW );
+        InvalidateRect( hwnd, NULL, TRUE );
         break;
 
     default:
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 799ec509f33..05a772ab175 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -9345,6 +9345,7 @@ static LRESULT LISTVIEW_ThemeChanged(const LISTVIEW_INFO *infoPtr)
     HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
     CloseThemeData(theme);
     OpenThemeData(infoPtr->hwndSelf, themeClass);
+    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     return 0;
 }
 
diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index 98c682df334..c0bec07f477 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -2697,6 +2697,7 @@ static LRESULT theme_changed (const MONTHCAL_INFO* infoPtr)
     HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
     CloseThemeData (theme);
     OpenThemeData (infoPtr->hwndSelf, themeClass);
+    InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
     return 0;
 }
 
diff --git a/dlls/comctl32/pager.c b/dlls/comctl32/pager.c
index 4763ed5640d..b8baa93e15f 100644
--- a/dlls/comctl32/pager.c
+++ b/dlls/comctl32/pager.c
@@ -966,6 +966,12 @@ PAGER_Timer (PAGER_INFO* infoPtr, INT nTimerId)
     return 0;
 }
 
+static LRESULT PAGER_ThemeChanged (const PAGER_INFO* infoPtr)
+{
+    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
+    return 0;
+}
+
 static LRESULT
 PAGER_EraseBackground (const PAGER_INFO* infoPtr, HDC hdc)
 {
@@ -1553,6 +1559,9 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
         case WM_COMMAND:
             return SendMessageW (infoPtr->hwndNotify, uMsg, wParam, lParam);
 
+        case WM_THEMECHANGED:
+            return PAGER_ThemeChanged (infoPtr);
+
         default:
             return DefWindowProcW (hwnd, uMsg, wParam, lParam);
     }
diff --git a/dlls/comctl32/progress.c b/dlls/comctl32/progress.c
index 5cf2ccda20f..fb4c2dc66dd 100644
--- a/dlls/comctl32/progress.c
+++ b/dlls/comctl32/progress.c
@@ -615,7 +615,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
             dwExStyle |= WS_EX_STATICEDGE;
         SetWindowLongW (hwnd, GWL_EXSTYLE, dwExStyle);
         
-        InvalidateRect (hwnd, NULL, FALSE);
+        InvalidateRect (hwnd, NULL, TRUE);
         return 0;
     }
 
diff --git a/dlls/comctl32/static.c b/dlls/comctl32/static.c
index b3254e5761b..2bd2b22bc20 100644
--- a/dlls/comctl32/static.c
+++ b/dlls/comctl32/static.c
@@ -505,6 +505,10 @@ static LRESULT CALLBACK STATIC_WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam,
         STATIC_TryPaintFcn( hwnd, full_style );
         break;
 
+    case WM_THEMECHANGED:
+        InvalidateRect( hwnd, 0, TRUE );
+        break;
+
     case WM_NCCREATE:
         {
             CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam;
diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c
index 0c3a90887c8..7bc9ec4386f 100644
--- a/dlls/comctl32/status.c
+++ b/dlls/comctl32/status.c
@@ -1111,6 +1111,7 @@ static LRESULT theme_changed (const STATUS_INFO* infoPtr)
     HTHEME theme = GetWindowTheme (infoPtr->Self);
     CloseThemeData (theme);
     OpenThemeData (infoPtr->Self, themeClass);
+    InvalidateRect (infoPtr->Self, NULL, TRUE);
     return 0;
 }
 
diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index 3bb5310d1f3..017719a183d 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -3106,6 +3106,7 @@ static LRESULT theme_changed(const TAB_INFO *infoPtr)
     HTHEME theme = GetWindowTheme (infoPtr->hwnd);
     CloseThemeData (theme);
     OpenThemeData (infoPtr->hwnd, themeClass);
+    InvalidateRect (infoPtr->hwnd, NULL, TRUE);
     return 0;
 }
 
diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c
index f4fcb300bb2..4b0c1f9a4d0 100644
--- a/dlls/comctl32/tests/misc.c
+++ b/dlls/comctl32/tests/misc.c
@@ -556,30 +556,30 @@ static void test_WM_THEMECHANGED(void)
     static const struct wm_themechanged_test tests[] =
     {
         {ANIMATE_CLASSA, wm_themechanged_no_paint_seq},
-        {WC_BUTTONA, wm_themechanged_paint_erase_seq, 2, {WM_GETTEXT, WM_GETTEXTLENGTH}, TRUE},
-        {WC_COMBOBOXA, wm_themechanged_paint_erase_seq, 1, {WM_CTLCOLOREDIT}, TRUE},
+        {WC_BUTTONA, wm_themechanged_paint_erase_seq, 2, {WM_GETTEXT, WM_GETTEXTLENGTH}},
+        {WC_COMBOBOXA, wm_themechanged_paint_erase_seq, 1, {WM_CTLCOLOREDIT}},
         {WC_COMBOBOXEXA, wm_themechanged_no_paint_seq},
-        {DATETIMEPICK_CLASSA, wm_themechanged_paint_erase_seq, 0, {0}, TRUE},
-        {WC_EDITA, wm_themechanged_paint_erase_seq, 7, {WM_GETTEXTLENGTH, WM_GETFONT, EM_GETSEL, EM_GETRECT, EM_CHARFROMPOS, EM_LINEFROMCHAR, EM_POSFROMCHAR}, TRUE},
-        {WC_HEADERA, wm_themechanged_paint_erase_seq, 0, {0}, TRUE},
+        {DATETIMEPICK_CLASSA, wm_themechanged_paint_erase_seq},
+        {WC_EDITA, wm_themechanged_paint_erase_seq, 7, {WM_GETTEXTLENGTH, WM_GETFONT, EM_GETSEL, EM_GETRECT, EM_CHARFROMPOS, EM_LINEFROMCHAR, EM_POSFROMCHAR}},
+        {WC_HEADERA, wm_themechanged_paint_erase_seq},
         {HOTKEY_CLASSA, wm_themechanged_no_paint_seq},
-        {WC_IPADDRESSA, wm_themechanged_paint_erase_seq, 1, {WM_CTLCOLOREDIT}, TRUE},
-        {WC_LISTBOXA, wm_themechanged_paint_erase_seq, 0, {0}, TRUE},
-        {WC_LISTVIEWA, wm_themechanged_paint_erase_seq, 0, {0}, TRUE},
-        {MONTHCAL_CLASSA, wm_themechanged_paint_erase_seq, 0, {0}, TRUE},
+        {WC_IPADDRESSA, wm_themechanged_paint_erase_seq, 1, {WM_CTLCOLOREDIT}},
+        {WC_LISTBOXA, wm_themechanged_paint_erase_seq},
+        {WC_LISTVIEWA, wm_themechanged_paint_erase_seq},
+        {MONTHCAL_CLASSA, wm_themechanged_paint_erase_seq},
         {WC_NATIVEFONTCTLA, wm_themechanged_no_paint_seq},
-        {WC_PAGESCROLLERA, wm_themechanged_paint_erase_seq, 0, {0}, TRUE},
-        {PROGRESS_CLASSA, wm_themechanged_paint_erase_seq, 3, {WM_STYLECHANGING, WM_STYLECHANGED, WM_NCPAINT}, TRUE},
+        {WC_PAGESCROLLERA, wm_themechanged_paint_erase_seq},
+        {PROGRESS_CLASSA, wm_themechanged_paint_erase_seq, 3, {WM_STYLECHANGING, WM_STYLECHANGED, WM_NCPAINT}},
         {REBARCLASSNAMEA, wm_themechanged_no_paint_seq, 1, {WM_WINDOWPOSCHANGING}},
-        {WC_STATICA, wm_themechanged_paint_erase_seq, 2, {WM_GETTEXT, WM_GETTEXTLENGTH}, TRUE},
-        {STATUSCLASSNAMEA, wm_themechanged_paint_erase_seq, 0, {0}, TRUE},
+        {WC_STATICA, wm_themechanged_paint_erase_seq, 2, {WM_GETTEXT, WM_GETTEXTLENGTH}},
+        {STATUSCLASSNAMEA, wm_themechanged_paint_erase_seq},
         {"SysLink", wm_themechanged_no_paint_seq},
-        {WC_TABCONTROLA, wm_themechanged_paint_erase_seq, 0, {0}, TRUE},
-        {TOOLBARCLASSNAMEA, wm_themechanged_paint_erase_seq, 1, {WM_WINDOWPOSCHANGING}, TRUE},
+        {WC_TABCONTROLA, wm_themechanged_paint_erase_seq},
+        {TOOLBARCLASSNAMEA, wm_themechanged_paint_erase_seq, 1, {WM_WINDOWPOSCHANGING}},
         {TOOLTIPS_CLASSA, wm_themechanged_no_paint_seq},
-        {TRACKBAR_CLASSA, wm_themechanged_paint_seq, 0, {0}, TRUE},
-        {WC_TREEVIEWA, wm_themechanged_paint_erase_seq, 1, {0x1128}, TRUE},
-        {UPDOWN_CLASSA, wm_themechanged_paint_erase_seq, 0, {0}, TRUE},
+        {TRACKBAR_CLASSA, wm_themechanged_paint_seq},
+        {WC_TREEVIEWA, wm_themechanged_paint_erase_seq, 1, {0x1128}},
+        {UPDOWN_CLASSA, wm_themechanged_paint_erase_seq},
         {WC_SCROLLBARA, wm_themechanged_paint_erase_seq, 1, {SBM_GETSCROLLINFO}, TRUE},
     };
 
diff --git a/dlls/comctl32/theme_scrollbar.c b/dlls/comctl32/theme_scrollbar.c
index 27d31bd4ac5..304ff5bacbc 100644
--- a/dlls/comctl32/theme_scrollbar.c
+++ b/dlls/comctl32/theme_scrollbar.c
@@ -547,6 +547,7 @@ LRESULT CALLBACK THEMING_ScrollbarSubclassProc (HWND hwnd, UINT msg,
             theme = GetWindowTheme(hwnd);
             CloseThemeData(theme);
             OpenThemeData(hwnd, themeClass);
+            InvalidateRect(hwnd, NULL, TRUE);
             break;
 
         case WM_SYSCOLORCHANGE:
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 667a2f4c277..1aeb499c45f 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -6556,6 +6556,7 @@ static LRESULT theme_changed (HWND hwnd)
     HTHEME theme = GetWindowTheme (hwnd);
     CloseThemeData (theme);
     OpenThemeData (hwnd, themeClass);
+    InvalidateRect (hwnd, NULL, TRUE);
     return 0;
 }
 
diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c
index 66522fd8582..1859cf0f516 100644
--- a/dlls/comctl32/trackbar.c
+++ b/dlls/comctl32/trackbar.c
@@ -1720,6 +1720,7 @@ static LRESULT theme_changed (const TRACKBAR_INFO* infoPtr)
     HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
     CloseThemeData (theme);
     OpenThemeData (infoPtr->hwndSelf, themeClass);
+    InvalidateRect (infoPtr->hwndSelf, NULL, FALSE);
     return 0;
 }
 
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index a45096d8239..98cf5489f2b 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -5633,6 +5633,7 @@ static LRESULT TREEVIEW_ThemeChanged(const TREEVIEW_INFO *infoPtr)
     HTHEME theme = GetWindowTheme (infoPtr->hwnd);
     CloseThemeData (theme);
     OpenThemeData (infoPtr->hwnd, themeClass);
+    InvalidateRect (infoPtr->hwnd, NULL, TRUE);
     return 0;
 }
 
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c
index a804018d5f8..d5625839db3 100644
--- a/dlls/comctl32/updown.c
+++ b/dlls/comctl32/updown.c
@@ -966,7 +966,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
             theme = GetWindowTheme (hwnd);
             CloseThemeData (theme);
             OpenThemeData (hwnd, L"Spin");
-            InvalidateRect (hwnd, NULL, FALSE);
+            InvalidateRect (hwnd, NULL, TRUE);
             break;
 
 	case WM_TIMER:
-- 
2.30.2




More information about the wine-devel mailing list