Merge branch 'Plasma/5.11'

This commit is contained in:
Martin Flöser 2017-10-16 17:58:28 +02:00
commit aed7ff64c4
2 changed files with 32 additions and 8 deletions

View file

@ -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;
}

View file

@ -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;