summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-08-03 01:00:16 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2018-08-07 17:44:51 +0200
commit053e7cce79d4bef99ec85101b0d22bbb171072c5 (patch)
treec2059e82cccdea1fd0024c5942d1a834c28d39da /src/plugins/platforms/xcb
parenta420d02538d28854914a6978c9637a0ddd652146 (diff)
parentf271dd8f960ad9f61697dfa57b26c4071441cadc (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: .qmake.conf src/corelib/doc/src/objectmodel/signalsandslots.qdoc src/plugins/platforms/cocoa/qcocoamenuloader.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp tests/auto/gui/image/qimage/tst_qimage.cpp Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I9bd24ee9b00d4f26c8f344ce3970aa6e93935ff5
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp89
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp16
4 files changed, 7 insertions, 103 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 327811a7d2..c14f3f3703 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -1693,10 +1693,8 @@ bool QXcbConnection::compressEvent(xcb_generic_event_t *event, int currentIndex,
continue;
if (isXIType(next, m_xiOpCode, XCB_INPUT_TOUCH_UPDATE)) {
auto *touchUpdateNextEvent = reinterpret_cast<xcb_input_touch_update_event_t *>(next);
- if (id == touchUpdateNextEvent->detail % INT_MAX &&
- touchUpdateNextEvent->deviceid == touchUpdateEvent->deviceid) {
+ if (id == touchUpdateNextEvent->detail % INT_MAX)
return true;
- }
}
}
return false;
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index c24bcf91f3..0b31e9c3e7 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -569,7 +569,6 @@ private:
bool m_xi2Enabled = false;
#if QT_CONFIG(xcb_xinput)
- QVector<int> m_floatingSlaveDevices;
int m_xi2Minor = -1;
void initializeXInput2();
void xi2SetupDevice(void *info, bool removeExisting = true);
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 01b1b37bb8..a327d8dea7 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -113,7 +113,7 @@ void QXcbConnection::xi2SelectDeviceEvents(xcb_window_t window)
}
qt_xcb_input_event_mask_t mask;
- mask.header.deviceid = XCB_INPUT_DEVICE_ALL;
+ mask.header.deviceid = XCB_INPUT_DEVICE_ALL_MASTER;
mask.header.mask_len = 1;
mask.mask = bitMask;
xcb_void_cookie_t cookie =
@@ -309,7 +309,6 @@ void QXcbConnection::xi2SetupDevices()
m_scrollingDevices.clear();
m_touchDevices.clear();
m_xiMasterPointerIds.clear();
- m_floatingSlaveDevices.clear();
auto reply = Q_XCB_REPLY(xcb_input_xi_query_device, m_connection, XCB_INPUT_DEVICE_ALL);
if (!reply) {
@@ -320,10 +319,6 @@ void QXcbConnection::xi2SetupDevices()
auto it = xcb_input_xi_query_device_infos_iterator(reply.get());
for (; it.rem; xcb_input_xi_device_info_next(&it)) {
xcb_input_xi_device_info_t *deviceInfo = it.data;
- if (deviceInfo->type == XCB_INPUT_DEVICE_TYPE_FLOATING_SLAVE) {
- m_floatingSlaveDevices.append(deviceInfo->deviceid);
- continue;
- }
if (deviceInfo->type == XCB_INPUT_DEVICE_TYPE_MASTER_POINTER) {
m_xiMasterPointerIds.append(deviceInfo->deviceid);
continue;
@@ -547,72 +542,6 @@ static inline qreal fixed1616ToReal(xcb_input_fp1616_t val)
}
#endif // QT_CONFIG(tabletevent)
-namespace {
-
-/*! \internal
-
- Qt listens for XIAllDevices to avoid losing mouse events. This function
- ensures that we don't process the same event twice: from a slave device and
- then again from a master device.
-
- In a normal use case (e.g. mouse press and release inside a window), we will
- drop events from master devices as duplicates. Other advantage of processing
- events from slave devices is that they don't share button state. All buttons
- on a master device share the state.
-
- Examples of special cases:
-
- - During system move/resize, window manager (_NET_WM_MOVERESIZE) grabs the
- master pointer, in this case we process the matching release from the slave
- device. A master device event is not sent by the server, hence no duplicate
- event to drop. If we listened for XIAllMasterDevices instead, we would never
- see a release event in this case.
-
- - If we dismiss a context menu by clicking somewhere outside a Qt application,
- we will process the mouse press from the master pointer as that is the
- device we are grabbing. We are not grabbing slave devices (grabbing on the
- slave device is buggy according to 19d289ab1b5bde3e136765e5432b5c7d004df3a4).
- And since the event occurs outside our window, the slave device event is
- not sent to us by the server, hence no duplicate event to drop.
-*/
-bool isDuplicateEvent(xcb_ge_event_t *event)
-{
- struct qXIEvent {
- bool isValid = false;
- uint16_t sourceid;
- uint8_t event_type;
- uint32_t detail;
- int32_t root_x;
- int32_t root_y;
- };
- static qXIEvent lastSeenEvent;
-
- bool isDuplicate = false;
- auto xiDeviceEvent = reinterpret_cast<qt_xcb_input_device_event_t *>(event);
- if (lastSeenEvent.isValid) {
- isDuplicate = lastSeenEvent.sourceid == xiDeviceEvent->sourceid &&
- lastSeenEvent.event_type == xiDeviceEvent->event_type &&
- lastSeenEvent.detail == xiDeviceEvent->detail &&
- lastSeenEvent.root_x == xiDeviceEvent->root_x &&
- lastSeenEvent.root_y == xiDeviceEvent->root_y;
- } else {
- lastSeenEvent.isValid = true;
- }
- lastSeenEvent.sourceid = xiDeviceEvent->sourceid;
- lastSeenEvent.event_type = xiDeviceEvent->event_type;
- lastSeenEvent.detail = xiDeviceEvent->detail;
- lastSeenEvent.root_x = xiDeviceEvent->root_x;
- lastSeenEvent.root_y = xiDeviceEvent->root_y;
-
- if (isDuplicate)
- // This sanity check ensures that special cases like QTBUG-59277 keep working.
- lastSeenEvent.isValid = false; // An event can be a duplicate only once.
-
- return isDuplicate;
-}
-
-} // namespace
-
void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
{
auto *xiEvent = reinterpret_cast<qt_xcb_input_device_event_t *>(event);
@@ -621,31 +550,15 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
xcb_input_enter_event_t *xiEnterEvent = nullptr;
QXcbWindowEventListener *eventListener = 0;
- bool isTouchEvent = true;
switch (xiEvent->event_type) {
case XCB_INPUT_BUTTON_PRESS:
case XCB_INPUT_BUTTON_RELEASE:
case XCB_INPUT_MOTION:
- isTouchEvent = false;
- if (!xi2MouseEventsDisabled() && isDuplicateEvent(event))
- return;
case XCB_INPUT_TOUCH_BEGIN:
case XCB_INPUT_TOUCH_UPDATE:
case XCB_INPUT_TOUCH_END:
{
xiDeviceEvent = xiEvent;
-
- if (m_floatingSlaveDevices.contains(xiDeviceEvent->sourceid))
- return; // Not interested in floating slave device events, only in attached slaves.
-
- bool isSlaveEvent = xiDeviceEvent->deviceid == xiDeviceEvent->sourceid;
- if (!xi2MouseEventsDisabled() && isTouchEvent && isSlaveEvent) {
- // For touch events we want events only from master devices, at least
- // currently there is no apparent reason why we would need to consider
- // events from slave devices.
- return;
- }
-
eventListener = windowEventListenerFromId(xiDeviceEvent->event);
sourceDeviceId = xiDeviceEvent->sourceid; // use the actual device id instead of the master
break;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index ed37c6b1f8..d42d95f890 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -2569,12 +2569,13 @@ bool QXcbWindow::startSystemMove(const QPoint &pos)
bool QXcbWindow::startSystemMoveResize(const QPoint &pos, int corner)
{
-#if QT_CONFIG(xcb_xinput)
+ return false; // ### FIXME QTBUG-69716
const xcb_atom_t moveResize = connection()->atom(QXcbAtom::_NET_WM_MOVERESIZE);
if (!connection()->wmSupport()->isSupportedByWM(moveResize))
return false;
const QPoint globalPos = QHighDpi::toNativePixels(window()->mapToGlobal(pos), window()->screen());
+#if QT_CONFIG(xcb_xinput)
// ### FIXME QTBUG-53389
bool startedByTouch = connection()->startSystemMoveResizeForTouchBegin(m_window, globalPos, corner);
if (startedByTouch) {
@@ -2584,11 +2585,9 @@ bool QXcbWindow::startSystemMoveResize(const QPoint &pos, int corner)
return false;
}
// KWin, Openbox, AwesomeWM have been tested to work with _NET_WM_MOVERESIZE.
- } else { // Started by mouse press.
- if (!connection()->hasXInput2() || connection()->xi2MouseEventsDisabled()) {
- // Without XI2 we can't get button press/move/release events.
- return false;
- }
+ } else
+#endif
+ { // Started by mouse press.
if (connection()->isUnity())
return false; // _NET_WM_MOVERESIZE on this WM is bouncy (WM bug?).
@@ -2596,11 +2595,6 @@ bool QXcbWindow::startSystemMoveResize(const QPoint &pos, int corner)
}
return true;
-#else
- Q_UNUSED(pos);
- Q_UNUSED(corner);
- return false;
-#endif // xcb_xinput
}
void QXcbWindow::doStartSystemMoveResize(const QPoint &globalPos, int corner)