summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-10-21 12:25:56 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-10-27 13:15:34 +0000
commit2627c726b132d53827a061638bcec7842ac54083 (patch)
treebded1bb11e63ed33cf3d363d182eade77e4923c4 /src/plugins/platforms/cocoa
parentab1744b18d640483ac37db0c9b46facb5effe54c (diff)
macOS: Merge QCocoaWindow::setNSWindow into code path it was used
The function was only used from a single code path, and moving the logic there makes it easier to refactor the code in followup commits. Change-Id: I9a7c3aeb95df8f3f507fed83d463e16fa4908374 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm24
2 files changed, 10 insertions, 15 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 68cafa3e42..0f5b3841f7 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -260,7 +260,6 @@ public:
protected:
void recreateWindow();
QCocoaNSWindow *createNSWindow();
- void setNSWindow(QCocoaNSWindow *window);
bool shouldUseNSPanel();
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index a44a9dff6a..1eb14f1b2f 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1479,7 +1479,16 @@ void QCocoaWindow::recreateWindow()
m_forwardWindow = oldParentCocoaWindow;
}
- setNSWindow(m_nsWindow);
+ // Move view to new NSWindow if needed
+ if (m_nsWindow.contentView != m_view) {
+ [m_view setPostsFrameChangedNotifications:NO];
+ [m_view retain];
+ if (m_view.superview) // m_view comes from another NSWindow
+ [m_view removeFromSuperview];
+ [m_nsWindow setContentView:m_view];
+ [m_view release];
+ [m_view setPostsFrameChangedNotifications:YES];
+ }
}
if (m_viewIsToBeEmbedded) {
@@ -1639,19 +1648,6 @@ QCocoaNSWindow * QCocoaWindow::createNSWindow()
return createdWindow;
}
-void QCocoaWindow::setNSWindow(QCocoaNSWindow *window)
-{
- if (window.contentView != m_view) {
- [m_view setPostsFrameChangedNotifications:NO];
- [m_view retain];
- if (m_view.superview) // m_view comes from another NSWindow
- [m_view removeFromSuperview];
- [window setContentView:m_view];
- [m_view release];
- [m_view setPostsFrameChangedNotifications:YES];
- }
-}
-
void QCocoaWindow::removeChildWindow(QCocoaWindow *child)
{
m_childWindows.removeOne(child);