summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.mm
diff options
context:
space:
mode:
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