diff --git a/pointer_input.cpp b/pointer_input.cpp index 0d2dfea0bf..b0756019ec 100644 --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -166,6 +166,26 @@ void PointerInputRedirection::init() } } ); + connect(this, &PointerInputRedirection::decorationChanged, this, + [this] { + disconnect(m_decorationGeometryConnection); + m_decorationGeometryConnection = QMetaObject::Connection(); + if (m_decoration) { + m_decorationGeometryConnection = connect(m_decoration->client(), &AbstractClient::geometryChanged, this, + [this] { + // ensure maximize button gets the leave event when maximizing/restore a window, see BUG 385140 + const auto oldDeco = m_decoration; + update(); + if (oldDeco && oldDeco == m_decoration && !m_decoration->client()->isMove() && !m_decoration->client()->isResize() && !areButtonsPressed()) { + // position of window did not change, we need to send HoverMotion manually + const QPointF p = m_pos - m_decoration->client()->pos(); + QHoverEvent event(QEvent::HoverMove, p, p); + QCoreApplication::instance()->sendEvent(m_decoration->decoration(), &event); + } + }, Qt::QueuedConnection); + } + } + ); // connect the move resize of all window auto setupMoveResizeConnection = [this] (AbstractClient *c) { connect(c, &AbstractClient::clientStartUserMovedResized, this, &PointerInputRedirection::updateOnStartMoveResize); @@ -425,6 +445,16 @@ void PointerInputRedirection::processPinchGestureCancelled(quint32 time, KWin::L m_input->processFilters(std::bind(&InputEventFilter::pinchGestureCancelled, std::placeholders::_1, time)); } +bool PointerInputRedirection::areButtonsPressed() const +{ + for (auto state : m_buttons) { + if (state == InputRedirection::PointerButtonPressed) { + return true; + } + } + return false; +} + void PointerInputRedirection::update() { if (!m_inited) { @@ -437,14 +467,6 @@ void PointerInputRedirection::update() if (input()->isSelectingWindow()) { return; } - auto areButtonsPressed = [this] { - for (auto state : qAsConst(m_buttons)) { - if (state == InputRedirection::PointerButtonPressed) { - return true; - } - } - return false; - }; if (areButtonsPressed()) { return; } diff --git a/pointer_input.h b/pointer_input.h index d1b334c465..6e746fd6b9 100644 --- a/pointer_input.h +++ b/pointer_input.h @@ -153,6 +153,7 @@ private: void disconnectConfinedPointerRegionConnection(); void disconnectPointerConstraintsConnection(); void breakPointerConstraints(KWayland::Server::SurfaceInterface *surface); + bool areButtonsPressed() const; CursorImage *m_cursor; bool m_inited = false; bool m_supportsWarping; @@ -163,6 +164,7 @@ private: QMetaObject::Connection m_internalWindowConnection; QMetaObject::Connection m_constraintsConnection; QMetaObject::Connection m_confinedPointerRegionConnection; + QMetaObject::Connection m_decorationGeometryConnection; bool m_confined = false; bool m_locked = false; bool m_blockConstraint = false;