From ab3603d2b5ed2cb6bc403643d82e97015449546b Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 5 Jun 2014 14:20:34 +0200 Subject: Fix alpha in no-opengl configuration on xcb Like the EGL + xcb configuration, the -no-opengl is broken too when it comes to translucent windows: Requesting an alpha channel is futile since the xcb_create_window call always uses the root's depth and visual. This is now corrected by picking a 32-bit visual. This will make translucent windows and drag pixmaps appear correctly again. Task-number: QTBUG-35126 Change-Id: I00e7d6e08b5fcc055ef3ea6d822561740a1f5457 Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbwindow.cpp | 34 ++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index a46fe437d8..74d8b7c2c8 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -337,12 +337,38 @@ void QXcbWindow::create() #endif //defined(XCB_USE_GLX) || defined(XCB_USE_EGL) { m_window = xcb_generate_id(xcb_connection()); + m_visualId = m_screen->screen()->root_visual; m_depth = m_screen->screen()->root_depth; + + uint32_t mask = 0; + uint32_t values[3]; + + if (m_format.alphaBufferSize() == 8) { + xcb_depth_iterator_t depthIter = xcb_screen_allowed_depths_iterator(m_screen->screen()); + while (depthIter.rem) { + if (depthIter.data->depth == 32) { + xcb_visualtype_iterator_t visualIter = xcb_depth_visuals_iterator(depthIter.data); + if (visualIter.rem) { + m_visualId = visualIter.data->visual_id; + m_depth = 32; + uint32_t colormap = xcb_generate_id(xcb_connection()); + xcb_create_colormap(xcb_connection(), XCB_COLORMAP_ALLOC_NONE, colormap, + xcb_parent_id, m_visualId); + mask |= XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL | XCB_CW_COLORMAP; + values[0] = m_screen->screen()->white_pixel; + values[1] = m_screen->screen()->black_pixel; + values[2] = colormap; + break; + } + } + xcb_depth_next(&depthIter); + } + } + m_imageFormat = imageFormatForDepth(m_depth); - m_visualId = m_screen->screen()->root_visual; Q_XCB_CALL(xcb_create_window(xcb_connection(), - XCB_COPY_FROM_PARENT, // depth -- same as root + m_depth, m_window, // window id xcb_parent_id, // parent window id rect.x(), @@ -352,8 +378,8 @@ void QXcbWindow::create() 0, // border width XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class m_visualId, // visual - 0, // value mask - 0)); // value list + mask, + values)); } connection()->addWindowEventListener(m_window, this); -- cgit v1.2.3 From da5dea807f497bc6004f40e966e5d882a2ba72b0 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 11 Apr 2014 13:45:47 +0200 Subject: Support hotplugging of input devices with XInput2 Since we only scan for XInput2 devices on application start, we will currently miss any devices plugged in while the application is running. This patch makes QXcbConnection listen for XInput2 hierachyChanged events and use them to trigger a rescan of XInput2 devices. This fixes a regression in Qt 5.3, where the scroll wheel on hot- plugged mice does not work until the Qt application is restarted. Change-Id: I2cdc7ca24d3ab00716cedc4b22355b6e4935b184 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.h | 2 + src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 248 +++++++++++++---------- 2 files changed, 145 insertions(+), 105 deletions(-) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index f96541318c..6c9ccbcc2f 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -496,8 +496,10 @@ private: #ifdef XCB_USE_XINPUT2 void initializeXInput2(); void finalizeXInput2(); + void xi2SetupDevices(); XInput2DeviceData *deviceForId(int id); void xi2HandleEvent(xcb_ge_event_t *event); + void xi2HandleHierachyEvent(void *event); int m_xiOpCode, m_xiEventBase, m_xiErrorBase; #ifndef QT_NO_TABLETEVENT struct TabletData { diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index eb7b220c43..0b7ea155c1 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -73,10 +73,6 @@ void QXcbConnection::initializeXInput2() { debug_xinput = qEnvironmentVariableIsSet("QT_XCB_DEBUG_XINPUT"); debug_xinput_devices = qEnvironmentVariableIsSet("QT_XCB_DEBUG_XINPUT_DEVICES"); -#ifndef QT_NO_TABLETEVENT - m_tabletData.clear(); -#endif - m_scrollingDevices.clear(); Display *xDisplay = static_cast(m_xlib_display); if (XQueryExtension(xDisplay, "XInputExtension", &m_xiOpCode, &m_xiEventBase, &m_xiErrorBase)) { int xiMajor = 2; @@ -97,122 +93,137 @@ void QXcbConnection::initializeXInput2() #else qDebug("XInput version %d.%d is available and Qt supports 2.0", xiMajor, m_xi2Minor); #endif - int deviceCount = 0; - XIDeviceInfo *devices = XIQueryDevice(xDisplay, XIAllDevices, &deviceCount); - for (int i = 0; i < deviceCount; ++i) { - // Only non-master pointing devices are relevant here. - if (devices[i].use != XISlavePointer) - continue; - if (Q_UNLIKELY(debug_xinput_devices)) - qDebug() << "input device "<< devices[i].name; + } + + xi2SetupDevices(); + } +} + +void QXcbConnection::xi2SetupDevices() +{ #ifndef QT_NO_TABLETEVENT - TabletData tabletData; + m_tabletData.clear(); #endif - ScrollingDevice scrollingDevice; - for (int c = 0; c < devices[i].num_classes; ++c) { - switch (devices[i].classes[c]->type) { - case XIValuatorClass: { - XIValuatorClassInfo *vci = reinterpret_cast(devices[i].classes[c]); - const int valuatorAtom = qatom(vci->label); - if (Q_UNLIKELY(debug_xinput_devices)) - qDebug() << " has valuator" << atomName(vci->label) << "recognized?" << (valuatorAtom < QXcbAtom::NAtoms); + m_scrollingDevices.clear(); + + if (!m_xi2Enabled) + return; + + Display *xDisplay = static_cast(m_xlib_display); + int deviceCount = 0; + XIDeviceInfo *devices = XIQueryDevice(xDisplay, XIAllDevices, &deviceCount); + for (int i = 0; i < deviceCount; ++i) { + // Only non-master pointing devices are relevant here. + if (devices[i].use != XISlavePointer) + continue; + if (Q_UNLIKELY(debug_xinput_devices)) + qDebug() << "input device "<< devices[i].name; #ifndef QT_NO_TABLETEVENT - if (valuatorAtom < QXcbAtom::NAtoms) { - TabletData::ValuatorClassInfo info; - info.minVal = vci->min; - info.maxVal = vci->max; - info.number = vci->number; - tabletData.valuatorInfo[valuatorAtom] = info; - } + TabletData tabletData; +#endif + ScrollingDevice scrollingDevice; + for (int c = 0; c < devices[i].num_classes; ++c) { + switch (devices[i].classes[c]->type) { + case XIValuatorClass: { + XIValuatorClassInfo *vci = reinterpret_cast(devices[i].classes[c]); + const int valuatorAtom = qatom(vci->label); + if (Q_UNLIKELY(debug_xinput_devices)) + qDebug() << " has valuator" << atomName(vci->label) << "recognized?" << (valuatorAtom < QXcbAtom::NAtoms); +#ifndef QT_NO_TABLETEVENT + if (valuatorAtom < QXcbAtom::NAtoms) { + TabletData::ValuatorClassInfo info; + info.minVal = vci->min; + info.maxVal = vci->max; + info.number = vci->number; + tabletData.valuatorInfo[valuatorAtom] = info; + } #endif // QT_NO_TABLETEVENT - if (valuatorAtom == QXcbAtom::RelHorizScroll || valuatorAtom == QXcbAtom::RelHorizWheel) - scrollingDevice.lastScrollPosition.setX(vci->value); - else if (valuatorAtom == QXcbAtom::RelVertScroll || valuatorAtom == QXcbAtom::RelVertWheel) - scrollingDevice.lastScrollPosition.setY(vci->value); - break; - } + if (valuatorAtom == QXcbAtom::RelHorizScroll || valuatorAtom == QXcbAtom::RelHorizWheel) + scrollingDevice.lastScrollPosition.setX(vci->value); + else if (valuatorAtom == QXcbAtom::RelVertScroll || valuatorAtom == QXcbAtom::RelVertWheel) + scrollingDevice.lastScrollPosition.setY(vci->value); + break; + } #ifdef XCB_USE_XINPUT21 - case XIScrollClass: { - XIScrollClassInfo *sci = reinterpret_cast(devices[i].classes[c]); - if (sci->scroll_type == XIScrollTypeVertical) { - scrollingDevice.orientations |= Qt::Vertical; - scrollingDevice.verticalIndex = sci->number; - scrollingDevice.verticalIncrement = sci->increment; - } - else if (sci->scroll_type == XIScrollTypeHorizontal) { - scrollingDevice.orientations |= Qt::Horizontal; - scrollingDevice.horizontalIndex = sci->number; - scrollingDevice.horizontalIncrement = sci->increment; - } - break; - } - case XIButtonClass: { - XIButtonClassInfo *bci = reinterpret_cast(devices[i].classes[c]); - if (bci->num_buttons >= 5) { - Atom label4 = bci->labels[3]; - Atom label5 = bci->labels[4]; - if ((!label4 || qatom(label4) == QXcbAtom::ButtonWheelUp) && (!label5 || qatom(label5) == QXcbAtom::ButtonWheelDown)) - scrollingDevice.legacyOrientations |= Qt::Vertical; - } - if (bci->num_buttons >= 7) { - Atom label6 = bci->labels[5]; - Atom label7 = bci->labels[6]; - if ((!label6 || qatom(label6) == QXcbAtom::ButtonHorizWheelLeft) && (!label7 || qatom(label7) == QXcbAtom::ButtonHorizWheelRight)) - scrollingDevice.legacyOrientations |= Qt::Horizontal; - } - break; - } -#endif - default: - break; - } + case XIScrollClass: { + XIScrollClassInfo *sci = reinterpret_cast(devices[i].classes[c]); + if (sci->scroll_type == XIScrollTypeVertical) { + scrollingDevice.orientations |= Qt::Vertical; + scrollingDevice.verticalIndex = sci->number; + scrollingDevice.verticalIncrement = sci->increment; } - bool isTablet = false; -#ifndef QT_NO_TABLETEVENT - // If we have found the valuators which we expect a tablet to have, assume it's a tablet. - if (tabletData.valuatorInfo.contains(QXcbAtom::AbsX) && - tabletData.valuatorInfo.contains(QXcbAtom::AbsY) && - tabletData.valuatorInfo.contains(QXcbAtom::AbsPressure)) { - tabletData.deviceId = devices[i].deviceid; - tabletData.pointerType = QTabletEvent::Pen; - if (QByteArray(devices[i].name).toLower().contains("eraser")) - tabletData.pointerType = QTabletEvent::Eraser; - m_tabletData.append(tabletData); - isTablet = true; - if (Q_UNLIKELY(debug_xinput_devices)) - qDebug() << " it's a tablet with pointer type" << tabletData.pointerType; + else if (sci->scroll_type == XIScrollTypeHorizontal) { + scrollingDevice.orientations |= Qt::Horizontal; + scrollingDevice.horizontalIndex = sci->number; + scrollingDevice.horizontalIncrement = sci->increment; + } + break; + } + case XIButtonClass: { + XIButtonClassInfo *bci = reinterpret_cast(devices[i].classes[c]); + if (bci->num_buttons >= 5) { + Atom label4 = bci->labels[3]; + Atom label5 = bci->labels[4]; + if ((!label4 || qatom(label4) == QXcbAtom::ButtonWheelUp) && (!label5 || qatom(label5) == QXcbAtom::ButtonWheelDown)) + scrollingDevice.legacyOrientations |= Qt::Vertical; + } + if (bci->num_buttons >= 7) { + Atom label6 = bci->labels[5]; + Atom label7 = bci->labels[6]; + if ((!label6 || qatom(label6) == QXcbAtom::ButtonHorizWheelLeft) && (!label7 || qatom(label7) == QXcbAtom::ButtonHorizWheelRight)) + scrollingDevice.legacyOrientations |= Qt::Horizontal; } + break; + } +#endif + default: + break; + } + } + bool isTablet = false; +#ifndef QT_NO_TABLETEVENT + // If we have found the valuators which we expect a tablet to have, assume it's a tablet. + if (tabletData.valuatorInfo.contains(QXcbAtom::AbsX) && + tabletData.valuatorInfo.contains(QXcbAtom::AbsY) && + tabletData.valuatorInfo.contains(QXcbAtom::AbsPressure)) { + tabletData.deviceId = devices[i].deviceid; + tabletData.pointerType = QTabletEvent::Pen; + if (QByteArray(devices[i].name).toLower().contains("eraser")) + tabletData.pointerType = QTabletEvent::Eraser; + m_tabletData.append(tabletData); + isTablet = true; + if (Q_UNLIKELY(debug_xinput_devices)) + qDebug() << " it's a tablet with pointer type" << tabletData.pointerType; + } #endif // QT_NO_TABLETEVENT #ifdef XCB_USE_XINPUT21 - if (scrollingDevice.orientations || scrollingDevice.legacyOrientations) { - scrollingDevice.deviceId = devices[i].deviceid; - // Only use legacy wheel button events when we don't have real scroll valuators. - scrollingDevice.legacyOrientations &= ~scrollingDevice.orientations; - m_scrollingDevices.insert(scrollingDevice.deviceId, scrollingDevice); - if (Q_UNLIKELY(debug_xinput_devices)) - qDebug() << " it's a scrolling device"; - } + if (scrollingDevice.orientations || scrollingDevice.legacyOrientations) { + scrollingDevice.deviceId = devices[i].deviceid; + // Only use legacy wheel button events when we don't have real scroll valuators. + scrollingDevice.legacyOrientations &= ~scrollingDevice.orientations; + m_scrollingDevices.insert(scrollingDevice.deviceId, scrollingDevice); + if (Q_UNLIKELY(debug_xinput_devices)) + qDebug() << " it's a scrolling device"; + } #endif - if (!isTablet) { - XInput2DeviceData *dev = deviceForId(devices[i].deviceid); - if (Q_UNLIKELY(debug_xinput_devices)) { - if (dev && dev->qtTouchDevice->type() == QTouchDevice::TouchScreen) - qDebug(" it's a touchscreen with type %d capabilities 0x%X max touch points %d", - dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), - dev->qtTouchDevice->maximumTouchPoints()); - else if (dev && dev->qtTouchDevice->type() == QTouchDevice::TouchPad) - qDebug(" it's a touchpad with type %d capabilities 0x%X max touch points %d size %f x %f", - dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), - dev->qtTouchDevice->maximumTouchPoints(), - dev->size.width(), dev->size.height()); - } - } + if (!isTablet) { + XInput2DeviceData *dev = deviceForId(devices[i].deviceid); + if (Q_UNLIKELY(debug_xinput_devices)) { + if (dev && dev->qtTouchDevice->type() == QTouchDevice::TouchScreen) + qDebug(" it's a touchscreen with type %d capabilities 0x%X max touch points %d", + dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), + dev->qtTouchDevice->maximumTouchPoints()); + else if (dev && dev->qtTouchDevice->type() == QTouchDevice::TouchPad) + qDebug(" it's a touchpad with type %d capabilities 0x%X max touch points %d size %f x %f", + dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), + dev->qtTouchDevice->maximumTouchPoints(), + dev->size.width(), dev->size.height()); } - XIFreeDeviceInfo(devices); } } + XIFreeDeviceInfo(devices); } void QXcbConnection::finalizeXInput2() @@ -303,6 +314,16 @@ void QXcbConnection::xi2Select(xcb_window_t window) #else Q_UNUSED(xiBitMask); #endif + + { + // Listen for hotplug events + XIEventMask xiEventMask; + bitMask = XI_HierarchyChangedMask; + xiEventMask.deviceid = XIAllDevices; + xiEventMask.mask_len = sizeof(bitMask); + xiEventMask.mask = xiBitMask; + XISelectEvents(xDisplay, window, &xiEventMask, 1); + } } XInput2DeviceData *QXcbConnection::deviceForId(int id) @@ -402,6 +423,10 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) if (xi2PrepareXIGenericDeviceEvent(event, m_xiOpCode)) { xXIGenericDeviceEvent *xiEvent = reinterpret_cast(event); + if (xiEvent->evtype == XI_HierarchyChanged) { + xi2HandleHierachyEvent(xiEvent); + return; + } #ifndef QT_NO_TABLETEVENT for (int i = 0; i < m_tabletData.count(); ++i) { if (m_tabletData.at(i).deviceId == xiEvent->deviceid) { @@ -561,6 +586,19 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) } } +void QXcbConnection::xi2HandleHierachyEvent(void *event) +{ + xXIHierarchyEvent *xiEvent = reinterpret_cast(event); + // We only care about hotplugged devices + if (!(xiEvent->flags & (XISlaveRemoved | XISlaveAdded))) + return; + xi2SetupDevices(); + // Reselect events for all event-listening windows. + Q_FOREACH (xcb_window_t window, m_mapper.keys()) { + xi2Select(window); + } +} + void QXcbConnection::handleEnterEvent(const xcb_enter_notify_event_t *) { #ifdef XCB_USE_XINPUT21 -- cgit v1.2.3 From a461bb1ff5b5f310244bae1691b08e7135aeda0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 19 May 2014 08:58:37 +0200 Subject: Flush xcb connection before EventDispatcher is going to block The non-threaded QXcbEventReader invokes processXcbEvents when the EventDispatcher is about to block. This method ensures that the xcb connection is going to flush. Applications can use low level xcb code in that case without having to ensure to flush the connection before going to block again. With the threaded QXcbEventReader this didn't work and applications which for example changed a window property and waited for the matching property notify event were stalled. This change ensures that also in the threaded case the connection gets flushed when the EventDispatcher is going to block. Change-Id: If1dc5eb96e2f1bde10b7a40af550b0608c62f70c Reviewed-by: Laszlo Agocs Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.cpp | 9 +++++++++ src/plugins/platforms/xcb/qxcbconnection.h | 6 +++++- src/plugins/platforms/xcb/qxcbintegration.cpp | 5 ++++- 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 1b72bb0da1..7f23c84cb9 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1028,6 +1028,15 @@ void QXcbEventReader::registerForEvents() connect(dispatcher, SIGNAL(awake()), m_connection, SLOT(processXcbEvents())); } +void QXcbEventReader::registerEventDispatcher(QAbstractEventDispatcher *dispatcher) +{ + // flush the xcb connection before the EventDispatcher is going to block + // In the non-threaded case processXcbEvents is called before going to block, + // which flushes the connection. + if (m_xcb_poll_for_queued_event) + connect(dispatcher, SIGNAL(aboutToBlock()), m_connection, SLOT(flush())); +} + void QXcbEventReader::run() { xcb_generic_event_t *event; diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 6c9ccbcc2f..0bfc2f8f76 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -311,6 +311,8 @@ public: void start(); + void registerEventDispatcher(QAbstractEventDispatcher *dispatcher); + signals: void eventPending(); @@ -410,7 +412,6 @@ public: void sync(); - void flush() { xcb_flush(m_connection); } void handleXcbError(xcb_generic_error_t *error); void handleXcbEvent(xcb_generic_event_t *event); @@ -464,8 +465,11 @@ public: void handleEnterEvent(const xcb_enter_notify_event_t *); #endif + QXcbEventReader *eventReader() const { return m_reader; } + public slots: void syncWindow(QXcbWindow *window); + void flush() { xcb_flush(m_connection); } private slots: void processXcbEvents(); diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index ddb164bf07..1b1c20f02c 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -303,7 +303,10 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const QAbstractEventDispatcher *QXcbIntegration::createEventDispatcher() const { - return createUnixEventDispatcher(); + QAbstractEventDispatcher *dispatcher = createUnixEventDispatcher(); + for (int i = 0; i < m_connections.size(); i++) + m_connections[i]->eventReader()->registerEventDispatcher(dispatcher); + return dispatcher; } void QXcbIntegration::initialize() -- cgit v1.2.3 From 4038f21dd0799d319a8ee019735cbe109405a532 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 10 Jun 2014 15:25:34 +0200 Subject: xcb: touch device mode is either Dependent or Direct, not Rel or Abs Change-Id: Ic0091007c95c4c307485bc2d5d3e1e967b44323e Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 0b7ea155c1..c296618c44 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -347,10 +347,10 @@ XInput2DeviceData *QXcbConnection::deviceForId(int id) if (Q_UNLIKELY(debug_xinput_devices)) qDebug(" has touch class with mode %d", tci->mode); switch (tci->mode) { - case XIModeRelative: + case XIDependentTouch: type = QTouchDevice::TouchPad; break; - case XIModeAbsolute: + case XIDirectTouch: type = QTouchDevice::TouchScreen; break; } -- cgit v1.2.3 From 7e62b10cc14629807ee9656ad155d1ce6170cd60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Mon, 16 Jun 2014 13:54:49 +0200 Subject: Remove unused define XCB_USE_IBUS. Change-Id: Ife95a822ed24b29e9bff0612cd0dc265192c49d8 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/xcb/xcb-plugin.pro | 1 - 1 file changed, 1 deletion(-) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index a52aaa4a2e..4d76e4d449 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -109,7 +109,6 @@ QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB CONFIG += qpa/genericunixfontdatabase contains(QT_CONFIG, dbus) { -DEFINES += XCB_USE_IBUS QT += dbus LIBS += -ldbus-1 } -- cgit v1.2.3 From 075c36e39beedb33ec4b239d57075f54acb21acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 16 Jun 2014 14:20:05 +0200 Subject: Do not overwrite existing event mask of root window QXcbScreen installs its own event mask on the screen's root window. This overwrites any existing event mask already set and by that breaks applications when a new screen is added. By first fetching the existing event mask and adding it to the newly installed event mask, Qt does no longer break applications also installing an event mask on the root window. Task-number: QTBUG-39648 Change-Id: I8686dd6ae49d0e807c6fe1ea4a231ff728bfcf25 Reviewed-by: Friedemann Kleint Reviewed-by: Shawn Rutledge Reviewed-by: Uli Schlachter Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbscreen.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 9f19841437..01e78465b6 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -106,6 +106,11 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, qDebug(" root ID........: %x", screen()->root); #endif + QScopedPointer rootAttribs( + xcb_get_window_attributes_reply(xcb_connection(), + xcb_get_window_attributes_unchecked(xcb_connection(), screen()->root), NULL)); + const quint32 existingEventMask = rootAttribs.isNull() ? 0 : rootAttribs->your_event_mask; + const quint32 mask = XCB_CW_EVENT_MASK; const quint32 values[] = { // XCB_CW_EVENT_MASK @@ -113,6 +118,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, | XCB_EVENT_MASK_LEAVE_WINDOW | XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY // for the "MANAGER" atom (system tray notification). + | existingEventMask // don't overwrite the event mask on the root window }; xcb_change_window_attributes(xcb_connection(), screen()->root, mask, values); -- cgit v1.2.3 From e98c461d43ea07c73898c93debe9285029ba0416 Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Thu, 12 Jun 2014 10:28:23 +0300 Subject: XCB: Fix leak with touch devices Task-number: QTBUG-39596 Change-Id: I4225d5a1ab4939280640b35d30c283f056a56519 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index c296618c44..a574dcae6c 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -228,6 +228,11 @@ void QXcbConnection::xi2SetupDevices() void QXcbConnection::finalizeXInput2() { + foreach (XInput2DeviceData *dev, m_touchDevices) { + if (dev->xiDeviceInfo) + XIFreeDeviceInfo(dev->xiDeviceInfo); + delete dev; + } } void QXcbConnection::xi2Select(xcb_window_t window) @@ -393,6 +398,7 @@ XInput2DeviceData *QXcbConnection::deviceForId(int id) m_touchDevices[id] = dev; } else { m_touchDevices.remove(id); + XIFreeDeviceInfo(dev->xiDeviceInfo); delete dev; dev = 0; } -- cgit v1.2.3 From 51d6df1d18322c630f79567ed22de3718436d78d Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 17 Jun 2014 11:41:23 +0200 Subject: Translate Super/Hyper keys to MetaModifier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is how it was done in Qt4. If users are interested in an actual X11 keysym they can use QKeyEvent::nativeVirtualKey(). Change-Id: I710664e48c5db1633a357aa0a5d238f3453103ab Task-number: QTBUG-38428 Reviewed-by: Christian Stenger Reviewed-by: Lars Knoll Reviewed-by: Sebastian Kügler Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 69601f44d4..4c84b19f82 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -929,6 +929,15 @@ int QXcbKeyboard::keysymToQtKey(xcb_keysym_t key) const i += 2; } + if (rmod_masks.meta) { + // translate Super/Hyper keys to Meta if we're using them as the MetaModifier + if (rmod_masks.meta == rmod_masks.super && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) { + code = Qt::Key_Meta; + } else if (rmod_masks.meta == rmod_masks.hyper && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) { + code = Qt::Key_Meta; + } + } + return code; } -- cgit v1.2.3