diff --git a/autotests/integration/screenedge_client_show_test.cpp b/autotests/integration/screenedge_client_show_test.cpp --- a/autotests/integration/screenedge_client_show_test.cpp +++ b/autotests/integration/screenedge_client_show_test.cpp @@ -86,15 +86,16 @@ void ScreenEdgeClientShowTest::testScreenEdgeShowHideX11_data() { QTest::addColumn("windowGeometry"); + QTest::addColumn("resizedWindowGeometry"); QTest::addColumn("location"); QTest::addColumn("triggerPos"); - QTest::newRow("bottom/left") << QRect(50, 1004, 1180, 20) << 2u << QPoint(100, 1023); - QTest::newRow("bottom/right") << QRect(1330, 1004, 1180, 20) << 2u << QPoint(1400, 1023); - QTest::newRow("top/left") << QRect(50, 0, 1180, 20) << 0u << QPoint(100, 0); - QTest::newRow("top/right") << QRect(1330, 0, 1180, 20) << 0u << QPoint(1400, 0); - QTest::newRow("left") << QRect(0, 10, 20, 1000) << 3u << QPoint(0, 50); - QTest::newRow("right") << QRect(2540, 10, 20, 1000) << 1u << QPoint(2559, 60); + QTest::newRow("bottom/left") << QRect(50, 1004, 1180, 20) << QRect(150, 1004, 1000, 20) << 2u << QPoint(100, 1023); + QTest::newRow("bottom/right") << QRect(1330, 1004, 1180, 20) << QRect(1410, 1004, 1000, 20) << 2u << QPoint(1400, 1023); + QTest::newRow("top/left") << QRect(50, 0, 1180, 20) << QRect(150, 0, 1000, 20) << 0u << QPoint(100, 0); + QTest::newRow("top/right") << QRect(1330, 0, 1180, 20) << QRect(1410, 0, 1000, 20) << 0u << QPoint(1400, 0); + QTest::newRow("left") << QRect(0, 10, 20, 1000) << QRect(0, 70, 20, 800) << 3u << QPoint(0, 50); + QTest::newRow("right") << QRect(2540, 10, 20, 1000) << QRect(2540, 70, 20, 800) << 1u << QPoint(2559, 60); } void ScreenEdgeClientShowTest::testScreenEdgeShowHideX11() @@ -161,6 +162,19 @@ QVERIFY(!client->isHiddenInternal()); QCOMPARE(effectsWindowShownSpy.count(), 1); + //hide window again + Cursor::setPos(QPoint(640, 512)); + xcb_change_property(c.data(), XCB_PROP_MODE_REPLACE, w, atom, XCB_ATOM_CARDINAL, 32, 1, &location); + xcb_flush(c.data()); + QVERIFY(clientHiddenSpy.wait()); + QVERIFY(client->isHiddenInternal()); + QFETCH(QRect, resizedWindowGeometry); + //resizewhile hidden + client->setGeometry(resizedWindowGeometry); + //triggerPos shouldn't be valid anymore + Cursor::setPos(triggerPos); + QVERIFY(client->isHiddenInternal()); + // destroy window again QSignalSpy windowClosedSpy(client, &Client::windowClosed); QVERIFY(windowClosedSpy.isValid()); diff --git a/client.h b/client.h --- a/client.h +++ b/client.h @@ -604,6 +604,7 @@ bool m_clientSideDecorated; QMetaObject::Connection m_edgeRemoveConnection; + QMetaObject::Connection m_edgeGeometryTrackingConnection; }; inline xcb_window_t Client::wrapperId() const diff --git a/client.cpp b/client.cpp --- a/client.cpp +++ b/client.cpp @@ -2066,6 +2066,7 @@ } if (border != ElectricNone) { disconnect(m_edgeRemoveConnection); + disconnect(m_edgeGeometryTrackingConnection); bool successfullyHidden = false; if (((value >> 8) & 0xFF) == 1) { @@ -2081,8 +2082,9 @@ hideClient(true); successfullyHidden = isHiddenInternal(); - m_edgeRemoveConnection = connect(this, &Client::geometryChanged, this, [this](){ - ScreenEdges::self()->reserve(this, ElectricNone); + m_edgeGeometryTrackingConnection = connect(this, &Client::geometryChanged, this, [this, border](){ + hideClient(true); + ScreenEdges::self()->reserve(this, border); }); } @@ -2100,6 +2102,7 @@ // TODO: add proper unreserve //this will call showOnScreenEdge to reset the state + disconnect(m_edgeGeometryTrackingConnection); ScreenEdges::self()->reserve(this, ElectricNone); } } diff --git a/screenedge.cpp b/screenedge.cpp --- a/screenedge.cpp +++ b/screenedge.cpp @@ -986,15 +986,8 @@ while (it != m_edges.end()) { if ((*it)->client() == client) { hadBorder = true; - if ((*it)->border() == border) { - if (!(*it)->isReserved()) { - (*it)->reserve(); - } - return; - } else { - delete *it; - it = m_edges.erase(it); - } + delete *it; + it = m_edges.erase(it); } else { it++; }