diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2013-02-26 15:34:00 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-06 20:07:41 +0100 |
commit | 544f1cbe2752e1bcc69729e2aeeae49b8683afdb (patch) | |
tree | c780e73ca4d3c14682bc72046b9d642e34956c82 | |
parent | 5a8378556781d8bd84f7c43840efacf7f0a59663 (diff) |
Cocoa: Fix shadowless popups
The window shadow was never invalidated after setting the transparency
mask. We now do it right after the first draw after setting the mask.
Change-Id: Icc5c6002d25abeb25d58ee4d1f868e928121ae9b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 2175b24e98..853b4b99e1 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -59,6 +59,7 @@ QT_END_NAMESPACE QPoint m_backingStoreOffset; CGImageRef m_maskImage; uchar *m_maskData; + bool m_shouldInvalidateWindowShadow; QWindow *m_window; QCocoaWindow *m_platformWindow; Qt::MouseButtons m_buttons; @@ -76,6 +77,7 @@ QT_END_NAMESPACE - (void)setQCocoaGLContext:(QCocoaGLContext *)context; - (void)flushBackingStore:(QCocoaBackingStore *)backingStore region:(const QRegion &)region offset:(QPoint)offset; - (void)setMaskRegion:(const QRegion *)region; +- (void)invalidateWindowShadowIfNeeded; - (void)drawRect:(NSRect)dirtyRect; - (void)updateGeometry; - (void)windowNotification : (NSNotification *) windowNotification; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index a50cc34893..b769ebf120 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -80,6 +80,7 @@ static QTouchDevice *touchDevice = 0; m_backingStore = 0; m_maskImage = 0; m_maskData = 0; + m_shouldInvalidateWindowShadow = false; m_window = 0; m_buttons = Qt::NoButton; m_sendKeyEvent = false; @@ -266,6 +267,7 @@ static QTouchDevice *touchDevice = 0; - (void) setMaskRegion:(const QRegion *)region { + m_shouldInvalidateWindowShadow = true; if (m_maskImage) CGImageRelease(m_maskImage); if (region->isEmpty()) { @@ -285,6 +287,14 @@ static QTouchDevice *touchDevice = 0; m_maskImage = qt_mac_toCGImage(maskImage, true, &m_maskData); } +- (void)invalidateWindowShadowIfNeeded +{ + if (m_shouldInvalidateWindowShadow && m_platformWindow->m_nsWindow) { + [m_platformWindow->m_nsWindow invalidateShadow]; + m_shouldInvalidateWindowShadow = false; + } +} + - (void) drawRect:(NSRect)dirtyRect { if (!m_backingStore) @@ -334,6 +344,8 @@ static QTouchDevice *touchDevice = 0; CGContextRestoreGState(cgContext); CGImageRelease(cleanImg); CGImageRelease(subMask); + + [self invalidateWindowShadowIfNeeded]; } - (BOOL) isFlipped |