diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-01-31 13:29:14 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-02-09 14:10:17 +0000 |
commit | a57f2128b15d363b88c063325eac1d36c2ff1578 (patch) | |
tree | 8cfd5c6ded2a9e4adc1766905114342addb94751 /src/plugins/platforms/cocoa/qcocoawindow.mm | |
parent | ee8b61bcf56e03aae0f8e346e70330276e221843 (diff) |
Add QPlatformWindow::isForeignWindow()
Simplifies code at call sites and allows for refactoring how to decide
if a window is foreign or not at a later point.
Change-Id: Icc51a83bac187f4975535366b53b4990832b6c82
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index fe24f95db4..114efc3e92 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -485,7 +485,7 @@ QCocoaWindow::~QCocoaWindow() // Make sure to disconnect observer in all case if view is valid // to avoid notifications received when deleting when using Qt::AA_NativeWindows attribute - if (window()->type() != Qt::ForeignWindow) + if (!isForeignWindow()) [[NSNotificationCenter defaultCenter] removeObserver:m_view]; // While it is unlikely that this window will be in the popup stack @@ -557,7 +557,7 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect) QMacAutoReleasePool pool; if (m_viewIsEmbedded) { - if (window()->type() != Qt::ForeignWindow) { + if (!isForeignWindow()) { [m_view setFrame:NSMakeRect(0, 0, rect.width(), rect.height())]; } else { QPlatformWindow::setGeometry(rect); @@ -581,7 +581,7 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect) [m_view setFrame:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())]; } - if (window()->type() == Qt::ForeignWindow) + if (isForeignWindow()) QPlatformWindow::setGeometry(rect); // will call QPlatformWindow::setGeometry(rect) during resize confirmation (see qnsview.mm) @@ -1288,7 +1288,7 @@ void QCocoaWindow::windowDidEndLiveResize() void QCocoaWindow::windowDidBecomeKey() { - if (window()->type() == Qt::ForeignWindow) + if (isForeignWindow()) return; if (m_windowUnderMouse) { @@ -1304,7 +1304,7 @@ void QCocoaWindow::windowDidBecomeKey() void QCocoaWindow::windowDidResignKey() { - if (window()->type() == Qt::ForeignWindow) + if (isForeignWindow()) return; // Key window will be non-nil if another window became key, so do not @@ -1885,7 +1885,7 @@ void QCocoaWindow::setWindowCursor(NSCursor *cursor) return; // Setting a cursor in a foregin view is not supported. - if (window()->type() == Qt::ForeignWindow) + if (isForeignWindow()) return; [m_windowCursor release]; |