libinput: Fix high dpi scaling support

Bring it onto the level of evdevtouch.

Task-number: QTBUG-55182
Change-Id: Iaba58234fa6289870d60f0fcc351d4b97655f3e2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2016-08-09 12:28:30 +02:00
parent e9fe0a15a8
commit 9981f521d9

View File

@ -41,6 +41,7 @@
#include <libinput.h> #include <libinput.h>
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <QtGui/QScreen> #include <QtGui/QScreen>
#include <QtGui/private/qhighdpiscaling_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -63,7 +64,8 @@ QLibInputTouch::DeviceState *QLibInputTouch::deviceState(libinput_event_touch *e
static inline QPointF getPos(libinput_event_touch *e) static inline QPointF getPos(libinput_event_touch *e)
{ {
const QSize screenSize = QGuiApplication::primaryScreen()->geometry().size(); QScreen *screen = QGuiApplication::primaryScreen();
const QSize screenSize = QHighDpi::toNativePixels(screen->geometry().size(), screen);
const double x = libinput_event_touch_get_x_transformed(e, screenSize.width()); const double x = libinput_event_touch_get_x_transformed(e, screenSize.width());
const double y = libinput_event_touch_get_y_transformed(e, screenSize.height()); const double y = libinput_event_touch_get_y_transformed(e, screenSize.height());
return QPointF(x, y); return QPointF(x, y);