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 c4140d6f4e.

BUG: 267277
This commit is contained in:
Bharadwaj Raju 2023-12-01 08:09:35 +00:00 committed by Vlad Zahorodnii
parent 83d0764870
commit e5753ea336
3 changed files with 22 additions and 7 deletions

View file

@ -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<KWayland::Client::Surface> surface(Test::createSurface());
std::unique_ptr<Test::LayerSurfaceV1> 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());
}

View file

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

View file

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