summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-12-30 17:39:21 +0100
committerLars Knoll <lars.knoll@qt.io>2018-01-02 09:58:44 +0100
commit0f315adf9199efcfafa44371464ab6d1fc866774 (patch)
tree35b67591255624c670aff0579e45b2973f56fd81 /src/plugins/platforms/xcb
parent2b0eb3fac319a17dd92903106d501f0f06df871f (diff)
parent52b85212a2ec8ec5bf187f6cd00b669a45bcf0bd (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: .qmake.conf sc/corelib/io/qfsfileengine_p.h src/corelib/io/qstorageinfo_unix.cpp src/platformsupport/eglconvenience/qeglpbuffer_p.h src/platformsupport/input/libinput/qlibinputkeyboard.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/ios/qiosscreen.h src/plugins/platforms/ios/qioswindow.h src/plugins/platforms/ios/quiview.mm src/printsupport/dialogs/qpagesetupdialog_unix_p.h src/printsupport/dialogs/qprintpreviewdialog.cpp src/printsupport/widgets/qcupsjobwidget_p.h src/widgets/widgets/qmenu.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Iecb4883122efe97ef0ed850271e6c51bab568e9c
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/README3
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp35
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp11
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp35
-rw-r--r--src/plugins/platforms/xcb/xcb_qpa_lib.pro2
6 files changed, 62 insertions, 28 deletions
diff --git a/src/plugins/platforms/xcb/README b/src/plugins/platforms/xcb/README
index 5efc9b7f99..8308db46dc 100644
--- a/src/plugins/platforms/xcb/README
+++ b/src/plugins/platforms/xcb/README
@@ -25,9 +25,8 @@ This should allow for binaries that are portable across most modern Linux distri
PACKAGE VERSION REQUIREMENTS
When using touch input via XInput 2.2 or higher, there is a potential issue on systems that ship with
-a libXi older than 1.7.4. This is because XIAllowTouchEvents can deadlock with libXi 1.7.3 and earlier.
+a libXi older than 1.7.5. This is because XIAllowTouchEvents can deadlock with libXi 1.7.4 and earlier.
When touch events are never received, this is not an issue, so plain mouse/keyboard systems are not affected.
-See http://lists.x.org/archives/xorg-devel/2014-July/043059.html for details on the libXi patch.
Qt versions before 5.8 attempted to recognize this scenario based on the pkg-config package version and skip
the call. This has been removed starting from 5.8 since relying on pkg-config package versions is unsafe given
that Qt must also support systems with limited or incomplete pkg-config setups.
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 2fc39012ce..315f295ff3 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -94,6 +94,7 @@ void QXcbConnection::xi2SelectStateEvents()
XIEventMask xiEventMask;
bitMask = XI_HierarchyChangedMask;
bitMask |= XI_DeviceChangedMask;
+ bitMask |= XI_PropertyEventMask;
xiEventMask.deviceid = XIAllDevices;
xiEventMask.mask_len = sizeof(bitMask);
xiEventMask.mask = xiBitMask;
@@ -115,7 +116,6 @@ void QXcbConnection::xi2SelectDeviceEvents(xcb_window_t window)
// core enter/leave events will be ignored in this case.
bitMask |= XI_EnterMask;
bitMask |= XI_LeaveMask;
- bitMask |= XI_PropertyEventMask;
#ifdef XCB_USE_XINPUT22
if (isAtLeastXI22()) {
bitMask |= XI_TouchBeginMask;
@@ -372,24 +372,25 @@ void QXcbConnection::xi2SelectDeviceEventsCompatibility(xcb_window_t window)
unsigned int mask = 0;
unsigned char *bitMask = reinterpret_cast<unsigned char *>(&mask);
- mask |= XI_PropertyEventMask;
+ Display *dpy = static_cast<Display *>(m_xlib_display);
+
#ifdef XCB_USE_XINPUT22
if (isAtLeastXI22()) {
mask |= XI_TouchBeginMask;
mask |= XI_TouchUpdateMask;
mask |= XI_TouchEndMask;
+
+ XIEventMask xiMask;
+ xiMask.mask_len = sizeof(mask);
+ xiMask.mask = bitMask;
+ xiMask.deviceid = XIAllMasterDevices;
+ Status result = XISelectEvents(dpy, window, &xiMask, 1);
+ if (result == Success)
+ QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);
+ else
+ qCDebug(lcQpaXInput, "failed to select events, window %x, result %d", window, result);
}
#endif
- XIEventMask xiMask;
- xiMask.mask_len = sizeof(mask);
- xiMask.mask = bitMask;
- xiMask.deviceid = XIAllMasterDevices;
- Display *dpy = static_cast<Display *>(m_xlib_display);
- Status result = XISelectEvents(dpy, window, &xiMask, 1);
- if (result == Success)
- QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);
- else
- qCDebug(lcQpaXInput, "failed to select events, window %x, result %d", window, result);
mask = XI_ButtonPressMask;
mask |= XI_ButtonReleaseMask;
@@ -428,6 +429,11 @@ void QXcbConnection::xi2SelectDeviceEventsCompatibility(xcb_window_t window)
XISelectEvents(dpy, window, xiEventMask.data(), i);
}
#endif
+
+#if !QT_CONFIG(tabletevent) && !defined(XCB_USE_XINPUT21)
+ Q_UNUSED(bitMask);
+ Q_UNUSED(dpy);
+#endif
}
QXcbConnection::TouchDeviceData *QXcbConnection::touchDeviceForId(int id)
@@ -749,8 +755,9 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo
// Touches must be accepted when we are grabbing touch events. Otherwise the entire sequence
// will get replayed when the grab ends.
if (m_xiGrab) {
- // XIAllowTouchEvents deadlocks with libXi < 1.7.4 (this has nothing to do with the XI2 versions like 2.2)
- // http://lists.x.org/archives/xorg-devel/2014-July/043059.html
+ // Note that XIAllowTouchEvents is known to deadlock with older libXi versions,
+ // for details see qtbase/src/plugins/platforms/xcb/README. This has nothing to
+ // do with the XInput protocol version, but is a bug in libXi implementation instead.
XIAllowTouchEvents(static_cast<Display *>(m_xlib_display), xiDeviceEvent->deviceid,
xiDeviceEvent->detail, xiDeviceEvent->event, XIAcceptTouch);
}
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 18f5ff4f0d..8ea0ebf966 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -165,6 +165,9 @@ void QXcbDrag::init()
QXcbCursor::queryPointer(connection(), &current_virtual_desktop, 0);
drag_types.clear();
+
+ dropped = false;
+ canceled = false;
}
bool QXcbDrag::eventFilter(QObject *o, QEvent *e)
@@ -215,6 +218,10 @@ void QXcbDrag::startDrag()
void QXcbDrag::endDrag()
{
QBasicDrag::endDrag();
+ if (!dropped && !canceled && canDrop()) {
+ // Set executed drop action when dropping outside application.
+ setExecutedDropAction(accepted_drop_action);
+ }
initiatorWindow.clear();
}
@@ -989,6 +996,8 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e
// reset
target_time = XCB_CURRENT_TIME;
+
+ dropped = true;
}
@@ -1087,6 +1096,8 @@ void QXcbDrag::cancel()
// remove canceled object
currentDrag()->deleteLater();
+
+ canceled = true;
}
// find an ancestor with XdndAware on it
diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h
index f261cc1322..31f1c47d83 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.h
+++ b/src/plugins/platforms/xcb/qxcbdrag.h
@@ -135,6 +135,10 @@ private:
QRect source_sameanswer;
bool waiting_for_status;
+ // helpers for setting executed drop action outside application
+ bool dropped;
+ bool canceled;
+
// top-level window we sent position to last.
xcb_window_t current_target;
// window to send events to (always valid if current_target)
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index cdeafa8cba..e3d9bc7a3d 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -446,17 +446,24 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe
m_cursor = new QXcbCursor(connection, this);
- // Parse EDID
- if (m_edid.parse(getEdid()))
- qCDebug(lcQpaScreen, "EDID data for output \"%s\": identifier '%s', manufacturer '%s', model '%s', serial '%s', physical size: %.2fx%.2f",
- name().toLatin1().constData(),
- m_edid.identifier.toLatin1().constData(),
- m_edid.manufacturer.toLatin1().constData(),
- m_edid.model.toLatin1().constData(),
- m_edid.serialNumber.toLatin1().constData(),
- m_edid.physicalSize.width(), m_edid.physicalSize.height());
- else
- qCDebug(lcQpaScreen) << "Failed to parse EDID data for output" << name(); // keep this debug, not warning
+ if (connection->hasXRandr()) { // Parse EDID
+ QByteArray edid = getEdid();
+ if (m_edid.parse(edid)) {
+ qCDebug(lcQpaScreen, "EDID data for output \"%s\": identifier '%s', manufacturer '%s',"
+ "model '%s', serial '%s', physical size: %.2fx%.2f",
+ name().toLatin1().constData(),
+ m_edid.identifier.toLatin1().constData(),
+ m_edid.manufacturer.toLatin1().constData(),
+ m_edid.model.toLatin1().constData(),
+ m_edid.serialNumber.toLatin1().constData(),
+ m_edid.physicalSize.width(), m_edid.physicalSize.height());
+ } else {
+ // This property is defined by the xrandr spec. Parsing failure indicates a valid error,
+ // but keep this as debug, for details see 4f515815efc318ddc909a0399b71b8a684962f38.
+ qCDebug(lcQpaScreen) << "Failed to parse EDID data for output" << name() <<
+ "edid data: " << edid;
+ }
+ }
}
QXcbScreen::~QXcbScreen()
@@ -901,9 +908,13 @@ QByteArray QXcbScreen::getOutputProperty(xcb_atom_t atom) const
QByteArray QXcbScreen::getEdid() const
{
+ QByteArray result;
+ if (!connection()->hasXRandr())
+ return result;
+
// Try a bunch of atoms
xcb_atom_t atom = connection()->internAtom("EDID");
- QByteArray result = getOutputProperty(atom);
+ result = getOutputProperty(atom);
if (result.isEmpty()) {
atom = connection()->internAtom("EDID_DATA");
result = getOutputProperty(atom);
diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
index a98a7892dd..00cce13fd0 100644
--- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro
+++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
@@ -99,4 +99,6 @@ qtConfig(vulkan) {
QMAKE_USE += xkbcommon
}
+qtConfig(dlopen): QMAKE_USE += libdl
+
load(qt_module)