diff --git a/winnativeeventfilter.cpp b/winnativeeventfilter.cpp index e504bf7..cd89601 100644 --- a/winnativeeventfilter.cpp +++ b/winnativeeventfilter.cpp @@ -300,7 +300,7 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType, break; } case WM_THEMECHANGED: { - data->themeEnabled = IsThemeActive(); + handleThemeChanged(data); break; } case WM_WINDOWPOSCHANGED: { @@ -360,6 +360,7 @@ void WinNativeEventFilter::init(LPWINDOW data) { SetLayeredWindowAttributes(data->hwnd, RGB(255, 0, 255), 0, LWA_COLORKEY); // Make sure our window has the frame shadow. handleDwmCompositionChanged(data); + handleThemeChanged(data); // Tell the window to redraw itself. SetWindowPos(data->hwnd, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | @@ -444,6 +445,10 @@ void WinNativeEventFilter::handleDwmCompositionChanged(LPWINDOW data) { updateRegion(data); } +void WinNativeEventFilter::handleThemeChanged(LPWINDOW data) { + data->themeEnabled = IsThemeActive(); +} + UINT WinNativeEventFilter::getDpiForWindow(HWND handle) const { const auto getScreenDpi = [this]() -> UINT { // Available since Windows 7. diff --git a/winnativeeventfilter.h b/winnativeeventfilter.h index 60b6f09..e370c3c 100644 --- a/winnativeeventfilter.h +++ b/winnativeeventfilter.h @@ -38,6 +38,7 @@ private: void init(LPWINDOW data); void updateRegion(LPWINDOW data); void handleDwmCompositionChanged(LPWINDOW data); + void handleThemeChanged(LPWINDOW data); UINT getDpiForWindow(HWND handle) const; qreal getDprForWindow(HWND handle) const; int getSystemMetricsForWindow(HWND handle, int index) const;