diff options
author | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2017-08-02 23:15:27 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2017-08-02 23:15:27 +0000 |
commit | 6c2bfbf88efa745882c636d9b91c4210b8fa5572 (patch) | |
tree | 54625073d07ee5830bdfba3853cf9d95ec211b7d /src/plugins/platforms/xcb | |
parent | 72cf2339edbb302b8b1dbe14c5475e8d2c3f62b1 (diff) | |
parent | ee07b912a1768ea0b103544f9eeac41f3cf50cf6 (diff) |
Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 28 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 5 |
3 files changed, 22 insertions, 12 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 674b0cef4b..13f5cd5842 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -428,6 +428,7 @@ public: #if QT_CONFIG(xinput2) void xi2Select(xcb_window_t window); + void xi2SelectStateEvents(); bool isAtLeastXI21() const { return m_xi2Enabled && m_xi2Minor >= 1; } bool isAtLeastXI22() const { return m_xi2Enabled && m_xi2Minor >= 2; } #endif diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index bf17e9c1e1..8ed6909990 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -79,6 +79,7 @@ void QXcbConnection::initializeXInput2() qCDebug(lcQpaXInput, "Using XInput version %d.%d", xiMajor, m_xi2Minor); m_xi2Enabled = true; xi2SetupDevices(); + xi2SelectStateEvents(); break; case BadRequest: // Must be an X server with XInput 1 qCDebug(lcQpaXInput, "X server does not support XInput 2"); @@ -90,6 +91,22 @@ void QXcbConnection::initializeXInput2() } } +void QXcbConnection::xi2SelectStateEvents() +{ + // These state events do not depend on a specific X window, but are global + // for the X client's (application's) state. + unsigned int bitMask = 0; + unsigned char *xiBitMask = reinterpret_cast<unsigned char *>(&bitMask); + XIEventMask xiEventMask; + bitMask = XI_HierarchyChangedMask; + bitMask |= XI_DeviceChangedMask; + xiEventMask.deviceid = XIAllDevices; + xiEventMask.mask_len = sizeof(bitMask); + xiEventMask.mask = xiBitMask; + Display *dpy = static_cast<Display *>(m_xlib_display); + XISelectEvents(dpy, DefaultRootWindow(dpy), &xiEventMask, 1); +} + void QXcbConnection::xi2SetupDevice(void *info, bool removeExisting) { XIDeviceInfo *deviceInfo = reinterpret_cast<XIDeviceInfo *>(info); @@ -373,17 +390,6 @@ void QXcbConnection::xi2Select(xcb_window_t window) #else Q_UNUSED(xiBitMask); #endif - - { - // Listen for hotplug events - XIEventMask xiEventMask; - bitMask = XI_HierarchyChangedMask; - bitMask |= XI_DeviceChangedMask; - xiEventMask.deviceid = XIAllDevices; - xiEventMask.mask_len = sizeof(bitMask); - xiEventMask.mask = xiBitMask; - XISelectEvents(xDisplay, window, &xiEventMask, 1); - } } QXcbConnection::TouchDeviceData *QXcbConnection::touchDeviceForId(int id) diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 8ba6834565..c8efe2fce8 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -329,12 +329,15 @@ QAbstractEventDispatcher *QXcbIntegration::createEventDispatcher() const void QXcbIntegration::initialize() { + const QLatin1String defaultInputContext("compose"); // Perform everything that may potentially need the event dispatcher (timers, socket // notifiers) here instead of the constructor. QString icStr = QPlatformInputContextFactory::requested(); if (icStr.isNull()) - icStr = QLatin1String("compose"); + icStr = defaultInputContext; m_inputContext.reset(QPlatformInputContextFactory::create(icStr)); + if (!m_inputContext && icStr != defaultInputContext && icStr != QLatin1String("none")) + m_inputContext.reset(QPlatformInputContextFactory::create(defaultInputContext)); } void QXcbIntegration::moveToScreen(QWindow *window, int screen) |