Zhiyi Zhang : comctl32/edit: Call GetWindowTheme() only when necessary.

Alexandre Julliard julliard at winehq.org
Wed Mar 3 15:47:30 CST 2021


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

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Wed Mar  3 14:49:08 2021 +0800

comctl32/edit: Call GetWindowTheme() only when necessary.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/edit.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c
index 05920893c93..639443bc338 100644
--- a/dlls/comctl32/edit.c
+++ b/dlls/comctl32/edit.c
@@ -4597,7 +4597,6 @@ static LRESULT EDIT_WM_NCDestroy(EDITSTATE *es)
 static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     EDITSTATE *es = (EDITSTATE *)GetWindowLongPtrW(hwnd, 0);
-    HTHEME theme = GetWindowTheme(hwnd);
     LRESULT result = 0;
     RECT *rect;
 
@@ -4905,7 +4904,7 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
     case WM_ENABLE:
         es->bEnableState = (BOOL) wParam;
         EDIT_UpdateText(es, NULL, TRUE);
-        if (theme)
+        if (GetWindowTheme(hwnd))
             RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
         break;
 
@@ -4935,7 +4934,7 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
         break;
 
     case WM_KILLFOCUS:
-        result = EDIT_WM_KillFocus(theme, es);
+        result = EDIT_WM_KillFocus(GetWindowTheme(hwnd), es);
         break;
 
     case WM_LBUTTONDBLCLK:
@@ -4972,7 +4971,7 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
         break;
 
     case WM_SETFOCUS:
-        EDIT_WM_SetFocus(theme, es);
+        EDIT_WM_SetFocus(GetWindowTheme(hwnd), es);
         break;
 
     case WM_SETFONT:
@@ -5096,7 +5095,7 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
         break;
 
     case WM_THEMECHANGED:
-        CloseThemeData (theme);
+        CloseThemeData(GetWindowTheme(hwnd));
         OpenThemeData(hwnd, WC_EDITW);
         break;
 




More information about the wine-cvs mailing list