From ae5f2a66720a4bb22c120bd7d1564652cac00367 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 29 Jul 2014 13:12:01 +0200 Subject: devicePixelRatio support for XCB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qxcbcursor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/xcb/qxcbcursor.cpp') 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()); } -- cgit v1.2.3