summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.mm
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-01-21 17:57:54 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-21 17:57:54 +0100
commit46791c08e17740418cc701b8862a980c0f711b87 (patch)
treebedba63fc48b80c2a2df54ea91c3f35398953aac /src/plugins/platforms/cocoa/qcocoawindow.mm
parentb8a38a6737acd670d92197ca5b009590d9fd8a9c (diff)
parent9033977d3971db5352a2bb51052a723a2ac57a8f (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 5702689d84..f62a6d29ce 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -220,6 +220,9 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
, m_overrideBecomeKey(false)
, m_alertRequest(NoAlertRequest)
, monitor(nil)
+ , m_drawContentBorderGradient(false)
+ , m_topContentBorderThickness(0)
+ , m_bottomContentBorderThickness(0)
, m_normalGeometry(QRect(0,0,-1,-1))
{
#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
@@ -511,6 +514,9 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
}
}
+ if (m_drawContentBorderGradient)
+ styleMask |= NSTexturedBackgroundWindowMask;
+
#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
qDebug("windowStyleMask of '%s': flags %X -> styleMask %lX", qPrintable(window()->title()), (int)flags, styleMask);
#endif
@@ -936,6 +942,9 @@ NSWindow * QCocoaWindow::createNSWindow()
}
m_windowModality = window()->modality();
+
+ applyContentBorderThickness(createdWindow);
+
return createdWindow;
}
@@ -1100,6 +1109,38 @@ void QCocoaWindow::registerTouch(bool enable)
[m_contentView setAcceptsTouchEvents:NO];
}
+void QCocoaWindow::setContentBorderThickness(int topThickness, int bottomThickness)
+{
+ m_topContentBorderThickness = topThickness;
+ m_bottomContentBorderThickness = bottomThickness;
+ bool enable = (topThickness > 0 || bottomThickness > 0);
+ m_drawContentBorderGradient = enable;
+
+ applyContentBorderThickness(m_nsWindow);
+}
+
+void QCocoaWindow::applyContentBorderThickness(NSWindow *window)
+{
+ if (!window)
+ return;
+
+ if (m_drawContentBorderGradient)
+ [window setStyleMask:[window styleMask] | NSTexturedBackgroundWindowMask];
+ else
+ [window setStyleMask:[window styleMask] & ~NSTexturedBackgroundWindowMask];
+
+ if (m_topContentBorderThickness > 0) {
+ [window setContentBorderThickness:m_topContentBorderThickness forEdge:NSMaxYEdge];
+ [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge];
+ }
+
+ if (m_bottomContentBorderThickness > 0) {
+ [window setContentBorderThickness:m_topContentBorderThickness forEdge:NSMinYEdge];
+ [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge];
+ }
+}
+
+
qreal QCocoaWindow::devicePixelRatio() const
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7