aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-10-27 15:30:02 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-11-01 16:34:09 -0500
commitc092722a147940532b08f62403e182ef279f2c74 (patch)
tree2f4d85e26c3e13566ec7f1bf7b18a2de4430d628
parent3d73efba15565f5995a492e660dff72286e0b672 (diff)
downloadwix-c092722a147940532b08f62403e182ef279f2c74.tar.gz
wix-c092722a147940532b08f62403e182ef279f2c74.tar.bz2
wix-c092722a147940532b08f62403e182ef279f2c74.zip
Add CS_HREDRAW and CS_VREDRAW to fix painting issues when resizing.
-rw-r--r--src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp14
-rw-r--r--src/libs/dutil/WixToolset.DUtil/inc/thmutil.h13
-rw-r--r--src/libs/dutil/WixToolset.DUtil/thmutil.cpp20
-rw-r--r--src/samples/thmviewer/display.cpp14
-rw-r--r--src/samples/thmviewer/thmviewer.cpp9
-rw-r--r--src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp14
6 files changed, 46 insertions, 38 deletions
diff --git a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
index cdb9d017..23158a1c 100644
--- a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
+++ b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
@@ -2647,31 +2647,25 @@ private:
2647 HRESULT CreateMainWindow() 2647 HRESULT CreateMainWindow()
2648 { 2648 {
2649 HRESULT hr = S_OK; 2649 HRESULT hr = S_OK;
2650 HICON hIcon = reinterpret_cast<HICON>(m_pTheme->hIcon);
2651 WNDCLASSW wc = { }; 2650 WNDCLASSW wc = { };
2652 DWORD dwWindowStyle = 0; 2651 DWORD dwWindowStyle = 0;
2653 int x = CW_USEDEFAULT; 2652 int x = CW_USEDEFAULT;
2654 int y = CW_USEDEFAULT; 2653 int y = CW_USEDEFAULT;
2655 POINT ptCursor = { }; 2654 POINT ptCursor = { };
2656 2655
2656 ThemeInitializeWindowClass(m_pTheme, &wc, CWixStandardBootstrapperApplication::WndProc, m_hModule, WIXSTDBA_WINDOW_CLASS);
2657
2657 // If the theme did not provide an icon, try using the icon from the bundle engine. 2658 // If the theme did not provide an icon, try using the icon from the bundle engine.
2658 if (!hIcon) 2659 if (!wc.hIcon)
2659 { 2660 {
2660 HMODULE hBootstrapperEngine = ::GetModuleHandleW(NULL); 2661 HMODULE hBootstrapperEngine = ::GetModuleHandleW(NULL);
2661 if (hBootstrapperEngine) 2662 if (hBootstrapperEngine)
2662 { 2663 {
2663 hIcon = ::LoadIconW(hBootstrapperEngine, MAKEINTRESOURCEW(1)); 2664 wc.hIcon = ::LoadIconW(hBootstrapperEngine, MAKEINTRESOURCEW(1));
2664 } 2665 }
2665 } 2666 }
2666 2667
2667 // Register the window class and create the window. 2668 // Register the window class and create the window.
2668 wc.lpfnWndProc = CWixStandardBootstrapperApplication::WndProc;
2669 wc.hInstance = m_hModule;
2670 wc.hIcon = hIcon;
2671 wc.hCursor = ::LoadCursorW(NULL, (LPCWSTR)IDC_ARROW);
2672 wc.hbrBackground = m_pTheme->rgFonts[m_pTheme->dwFontId].hBackground;
2673 wc.lpszMenuName = NULL;
2674 wc.lpszClassName = WIXSTDBA_WINDOW_CLASS;
2675 if (!::RegisterClassW(&wc)) 2669 if (!::RegisterClassW(&wc))
2676 { 2670 {
2677 ExitWithLastError(hr, "Failed to register window."); 2671 ExitWithLastError(hr, "Failed to register window.");
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/thmutil.h b/src/libs/dutil/WixToolset.DUtil/inc/thmutil.h
index eda81485..cd286854 100644
--- a/src/libs/dutil/WixToolset.DUtil/inc/thmutil.h
+++ b/src/libs/dutil/WixToolset.DUtil/inc/thmutil.h
@@ -530,6 +530,19 @@ HRESULT DAPI ThemeRegisterVariableCallbacks(
530 ); 530 );
531 531
532/******************************************************************** 532/********************************************************************
533 ThemeInitializeWindowClass - sets defaults for the window class
534 from the given theme.
535
536*******************************************************************/
537void DAPI ThemeInitializeWindowClass(
538 __in THEME* pTheme,
539 __in WNDCLASSW* pWndClass,
540 __in WNDPROC pfnWndProc,
541 __in HINSTANCE hInstance,
542 __in LPCWSTR wzClassName
543 );
544
545/********************************************************************
533 ThemeCreateParentWindow - creates a parent window for the theme. 546 ThemeCreateParentWindow - creates a parent window for the theme.
534 547
535*******************************************************************/ 548*******************************************************************/
diff --git a/src/libs/dutil/WixToolset.DUtil/thmutil.cpp b/src/libs/dutil/WixToolset.DUtil/thmutil.cpp
index 068638f6..e8c23b6c 100644
--- a/src/libs/dutil/WixToolset.DUtil/thmutil.cpp
+++ b/src/libs/dutil/WixToolset.DUtil/thmutil.cpp
@@ -824,6 +824,26 @@ LExit:
824} 824}
825 825
826 826
827DAPI_(void) ThemeInitializeWindowClass(
828 __in THEME* pTheme,
829 __in WNDCLASSW* pWndClass,
830 __in WNDPROC pfnWndProc,
831 __in HINSTANCE hInstance,
832 __in LPCWSTR wzClassName
833 )
834{
835 pWndClass->style = CS_HREDRAW | CS_VREDRAW;
836 pWndClass->hCursor = ::LoadCursorW(NULL, (LPCWSTR)IDC_ARROW);
837
838 pWndClass->lpfnWndProc = pfnWndProc;
839 pWndClass->hInstance = hInstance;
840 pWndClass->lpszClassName = wzClassName;
841
842 pWndClass->hIcon = reinterpret_cast<HICON>(pTheme->hIcon);
843 pWndClass->hbrBackground = pTheme->rgFonts[pTheme->dwFontId].hBackground;
844}
845
846
827DAPI_(HRESULT) ThemeCreateParentWindow( 847DAPI_(HRESULT) ThemeCreateParentWindow(
828 __in THEME* pTheme, 848 __in THEME* pTheme,
829 __in DWORD dwExStyle, 849 __in DWORD dwExStyle,
diff --git a/src/samples/thmviewer/display.cpp b/src/samples/thmviewer/display.cpp
index e64f79c6..9ef88018 100644
--- a/src/samples/thmviewer/display.cpp
+++ b/src/samples/thmviewer/display.cpp
@@ -78,11 +78,7 @@ static DWORD WINAPI DisplayThreadProc(
78 78
79 HANDLE_THEME* pCurrentHandle = NULL; 79 HANDLE_THEME* pCurrentHandle = NULL;
80 ATOM atomWc = 0; 80 ATOM atomWc = 0;
81 WNDCLASSW wc = { }; // the following are constant for the display window class. 81 WNDCLASSW wc = { };
82 wc.lpfnWndProc = DisplayWndProc;
83 wc.hInstance = hInstance;
84 wc.lpszClassName = THMVWR_WINDOW_CLASS_DISPLAY;
85
86 HWND hWnd = NULL; 82 HWND hWnd = NULL;
87 RECT rc = { }; 83 RECT rc = { };
88 int x = CW_USEDEFAULT; 84 int x = CW_USEDEFAULT;
@@ -170,12 +166,8 @@ static DWORD WINAPI DisplayThreadProc(
170 pCurrentHandle = reinterpret_cast<HANDLE_THEME*>(msg.lParam); 166 pCurrentHandle = reinterpret_cast<HANDLE_THEME*>(msg.lParam);
171 if (pCurrentHandle) 167 if (pCurrentHandle)
172 { 168 {
173 wc.hIcon = reinterpret_cast<HICON>(pCurrentHandle->pTheme->hIcon); 169 ThemeInitializeWindowClass(pCurrentHandle->pTheme, &wc, DisplayWndProc, hInstance, THMVWR_WINDOW_CLASS_DISPLAY);
174 wc.hCursor = ::LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); 170
175 if (0 < pCurrentHandle->pTheme->cFonts)
176 {
177 wc.hbrBackground = pCurrentHandle->pTheme->rgFonts[pCurrentHandle->pTheme->dwFontId].hBackground;
178 }
179 atomWc = ::RegisterClassW(&wc); 171 atomWc = ::RegisterClassW(&wc);
180 if (!atomWc) 172 if (!atomWc)
181 { 173 {
diff --git a/src/samples/thmviewer/thmviewer.cpp b/src/samples/thmviewer/thmviewer.cpp
index 1d941323..94b1ef55 100644
--- a/src/samples/thmviewer/thmviewer.cpp
+++ b/src/samples/thmviewer/thmviewer.cpp
@@ -312,13 +312,8 @@ static HRESULT CreateMainWindowClass(
312 ATOM atom = 0; 312 ATOM atom = 0;
313 WNDCLASSW wc = { }; 313 WNDCLASSW wc = { };
314 314
315 wc.lpfnWndProc = MainWndProc; 315 ThemeInitializeWindowClass(pTheme, &wc, MainWndProc, hInstance, THMVWR_WINDOW_CLASS_MAIN);
316 wc.hInstance = hInstance; 316
317 wc.hIcon = reinterpret_cast<HICON>(pTheme->hIcon);
318 wc.hCursor = ::LoadCursorW(NULL, (LPCWSTR)IDC_ARROW);
319 wc.hbrBackground = pTheme->rgFonts[pTheme->dwFontId].hBackground;
320 wc.lpszMenuName = NULL;
321 wc.lpszClassName = THMVWR_WINDOW_CLASS_MAIN;
322 atom = ::RegisterClassW(&wc); 317 atom = ::RegisterClassW(&wc);
323 if (!atom) 318 if (!atom)
324 { 319 {
diff --git a/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp b/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
index e5ff9131..b502285f 100644
--- a/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
+++ b/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
@@ -130,30 +130,24 @@ private:
130 HRESULT CreateTestingWindow() 130 HRESULT CreateTestingWindow()
131 { 131 {
132 HRESULT hr = S_OK; 132 HRESULT hr = S_OK;
133 HICON hIcon = reinterpret_cast<HICON>(m_pBafTheme->hIcon);
134 WNDCLASSW wc = { }; 133 WNDCLASSW wc = { };
135 int x = CW_USEDEFAULT; 134 int x = CW_USEDEFAULT;
136 int y = CW_USEDEFAULT; 135 int y = CW_USEDEFAULT;
137 POINT ptCursor = { }; 136 POINT ptCursor = { };
138 137
138 ThemeInitializeWindowClass(m_pBafTheme, &wc, CBafThmUtilTesting::TestingWndProc, m_hModule, BAFTHMUTILTESTING_WINDOW_CLASS);
139
139 // If the theme did not provide an icon, try using the icon from the bundle engine. 140 // If the theme did not provide an icon, try using the icon from the bundle engine.
140 if (!hIcon) 141 if (!wc.hIcon)
141 { 142 {
142 HMODULE hBootstrapperEngine = ::GetModuleHandleW(NULL); 143 HMODULE hBootstrapperEngine = ::GetModuleHandleW(NULL);
143 if (hBootstrapperEngine) 144 if (hBootstrapperEngine)
144 { 145 {
145 hIcon = ::LoadIconW(hBootstrapperEngine, MAKEINTRESOURCEW(1)); 146 wc.hIcon = ::LoadIconW(hBootstrapperEngine, MAKEINTRESOURCEW(1));
146 } 147 }
147 } 148 }
148 149
149 // Register the window class and create the window. 150 // Register the window class and create the window.
150 wc.lpfnWndProc = CBafThmUtilTesting::TestingWndProc;
151 wc.hInstance = m_hModule;
152 wc.hIcon = hIcon;
153 wc.hCursor = ::LoadCursorW(NULL, (LPCWSTR)IDC_ARROW);
154 wc.hbrBackground = m_pBafTheme->rgFonts[m_pBafTheme->dwFontId].hBackground;
155 wc.lpszMenuName = NULL;
156 wc.lpszClassName = BAFTHMUTILTESTING_WINDOW_CLASS;
157 if (!::RegisterClassW(&wc)) 151 if (!::RegisterClassW(&wc))
158 { 152 {
159 ExitWithLastError(hr, "Failed to register window."); 153 ExitWithLastError(hr, "Failed to register window.");