[wayland] Support for hideClient in ShellClient
Summary: This implements the hideClient for ShellClient which was previously not implmented. Also autotest for same is added. Test Plan: ran autotest Reviewers: graesslin, #plasma Reviewed By: graesslin, #plasma Subscribers: plasma-devel, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D3022
This commit is contained in:
parent
5543cfdf68
commit
7843974a8a
3 changed files with 52 additions and 2 deletions
|
@ -60,6 +60,8 @@ private Q_SLOTS:
|
||||||
void testMaximizedToFullscreen();
|
void testMaximizedToFullscreen();
|
||||||
void testWindowOpensLargerThanScreen_data();
|
void testWindowOpensLargerThanScreen_data();
|
||||||
void testWindowOpensLargerThanScreen();
|
void testWindowOpensLargerThanScreen();
|
||||||
|
void testHidden_data();
|
||||||
|
void testHidden();
|
||||||
};
|
};
|
||||||
|
|
||||||
void TestShellClient::initTestCase()
|
void TestShellClient::initTestCase()
|
||||||
|
@ -544,5 +546,42 @@ void TestShellClient::testWindowOpensLargerThanScreen()
|
||||||
QVERIFY(sizeChangeRequestedSpy.wait());
|
QVERIFY(sizeChangeRequestedSpy.wait());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestShellClient::testHidden_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||||
|
|
||||||
|
QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell;
|
||||||
|
QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestShellClient::testHidden()
|
||||||
|
{
|
||||||
|
// this test verifies that when hiding window it doesn't get shown
|
||||||
|
QScopedPointer<Surface> surface(Test::createSurface());
|
||||||
|
QFETCH(Test::ShellSurfaceType, type);
|
||||||
|
QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data()));
|
||||||
|
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
||||||
|
QVERIFY(c);
|
||||||
|
QVERIFY(c->isActive());
|
||||||
|
QCOMPARE(workspace()->activeClient(), c);
|
||||||
|
QVERIFY(c->wantsInput());
|
||||||
|
QVERIFY(c->wantsTabFocus());
|
||||||
|
QVERIFY(c->isShown(true));
|
||||||
|
|
||||||
|
c->hideClient(true);
|
||||||
|
QVERIFY(!c->isShown(true));
|
||||||
|
QVERIFY(!c->isActive());
|
||||||
|
QVERIFY(c->wantsInput());
|
||||||
|
QVERIFY(c->wantsTabFocus());
|
||||||
|
|
||||||
|
// unhide again
|
||||||
|
c->hideClient(false);
|
||||||
|
QVERIFY(c->isShown(true));
|
||||||
|
QVERIFY(c->wantsInput());
|
||||||
|
QVERIFY(c->wantsTabFocus());
|
||||||
|
|
||||||
|
//QCOMPARE(workspace()->activeClient(), c);
|
||||||
|
}
|
||||||
|
|
||||||
WAYLANDTEST_MAIN(TestShellClient)
|
WAYLANDTEST_MAIN(TestShellClient)
|
||||||
#include "shell_client_test.moc"
|
#include "shell_client_test.moc"
|
||||||
|
|
|
@ -623,12 +623,22 @@ bool ShellClient::isResizable() const
|
||||||
bool ShellClient::isShown(bool shaded_is_shown) const
|
bool ShellClient::isShown(bool shaded_is_shown) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(shaded_is_shown)
|
Q_UNUSED(shaded_is_shown)
|
||||||
return !m_closing && !m_unmapped && !isMinimized();
|
return !m_closing && !m_unmapped && !isMinimized() && !m_hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellClient::hideClient(bool hide)
|
void ShellClient::hideClient(bool hide)
|
||||||
{
|
{
|
||||||
Q_UNUSED(hide)
|
if (m_hidden == hide) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_hidden = hide;
|
||||||
|
if (hide) {
|
||||||
|
addWorkspaceRepaint(visibleRect());
|
||||||
|
workspace()->clientHidden(this);
|
||||||
|
emit windowHidden(this);
|
||||||
|
} else {
|
||||||
|
emit windowShown(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool changeMaximizeRecursion = false;
|
static bool changeMaximizeRecursion = false;
|
||||||
|
|
|
@ -190,6 +190,7 @@ private:
|
||||||
bool m_userNoBorder = false;
|
bool m_userNoBorder = false;
|
||||||
bool m_fullScreen = false;
|
bool m_fullScreen = false;
|
||||||
bool m_transient = false;
|
bool m_transient = false;
|
||||||
|
bool m_hidden = false;
|
||||||
bool m_internal;
|
bool m_internal;
|
||||||
qreal m_opacity = 1.0;
|
qreal m_opacity = 1.0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue