wayland: Implement closeable window rule

BUG: 443129
This commit is contained in:
Vlad Zahorodnii 2024-01-25 14:49:27 +02:00
parent 35572904fc
commit b21229e59a
2 changed files with 41 additions and 1 deletions

View file

@ -155,6 +155,10 @@ private Q_SLOTS:
void testLayerForce();
void testLayerForceTemporarily();
void testCloseableDontAffect();
void testCloseableForce();
void testCloseableForceTemporarily();
void testMatchAfterNameChange();
private:
@ -3021,5 +3025,41 @@ void TestXdgShellWindowRules::testLayerForceTemporarily()
destroyTestWindow();
}
void TestXdgShellWindowRules::testCloseableDontAffect()
{
setWindowRule("closeable", false, int(Rules::DontAffect));
createTestWindow();
QVERIFY(m_window->isCloseable());
destroyTestWindow();
}
void TestXdgShellWindowRules::testCloseableForce()
{
setWindowRule("closeable", false, int(Rules::Force));
createTestWindow();
QVERIFY(!m_window->isCloseable());
destroyTestWindow();
}
void TestXdgShellWindowRules::testCloseableForceTemporarily()
{
setWindowRule("closeable", false, int(Rules::ForceTemporarily));
createTestWindow();
QVERIFY(!m_window->isCloseable());
// The rule should be discarded when the window is closed.
destroyTestWindow();
createTestWindow();
QVERIFY(m_window->isCloseable());
destroyTestWindow();
}
WAYLANDTEST_MAIN(TestXdgShellWindowRules)
#include "xdgshellwindow_rules_test.moc"

View file

@ -567,7 +567,7 @@ bool XdgToplevelWindow::isResizable() const
bool XdgToplevelWindow::isCloseable() const
{
return !isDesktop() && !isDock();
return rules()->checkCloseable(!isDesktop() && !isDock());
}
bool XdgToplevelWindow::isFullScreenable() const