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>
This commit is contained in:
parent
5a83785567
commit
544f1cbe27
@ -59,6 +59,7 @@ QT_END_NAMESPACE
|
|||||||
QPoint m_backingStoreOffset;
|
QPoint m_backingStoreOffset;
|
||||||
CGImageRef m_maskImage;
|
CGImageRef m_maskImage;
|
||||||
uchar *m_maskData;
|
uchar *m_maskData;
|
||||||
|
bool m_shouldInvalidateWindowShadow;
|
||||||
QWindow *m_window;
|
QWindow *m_window;
|
||||||
QCocoaWindow *m_platformWindow;
|
QCocoaWindow *m_platformWindow;
|
||||||
Qt::MouseButtons m_buttons;
|
Qt::MouseButtons m_buttons;
|
||||||
@ -76,6 +77,7 @@ QT_END_NAMESPACE
|
|||||||
- (void)setQCocoaGLContext:(QCocoaGLContext *)context;
|
- (void)setQCocoaGLContext:(QCocoaGLContext *)context;
|
||||||
- (void)flushBackingStore:(QCocoaBackingStore *)backingStore region:(const QRegion &)region offset:(QPoint)offset;
|
- (void)flushBackingStore:(QCocoaBackingStore *)backingStore region:(const QRegion &)region offset:(QPoint)offset;
|
||||||
- (void)setMaskRegion:(const QRegion *)region;
|
- (void)setMaskRegion:(const QRegion *)region;
|
||||||
|
- (void)invalidateWindowShadowIfNeeded;
|
||||||
- (void)drawRect:(NSRect)dirtyRect;
|
- (void)drawRect:(NSRect)dirtyRect;
|
||||||
- (void)updateGeometry;
|
- (void)updateGeometry;
|
||||||
- (void)windowNotification : (NSNotification *) windowNotification;
|
- (void)windowNotification : (NSNotification *) windowNotification;
|
||||||
|
@ -80,6 +80,7 @@ static QTouchDevice *touchDevice = 0;
|
|||||||
m_backingStore = 0;
|
m_backingStore = 0;
|
||||||
m_maskImage = 0;
|
m_maskImage = 0;
|
||||||
m_maskData = 0;
|
m_maskData = 0;
|
||||||
|
m_shouldInvalidateWindowShadow = false;
|
||||||
m_window = 0;
|
m_window = 0;
|
||||||
m_buttons = Qt::NoButton;
|
m_buttons = Qt::NoButton;
|
||||||
m_sendKeyEvent = false;
|
m_sendKeyEvent = false;
|
||||||
@ -266,6 +267,7 @@ static QTouchDevice *touchDevice = 0;
|
|||||||
|
|
||||||
- (void) setMaskRegion:(const QRegion *)region
|
- (void) setMaskRegion:(const QRegion *)region
|
||||||
{
|
{
|
||||||
|
m_shouldInvalidateWindowShadow = true;
|
||||||
if (m_maskImage)
|
if (m_maskImage)
|
||||||
CGImageRelease(m_maskImage);
|
CGImageRelease(m_maskImage);
|
||||||
if (region->isEmpty()) {
|
if (region->isEmpty()) {
|
||||||
@ -285,6 +287,14 @@ static QTouchDevice *touchDevice = 0;
|
|||||||
m_maskImage = qt_mac_toCGImage(maskImage, true, &m_maskData);
|
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
|
- (void) drawRect:(NSRect)dirtyRect
|
||||||
{
|
{
|
||||||
if (!m_backingStore)
|
if (!m_backingStore)
|
||||||
@ -334,6 +344,8 @@ static QTouchDevice *touchDevice = 0;
|
|||||||
CGContextRestoreGState(cgContext);
|
CGContextRestoreGState(cgContext);
|
||||||
CGImageRelease(cleanImg);
|
CGImageRelease(cleanImg);
|
||||||
CGImageRelease(subMask);
|
CGImageRelease(subMask);
|
||||||
|
|
||||||
|
[self invalidateWindowShadowIfNeeded];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) isFlipped
|
- (BOOL) isFlipped
|
||||||
|
Loading…
x
Reference in New Issue
Block a user