Commit 9225848f authored by Benjamin Port's avatar Benjamin Port Committed by Vlad Zahorodnii
Browse files

When maximizing a window raise client and gain focus

BUG: 418938 FIXED-IN: 5.20
parent 0ec34afd
......@@ -56,6 +56,7 @@ private Q_SLOTS:
void testInitiallyMaximizedBorderless();
void testBorderlessMaximizedWindow();
void testBorderlessMaximizedWindowNoClientSideDecoration();
void testMaximizedGainFocusAndBeActivated();
};
void TestMaximized::initTestCase()
......@@ -426,5 +427,31 @@ void TestMaximized::testBorderlessMaximizedWindowNoClientSideDecoration()
QCOMPARE(deco->mode(), XdgDecoration::Mode::ServerSide);
}
void TestMaximized::testMaximizedGainFocusAndBeActivated()
{
// This test verifies that a window will be raised and gain focus when it's maximized
QScopedPointer<Surface> surface(Test::createSurface());
QScopedPointer<XdgShellSurface> xdgShellSurface(Test::createXdgShellStableSurface(surface.data()));
auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QScopedPointer<Surface> surface2(Test::createSurface());
QScopedPointer<XdgShellSurface> xdgShellSurface2(Test::createXdgShellStableSurface(surface2.data()));
auto client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
QVERIFY(!client->isActive());
QVERIFY(client2->isActive());
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{client, client2}));
workspace()->performWindowOperation(client, Options::MaximizeOp);
QVERIFY(client->isActive());
QVERIFY(!client2->isActive());
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{client2, client}));
xdgShellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(client));
xdgShellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(client2));
}
WAYLANDTEST_MAIN(TestMaximized)
#include "maximize_test.moc"
......@@ -1071,15 +1071,19 @@ void Workspace::performWindowOperation(AbstractClient* c, Options::WindowOperati
case Options::MaximizeOp:
c->maximize(c->maximizeMode() == MaximizeFull
? MaximizeRestore : MaximizeFull);
takeActivity(c, ActivityFocus | ActivityRaise);
break;
case Options::HMaximizeOp:
c->maximize(c->maximizeMode() ^ MaximizeHorizontal);
takeActivity(c, ActivityFocus | ActivityRaise);
break;
case Options::VMaximizeOp:
c->maximize(c->maximizeMode() ^ MaximizeVertical);
takeActivity(c, ActivityFocus | ActivityRaise);
break;
case Options::RestoreOp:
c->maximize(MaximizeRestore);
takeActivity(c, ActivityFocus | ActivityRaise);
break;
case Options::MinimizeOp:
c->minimize();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment