diff options
author | Paul Olav Tvete <paul.tvete@digia.com> | 2014-07-29 13:12:01 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@digia.com> | 2014-08-19 13:22:20 +0200 |
commit | ae5f2a66720a4bb22c120bd7d1564652cac00367 (patch) | |
tree | 21c059bb667bd6afa3192b8de7cbead877c142ab /src/plugins/platforms/xcb/qxcbcursor.cpp | |
parent | 98cd256d24eadbe5d9de91a2ab86c2bb5d7a766a (diff) |
devicePixelRatio support for XCB
This adds support for the environment variable
QT_DEVICE_PIXEL_RATIO for the xcb platform plugin.
Task-number: QTBUG-38858
Change-Id: I7faca2f2e7dc5c601a82b3cc08456870b3e5602d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbcursor.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbcursor.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index 6dbac90e0c..c9adf00673 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -629,16 +629,18 @@ void QXcbCursor::queryPointer(QXcbConnection *c, xcb_window_t *rootWin, QPoint * QPoint QXcbCursor::pos() const { + const int dpr = int(m_screen->devicePixelRatio()); QPoint p; queryPointer(connection(), 0, &p); - return p; + return p / dpr; } void QXcbCursor::setPos(const QPoint &pos) { + const int dpr = int(m_screen->devicePixelRatio()); xcb_window_t root = 0; queryPointer(connection(), &root, 0); - xcb_warp_pointer(xcb_connection(), XCB_NONE, root, 0, 0, 0, 0, pos.x(), pos.y()); + xcb_warp_pointer(xcb_connection(), XCB_NONE, root, 0, 0, 0, 0, pos.x()*dpr, pos.y()*dpr); xcb_flush(xcb_connection()); } |