summaryrefslogtreecommitdiffstats
path: root/src/gui/embedded/qmouselinuxinput_qws.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/embedded/qmouselinuxinput_qws.cpp')
-rw-r--r--src/gui/embedded/qmouselinuxinput_qws.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gui/embedded/qmouselinuxinput_qws.cpp b/src/gui/embedded/qmouselinuxinput_qws.cpp
index 19a9a99..5b4f664 100644
--- a/src/gui/embedded/qmouselinuxinput_qws.cpp
+++ b/src/gui/embedded/qmouselinuxinput_qws.cpp
@@ -43,6 +43,7 @@
#include <QScreen>
#include <QSocketNotifier>
+#include <QStringList>
#include <qplatformdefs.h>
#include <private/qcore_unix_p.h> // overrides QT_OPEN
@@ -101,11 +102,19 @@ QWSLinuxInputMousePrivate::QWSLinuxInputMousePrivate(QWSLinuxInputMouseHandler *
setObjectName(QLatin1String("LinuxInputSubsystem Mouse Handler"));
QString dev = QLatin1String("/dev/input/event0");
- if (device.startsWith(QLatin1String("/dev/")))
- dev = device;
+ int grab = 0;
+
+ QStringList args = device.split(QLatin1Char(':'));
+ foreach (const QString &arg, args) {
+ if (arg.startsWith(QLatin1String("grab=")))
+ grab = arg.mid(5).toInt();
+ else if (arg.startsWith(QLatin1String("/dev/")))
+ dev = arg;
+ }
m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
if (m_fd >= 0) {
+ ::ioctl(m_fd, EVIOCGRAB, grab);
m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData()));
} else {