summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-03-10 08:29:37 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-03-14 09:24:31 +0000
commit3bf655e5960c8f0ac4cb8b99a671886b824c7191 (patch)
tree4f01f8abe022da61ae101ea5e5dc459446973b9b /src/gui
parent00c09aaf5bac2ae2ee46b20bfbb4b46379ba90e7 (diff)
Support QCursor::setPos() properly for eglfs
The internal state of the input handlers need updating too. This was not possible in the past due to the one way communication from the input handlers (that are potentially loaded as interface-less generic plugins), but using our new private QInputDeviceManager in QtGui we can now easily implement "talking back" from QtGui to the input handlers, regardless of them being plugins or compiled in. The rest of setPos() is in place already for eglfs. linuxfb will be handled in follow-up patches. Task-number: QTBUG-44856 Change-Id: Id72fdb8b1ea176ddfe082e466e7a538a2a98a005 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qinputdevicemanager.cpp24
-rw-r--r--src/gui/kernel/qinputdevicemanager_p.h3
2 files changed, 27 insertions, 0 deletions
diff --git a/src/gui/kernel/qinputdevicemanager.cpp b/src/gui/kernel/qinputdevicemanager.cpp
index 1a3e6b8119..d0dd8a4e7c 100644
--- a/src/gui/kernel/qinputdevicemanager.cpp
+++ b/src/gui/kernel/qinputdevicemanager.cpp
@@ -36,6 +36,25 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QInputDeviceManager
+ \internal
+
+ \brief QInputDeviceManager acts as a communication hub between QtGui and the input handlers.
+
+ On embedded platforms the input handling code is either compiled into the platform
+ plugin or is loaded dynamically as a generic plugin without any interface. The input
+ handler in use may also change between each run (e.g. evdevmouse/keyboard/touch
+ vs. libinput). QWindowSystemInterface is too limiting when Qt (the platform plugin) is
+ acting as a windowing system, and is one way only.
+
+ QInputDeviceManager solves this by providing a global object that is used to communicate
+ from the input handlers to the rest of Qt (e.g. the number of connected mice, which may
+ be important information for the cursor drawing code), and vice-versa (e.g. to indicate
+ to the input handler that a manual cursor position change was requested by the
+ application via QCursor::setPos and thus any internal state has to be updated accordingly).
+*/
+
QInputDeviceManager::QInputDeviceManager(QObject *parent)
: QObject(*new QInputDeviceManagerPrivate, parent)
{
@@ -61,4 +80,9 @@ void QInputDeviceManagerPrivate::setDeviceCount(QInputDeviceManager::DeviceType
}
}
+void QInputDeviceManager::setCursorPos(const QPoint &pos)
+{
+ emit cursorPositionChangeRequested(pos);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h
index cc55c8b4e5..15c84d1a82 100644
--- a/src/gui/kernel/qinputdevicemanager_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p.h
@@ -68,8 +68,11 @@ public:
int deviceCount(DeviceType type) const;
+ void setCursorPos(const QPoint &pos);
+
signals:
void deviceListChanged(DeviceType type);
+ void cursorPositionChangeRequested(const QPoint &pos);
};
QT_END_NAMESPACE