diff --git a/plugins/platforms/x11/standalone/edge.h b/plugins/platforms/x11/standalone/edge.h --- a/plugins/platforms/x11/standalone/edge.h +++ b/plugins/platforms/x11/standalone/edge.h @@ -61,6 +61,7 @@ void createApproachWindow(); Xcb::Window m_window; Xcb::Window m_approachWindow; + QMetaObject::Connection m_cursorPollingConnection; }; inline quint32 WindowBasedEdge::window() const diff --git a/plugins/platforms/x11/standalone/edge.cpp b/plugins/platforms/x11/standalone/edge.cpp --- a/plugins/platforms/x11/standalone/edge.cpp +++ b/plugins/platforms/x11/standalone/edge.cpp @@ -110,18 +110,20 @@ } 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(); }