diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-04-02 12:35:09 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-05 08:15:24 +0200 |
commit | bd2ec12a7b2787638aa3f7932c20ae4d6577734e (patch) | |
tree | 7334447f01720ff22a360077ede4c04efe676645 /src/plugins/platforms/cocoa/qcocoaintegration.h | |
parent | bb73d8d0704fbef9bd54fedccfe1e4647f3063cc (diff) |
Cocoa: Make QScreen::topLevelAt() work correctly
The QPlatformScreen::topLevelAt() default implementation
is flawed in that it does not check z-ordering but
simply returns the first window in the window list
that contains the test point.
Add QCocoaScreen::topLevelAt(). Use [NSApp orderedWindows]
to iterate through the window list in z order. Add
a NSWindow->QCococaWindow mapping hash to QCocoaIntegration
for getting the corresponding QWindow once a NSWindow
is found.
Task-number: QTBUG-37597
Change-Id: I7af70163a32528cb56f8d6caa037b98f580ee191
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaintegration.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index 24adc7a95b..9c4f86d893 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -80,6 +80,7 @@ public: qreal refreshRate() const { return m_refreshRate; } QString name() const { return m_name; } QPlatformCursor *cursor() const { return m_cursor; } + QWindow *topLevelAt(const QPoint &point) const; QList<QPlatformScreen *> virtualSiblings() const { return m_siblings; } // ---------------------------------------------------- @@ -138,6 +139,8 @@ public: void setToolbar(QWindow *window, NSToolbar *toolbar); NSToolbar *toolbar(QWindow *window) const; void clearToolbars(); + void setWindow(NSWindow* nsWindow, QCocoaWindow *window); + QCocoaWindow *window(NSWindow *window); private: static QCocoaIntegration *mInstance; @@ -156,6 +159,7 @@ private: QScopedPointer<QCocoaKeyMapper> mKeyboardMapper; QHash<QWindow *, NSToolbar *> mToolbars; + QHash<NSWindow *, QCocoaWindow*> mWindows; }; QT_END_NAMESPACE |