diff --git a/plugins/platforms/x11/standalone/edge.cpp b/plugins/platforms/x11/standalone/edge.cpp index f4331fabc5..700d086849 100644 --- a/plugins/platforms/x11/standalone/edge.cpp +++ b/plugins/platforms/x11/standalone/edge.cpp @@ -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(); } diff --git a/plugins/platforms/x11/standalone/edge.h b/plugins/platforms/x11/standalone/edge.h index 980c8b3ae8..6934b7dcbd 100644 --- a/plugins/platforms/x11/standalone/edge.h +++ b/plugins/platforms/x11/standalone/edge.h @@ -61,6 +61,7 @@ private: void createApproachWindow(); Xcb::Window m_window; Xcb::Window m_approachWindow; + QMetaObject::Connection m_cursorPollingConnection; }; inline quint32 WindowBasedEdge::window() const