From 09001e72dc527cb50d84c15d7afdfb4b4116c883 Mon Sep 17 00:00:00 2001 From: Morten Sorvig Date: Fri, 25 May 2012 11:36:03 +0200 Subject: [PATCH] Cocoa: Fix QCocoaBackingStore::flush on 10.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The call to displayRect works on 10.7 but does not update the pixels on screen on 10.8. Many Qt windows do not update properly. This is a workaround found by trail and error without fully understanding the underlying issue. I would like to have this in place until we can determine the cause of the bug. Change-Id: I1ecee745f42a93ded4f651cc8ad51963f250e78d Reviewed-by: Christoph Schleifenbaum Reviewed-by: Bradley T. Hughes Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoabackingstore.mm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index 660c2b651f..44243d379d 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -72,8 +72,18 @@ void QCocoaBackingStore::flush(QWindow *widget, const QRegion ®ion, const QPo QRect geo = region.boundingRect(); NSRect rect = NSMakeRect(geo.x(), geo.y(), geo.width(), geo.height()); QCocoaWindow *cocoaWindow = static_cast(window()->handle()); - if (cocoaWindow) + if (cocoaWindow) { + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 + if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { + // Workaround for malfunctioning displayRect on 10.8 where + // calling it seems to have no effect. Call setImage like + // resize() does. + [cocoaWindow->m_contentView setImage:m_image]; + } +#endif [cocoaWindow->m_contentView displayRect:rect]; + } } void QCocoaBackingStore::resize(const QSize &size, const QRegion &)