summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-03-16 10:31:07 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-03-16 10:31:07 +0100
commit198606f6dbca95ba3a170fff387327d8271018cd (patch)
tree79e8c632f5277fc7f0ae30ae7fb1e1c41745c815 /src/platformsupport
parent77c0c1ca6505eb66bd75b3766f9a498574822bd1 (diff)
parent0d5ffd67a4748bcbf19dc3a4b9a36ae6314e58a6 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: src/plugins/platforms/xcb/qxcbnativeinterface.cpp src/plugins/platforms/xcb/qxcbnativeinterface.h Change-Id: I31b38ba439b9341d51a01c0fd54bea33f7410076
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_p.h3
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_static.cpp53
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp36
-rw-r--r--src/platformsupport/eglconvenience/qeglconvenience.cpp27
-rw-r--r--src/platformsupport/eglconvenience/qeglconvenience_p.h1
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcursor.cpp6
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcursor_p.h3
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformscreen.cpp42
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformscreen_p.h5
-rw-r--r--src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm8
-rw-r--r--src/platformsupport/fbconvenience/qfbcursor.cpp26
-rw-r--r--src/platformsupport/fbconvenience/qfbcursor_p.h7
-rw-r--r--src/platformsupport/fontdatabases/basic/basic.pri73
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp35
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h3
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouch.cpp2
-rw-r--r--src/platformsupport/input/libinput/qlibinputhandler.cpp8
-rw-r--r--src/platformsupport/input/libinput/qlibinputhandler_p.h1
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer.cpp7
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer_p.h2
20 files changed, 194 insertions, 154 deletions
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_p.h b/src/platformsupport/devicediscovery/qdevicediscovery_p.h
index 88b75ee439..637a74cb1f 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_p.h
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_p.h
@@ -74,7 +74,8 @@ public:
Device_DRM = 0x10,
Device_DRM_PrimaryGPU = 0x20,
Device_Tablet = 0x40,
- Device_InputMask = Device_Mouse | Device_Touchpad | Device_Touchscreen | Device_Keyboard | Device_Tablet,
+ Device_Joystick = 0x80,
+ Device_InputMask = Device_Mouse | Device_Touchpad | Device_Touchscreen | Device_Keyboard | Device_Tablet | Device_Joystick,
Device_VideoMask = Device_DRM
};
Q_DECLARE_FLAGS(QDeviceTypes, QDeviceType)
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
index 160fb7f5c0..1bc834b5ef 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
@@ -38,6 +38,7 @@
#include <QObject>
#include <QHash>
#include <QDir>
+#include <QLoggingCategory>
#include <QtCore/private/qcore_unix_p.h>
#include <linux/input.h>
@@ -56,13 +57,6 @@
#define ABS_CNT (ABS_MAX+1)
#endif
-
-//#define QT_QPA_DEVICE_DISCOVERY_DEBUG
-
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
-#include <QtDebug>
-#endif
-
#define LONG_BITS (sizeof(long) * 8 )
#define LONG_FIELD_SIZE(bits) ((bits / LONG_BITS) + 1)
@@ -73,6 +67,8 @@ static bool testBit(long bit, const long *field)
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcDD, "qt.qpa.input")
+
QDeviceDiscovery *QDeviceDiscovery::create(QDeviceTypes types, QObject *parent)
{
return new QDeviceDiscoveryStatic(types, parent);
@@ -81,9 +77,7 @@ QDeviceDiscovery *QDeviceDiscovery::create(QDeviceTypes types, QObject *parent)
QDeviceDiscoveryStatic::QDeviceDiscoveryStatic(QDeviceTypes types, QObject *parent)
: QDeviceDiscovery(types, parent)
{
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
- qWarning() << "New DeviceDiscovery created for type" << types;
-#endif
+ qCDebug(lcDD) << "static device discovery for type" << types;
}
QStringList QDeviceDiscoveryStatic::scanConnectedDevices()
@@ -112,9 +106,7 @@ QStringList QDeviceDiscoveryStatic::scanConnectedDevices()
}
}
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
- qWarning() << "DeviceDiscovery found matching devices" << devices;
-#endif
+ qCDebug(lcDD) << "Found matching devices" << devices;
return devices;
}
@@ -124,9 +116,7 @@ bool QDeviceDiscoveryStatic::checkDeviceType(const QString &device)
bool ret = false;
int fd = QT_OPEN(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
if (!fd) {
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
- qWarning() << "DeviceDiscovery cannot open device" << device;
-#endif
+ qWarning() << "Device discovery cannot open device" << device;
return false;
}
@@ -134,9 +124,7 @@ bool QDeviceDiscoveryStatic::checkDeviceType(const QString &device)
if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(bitsKey)), bitsKey) >= 0 ) {
if (!ret && (m_types & Device_Keyboard)) {
if (testBit(KEY_Q, bitsKey)) {
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
- qWarning() << "DeviceDiscovery found keyboard at" << device;
-#endif
+ qCDebug(lcDD) << "Found keyboard at" << device;
ret = true;
}
}
@@ -145,9 +133,7 @@ bool QDeviceDiscoveryStatic::checkDeviceType(const QString &device)
long bitsRel[LONG_FIELD_SIZE(REL_CNT)];
if (ioctl(fd, EVIOCGBIT(EV_REL, sizeof(bitsRel)), bitsRel) >= 0 ) {
if (testBit(REL_X, bitsRel) && testBit(REL_Y, bitsRel) && testBit(BTN_MOUSE, bitsKey)) {
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
- qWarning() << "DeviceDiscovery found mouse at" << device;
-#endif
+ qCDebug(lcDD) << "Found mouse at" << device;
ret = true;
}
}
@@ -158,24 +144,29 @@ bool QDeviceDiscoveryStatic::checkDeviceType(const QString &device)
if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(bitsAbs)), bitsAbs) >= 0 ) {
if (testBit(ABS_X, bitsAbs) && testBit(ABS_Y, bitsAbs)) {
if ((m_types & Device_Touchpad) && testBit(BTN_TOOL_FINGER, bitsKey)) {
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
- qWarning() << "DeviceDiscovery found touchpad at" << device;
-#endif
+ qCDebug(lcDD) << "Found touchpad at" << device;
ret = true;
} else if ((m_types & Device_Touchscreen) && testBit(BTN_TOUCH, bitsKey)) {
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
- qWarning() << "DeviceDiscovery found touchscreen at" << device;
-#endif
+ qCDebug(lcDD) << "Found touchscreen at" << device;
ret = true;
} else if ((m_types & Device_Tablet) && (testBit(BTN_STYLUS, bitsKey) || testBit(BTN_TOOL_PEN, bitsKey))) {
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
- qWarning() << "DeviceDiscovery found tablet at" << device;
-#endif
+ qCDebug(lcDD) << "Found tablet at" << device;
ret = true;
}
}
}
}
+
+ if (!ret && (m_types & Device_Joystick)) {
+ long bitsAbs[LONG_FIELD_SIZE(ABS_CNT)];
+ if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(bitsAbs)), bitsAbs) >= 0 ) {
+ if ((m_types & Device_Joystick)
+ && (testBit(BTN_A, bitsKey) || testBit(BTN_TRIGGER, bitsKey) || testBit(ABS_RX, bitsAbs))) {
+ qCDebug(lcDD) << "Found joystick/gamepad at" << device;
+ ret = true;
+ }
+ }
+ }
}
if (!ret && (m_types & Device_DRM) && device.contains(QString::fromLatin1(QT_DRM_DEVICE_PREFIX)))
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
index 358be828fa..8fa82e2ad7 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
@@ -38,22 +38,17 @@
#include <QObject>
#include <QHash>
#include <QSocketNotifier>
+#include <QLoggingCategory>
#include <linux/input.h>
-//#define QT_QPA_DEVICE_DISCOVERY_DEBUG
-
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
-#include <QtDebug>
-#endif
-
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcDD, "qt.qpa.input")
+
QDeviceDiscovery *QDeviceDiscovery::create(QDeviceTypes types, QObject *parent)
{
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
- qWarning() << "Try to create new UDeviceHelper";
-#endif
+ qCDebug(lcDD) << "udev device discovery for type" << types;
QDeviceDiscovery *helper = 0;
struct udev *udev;
@@ -62,7 +57,7 @@ QDeviceDiscovery *QDeviceDiscovery::create(QDeviceTypes types, QObject *parent)
if (udev) {
helper = new QDeviceDiscoveryUDev(types, udev, parent);
} else {
- qWarning("Failed to get udev library context.");
+ qWarning("Failed to get udev library context");
}
return helper;
@@ -72,18 +67,12 @@ QDeviceDiscoveryUDev::QDeviceDiscoveryUDev(QDeviceTypes types, struct udev *udev
QDeviceDiscovery(types, parent),
m_udev(udev), m_udevMonitor(0), m_udevMonitorFileDescriptor(-1), m_udevSocketNotifier(0)
{
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
- qWarning() << "New UDeviceHelper created for type" << types;
-#endif
-
if (!m_udev)
return;
m_udevMonitor = udev_monitor_new_from_netlink(m_udev, "udev");
if (!m_udevMonitor) {
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
- qWarning("Unable to create an Udev monitor. No devices can be detected.");
-#endif
+ qWarning("Unable to create an udev monitor. No devices can be detected.");
return;
}
@@ -128,11 +117,11 @@ QStringList QDeviceDiscoveryUDev::scanConnectedDevices()
}
if (m_types & Device_Tablet)
udev_enumerate_add_match_property(ue, "ID_INPUT_TABLET", "1");
+ if (m_types & Device_Joystick)
+ udev_enumerate_add_match_property(ue, "ID_INPUT_JOYSTICK", "1");
if (udev_enumerate_scan_devices(ue) != 0) {
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
- qWarning() << "UDeviceHelper scan connected devices for enumeration failed";
-#endif
+ qWarning("Failed to scan devices");
return devices;
}
@@ -158,9 +147,7 @@ QStringList QDeviceDiscoveryUDev::scanConnectedDevices()
}
udev_enumerate_unref(ue);
-#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
- qWarning() << "UDeviceHelper found matching devices" << devices;
-#endif
+ qCDebug(lcDD) << "Found matching devices" << devices;
return devices;
}
@@ -251,6 +238,9 @@ bool QDeviceDiscoveryUDev::checkDeviceType(udev_device *dev)
if ((m_types & Device_Tablet) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TABLET"), "1") == 0))
return true;
+ if ((m_types & Device_Joystick) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK"), "1") == 0))
+ return true;
+
if ((m_types & Device_DRM) && (qstrcmp(udev_device_get_subsystem(dev), "drm") == 0))
return true;
diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp
index 011e2c2961..922455c96f 100644
--- a/src/platformsupport/eglconvenience/qeglconvenience.cpp
+++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp
@@ -576,6 +576,33 @@ int q_screenDepthFromFb(int framebufferDevice)
return depth;
}
+qreal q_refreshRateFromFb(int framebufferDevice)
+{
+ static qreal rate = 0;
+
+#ifdef Q_OS_LINUX
+ if (rate == 0) {
+ if (framebufferDevice != -1) {
+ struct fb_var_screeninfo vinfo;
+ if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) != -1) {
+ const quint64 quot = quint64(vinfo.left_margin + vinfo.right_margin + vinfo.xres + vinfo.hsync_len)
+ * quint64(vinfo.upper_margin + vinfo.lower_margin + vinfo.yres + vinfo.vsync_len)
+ * vinfo.pixclock;
+ if (quot)
+ rate = 1000000000000LLU / quot;
+ } else {
+ qWarning("eglconvenience: Could not query screen info");
+ }
+ }
+ }
+#endif
+
+ if (rate == 0)
+ rate = 60;
+
+ return rate;
+}
+
#endif // Q_OS_UNIX
QT_END_NAMESPACE
diff --git a/src/platformsupport/eglconvenience/qeglconvenience_p.h b/src/platformsupport/eglconvenience/qeglconvenience_p.h
index 1d35545430..59441d8c9a 100644
--- a/src/platformsupport/eglconvenience/qeglconvenience_p.h
+++ b/src/platformsupport/eglconvenience/qeglconvenience_p.h
@@ -63,6 +63,7 @@ void q_printEglConfig(EGLDisplay display, EGLConfig config);
QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize = QSize());
QSize q_screenSizeFromFb(int framebufferDevice);
int q_screenDepthFromFb(int framebufferDevice);
+qreal q_refreshRateFromFb(int framebufferDevice);
#endif
class QEglConfigChooser
diff --git a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp b/src/platformsupport/eglconvenience/qeglplatformcursor.cpp
index bf23d52465..09243487c7 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformcursor.cpp
@@ -43,6 +43,7 @@
#include "qeglplatformcursor_p.h"
#include "qeglplatformintegration_p.h"
+#include "qeglplatformscreen_p.h"
QT_BEGIN_NAMESPACE
@@ -56,7 +57,7 @@ QT_BEGIN_NAMESPACE
QEGLPlatformCursor::QEGLPlatformCursor(QPlatformScreen *screen)
: m_visible(true),
- m_screen(screen),
+ m_screen(static_cast<QEGLPlatformScreen *>(screen)),
m_program(0),
m_vertexCoordEntry(0),
m_textureCoordEntry(0),
@@ -297,9 +298,11 @@ QPoint QEGLPlatformCursor::pos() const
void QEGLPlatformCursor::setPos(const QPoint &pos)
{
+ QGuiApplicationPrivate::inputDeviceManager()->setCursorPos(pos);
const QRect oldCursorRect = cursorRect();
m_cursor.pos = pos;
update(oldCursorRect | cursorRect());
+ m_screen->handleCursorMove(m_cursor.pos);
}
void QEGLPlatformCursor::pointerEvent(const QMouseEvent &event)
@@ -309,6 +312,7 @@ void QEGLPlatformCursor::pointerEvent(const QMouseEvent &event)
const QRect oldCursorRect = cursorRect();
m_cursor.pos = event.screenPos().toPoint();
update(oldCursorRect | cursorRect());
+ m_screen->handleCursorMove(m_cursor.pos);
}
void QEGLPlatformCursor::paintOnScreen()
diff --git a/src/platformsupport/eglconvenience/qeglplatformcursor_p.h b/src/platformsupport/eglconvenience/qeglplatformcursor_p.h
index 481bb3c74c..b89dd1ca43 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcursor_p.h
+++ b/src/platformsupport/eglconvenience/qeglplatformcursor_p.h
@@ -54,6 +54,7 @@ QT_BEGIN_NAMESPACE
class QOpenGLShaderProgram;
class QEGLPlatformCursor;
+class QEGLPlatformScreen;
class QEGLPlatformCursorDeviceListener : public QObject
{
@@ -127,7 +128,7 @@ private:
} m_cursorAtlas;
bool m_visible;
- QPlatformScreen *m_screen;
+ QEGLPlatformScreen *m_screen;
QOpenGLShaderProgram *m_program;
int m_vertexCoordEntry;
int m_textureCoordEntry;
diff --git a/src/platformsupport/eglconvenience/qeglplatformscreen.cpp b/src/platformsupport/eglconvenience/qeglplatformscreen.cpp
index dd4a97cdf5..6e2fc81c42 100644
--- a/src/platformsupport/eglconvenience/qeglplatformscreen.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformscreen.cpp
@@ -32,6 +32,8 @@
****************************************************************************/
#include "qeglplatformscreen_p.h"
+#include <QtGui/qwindow.h>
+#include <qpa/qwindowsysteminterface.h>
#include <QtPlatformSupport/private/qopenglcompositor_p.h>
QT_BEGIN_NAMESPACE
@@ -45,7 +47,8 @@ QT_BEGIN_NAMESPACE
*/
QEGLPlatformScreen::QEGLPlatformScreen(EGLDisplay dpy)
- : m_dpy(dpy)
+ : m_dpy(dpy),
+ m_pointerWindow(0)
{
}
@@ -54,4 +57,41 @@ QEGLPlatformScreen::~QEGLPlatformScreen()
QOpenGLCompositor::destroy();
}
+void QEGLPlatformScreen::handleCursorMove(const QPoint &pos)
+{
+ const QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
+ const QList<QOpenGLCompositorWindow *> windows = compositor->windows();
+
+ // Generate enter and leave events like a real windowing system would do.
+ if (windows.isEmpty())
+ return;
+
+ // First window is always fullscreen.
+ if (windows.count() == 1) {
+ QWindow *window = windows[0]->sourceWindow();
+ if (m_pointerWindow != window) {
+ m_pointerWindow = window;
+ QWindowSystemInterface::handleEnterEvent(window, window->mapFromGlobal(pos), pos);
+ }
+ return;
+ }
+
+ QWindow *enter = 0, *leave = 0;
+ for (int i = windows.count() - 1; i >= 0; --i) {
+ QWindow *window = windows[i]->sourceWindow();
+ const QRect geom = window->geometry();
+ if (geom.contains(pos)) {
+ if (m_pointerWindow != window) {
+ leave = m_pointerWindow;
+ m_pointerWindow = window;
+ enter = window;
+ }
+ break;
+ }
+ }
+
+ if (enter && leave)
+ QWindowSystemInterface::handleEnterLeaveEvent(enter, leave, enter->mapFromGlobal(pos), pos);
+}
+
QT_END_NAMESPACE
diff --git a/src/platformsupport/eglconvenience/qeglplatformscreen_p.h b/src/platformsupport/eglconvenience/qeglplatformscreen_p.h
index 33528e61a7..98a108c4b7 100644
--- a/src/platformsupport/eglconvenience/qeglplatformscreen_p.h
+++ b/src/platformsupport/eglconvenience/qeglplatformscreen_p.h
@@ -46,6 +46,7 @@
//
#include <QtCore/QList>
+#include <QtCore/QPoint>
#include <QtCore/qtextstream.h>
#include <qpa/qplatformscreen.h>
#include <EGL/egl.h>
@@ -53,6 +54,7 @@
QT_BEGIN_NAMESPACE
class QOpenGLContext;
+class QWindow;
class QEGLPlatformWindow;
class QEGLPlatformScreen : public QPlatformScreen
@@ -63,8 +65,11 @@ public:
EGLDisplay display() const { return m_dpy; }
+ void handleCursorMove(const QPoint &pos);
+
private:
EGLDisplay m_dpy;
+ QWindow *m_pointerWindow;
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm b/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm
index bd0f89ba2f..13b7dc4358 100644
--- a/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm
+++ b/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm
@@ -268,6 +268,10 @@ bool QEventDispatcherCoreFoundation::processEvents(QEventLoop::ProcessEventsFlag
qUnIndent(); qEventDispatcherDebug() << "result = " << qPrintableResult(result);
+ eventsProcessed |= (result == kCFRunLoopRunHandledSource
+ || m_processEvents.processedPostedEvents
+ || m_processEvents.processedTimers);
+
if (result == kCFRunLoopRunFinished) {
// This should only happen at application shutdown, as the main runloop
// will presumably always have sources registered.
@@ -302,10 +306,6 @@ bool QEventDispatcherCoreFoundation::processEvents(QEventLoop::ProcessEventsFlag
}
}
- eventsProcessed |= (result == kCFRunLoopRunHandledSource
- || m_processEvents.processedPostedEvents
- || m_processEvents.processedTimers);
-
if (m_processEvents.flags & QEventLoop::EventLoopExec) {
// We were called from QEventLoop's exec(), which blocks until the event
// loop is asked to exit by calling processEvents repeatedly. Instead of
diff --git a/src/platformsupport/fbconvenience/qfbcursor.cpp b/src/platformsupport/fbconvenience/qfbcursor.cpp
index 963d315998..c727d67e72 100644
--- a/src/platformsupport/fbconvenience/qfbcursor.cpp
+++ b/src/platformsupport/fbconvenience/qfbcursor.cpp
@@ -81,22 +81,34 @@ QRect QFbCursor::getCurrentRect()
{
QRect rect = mGraphic->image()->rect().translated(-mGraphic->hotspot().x(),
-mGraphic->hotspot().y());
- rect.translate(QCursor::pos());
+ rect.translate(m_pos);
QPoint mScreenOffset = mScreen->geometry().topLeft();
rect.translate(-mScreenOffset); // global to local translation
return rect;
}
+QPoint QFbCursor::pos() const
+{
+ return m_pos;
+}
-void QFbCursor::pointerEvent(const QMouseEvent & e)
+void QFbCursor::setPos(const QPoint &pos)
{
- Q_UNUSED(e);
- QPoint mScreenOffset = mScreen->geometry().topLeft();
+ QGuiApplicationPrivate::inputDeviceManager()->setCursorPos(pos);
+ m_pos = pos;
mCurrentRect = getCurrentRect();
- // global to local translation
- if (mOnScreen || mScreen->geometry().intersects(mCurrentRect.translated(mScreenOffset))) {
+ if (mOnScreen || mScreen->geometry().intersects(mCurrentRect.translated(mScreen->geometry().topLeft())))
+ setDirty();
+}
+
+void QFbCursor::pointerEvent(const QMouseEvent &e)
+{
+ if (e.type() != QEvent::MouseMove)
+ return;
+ m_pos = e.screenPos().toPoint();
+ mCurrentRect = getCurrentRect();
+ if (mOnScreen || mScreen->geometry().intersects(mCurrentRect.translated(mScreen->geometry().topLeft())))
setDirty();
- }
}
QRect QFbCursor::drawCursor(QPainter & painter)
diff --git a/src/platformsupport/fbconvenience/qfbcursor_p.h b/src/platformsupport/fbconvenience/qfbcursor_p.h
index fe3aeada4c..9c5506b455 100644
--- a/src/platformsupport/fbconvenience/qfbcursor_p.h
+++ b/src/platformsupport/fbconvenience/qfbcursor_p.h
@@ -81,9 +81,11 @@ public:
virtual QRect drawCursor(QPainter &painter);
// input methods
- virtual void pointerEvent(const QMouseEvent &event) Q_DECL_OVERRIDE;
+ void pointerEvent(const QMouseEvent &event) Q_DECL_OVERRIDE;
+ QPoint pos() const Q_DECL_OVERRIDE;
+ void setPos(const QPoint &pos) Q_DECL_OVERRIDE;
#ifndef QT_NO_CURSOR
- virtual void changeCursor(QCursor *widgetCursor, QWindow *window) Q_DECL_OVERRIDE;
+ void changeCursor(QCursor *widgetCursor, QWindow *window) Q_DECL_OVERRIDE;
#endif
virtual void setDirty();
@@ -107,6 +109,7 @@ private:
bool mOnScreen;
QPlatformCursorImage *mGraphic;
QFbCursorDeviceListener *mDeviceListener;
+ QPoint m_pos;
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/fontdatabases/basic/basic.pri b/src/platformsupport/fontdatabases/basic/basic.pri
index 568cdf8ee7..c09ea4eed5 100644
--- a/src/platformsupport/fontdatabases/basic/basic.pri
+++ b/src/platformsupport/fontdatabases/basic/basic.pri
@@ -11,78 +11,7 @@ SOURCES += \
CONFIG += opentype
contains(QT_CONFIG, freetype) {
- QT_FREETYPE_DIR = $$QT_SOURCE_TREE/src/3rdparty/freetype
- SOURCES += \
- $$QT_FREETYPE_DIR/src/base/ftbase.c \
- $$QT_FREETYPE_DIR/src/base/ftbbox.c \
- $$QT_FREETYPE_DIR/src/base/ftdebug.c \
- $$QT_FREETYPE_DIR/src/base/ftglyph.c \
- $$QT_FREETYPE_DIR/src/base/ftlcdfil.c \
- $$QT_FREETYPE_DIR/src/base/ftinit.c \
- $$QT_FREETYPE_DIR/src/base/ftmm.c \
- $$QT_FREETYPE_DIR/src/base/fttype1.c \
- $$QT_FREETYPE_DIR/src/base/ftsynth.c \
- $$QT_FREETYPE_DIR/src/base/ftbitmap.c \
- $$QT_FREETYPE_DIR/src/bdf/bdf.c \
- $$QT_FREETYPE_DIR/src/cache/ftcache.c \
- $$QT_FREETYPE_DIR/src/cff/cff.c \
- $$QT_FREETYPE_DIR/src/cid/type1cid.c \
- $$QT_FREETYPE_DIR/src/gzip/ftgzip.c \
- $$QT_FREETYPE_DIR/src/pcf/pcf.c \
- $$QT_FREETYPE_DIR/src/pfr/pfr.c \
- $$QT_FREETYPE_DIR/src/psaux/psaux.c \
- $$QT_FREETYPE_DIR/src/pshinter/pshinter.c \
- $$QT_FREETYPE_DIR/src/psnames/psmodule.c \
- $$QT_FREETYPE_DIR/src/raster/raster.c \
- $$QT_FREETYPE_DIR/src/sfnt/sfnt.c \
- $$QT_FREETYPE_DIR/src/smooth/smooth.c \
- $$QT_FREETYPE_DIR/src/truetype/truetype.c \
- $$QT_FREETYPE_DIR/src/type1/type1.c \
- $$QT_FREETYPE_DIR/src/type42/type42.c \
- $$QT_FREETYPE_DIR/src/winfonts/winfnt.c \
- $$QT_FREETYPE_DIR/src/lzw/ftlzw.c\
- $$QT_FREETYPE_DIR/src/otvalid/otvalid.c\
- $$QT_FREETYPE_DIR/src/otvalid/otvbase.c\
- $$QT_FREETYPE_DIR/src/otvalid/otvgdef.c\
- $$QT_FREETYPE_DIR/src/otvalid/otvjstf.c\
- $$QT_FREETYPE_DIR/src/otvalid/otvcommn.c\
- $$QT_FREETYPE_DIR/src/otvalid/otvgpos.c\
- $$QT_FREETYPE_DIR/src/otvalid/otvgsub.c\
- $$QT_FREETYPE_DIR/src/otvalid/otvmod.c\
- $$QT_FREETYPE_DIR/src/autofit/afangles.c\
- $$QT_FREETYPE_DIR/src/autofit/afglobal.c\
- $$QT_FREETYPE_DIR/src/autofit/aflatin.c\
- $$QT_FREETYPE_DIR/src/autofit/afmodule.c\
- $$QT_FREETYPE_DIR/src/autofit/afdummy.c\
- $$QT_FREETYPE_DIR/src/autofit/afhints.c\
- $$QT_FREETYPE_DIR/src/autofit/afloader.c\
- $$QT_FREETYPE_DIR/src/autofit/autofit.c
-
- win32 {
- SOURCES += \
- $$QT_FREETYPE_DIR/src/base/ftsystem.c
- } else {
- SOURCES += \
- $$QT_FREETYPE_DIR/builds/unix/ftsystem.c
- INCLUDEPATH += \
- $$QT_FREETYPE_DIR/builds/unix
- }
-
- # disable warnings about "unsafe" methods in C code
- msvc:QMAKE_CFLAGS_WARN_ON += -wd"4996"
-
- INCLUDEPATH += \
- $$QT_FREETYPE_DIR/src \
- $$QT_FREETYPE_DIR/include
-
- TR_EXCLUDE += $$QT_FREETYPE_DIR/*
-
- DEFINES += FT2_BUILD_LIBRARY
- contains(QT_CONFIG, system-zlib) {
- DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB
- include($$PWD/../../../3rdparty/zlib_dependency.pri)
- }
-
+ include($$QT_SOURCE_TREE/src/3rdparty/freetype.pri)
} else:contains(QT_CONFIG, system-freetype) {
# pull in the proper freetype2 include directory
include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
index 6eb1fccba0..805397f021 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
@@ -92,6 +92,9 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeMouse(QString)));
}
}
+
+ connect(QGuiApplicationPrivate::inputDeviceManager(), SIGNAL(cursorPositionChangeRequested(QPoint)),
+ this, SLOT(handleCursorPositionChange(QPoint)));
}
QEvdevMouseManager::~QEvdevMouseManager()
@@ -100,17 +103,8 @@ QEvdevMouseManager::~QEvdevMouseManager()
m_mice.clear();
}
-void QEvdevMouseManager::handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons)
+void QEvdevMouseManager::clampPosition()
{
- // update current absolute coordinates
- if (!abs) {
- m_x += x;
- m_y += y;
- } else {
- m_x = x;
- m_y = y;
- }
-
// clamp to screen geometry
QRect g = QGuiApplication::primaryScreen()->virtualGeometry();
if (m_x + m_xoffset < g.left())
@@ -122,6 +116,20 @@ void QEvdevMouseManager::handleMouseEvent(int x, int y, bool abs, Qt::MouseButto
m_y = g.top() - m_yoffset;
else if (m_y + m_yoffset > g.bottom())
m_y = g.bottom() - m_yoffset;
+}
+
+void QEvdevMouseManager::handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons)
+{
+ // update current absolute coordinates
+ if (!abs) {
+ m_x += x;
+ m_y += y;
+ } else {
+ m_x = x;
+ m_y = y;
+ }
+
+ clampPosition();
QPoint pos(m_x + m_xoffset, m_y + m_yoffset);
// Cannot track the keyboard modifiers ourselves here. Instead, report the
@@ -163,4 +171,11 @@ void QEvdevMouseManager::removeMouse(const QString &deviceNode)
}
}
+void QEvdevMouseManager::handleCursorPositionChange(const QPoint &pos)
+{
+ m_x = pos.x();
+ m_y = pos.y();
+ clampPosition();
+}
+
QT_END_NAMESPACE
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
index 944effd80b..e1b24b807d 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
+++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
@@ -69,8 +69,11 @@ public slots:
private slots:
void addMouse(const QString &deviceNode = QString());
void removeMouse(const QString &deviceNode);
+ void handleCursorPositionChange(const QPoint &pos);
private:
+ void clampPosition();
+
QString m_spec;
QHash<QString,QEvdevMouseHandler*> m_mice;
QDeviceDiscovery *m_deviceDiscovery;
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
index 5215f7da0a..5c28dfb082 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
@@ -175,7 +175,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
setObjectName(QLatin1String("Evdev Touch Handler"));
if (qEnvironmentVariableIsSet("QT_QPA_EVDEV_DEBUG"))
- ((QLoggingCategory &) qLcEvdevTouch()).setEnabled(QtDebugMsg, true);
+ const_cast<QLoggingCategory &>(qLcEvdevTouch()).setEnabled(QtDebugMsg, true);
// only the first device argument is used for now
QString spec = QString::fromLocal8Bit(qgetenv("QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS"));
diff --git a/src/platformsupport/input/libinput/qlibinputhandler.cpp b/src/platformsupport/input/libinput/qlibinputhandler.cpp
index 22b08960df..1a64ad5a30 100644
--- a/src/platformsupport/input/libinput/qlibinputhandler.cpp
+++ b/src/platformsupport/input/libinput/qlibinputhandler.cpp
@@ -107,6 +107,9 @@ QLibInputHandler::QLibInputHandler(const QString &key, const QString &spec)
m_keyboard.reset(new QLibInputKeyboard);
m_touch.reset(new QLibInputTouch);
+ connect(QGuiApplicationPrivate::inputDeviceManager(), SIGNAL(cursorPositionChangeRequested(QPoint)),
+ this, SLOT(onCursorPositionChangeRequested(QPoint)));
+
// Process the initial burst of DEVICE_ADDED events.
onReadyRead();
}
@@ -227,4 +230,9 @@ void QLibInputHandler::processEvent(libinput_event *ev)
}
}
+void QLibInputHandler::onCursorPositionChangeRequested(const QPoint &pos)
+{
+ m_pointer->setPos(pos);
+}
+
QT_END_NAMESPACE
diff --git a/src/platformsupport/input/libinput/qlibinputhandler_p.h b/src/platformsupport/input/libinput/qlibinputhandler_p.h
index 5d54f984de..de04d71f93 100644
--- a/src/platformsupport/input/libinput/qlibinputhandler_p.h
+++ b/src/platformsupport/input/libinput/qlibinputhandler_p.h
@@ -74,6 +74,7 @@ signals:
private slots:
void onReadyRead();
+ void onCursorPositionChangeRequested(const QPoint &pos);
private:
void processEvent(libinput_event *ev);
diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp
index 794ac54e8e..48e5a6cf1c 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer.cpp
+++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp
@@ -108,4 +108,11 @@ void QLibInputPointer::processAxis(libinput_event_pointer *e)
#endif
}
+void QLibInputPointer::setPos(const QPoint &pos)
+{
+ const QRect g = QGuiApplication::primaryScreen()->virtualGeometry();
+ m_pos.setX(qBound(g.left(), pos.x(), g.right()));
+ m_pos.setY(qBound(g.top(), pos.y(), g.bottom()));
+}
+
QT_END_NAMESPACE
diff --git a/src/platformsupport/input/libinput/qlibinputpointer_p.h b/src/platformsupport/input/libinput/qlibinputpointer_p.h
index 3b0c5df1c6..a8ba19c7ec 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer_p.h
+++ b/src/platformsupport/input/libinput/qlibinputpointer_p.h
@@ -60,6 +60,8 @@ public:
void processMotion(libinput_event_pointer *e);
void processAxis(libinput_event_pointer *e);
+ void setPos(const QPoint &pos);
+
private:
QPoint m_pos;
Qt::MouseButtons m_buttons;