summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabien Freling <fabien.freling@nokia.com>2010-03-24 16:54:31 (GMT)
committerFabien Freling <fabien.freling@nokia.com>2010-03-25 09:57:14 (GMT)
commit062af5a146e4875ace293823452347a572eda14f (patch)
treefb932f19fa6bd7ea93a6638693f58f5c644f806a /src
parent977999bf52983013dcc8afdb7931816ccdbba994 (diff)
downloadQt-062af5a146e4875ace293823452347a572eda14f.zip
Qt-062af5a146e4875ace293823452347a572eda14f.tar.gz
Qt-062af5a146e4875ace293823452347a572eda14f.tar.bz2
Add experimental support for StaticContents in Mac OS X.
Reviewed-by: Morten Sorvig
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 0e378f9..06eb7ff 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -197,6 +197,7 @@ static int qCocoaViewCount = 0;
if (self) {
[self finishInitWithQWidget:widget widgetPrivate:widgetprivate];
}
+ [self setFocusRingType:NSFocusRingTypeNone];
composingText = new QString();
#ifdef ALIEN_DEBUG
@@ -445,7 +446,11 @@ static int qCocoaViewCount = 0;
return YES;
}
-- (BOOL) preservesContentDuringLiveResize;
+// We preserve the content of the view if WA_StaticContents is defined.
+//
+// More info in the Cocoa documentation:
+// http://developer.apple.com/mac/library/documentation/cocoa/conceptual/CocoaViewsGuide/Optimizing/Optimizing.html
+- (BOOL) preservesContentDuringLiveResize
{
return qwidget->testAttribute(Qt::WA_StaticContents);
}
@@ -475,6 +480,18 @@ static int qCocoaViewCount = 0;
}
}
+// We catch the 'setNeedsDisplay:' message in order to avoid a useless full repaint.
+// During the resize, the top of the widget is repainted, probably because of the
+// change of coordinate space (Quartz vs Qt). This is then followed by this message:
+// -[NSView _setNeedsDisplayIfTopLeftChanged]
+// which force a full repaint by sending the message 'setNeedsDisplay:'.
+// That is what we are preventing here.
+- (void)setNeedsDisplay:(BOOL)flag {
+ if (![self inLiveResize] || !(qwidget->testAttribute(Qt::WA_StaticContents))) {
+ [super setNeedsDisplay:flag];
+ }
+}
+
- (void)drawRect:(NSRect)aRect
{
if (!qwidget)