diff options
Diffstat (limited to 'src/platformsupport/input')
5 files changed, 13 insertions, 4 deletions
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp index de37f5e2df..24b2821fbb 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp @@ -138,7 +138,11 @@ std::unique_ptr<QEvdevKeyboardHandler> QEvdevKeyboardHandler::create(const QStri qCDebug(qLcEvdevKey, "Opening keyboard at %ls", qUtf16Printable(device)); - QFdContainer fd(qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0)); + QFdContainer fd(qt_safe_open(device.toLocal8Bit().constData(), O_RDWR | O_NDELAY, 0)); + if (fd.get() < 0) { + qCDebug(qLcEvdevKey, "Keyboard device could not be opened as read-write, trying read-only"); + fd.reset(qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0)); + } if (fd.get() >= 0) { ::ioctl(fd.get(), EVIOCGRAB, grab); if (repeatDelay > 0 && repeatRate > 0) { diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h index f92a2bf704..24ed1b64a8 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h @@ -143,6 +143,7 @@ public: int release() noexcept { int result = m_fd; m_fd = -1; return result; } void reset() noexcept; + void reset(int fd) { reset(); m_fd = fd; } }; class QEvdevKeyboardHandler : public QObject diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index f57e1540e0..80a911a210 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -756,7 +756,7 @@ QRect QEvdevTouchScreenData::screenGeometry() const if (m_screen) screen = m_screen; } - return QHighDpi::toNativePixels(screen->geometry(), screen); + return screen ? QHighDpi::toNativePixels(screen->geometry(), screen) : QRect(); } void QEvdevTouchScreenData::reportPoints() diff --git a/src/platformsupport/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp index 446218e4b3..6eb3a8a355 100644 --- a/src/platformsupport/input/libinput/qlibinputtouch.cpp +++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp @@ -82,7 +82,7 @@ QPointF QLibInputTouch::getPos(libinput_event_touch *e) if (m_screen) screen = m_screen; } - const QRect geom = QHighDpi::toNativePixels(screen->geometry(), screen); + const QRect geom = screen ? QHighDpi::toNativePixels(screen->geometry(), screen) : QRect(); const double x = libinput_event_touch_get_x_transformed(e, geom.width()); const double y = libinput_event_touch_get_y_transformed(e, geom.height()); return geom.topLeft() + QPointF(x, y); diff --git a/src/platformsupport/input/xkbcommon/qxkbcommon.cpp b/src/platformsupport/input/xkbcommon/qxkbcommon.cpp index 877c5d848f..b713c19447 100644 --- a/src/platformsupport/input/xkbcommon/qxkbcommon.cpp +++ b/src/platformsupport/input/xkbcommon/qxkbcommon.cpp @@ -41,7 +41,9 @@ #include <private/qmakearray_p.h> +#include <QtCore/private/qstringiterator_p.h> #include <QtCore/QMetaMethod> + #include <QtGui/QKeyEvent> #include <QtGui/private/qguiapplication_p.h> @@ -574,7 +576,9 @@ static int keysymToQtKey_internal(xkb_keysym_t keysym, Qt::KeyboardModifiers mod // e.g CTRL + ۲ (arabic two), is mapped to CTRL + Qt::Key_2. qtKey = Qt::Key_0 + text.unicode()->digitValue(); } else { - qtKey = text.unicode()->toUpper().unicode(); + text = text.toUpper(); + QStringIterator i(text); + qtKey = i.next(0); } } |