diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2011-01-20 11:35:20 (GMT) |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2011-01-20 13:08:26 (GMT) |
commit | 5e5e16fd7107334e10939592170fc322cfa86da9 (patch) | |
tree | 5cdadbc5e8a32a82c6efe236a35ee949bbe55ea3 /src/gui/kernel/qwidget_mac.mm | |
parent | 2a333975ce44546b18f306bf2b73b5a7e09616cc (diff) | |
download | Qt-5e5e16fd7107334e10939592170fc322cfa86da9.zip Qt-5e5e16fd7107334e10939592170fc322cfa86da9.tar.gz Qt-5e5e16fd7107334e10939592170fc322cfa86da9.tar.bz2 |
Cocoa/Alien: let QWidget::scroll_sys handle overlapping widgets
Diffstat (limited to 'src/gui/kernel/qwidget_mac.mm')
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index df8e61e..8d6c09c 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4662,6 +4662,17 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &qscrollRect) return; } + static int accelEnv = -1; + if (accelEnv == -1) { + accelEnv = qgetenv("QT_NO_FAST_SCROLL").toInt() == 0; + } + + // Scroll the whole widget instead if qscrollRect is not valid: + QRect validScrollRect = qscrollRect.isValid() ? qscrollRect : q->rect(); + // If q is overlapped by other widgets, we cannot just blit pixels since + // this will move overlapping widgets as well. In case we just update: + const bool overlapped = isOverlapped(validScrollRect.translated(data.crect.topLeft())); + const bool accelerateScroll = accelEnv && isOpaque && !overlapped; const bool isAlien = (q->internalWinId() == 0); const QPoint scrollDelta(dx, dy); @@ -4677,10 +4688,21 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &qscrollRect) return; } + if (!accelerateScroll) { + if (overlapped) { + QRegion region(validScrollRect); + subtractOpaqueSiblings(region); + update_sys(region); + }else { + update_sys(qscrollRect); + } + return; + } #ifdef QT_MAC_USE_COCOA QMacCocoaAutoReleasePool pool; #else + Q_UNUSED(isAlien); // We're not sure what the following call is supposed to achive // but until we see what it breaks, we don't bring it into the // Cocoa port: @@ -4750,9 +4772,6 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &qscrollRect) if (!view) return; - // Scroll the whole widget instead if qscrollRect is not valid: - QRect validScrollRect = qscrollRect.isValid() ? qscrollRect : QRect(0, 0, q->width(), q->height()); - if (isAlien) { // Since q is alien, we need to translate the scroll rect: QPoint widgetTopLeftInsideNative = nativeWidget->mapFromGlobal(q->mapToGlobal(QPoint())); |