summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-02-06 15:28:23 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-02-16 14:32:00 +0000
commitef32f16fc284e5017da6016f72a17957fa2fef34 (patch)
treed87fee6aec8e85d55d02730fe117289af4c65a6c /src/plugins/platforms/cocoa/qcocoawindow.h
parent925a3c65297edc37e394b9837782e79d837d20d1 (diff)
macOS: Rewrite window state handling
Instead of relying on specific notifications to change the window state we now evaluate the state based on the current window state. This allows us to get rid of windowShouldZoom in the window delegate, making window state handling work for foreign windows as well, and also allows us to re-evaluate the state in more places, such as when moving a window, which may bring it out of maximized state. The full screen state is tracked by a helper category that doesn't just rely on the styleFlag, but also on the full screen notifications. This is needed as macOS will complain if you try to go in or out of fullscreen while a transition is in effect. The differentiation between performFoo: and foo: has been removed, as the latter works in both cases and doesn't rely on the button being visible/enabled. These changes fixes many observed quirks in the window state handling that also resulted in making it hard to write tests that relied on the fullscreen/maximized operations always working. Change-Id: I0538c42d9223a56f20ec9156f4939288e0750552 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.h')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index b057299d0e..f60597fe42 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -217,7 +217,7 @@ public:
bool windowShouldClose();
bool windowIsPopupType(Qt::WindowType type = Qt::Widget) const;
- void handleWindowStateChanged(Qt::WindowState);
+ void reportCurrentWindowState(bool unconditionally = false);
NSInteger windowLevel(Qt::WindowFlags flags);
NSUInteger windowStyleMask(Qt::WindowFlags flags);
@@ -284,10 +284,15 @@ protected:
QCocoaNSWindow *createNSWindow(bool shouldBeChildNSWindow, bool shouldBePanel);
QRect nativeWindowGeometry() const;
- void syncWindowState(Qt::WindowState newState);
void reinsertChildWindow(QCocoaWindow *child);
void removeChildWindow(QCocoaWindow *child);
+ Qt::WindowState windowState() const;
+ void applyWindowState(Qt::WindowState newState);
+ void toggleMaximized();
+ void toggleFullScreen();
+ bool isTransitioningToFullScreen() const;
+
// private:
public: // for QNSView
friend class QCocoaBackingStore;
@@ -304,8 +309,7 @@ public: // for QNSView
bool m_viewIsToBeEmbedded; // true if the m_view is intended to be embedded in a "foreign" NSView hiearchy
Qt::WindowFlags m_windowFlags;
- bool m_effectivelyMaximized;
- Qt::WindowState m_synchedWindowState;
+ Qt::WindowState m_lastReportedWindowState;
Qt::WindowModality m_windowModality;
QPointer<QWindow> m_enterLeaveTargetWindow;
bool m_windowUnderMouse;
@@ -339,11 +343,6 @@ public: // for QNSView
int m_topContentBorderThickness;
int m_bottomContentBorderThickness;
- // used by showFullScreen in fake mode
- QRect m_normalGeometry;
- Qt::WindowFlags m_oldWindowFlags;
- NSApplicationPresentationOptions m_presentationOptions;
-
struct BorderRange {
BorderRange(quintptr i, int u, int l) : identifier(i), upper(u), lower(l) { }
quintptr identifier;