[platforms/x11] Fix incorrect screen edge approaching with switch desktop on window move

Summary:
There is a regression in WindowBasedEdge::soStopApproaching. Due to
only operate when the edge activates for pointer it is possible that
the cursor polling stays active. Explaining the situation:

1. Activate switch desktop when moving window
2. Start moving a window
3. Move mouse into the approach geometry
-> doStartApproaching activates as we are moving a window
4. stop moving window
-> doStopApproaching early exits as the position does not activate for
   pointer any more - we are not moving a window
-> cursor polling is still connected and whenever mouse enters edge
   approaching is started

The analysis shows that the check whether activates for pointer is wrong
in the case of stop approaching. If the edge started to approach, we also
need to stop approaching.

This change addresses the problem by turning the check into whether the
connection for cursor position update is set.

This is the third bug fix to the X11 screen edge handling after
introducing touch screen edges. This needs more manual testing by
everybody in the Plasma team who is still using X11.

BUG: 381849
FIXED-IN: 5.10.4

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6467
This commit is contained in:
Martin Flöser 2017-07-02 13:31:24 +02:00
parent 24ff93854d
commit 4e9456a857
2 changed files with 8 additions and 5 deletions

View file

@ -110,18 +110,20 @@ void WindowBasedEdge::doStartApproaching()
}
m_approachWindow.unmap();
Cursor *cursor = Cursor::self();
connect(cursor, SIGNAL(posChanged(QPoint)), SLOT(updateApproaching(QPoint)));
#ifndef KWIN_UNIT_TEST
m_cursorPollingConnection = connect(cursor, &Cursor::posChanged, this, &WindowBasedEdge::updateApproaching);
#endif
cursor->startMousePolling();
}
void WindowBasedEdge::doStopApproaching()
{
if (!activatesForPointer()) {
if (!m_cursorPollingConnection) {
return;
}
Cursor *cursor = Cursor::self();
disconnect(cursor, SIGNAL(posChanged(QPoint)), this, SLOT(updateApproaching(QPoint)));
cursor->stopMousePolling();
disconnect(m_cursorPollingConnection);
m_cursorPollingConnection = QMetaObject::Connection();
Cursor::self()->stopMousePolling();
m_approachWindow.map();
}

View file

@ -61,6 +61,7 @@ private:
void createApproachWindow();
Xcb::Window m_window;
Xcb::Window m_approachWindow;
QMetaObject::Connection m_cursorPollingConnection;
};
inline quint32 WindowBasedEdge::window() const