summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/devicediscovery/devicediscovery.pri22
-rw-r--r--src/platformsupport/eglconvenience/qeglconvenience.cpp4
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp15
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h3
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp13
-rw-r--r--src/platformsupport/platformsupport.pro6
6 files changed, 42 insertions, 21 deletions
diff --git a/src/platformsupport/devicediscovery/devicediscovery.pri b/src/platformsupport/devicediscovery/devicediscovery.pri
index 1ac25da901..9829ae88ba 100644
--- a/src/platformsupport/devicediscovery/devicediscovery.pri
+++ b/src/platformsupport/devicediscovery/devicediscovery.pri
@@ -1,18 +1,14 @@
HEADERS += $$PWD/qdevicediscovery_p.h
-linux {
- contains(QT_CONFIG, libudev) {
- SOURCES += $$PWD/qdevicediscovery_udev.cpp
- HEADERS += $$PWD/qdevicediscovery_udev_p.h
- INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV
- LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
- } else: contains(QT_CONFIG, evdev) {
- SOURCES += $$PWD/qdevicediscovery_static.cpp
- HEADERS += $$PWD/qdevicediscovery_static_p.h
- } else {
- SOURCES += $$PWD/qdevicediscovery_dummy.cpp
- HEADERS += $$PWD/qdevicediscovery_dummy_p.h
- }
+contains(QT_CONFIG, libudev) {
+ SOURCES += $$PWD/qdevicediscovery_udev.cpp
+ HEADERS += $$PWD/qdevicediscovery_udev_p.h
+ INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV
+ LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
+} else: contains(QT_CONFIG, evdev) {
+ SOURCES += $$PWD/qdevicediscovery_static.cpp
+ HEADERS += $$PWD/qdevicediscovery_static_p.h
} else {
SOURCES += $$PWD/qdevicediscovery_dummy.cpp
+ HEADERS += $$PWD/qdevicediscovery_dummy_p.h
}
diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp
index f8efd105bc..da41cfeabf 100644
--- a/src/platformsupport/eglconvenience/qeglconvenience.cpp
+++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp
@@ -587,6 +587,10 @@ int q_screenDepthFromFb(int framebufferDevice)
qreal q_refreshRateFromFb(int framebufferDevice)
{
+#ifndef Q_OS_LINUX
+ Q_UNUSED(framebufferDevice)
+#endif
+
static qreal rate = 0;
#ifdef Q_OS_LINUX
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
index 36de1e0c69..c7f6dd2740 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
@@ -60,7 +60,7 @@ Q_LOGGING_CATEGORY(qLcEvdevKeyMap, "qt.qpa.input.keymap")
#include "qevdevkeyboard_defaultmap_p.h"
QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, int fd, bool disableZap, bool enableCompose, const QString &keymapFile)
- : m_device(device), m_fd(fd),
+ : m_device(device), m_fd(fd), m_notify(Q_NULLPTR),
m_modifiers(0), m_composing(0), m_dead_unicode(0xffff),
m_no_zap(disableZap), m_do_compose(enableCompose),
m_keymap(0), m_keymap_size(0), m_keycompose(0), m_keycompose_size(0)
@@ -75,9 +75,8 @@ QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, int fd, bool
unloadKeymap();
// socket notifier for events on the keyboard device
- QSocketNotifier *notifier;
- notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), this, SLOT(readKeycode()));
+ m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
+ connect(m_notify, SIGNAL(activated(int)), this, SLOT(readKeycode()));
}
QEvdevKeyboardHandler::~QEvdevKeyboardHandler()
@@ -162,6 +161,14 @@ void QEvdevKeyboardHandler::readKeycode()
} else if (result < 0) {
if (errno != EINTR && errno != EAGAIN) {
qErrnoWarning(errno, "evdevkeyboard: Could not read from input device");
+ // If the device got disconnected, stop reading, otherwise we get flooded
+ // by the above error over and over again.
+ if (errno == ENODEV) {
+ delete m_notify;
+ m_notify = Q_NULLPTR;
+ qt_safe_close(m_fd);
+ m_fd = -1;
+ }
return;
}
} else {
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
index 89fa879115..b94323fcbb 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
@@ -57,6 +57,8 @@
QT_BEGIN_NAMESPACE
+class QSocketNotifier;
+
namespace QEvdevKeyboardMap {
const quint32 FileMagic = 0x514d4150; // 'QMAP'
@@ -186,6 +188,7 @@ private:
QString m_device;
int m_fd;
+ QSocketNotifier *m_notify;
// keymap handling
quint8 m_modifiers;
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
index 382b9b1514..d5ea04bee8 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
@@ -111,9 +111,8 @@ QEvdevMouseHandler::QEvdevMouseHandler(const QString &device, int fd, bool abs,
m_abs = getHardwareMaximum();
// socket notifier for events on the mouse device
- QSocketNotifier *notifier;
- notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), this, SLOT(readMouseData()));
+ m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
+ connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData()));
}
QEvdevMouseHandler::~QEvdevMouseHandler()
@@ -202,6 +201,14 @@ void QEvdevMouseHandler::readMouseData()
} else if (result < 0) {
if (errno != EINTR && errno != EAGAIN) {
qErrnoWarning(errno, "evdevmouse: Could not read from input device");
+ // If the device got disconnected, stop reading, otherwise we get flooded
+ // by the above error over and over again.
+ if (errno == ENODEV) {
+ delete m_notify;
+ m_notify = Q_NULLPTR;
+ qt_safe_close(m_fd);
+ m_fd = -1;
+ }
return;
}
} else {
diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro
index 81c7faa389..60be964b74 100644
--- a/src/platformsupport/platformsupport.pro
+++ b/src/platformsupport/platformsupport.pro
@@ -21,7 +21,11 @@ include(accessibility/accessibility.pri)
include(linuxaccessibility/linuxaccessibility.pri)
include(clipboard/clipboard.pri)
include(platformcompositor/platformcompositor.pri)
-contains(QT_CONFIG, dbus) {
+
+# dbus convenience, but not for darwin: the platform
+# plugins for these platforms do not use dbus and we
+# don't want to create a false dependency.
+!darwin: contains(QT_CONFIG, dbus) {
include(dbusmenu/dbusmenu.pri)
include(dbustray/dbustray.pri)
}