summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget_mac.mm
diff options
context:
space:
mode:
authorFabien Freling <fabien.freling@nokia.com>2010-03-11 16:46:49 (GMT)
committerFabien Freling <fabien.freling@nokia.com>2010-03-11 16:47:48 (GMT)
commit4ad9d5d1470a168f226cc3e88728b6a3cce04aba (patch)
treefdeb3c90b2decd5a61d4495d4e9b02848a649f46 /src/gui/kernel/qwidget_mac.mm
parentd9f10e4e4c73e5d4bb1cfe4641ef25910edba2ec (diff)
downloadQt-4ad9d5d1470a168f226cc3e88728b6a3cce04aba.zip
Qt-4ad9d5d1470a168f226cc3e88728b6a3cce04aba.tar.gz
Qt-4ad9d5d1470a168f226cc3e88728b6a3cce04aba.tar.bz2
Revert some unfinished changes.
Diffstat (limited to 'src/gui/kernel/qwidget_mac.mm')
-rw-r--r--src/gui/kernel/qwidget_mac.mm38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index e2fa614..3b80463 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3332,7 +3332,21 @@ void QWidgetPrivate::update_sys(const QRegion &rgn)
HIViewSetNeedsDisplay(qt_mac_nativeview_for(q), true); // do a complete repaint on overflow.
}
#else
- qt_mac_set_needs_display(q, rgn);
+ // Cocoa doesn't do regions, it seems more efficient to just update the bounding rect instead of a potential number of message passes for each rect.
+ const QRect & boundingRect = rgn.boundingRect();
+
+ // Alien support: get the first native ancestor widget (will be q itself in the non-alien case),
+ // map the coordinates from q space to NSView space and invalidate the rect.
+ QWidget *nativeParent = q->internalWinId() ? q : q->nativeParentWidget();
+ if (nativeParent == 0)
+ return;
+ const QRect nativeBoundingRect = QRect(
+ QPoint(q->mapTo(nativeParent, boundingRect.topLeft())),
+ QSize(boundingRect.size()));
+
+ [qt_mac_nativeview_for(nativeParent) setNeedsDisplayInRect:NSMakeRect(nativeBoundingRect.x(),
+ nativeBoundingRect.y(), nativeBoundingRect.width(),
+ nativeBoundingRect.height())];
#endif
}
@@ -4011,17 +4025,10 @@ static void qt_mac_update_widget_posisiton(QWidget *q, QRect oldRect, QRect newR
const HIRect horizontalSlice = CGRectMake(0, starty, startx, stopy);
HIViewSetNeedsDisplayInRect(view, &horizontalSlice, true);
#else
- const bool isResize = (oldRect.size() != newRect.size());
-
- qDebug() << "update widget";
- // Perform a normal (complete repaint) update in some cases:
- if (isResize && q->testAttribute(Qt::WA_StaticContents) == false) {
- NSRect bounds = NSMakeRect(newRect.x(), newRect.y(),
- newRect.width(), newRect.height());
- [qt_mac_nativeview_for(q) setFrame:bounds];
- return;
- }
-
+ Q_UNUSED(oldRect);
+ NSRect bounds = NSMakeRect(newRect.x(), newRect.y(),
+ newRect.width(), newRect.height());
+ [qt_mac_nativeview_for(q) setFrame:bounds];
#endif
}
@@ -4569,15 +4576,14 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r)
const QRect rect = *it;
const NSRect dirtyRect = NSMakeRect(rect.x() + dx, rect.y() + dy,
rect.width(), rect.height());
- //[view setNeedsDisplayInRect:dirtyRect];
+ [view setNeedsDisplayInRect:dirtyRect];
++it;
}
NSSize deltaSize = NSMakeSize(dx, dy);
- //[view translateRectsNeedingDisplayInRect:scrollRect by:deltaSize];
[view scrollRect:scrollRect by:deltaSize];
- //[view setNeedsDisplayInRect:deltaXRect];
- //[view setNeedsDisplayInRect:deltaYRect];
+ [view setNeedsDisplayInRect:deltaXRect];
+ [view setNeedsDisplayInRect:deltaYRect];
#endif // QT_MAC_USE_COCOA
}