summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2012-07-06 16:26:52 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-09-18 17:39:50 +0200
commitb1893f7c49707ac386a003e3e974f0c04a1d29ff (patch)
tree4df4aaf749f16751bb15e8bfbf0793eba77c807f /src
parentd92fd4ca54ae71e9c0190d15df9c131435a4be68 (diff)
Introducing NoDropShadowWindowHint window flag
Added suppport on QCocoaWindow. Also we deprecate WA_MacNoShadow since it isn't used anywhere, and updated the 'windowflags' example app. Change-Id: Id0b453ba15a23b768b0615838597bca139f507ad Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qnamespace.h3
-rw-r--r--src/corelib/global/qnamespace.qdoc6
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm8
4 files changed, 14 insertions, 4 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 1940c1acff..e413dd2064 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -312,7 +312,8 @@ public:
WindowOkButtonHint = 0x00080000,
WindowCancelButtonHint = 0x00100000,
WindowSoftkeysVisibleHint = 0x40000000,
- WindowSoftkeysRespondHint = 0x80000000
+ WindowSoftkeysRespondHint = 0x80000000,
+ NoDropShadowWindowHint = 0x40000000
};
Q_DECLARE_FLAGS(WindowFlags, WindowType)
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index f60805c835..03bf7627fb 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1175,9 +1175,6 @@
to this top level window. This attribute has no effect on non-X11
platforms.
- \value WA_MacNoShadow Since Qt 4.8, this attribute disables drop shadows
- for this top level window. Only affects Cocoa builds of Qt for Mac OS X.
-
\omitvalue WA_SetLayoutDirection
\omitvalue WA_InputMethodTransparent
\omitvalue WA_WState_CompressKeys
@@ -1208,6 +1205,7 @@
\omitvalue WA_SetWindowModality
\omitvalue WA_WState_WindowOpacitySet
\omitvalue WA_WState_AcceptedTouchBeginEvent
+ \omitvalue WA_MacNoShadow
*/
/*! \typedef Qt::HANDLE
@@ -1968,6 +1966,8 @@
ability to understand Motif and/or NETWM hints. Most existing
modern window managers can handle this.
+ \value NoDropShadowWindowHint Disables window drop shadow on supporting platforms.
+
The \c CustomizeWindowHint flag is used to enable customization of
the window controls. This flag must be set to allow the \c
WindowTitleHint, \c WindowSystemMenuHint, \c
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index ef80616221..defadb6c65 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -122,6 +122,7 @@ public:
NSInteger windowLevel(Qt::WindowFlags flags);
NSUInteger windowStyleMask(Qt::WindowFlags flags);
+ void setWindowShadow(Qt::WindowFlags flags);
void setCurrentContext(QCocoaGLContext *context);
QCocoaGLContext *currentContext() const;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index ae9fd6e314..72a5bc9e8b 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -370,6 +370,12 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
return styleMask;
}
+void QCocoaWindow::setWindowShadow(Qt::WindowFlags flags)
+{
+ bool keepShadow = !(flags & Qt::NoDropShadowWindowHint);
+ [m_nsWindow setHasShadow:(keepShadow ? YES : NO)];
+}
+
Qt::WindowFlags QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
{
if (m_nsWindow) {
@@ -377,6 +383,7 @@ Qt::WindowFlags QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
NSInteger level = this->windowLevel(flags);
[m_nsWindow setStyleMask:styleMask];
[m_nsWindow setLevel:level];
+ setWindowShadow(flags);
}
m_windowFlags = flags;
@@ -625,6 +632,7 @@ NSWindow * QCocoaWindow::createNSWindow()
defer:NO]; // Deferring window creation breaks OpenGL (the GL context is set up
// before the window is shown and needs a proper window.).
window->m_cocoaPlatformWindow = this;
+ setWindowShadow(flags);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {