diff --git a/pointer_input.h b/pointer_input.h --- a/pointer_input.h +++ b/pointer_input.h @@ -153,6 +153,7 @@ 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 @@ 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; diff --git a/pointer_input.cpp b/pointer_input.cpp --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -166,6 +166,26 @@ } } ); + 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 @@ 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 @@ if (input()->isSelectingWindow()) { return; } - auto areButtonsPressed = [this] { - for (auto state : qAsConst(m_buttons)) { - if (state == InputRedirection::PointerButtonPressed) { - return true; - } - } - return false; - }; if (areButtonsPressed()) { return; }