summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2014-03-10 16:38:38 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-18 10:03:37 +0100
commit336cb75d8f1de45215ed6e871cc5121a3e12c111 (patch)
tree581ecd53c75b1cbd8e3d97b9ee3394430c7e4601 /src
parent3245745cd0d843a8927dbc2015b8f3f416a41cdb (diff)
X11: defaultDragDistance depends on screen resolution
The usual default is 10 pixels, but on a screen with resolution exceeding 100 DPI, it will be a proportionally larger number. The reason is that such precise finger and mouse movements are more difficult on higher-resolution screens. Change-Id: I6e66299e12e6cac5c4e032251b32a34940970372 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index aaa2e81c40..0bab341914 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -396,7 +396,6 @@ QVariant QXcbIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
case QPlatformIntegration::CursorFlashTime:
case QPlatformIntegration::KeyboardInputInterval:
case QPlatformIntegration::MouseDoubleClickInterval:
- case QPlatformIntegration::StartDragDistance:
case QPlatformIntegration::StartDragTime:
case QPlatformIntegration::KeyboardAutoRepeatRate:
case QPlatformIntegration::PasswordMaskDelay:
@@ -406,6 +405,20 @@ QVariant QXcbIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
case QPlatformIntegration::PasswordMaskCharacter:
// TODO using various xcb, gnome or KDE settings
break; // Not implemented, use defaults
+ case QPlatformIntegration::StartDragDistance: {
+ // The default (in QPlatformTheme::defaultThemeHint) is 10 pixels, but
+ // on a high-resolution screen it makes sense to increase it.
+ const QList<QXcbScreen *> &screens = defaultConnection()->screens();
+ qreal dpi = 100.0;
+ if (screens.length() > 0) {
+ const QXcbScreen *screen = screens.at(defaultConnection()->primaryScreen());
+ if (screen->logicalDpi().first > dpi)
+ dpi = screen->logicalDpi().first;
+ if (screen->logicalDpi().second > dpi)
+ dpi = screen->logicalDpi().second;
+ }
+ return 10.0 * dpi / 100.0;
+ }
case QPlatformIntegration::ShowIsFullScreen:
// X11 always has support for windows, but the
// window manager could prevent it (e.g. matchbox)