xcb: fix QWindow::startSystemMove()/Resize() triggered by touch
Abort the system move/resise at XCB_INPUT_TOUCH_END. Limit the behavior only on supported platforms, such as KDE and OpenBox. Change-Id: I53c86979ca56f4de8c5cf2807f781abdad6987b2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
8e506fdd29
commit
50a4b97d31
@ -96,8 +96,6 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
|
||||
|
||||
m_eventQueue = new QXcbEventQueue(this);
|
||||
|
||||
m_xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP").toLower();
|
||||
|
||||
if (hasXRandr())
|
||||
xrandrSelectEvents();
|
||||
|
||||
@ -795,6 +793,15 @@ void QXcbConnection::ungrabServer()
|
||||
xcb_ungrab_server(xcb_connection());
|
||||
}
|
||||
|
||||
QString QXcbConnection::windowManagerName() const
|
||||
{
|
||||
QXcbVirtualDesktop *pvd = primaryVirtualDesktop();
|
||||
if (pvd)
|
||||
return pvd->windowManagerName().toLower();
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
xcb_timestamp_t QXcbConnection::getTimestamp()
|
||||
{
|
||||
// send a dummy event to myself to get the timestamp from X server.
|
||||
|
@ -213,8 +213,7 @@ public:
|
||||
void grabServer();
|
||||
void ungrabServer();
|
||||
|
||||
bool isUnity() const { return m_xdgCurrentDesktop == "unity"; }
|
||||
bool isGnome() const { return m_xdgCurrentDesktop == "gnome"; }
|
||||
QString windowManagerName() const;
|
||||
|
||||
QXcbNativeInterface *nativeInterface() const { return m_nativeInterface; }
|
||||
|
||||
@ -378,7 +377,6 @@ private:
|
||||
|
||||
friend class QXcbEventQueue;
|
||||
|
||||
QByteArray m_xdgCurrentDesktop;
|
||||
QTimer m_focusInTimer;
|
||||
|
||||
};
|
||||
|
@ -648,6 +648,9 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
|
||||
if (xiEvent->event_type == XCB_INPUT_BUTTON_RELEASE
|
||||
&& xiEvent->detail == XCB_BUTTON_INDEX_1 ) {
|
||||
abortSystemMoveResize(xiEvent->event);
|
||||
} else if (xiEvent->event_type == XCB_INPUT_TOUCH_END) {
|
||||
abortSystemMoveResize(xiEvent->event);
|
||||
return;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@ -921,6 +924,8 @@ bool QXcbConnection::startSystemMoveResizeForTouch(xcb_window_t window, int edge
|
||||
m_startSystemMoveResizeInfo.deviceid = devIt.key();
|
||||
m_startSystemMoveResizeInfo.pointid = pointIt.key();
|
||||
m_startSystemMoveResizeInfo.edges = edges;
|
||||
setDuringSystemMoveResize(true);
|
||||
qCDebug(lcQpaXInputDevices) << "triggered system move or resize from touch";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2332,8 +2332,10 @@ bool QXcbWindow::startSystemMoveResize(const QPoint &pos, int edges)
|
||||
// ### FIXME QTBUG-53389
|
||||
bool startedByTouch = connection()->startSystemMoveResizeForTouch(m_window, edges);
|
||||
if (startedByTouch) {
|
||||
if (connection()->isUnity()) {
|
||||
// Unity fails to move/resize via _NET_WM_MOVERESIZE (WM bug?).
|
||||
const QString wmname = connection()->windowManagerName();
|
||||
if (wmname != QLatin1String("kwin") && wmname != QLatin1String("openbox")) {
|
||||
qCDebug(lcQpaXInputDevices) << "only KDE and OpenBox support startSystemMove/Resize which is triggered from touch events: XDG_CURRENT_DESKTOP="
|
||||
<< qgetenv("XDG_CURRENT_DESKTOP");
|
||||
connection()->abortSystemMoveResize(m_window);
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user