From a02959bb5b43a3f9d881e5213ceedf535202b6a1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 1 Feb 2017 17:21:33 +0100 Subject: Make QWindow's windowState a QFlags of the WindowState This reflects QWidget API, and restores some behavior from Qt4. Some WM can have several state at the same time. On Plasma for example, when a window is both maximized and minimized, the "maximized" checkbox is checked from the taskbar entry. The API of QPlatformWindow was changed to take a QFlag and the platform plugins were adapted. - On XCB: Always send the full state to the WM. And read the full state. - On Windows: The code was originally written with '&' in Qt4, and was changed to == when porting. Some adaptation had to be made so the states would be preserved. - On macOS: Only a single state can be set and is reported back for now, with the possibly to expand this in the future. - Other platforms: Just do as before with the effective state. Task-number: QTBUG-57882 Task-number: QTBUG-52616 Task-number: QTBUG-52555 Change-Id: I7a1f7cac64236bbd4c591f796374315639233dad Reviewed-by: Gunnar Sletta Reviewed-by: Robin Burchell --- src/plugins/platforms/xcb/qxcbwindow.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/xcb/qxcbwindow.h') diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index b4d947e700..3e539337b1 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -82,7 +82,7 @@ public: void setVisible(bool visible) override; void setWindowFlags(Qt::WindowFlags flags) override; - void setWindowState(Qt::WindowState state) override; + void setWindowState(Qt::WindowStates state) override; WId winId() const override; void setParent(const QPlatformWindow *window) override; @@ -243,7 +243,7 @@ protected: xcb_sync_int64_t m_syncValue; xcb_sync_counter_t m_syncCounter = 0; - Qt::WindowState m_windowState = Qt::WindowNoState; + Qt::WindowStates m_windowState = Qt::WindowNoState; xcb_gravity_t m_gravity = XCB_GRAVITY_STATIC; @@ -253,6 +253,7 @@ protected: bool m_deferredActivation = false; bool m_embedded = false; bool m_alertState = false; + bool m_minimized = false; xcb_window_t m_netWmUserTimeWindow = XCB_NONE; QSurfaceFormat m_format; @@ -264,7 +265,8 @@ protected: QSize m_oldWindowSize; xcb_visualid_t m_visualId = 0; - int m_lastWindowStateEvent = -1; + // Last sent state. Initialized to an invalid state, on purpose. + Qt::WindowStates m_lastWindowStateEvent = Qt::WindowActive; enum SyncState { NoSyncNeeded, -- cgit v1.2.3