From e5753ea33669813f2ba0cf23f28b4cf06ac259f3 Mon Sep 17 00:00:00 2001 From: Bharadwaj Raju Date: Fri, 1 Dec 2023 08:09:35 +0000 Subject: [PATCH] Make autohide screen edges use the same activation delay setting as other edges Makes it possible to easily target things in a window near your panel edge, without bringing up your panel. The `m_client` condition this MR removes appears to have been added solely to make autohiding panels appear instantly. See https://invent.kde.org/plasma/kwin/-/commit/c4140d6f4e5cd953023f2c078088d20a553ab875. BUG: 267277 --- autotests/integration/layershellv1window_test.cpp | 12 ++++++++++-- autotests/integration/screenedges_test.cpp | 15 +++++++++++---- src/screenedge.cpp | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/autotests/integration/layershellv1window_test.cpp b/autotests/integration/layershellv1window_test.cpp index ffa55de5a1..e4aab92644 100644 --- a/autotests/integration/layershellv1window_test.cpp +++ b/autotests/integration/layershellv1window_test.cpp @@ -674,6 +674,11 @@ void LayerShellV1WindowTest::testUnmap() void LayerShellV1WindowTest::testScreenEdge() { + auto config = kwinApp()->config(); + config->group("Windows").writeEntry("ElectricBorderDelay", 150); + config->sync(); + workspace()->slotReconfigure(); + // Create a layer shell surface. std::unique_ptr surface(Test::createSurface()); std::unique_ptr shellSurface(Test::createLayerSurfaceV1(surface.get(), QStringLiteral("test"))); @@ -717,8 +722,11 @@ void LayerShellV1WindowTest::testScreenEdge() QVERIFY(windowHiddenSpy.wait()); QVERIFY(!window->isShown()); - Test::pointerMotion(QPointF(640, 1023), timestamp++); - Test::pointerMotion(QPointF(640, 512), timestamp++); + Test::pointerMotion(QPointF(640, 1023), timestamp); + timestamp += 160; + Test::pointerMotion(QPointF(640, 1023), timestamp); + timestamp += 160; + Test::pointerMotion(QPointF(640, 512), timestamp); QVERIFY(windowShowSpy.wait()); QVERIFY(window->isShown()); } diff --git a/autotests/integration/screenedges_test.cpp b/autotests/integration/screenedges_test.cpp index 9ba753a151..4869fa2faf 100644 --- a/autotests/integration/screenedges_test.cpp +++ b/autotests/integration/screenedges_test.cpp @@ -78,7 +78,7 @@ void ScreenEdgesTest::initTestCase() Test::setOutputConfig({QRect(0, 0, 1280, 1024)}); // Disable effects, in particular present windows, which reserves a screen edge. - auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); + auto config = kwinApp()->config(); KConfigGroup plugins(config, QStringLiteral("Plugins")); const auto builtinNames = EffectLoader().listOfKnownEffects(); for (const QString &name : builtinNames) { @@ -378,6 +378,11 @@ void ScreenEdgesTest::testKdeNetWmScreenEdgeShow() // This test verifies that _KDE_NET_WM_SCREEN_EDGE_SHOW is handled properly. Note that // _KDE_NET_WM_SCREEN_EDGE_SHOW has oneshot effect. It's deleted when the window is shown. + auto config = kwinApp()->config(); + config->group("Windows").writeEntry("ElectricBorderDelay", 150); + config->sync(); + workspace()->slotReconfigure(); + Test::XcbConnectionPtr c = Test::createX11Connection(); QVERIFY(!xcb_connection_has_error(c.get())); @@ -420,11 +425,13 @@ void ScreenEdgesTest::testKdeNetWmScreenEdgeShow() QVERIFY(windowHiddenSpy.wait()); QVERIFY(!window->isShown()); - Test::pointerMotion(QPointF(640, 1024), timestamp++); + Test::pointerMotion(QPointF(640, 1023), timestamp); + timestamp += 160; + Test::pointerMotion(QPointF(640, 1023), timestamp); QVERIFY(withdrawnSpy.wait()); QVERIFY(window->isShown()); - - Test::pointerMotion(QPointF(640, 512), timestamp++); + timestamp += 160; + Test::pointerMotion(QPointF(640, 512), timestamp); QVERIFY(window->isShown()); } diff --git a/src/screenedge.cpp b/src/screenedge.cpp index d9063685cc..ff4d07fbd1 100644 --- a/src/screenedge.cpp +++ b/src/screenedge.cpp @@ -308,7 +308,7 @@ bool Edge::check(const QPoint &cursorPos, const QDateTime &triggerTime, bool for return false; } // no pushback so we have to activate at once - bool directActivate = forceNoPushBack || edges()->cursorPushBackDistance().isNull() || m_client; + bool directActivate = forceNoPushBack || edges()->cursorPushBackDistance().isNull(); if (directActivate || canActivate(cursorPos, triggerTime)) { markAsTriggered(cursorPos, triggerTime); handle(cursorPos);