From 02549ed219163413c9d7b2d1f28df13d6bcbe6c0 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 19 Sep 2012 18:06:12 +0200 Subject: Windows QScreen: handle change in working area when the taskbar moves Change-Id: Ic496419d89b9cca7653e77ef22978597abcb4e30 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qtwindowsglobal.h | 6 ++++++ src/plugins/platforms/windows/qwindowscontext.cpp | 2 ++ src/plugins/platforms/windows/qwindowsscreen.cpp | 3 ++- src/plugins/platforms/windows/qwindowsscreen.h | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h index 6eb3bdee10..73f963b6b8 100644 --- a/src/plugins/platforms/windows/qtwindowsglobal.h +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -104,6 +104,7 @@ enum WindowsEventType // Simplify event types InputMethodRequest = InputMethodEventFlag + 6, ThemeChanged = ThemingEventFlag + 1, DisplayChangedEvent = 437, + SettingChangedEvent = DisplayChangedEvent + 1, UnknownEvent = 542 }; @@ -184,6 +185,11 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI return QtWindows::FocusInEvent; case WM_KILLFOCUS: return QtWindows::FocusOutEvent; + // Among other things, WM_SETTINGCHANGE happens when the taskbar is moved + // and therefore the "working area" changes. + // http://msdn.microsoft.com/en-us/library/ms695534(v=vs.85).aspx + case WM_SETTINGCHANGE: + return QtWindows::SettingChangedEvent; case WM_DISPLAYCHANGE: return QtWindows::DisplayChangedEvent; case WM_THEMECHANGED: diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index c36b9196b1..98c17deba9 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -754,6 +754,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, #endif case QtWindows::DisplayChangedEvent: return d->m_screenManager.handleDisplayChange(wParam, lParam); + case QtWindows::SettingChangedEvent: + return d->m_screenManager.handleScreenChanges(); default: break; } diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 05a6893aad..0717a8ec60 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -372,7 +372,7 @@ static inline int indexOfMonitor(const QList &screenData, ones and propagates resolution changes to QWindowSystemInterface. */ -void QWindowsScreenManager::handleScreenChanges() +bool QWindowsScreenManager::handleScreenChanges() { // Look for changed monitors, add new ones const WindowsScreenDataList newDataList = monitorData(); @@ -396,6 +396,7 @@ void QWindowsScreenManager::handleScreenChanges() delete m_screens.takeAt(i); } // not found } // for existing screens + return true; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h index 49b62632fc..dfd85f9be4 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -129,7 +129,7 @@ public: delete m_screens.takeLast(); } - void handleScreenChanges(); + bool handleScreenChanges(); bool handleDisplayChange(WPARAM wParam, LPARAM lParam); const WindowsScreenList &screens() const { return m_screens; } -- cgit v1.2.3