Merge branch 'Plasma/5.6'
This commit is contained in:
commit
5dc6da0bbe
9 changed files with 45 additions and 13 deletions
|
@ -1379,9 +1379,10 @@ void AbstractClient::layoutDecorationRects(QRect &left, QRect &top, QRect &right
|
|||
borderRight(), r.height() - top.height() - bottom.height());
|
||||
}
|
||||
|
||||
void AbstractClient::processDecorationMove()
|
||||
void AbstractClient::processDecorationMove(const QPoint &localPos, const QPoint &globalPos)
|
||||
{
|
||||
if (isMoveResizePointerButtonDown()) {
|
||||
handleMoveResize(localPos.x(), localPos.y(), globalPos.x(), globalPos.y());
|
||||
return;
|
||||
}
|
||||
// TODO: handle modifiers
|
||||
|
|
|
@ -523,7 +523,7 @@ public:
|
|||
bool decorationHasAlpha() const;
|
||||
void triggerDecorationRepaint();
|
||||
virtual void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom) const;
|
||||
void processDecorationMove();
|
||||
void processDecorationMove(const QPoint &localPos, const QPoint &globalPos);
|
||||
bool processDecorationButtonPress(QMouseEvent *event, bool ignoreMenu = false);
|
||||
void processDecorationButtonRelease(QMouseEvent *event);
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ private Q_SLOTS:
|
|||
void testAxis();
|
||||
void testDoubleClick();
|
||||
void testHover();
|
||||
void testPressToMove_data();
|
||||
void testPressToMove();
|
||||
|
||||
private:
|
||||
|
@ -325,46 +326,63 @@ void DecorationInputTest::testHover()
|
|||
QCOMPARE(c->cursor(), Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
void DecorationInputTest::testPressToMove_data()
|
||||
{
|
||||
QTest::addColumn<QPoint>("offset");
|
||||
QTest::addColumn<QPoint>("offset2");
|
||||
QTest::addColumn<QPoint>("offset3");
|
||||
|
||||
QTest::newRow("To right") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0);
|
||||
QTest::newRow("To left") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0);
|
||||
QTest::newRow("To bottom") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30);
|
||||
QTest::newRow("To top") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30);
|
||||
}
|
||||
|
||||
void DecorationInputTest::testPressToMove()
|
||||
{
|
||||
AbstractClient *c = showWindow();
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
QVERIFY(!c->noBorder());
|
||||
c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2));
|
||||
QSignalSpy startMoveResizedSpy(c, &AbstractClient::clientStartUserMovedResized);
|
||||
QVERIFY(startMoveResizedSpy.isValid());
|
||||
QSignalSpy clientFinishUserMovedResizedSpy(c, &AbstractClient::clientFinishUserMovedResized);
|
||||
QVERIFY(clientFinishUserMovedResizedSpy.isValid());
|
||||
|
||||
quint32 timestamp = 1;
|
||||
MOTION(QPoint(c->geometry().center().x(), c->clientPos().y() / 2));
|
||||
MOTION(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2));
|
||||
QCOMPARE(c->cursor(), Qt::ArrowCursor);
|
||||
|
||||
PRESS;
|
||||
QVERIFY(!c->isMove());
|
||||
MOTION(QPoint(c->geometry().center().x() + 10, c->clientPos().y() / 2));
|
||||
const int oldX = c->x();
|
||||
QTRY_VERIFY(c->isMove());
|
||||
QFETCH(QPoint, offset);
|
||||
MOTION(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2) + offset);
|
||||
const QPoint oldPos = c->pos();
|
||||
QVERIFY(c->isMove());
|
||||
QCOMPARE(startMoveResizedSpy.count(), 1);
|
||||
|
||||
RELEASE;
|
||||
QTRY_VERIFY(!c->isMove());
|
||||
QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1);
|
||||
QEXPECT_FAIL("", "Just trigger move doesn't move the window", Continue);
|
||||
QCOMPARE(c->x(), oldX + 10);
|
||||
QCOMPARE(c->pos(), oldPos + offset);
|
||||
|
||||
// again
|
||||
PRESS;
|
||||
QVERIFY(!c->isMove());
|
||||
MOTION(QPoint(c->geometry().center().x() + 20, c->clientPos().y() / 2));
|
||||
QTRY_VERIFY(c->isMove());
|
||||
QFETCH(QPoint, offset2);
|
||||
MOTION(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2) + offset2);
|
||||
QVERIFY(c->isMove());
|
||||
QCOMPARE(startMoveResizedSpy.count(), 2);
|
||||
MOTION(QPoint(c->geometry().center().x() + 30, c->clientPos().y() / 2));
|
||||
QFETCH(QPoint, offset3);
|
||||
MOTION(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2) + offset3);
|
||||
|
||||
RELEASE;
|
||||
QTRY_VERIFY(!c->isMove());
|
||||
QCOMPARE(clientFinishUserMovedResizedSpy.count(), 2);
|
||||
QCOMPARE(c->x(), oldX + 20);
|
||||
// TODO: the offset should also be included
|
||||
QCOMPARE(c->pos(), oldPos + offset2 + offset3);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -127,6 +127,10 @@ void StartTest::testCreateWindow()
|
|||
// but still not yet in workspace
|
||||
QVERIFY(workspace()->allClientList().isEmpty());
|
||||
|
||||
// icon geometry accesses windowManagementInterface which only exists after window became visible
|
||||
// verify that accessing doesnt't crash
|
||||
QVERIFY(waylandServer()->clients().first()->iconGeometry().isNull());
|
||||
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
|
|
|
@ -2619,6 +2619,8 @@ bool AbstractClient::startMoveResize()
|
|||
return false;
|
||||
}
|
||||
|
||||
invalidateDecorationDoubleClickTimer();
|
||||
|
||||
setMoveResize(true);
|
||||
workspace()->setClientIsMoving(this);
|
||||
|
||||
|
|
|
@ -446,7 +446,7 @@ public:
|
|||
}
|
||||
QHoverEvent e(QEvent::HoverMove, p, p);
|
||||
QCoreApplication::instance()->sendEvent(decoration->decoration(), &e);
|
||||
decoration->client()->processDecorationMove();
|
||||
decoration->client()->processDecorationMove(p.toPoint(), event->globalPos());
|
||||
return true;
|
||||
}
|
||||
case QEvent::MouseButtonPress:
|
||||
|
|
|
@ -181,7 +181,9 @@ void Integration::initializeWayland()
|
|||
void Integration::createWaylandOutput(quint32 name, quint32 version)
|
||||
{
|
||||
if (m_dummyScreen) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
|
||||
destroyScreen(m_dummyScreen);
|
||||
#endif
|
||||
m_dummyScreen = nullptr;
|
||||
}
|
||||
using namespace KWayland::Client;
|
||||
|
|
|
@ -396,7 +396,7 @@ void PointerInputRedirection::updateDecoration(Toplevel *t)
|
|||
const QPointF p = m_pos - t->pos();
|
||||
QHoverEvent event(QEvent::HoverMove, p, p);
|
||||
QCoreApplication::instance()->sendEvent(m_decoration->decoration(), &event);
|
||||
m_decoration->client()->processDecorationMove();
|
||||
m_decoration->client()->processDecorationMove(p.toPoint(), m_pos.toPoint());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -473,6 +473,11 @@ bool ShellClient::isMinimizable() const
|
|||
|
||||
QRect ShellClient::iconGeometry() const
|
||||
{
|
||||
if (!windowManagementInterface()) {
|
||||
// window management interface is only available if the surface is mapped
|
||||
return QRect();
|
||||
}
|
||||
|
||||
int minDistance = INT_MAX;
|
||||
ShellClient *candidatePanel = nullptr;
|
||||
QRect candidateGeom;
|
||||
|
|
Loading…
Reference in a new issue