summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbwindow.cpp
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2018-06-05 14:38:01 +0200
committerGatis Paeglis <gatis.paeglis@qt.io>2018-07-23 21:43:19 +0000
commit3bc0f1724ae49c2fd7e6d7bcb650350d20d12246 (patch)
treeea994be2bcadcb297a47bb91681b19c5337e16d3 /src/plugins/platforms/xcb/qxcbwindow.cpp
parent27f1f84c1c220c5dadc739d5b056ec0f1b9f63a6 (diff)
xcb: fix various bugs with _NET_WM_MOVERESIZE
1) After a37785ec7638e7485112b87dd7e767881fecc114 it become apparent that we don't get mouse release event from X server when system move/resize ends (because WM is grabbing the pointer). The old code (before a37785ec) would wrongly deduce mouse move as mouse release, which is why the issue was not seen before. The solution is to subscribe to slave device events. 2) This patch also amends 2488f34ecfd68702b5508c50cca3fb8e967ac8ea as that patch was solving the issue only for 1/3 of the supported DEs. It worked with KWin, but not with Unity and Gnome. Its worth noting that it also worked with two other WMs that I tested - openbox and awesomewm. The way forward is to detect when system move/resize was started as a result of touch event and let the QSizeGrip do the move/resize instead of WMs that are known to have bugs. With this patch we also need to adjust the event compression algorithm to not treat all XI_TouchUpdate events equally. For XI_Motion we don't care if the event that we process comes from a master or a slave device, so we can process them as equal. Task-number: QTBUG-68501 Task-number: QTBUG-51385 Task-number: QTBUG-32476 Change-Id: Iab4e79a289d7bc0fe26f7ae2cff7c562f51a3334 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbwindow.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 50711e75c3..8c096ddc74 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -2635,15 +2635,34 @@ bool QXcbWindow::startSystemMoveResize(const QPoint &pos, int corner)
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());
+ bool startedByTouch = false;
#ifdef XCB_USE_XINPUT22
- if (connection()->startSystemMoveResizeForTouchBegin(m_window, globalPos, corner))
- return true;
+ // ### FIXME QTBUG-53389
+ startedByTouch = connection()->startSystemMoveResizeForTouchBegin(m_window, globalPos, corner);
#endif
- return doStartSystemMoveResize(globalPos, corner);
-}
+ if (startedByTouch) {
+ if (connection()->isUnity() || connection()->isGnome()) {
+ // These desktops fail to move/resize via _NET_WM_MOVERESIZE (WM bug?).
+ connection()->abortSystemMoveResizeForTouch();
+ 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;
+ }
+ if (connection()->isUnity())
+ return false; // _NET_WM_MOVERESIZE on this WM is bouncy (WM bug?).
+
+ doStartSystemMoveResize(globalPos, corner);
+ }
-bool QXcbWindow::doStartSystemMoveResize(const QPoint &globalPos, int corner)
+ return true;
+}
+void QXcbWindow::doStartSystemMoveResize(const QPoint &globalPos, int corner)
{
const xcb_atom_t moveResize = connection()->atom(QXcbAtom::_NET_WM_MOVERESIZE);
xcb_client_message_event_t xev;
@@ -2670,7 +2689,6 @@ bool QXcbWindow::doStartSystemMoveResize(const QPoint &globalPos, int corner)
xcb_send_event(connection()->xcb_connection(), false, xcbScreen()->root(),
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY,
(const char *)&xev);
- return true;
}
// Sends an XEmbed message.