@@ -11,7 +11,8 @@ namespace {
1111// /
1212// / Redefined in case the developer's machine has a Windows SDK older than
1313// / version 10.0.22000.0.
14- // / See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute
14+ // / See:
15+ // / https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute
1516#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
1617#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
1718#endif
@@ -23,8 +24,9 @@ constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW";
2324// / A value of 0 indicates apps should use dark mode. A non-zero or missing
2425// / value indicates apps should use light mode.
2526constexpr const wchar_t kGetPreferredBrightnessRegKey [] =
26- L" Software\\ Microsoft\\ Windows\\ CurrentVersion\\ Themes\\ Personalize" ;
27- constexpr const wchar_t kGetPreferredBrightnessRegValue [] = L" AppsUseLightTheme" ;
27+ L" Software\\ Microsoft\\ Windows\\ CurrentVersion\\ Themes\\ Personalize" ;
28+ constexpr const wchar_t kGetPreferredBrightnessRegValue [] =
29+ L" AppsUseLightTheme" ;
2830
2931// The number of Win32Window objects that currently exist.
3032static int g_active_window_count = 0 ;
@@ -111,17 +113,14 @@ void WindowClassRegistrar::UnregisterWindowClass() {
111113 class_registered_ = false ;
112114}
113115
114- Win32Window::Win32Window () {
115- ++g_active_window_count;
116- }
116+ Win32Window::Win32Window () { ++g_active_window_count; }
117117
118118Win32Window::~Win32Window () {
119119 --g_active_window_count;
120120 Destroy ();
121121}
122122
123- bool Win32Window::Create (const std::wstring& title,
124- const Point& origin,
123+ bool Win32Window::Create (const std::wstring& title, const Point& origin,
125124 const Size& size) {
126125 Destroy ();
127126
@@ -149,13 +148,10 @@ bool Win32Window::Create(const std::wstring& title,
149148 return OnCreate ();
150149}
151150
152- bool Win32Window::Show () {
153- return ShowWindow (window_handle_, SW_SHOWNORMAL);
154- }
151+ bool Win32Window::Show () { return ShowWindow (window_handle_, SW_SHOWNORMAL); }
155152
156153// static
157- LRESULT CALLBACK Win32Window::WndProc (HWND const window,
158- UINT const message,
154+ LRESULT CALLBACK Win32Window::WndProc (HWND const window, UINT const message,
159155 WPARAM const wparam,
160156 LPARAM const lparam) noexcept {
161157 if (message == WM_NCCREATE) {
@@ -174,9 +170,7 @@ LRESULT CALLBACK Win32Window::WndProc(HWND const window,
174170}
175171
176172LRESULT
177- Win32Window::MessageHandler (HWND hwnd,
178- UINT const message,
179- WPARAM const wparam,
173+ Win32Window::MessageHandler (HWND hwnd, UINT const message, WPARAM const wparam,
180174 LPARAM const lparam) noexcept {
181175 switch (message) {
182176 case WM_DESTROY:
@@ -255,9 +249,7 @@ RECT Win32Window::GetClientArea() {
255249 return frame;
256250}
257251
258- HWND Win32Window::GetHandle () {
259- return window_handle_;
260- }
252+ HWND Win32Window::GetHandle () { return window_handle_; }
261253
262254void Win32Window::SetQuitOnClose (bool quit_on_close) {
263255 quit_on_close_ = quit_on_close;
@@ -275,10 +267,10 @@ void Win32Window::OnDestroy() {
275267void Win32Window::UpdateTheme (HWND const window) {
276268 DWORD light_mode;
277269 DWORD light_mode_size = sizeof (light_mode);
278- LSTATUS result = RegGetValue (HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey ,
279- kGetPreferredBrightnessRegValue ,
280- RRF_RT_REG_DWORD, nullptr , &light_mode ,
281- &light_mode_size);
270+ LSTATUS result =
271+ RegGetValue (HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey ,
272+ kGetPreferredBrightnessRegValue , RRF_RT_REG_DWORD, nullptr ,
273+ &light_mode, &light_mode_size);
282274
283275 if (result == ERROR_SUCCESS) {
284276 BOOL enable_dark_mode = light_mode == 0 ;
0 commit comments