Add flicking behavior hints to xcb platform integration

For now these will be used in QtQuick Flickable.

Task-number: QTBUG-35608
Task-number: QTBUG-35609
Task-number: QTBUG-97055
Pick-to: 6.5
Change-Id: I944d7f0271d535822ceeef610f232f56c85e0938
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Shawn Rutledge 2014-07-31 18:10:33 +02:00
parent 7b9e73a921
commit ebd2fe108a

View File

@ -472,21 +472,23 @@ QVariant QXcbIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
case QPlatformIntegration::StartDragVelocity: case QPlatformIntegration::StartDragVelocity:
case QPlatformIntegration::UseRtlExtensions: case QPlatformIntegration::UseRtlExtensions:
case QPlatformIntegration::PasswordMaskCharacter: case QPlatformIntegration::PasswordMaskCharacter:
case QPlatformIntegration::FlickMaximumVelocity:
case QPlatformIntegration::FlickDeceleration:
// TODO using various xcb, gnome or KDE settings // TODO using various xcb, gnome or KDE settings
break; // Not implemented, use defaults break; // Not implemented, use defaults
case QPlatformIntegration::FlickStartDistance:
case QPlatformIntegration::StartDragDistance: { case QPlatformIntegration::StartDragDistance: {
RETURN_VALID_XSETTINGS(xsNetDndDragThreshold); RETURN_VALID_XSETTINGS(xsNetDndDragThreshold);
// The default (in QPlatformTheme::defaultThemeHint) is 10 pixels, but // The default (in QPlatformTheme::defaultThemeHint) is 10 pixels, but
// on a high-resolution screen it makes sense to increase it. // on a high-resolution screen it makes sense to increase it.
qreal dpi = 100.0; qreal dpi = 100;
if (const QXcbScreen *screen = connection()->primaryScreen()) { if (const QXcbScreen *screen = connection()->primaryScreen()) {
if (screen->logicalDpi().first > dpi) if (screen->logicalDpi().first > dpi)
dpi = screen->logicalDpi().first; dpi = screen->logicalDpi().first;
if (screen->logicalDpi().second > dpi) if (screen->logicalDpi().second > dpi)
dpi = screen->logicalDpi().second; dpi = screen->logicalDpi().second;
} }
return 10.0 * dpi / 100.0; return (hint == QPlatformIntegration::FlickStartDistance ? qreal(15) : qreal(10)) * dpi / qreal(100);
} }
case QPlatformIntegration::ShowIsFullScreen: case QPlatformIntegration::ShowIsFullScreen:
// X11 always has support for windows, but the // X11 always has support for windows, but the