summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.h
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2014-01-28 15:19:01 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-05 23:12:50 +0100
commitb1714aec5103ddd24e4f1cf14138746a3526ae95 (patch)
tree63307d9f9d54ee77d5b78fe98553f5155d5fe785 /src/plugins/platforms/cocoa/qcocoawindow.h
parent23401a1462ffd601172d17365ff07118f198c438 (diff)
Cocoa: Allow frameless NSWindow child QWindows
Showing, moving and resizing Contrarily to what an NSWindow does to its NSViews, child NSWindows need to be explicitly shown and hidden, and clipped if the parent NSWindow changes geometry. Also, hiding an NSWindow will not hide its child windows. This needed to be managed manually, adding 2 additional states to QCocoaWindow to reflect whether a child window has been clipped out by any ancestor geometry change, or hidden by any ancestor being hid. Also, ordering out an NSWindow will remove it fromm its parent's child windows array, making necessary to maintain a parallel list of child windows in QCocoaWindow. Stack order Although child NSWindows can be ordered relatively to each other, they need to be added again to be moved lower in the window stack. This also means the windows above it need to be added on top. Key (focus) status One of the remaining issues, is to make sure the top level window keeps the "key status" while still forwarding key events to the child window. Keeping same event propagation This use case is best illustrated with undocking QDockWidgets (if these are child NSWindows). The main issue is to make sure the QDockArea will get the mouse events right after undocking a dock widget. We used a similar workaround as the "key status" problem, and manually forward the mouse events to the dock area's QWindow. Manual test, by Morten Johan Sørvig, included. Task-number: QTBUG-33082 Task-number: QTBUG-22815 Change-Id: I50e34936fb82bff013e99f4bcb3bd0db0704c6ae Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.h')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 18d512ce30..9fbd10dea5 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -98,6 +98,10 @@ public:
void setGeometry(const QRect &rect);
void setCocoaGeometry(const QRect &rect);
+ void clipChildWindows();
+ void clipWindow(const NSRect &clipRect);
+ void show(bool becauseOfAncestor = false);
+ void hide(bool becauseOfAncestor = false);
void setVisible(bool visible);
void setWindowFlags(Qt::WindowFlags flags);
void setWindowState(Qt::WindowState state);
@@ -166,8 +170,6 @@ public:
void updateExposedGeometry();
QWindow *childWindowAt(QPoint windowPoint);
protected:
- // NSWindow handling. The QCocoaWindow/QNSView can either be displayed
- // in an existing NSWindow or in one created by Qt.
void recreateWindow(const QPlatformWindow *parentWindow);
QNSWindow *createNSWindow();
void setNSWindow(QNSWindow *window);
@@ -176,6 +178,8 @@ protected:
QRect windowGeometry() const;
QCocoaWindow *parentCocoaWindow() const;
void syncWindowState(Qt::WindowState newState);
+ void reinsertChildWindow(QCocoaWindow *child);
+ void removeChildWindow(QCocoaWindow *child);
// private:
public: // for QNSView
@@ -185,12 +189,15 @@ public: // for QNSView
NSView *m_contentView;
QNSView *m_qtView;
QNSWindow *m_nsWindow;
+ QCocoaWindow *m_forwardWindow;
// TODO merge to one variable if possible
bool m_contentViewIsEmbedded; // true if the m_contentView is actually embedded in a "foreign" NSView hiearchy
bool m_contentViewIsToBeEmbedded; // true if the m_contentView is intended to be embedded in a "foreign" NSView hiearchy
QCocoaWindow *m_parentCocoaWindow;
+ bool m_isNSWindowChild; // this window is a non-top level QWindow with a NSWindow.
+ QList<QCocoaWindow *> m_childWindows;
QNSWindowDelegate *m_nsWindowDelegate;
Qt::WindowFlags m_windowFlags;
@@ -213,6 +220,8 @@ public: // for QNSView
int m_registerTouchCount;
bool m_resizableTransientParent;
bool m_overrideBecomeKey;
+ bool m_hiddenByClipping;
+ bool m_hiddenByAncestor;
static const int NoAlertRequest;
NSInteger m_alertRequest;