Port away the remaining users of windowShown/windowHidden to hiddenChanged

This commit is contained in:
Vlad Zahorodnii 2024-01-30 00:04:57 +02:00
parent 5a32f012c3
commit a8a53c651b
7 changed files with 30 additions and 33 deletions

View file

@ -213,12 +213,12 @@ void InputMethodTest::testEnableDisableV3()
kwinApp()->inputMethod()->hide();
QVERIFY(!keyboardClient->isShown());
QSignalSpy windowShownSpy(keyboardClient, &Window::windowShown);
QSignalSpy hiddenChangedSpy(keyboardClient, &Window::hiddenChanged);
// Force enable the text input object. This is what's done by Gtk.
textInputV3->enable();
textInputV3->commit();
windowShownSpy.wait();
hiddenChangedSpy.wait();
QVERIFY(keyboardClient->isShown());
// disable text input and ensure that it is not hiding input panel without commit

View file

@ -734,25 +734,24 @@ void LayerShellV1WindowTest::testScreenEdge()
QVERIFY(window);
QVERIFY(!window->isActive());
QSignalSpy windowShowSpy(window, &Window::windowShown);
QSignalSpy windowHiddenSpy(window, &Window::windowHidden);
QSignalSpy hiddenChangedSpy(window, &Window::hiddenChanged);
quint32 timestamp = 0;
// The layer surface will be hidden and shown when the screen edge is activated or deactivated.
{
screenEdge->activate();
QVERIFY(windowHiddenSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(!window->isShown());
screenEdge->deactivate();
QVERIFY(windowShowSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(window->isShown());
}
// The layer surface will be shown when the screen edge is triggered.
{
screenEdge->activate();
QVERIFY(windowHiddenSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(!window->isShown());
Test::pointerMotion(QPointF(640, 1023), timestamp);
@ -760,7 +759,7 @@ void LayerShellV1WindowTest::testScreenEdge()
Test::pointerMotion(QPointF(640, 1023), timestamp);
timestamp += 160;
Test::pointerMotion(QPointF(640, 512), timestamp);
QVERIFY(windowShowSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(window->isShown());
}
@ -768,7 +767,7 @@ void LayerShellV1WindowTest::testScreenEdge()
{
QSignalSpy approachingSpy(workspace()->screenEdges(), &ScreenEdges::approaching);
screenEdge->activate();
QVERIFY(windowHiddenSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(!window->isShown());
Test::pointerMotion(QPointF(640, 1020), timestamp++);
@ -777,7 +776,7 @@ void LayerShellV1WindowTest::testScreenEdge()
QVERIFY(approachingSpy.last().at(1).toReal() != 0.0);
screenEdge->deactivate();
QVERIFY(windowShowSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(window->isShown());
QVERIFY(approachingSpy.last().at(1).toReal() == 0.0);
@ -787,11 +786,11 @@ void LayerShellV1WindowTest::testScreenEdge()
// The layer surface will be shown when the screen edge is destroyed.
{
screenEdge->activate();
QVERIFY(windowHiddenSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(!window->isShown());
screenEdge.reset();
QVERIFY(windowShowSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(window->isShown());
}
}

View file

@ -666,7 +666,7 @@ void MoveResizeWindowTest::testAdjustClientGeometryOfHiddenX11Panel()
QTEST(Workspace::self()->adjustWindowPosition(testWindow, targetPoint, false).toPoint(), "expectedAdjustedPoint");
// now let's hide the panel
QSignalSpy panelHiddenSpy(panel, &Window::windowHidden);
QSignalSpy panelHiddenSpy(panel, &Window::hiddenChanged);
QFETCH(quint32, hideLocation);
xcb_change_property(c.get(), XCB_PROP_MODE_REPLACE, windowId, atoms->kde_screen_edge_show, XCB_ATOM_CARDINAL, 32, 1, &hideLocation);
xcb_flush(c.get());

View file

@ -414,15 +414,14 @@ void ScreenEdgesTest::testKdeNetWmScreenEdgeShow()
ScreenEdgePropertyMonitor screenEdgeMonitor(c.get(), windowId);
QSignalSpy withdrawnSpy(&screenEdgeMonitor, &ScreenEdgePropertyMonitor::withdrawn);
QSignalSpy windowShownSpy(window, &Window::windowShown);
QSignalSpy windowHiddenSpy(window, &Window::windowHidden);
QSignalSpy hiddenChangedSpy(window, &Window::hiddenChanged);
quint32 timestamp = 0;
// The window will be shown when the pointer approaches its reserved screen edge.
{
enableAutoHide(c.get(), windowId, ElectricBottom);
xcb_flush(c.get());
QVERIFY(windowHiddenSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(!window->isShown());
Test::pointerMotion(QPointF(640, 1023), timestamp);
@ -439,7 +438,7 @@ void ScreenEdgesTest::testKdeNetWmScreenEdgeShow()
{
enableAutoHide(c.get(), windowId, ElectricBottom);
xcb_flush(c.get());
QVERIFY(windowHiddenSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(!window->isShown());
Test::touchDown(0, QPointF(640, 1023), timestamp++);
@ -453,7 +452,7 @@ void ScreenEdgesTest::testKdeNetWmScreenEdgeShow()
{
enableAutoHide(c.get(), windowId, ElectricBottom);
xcb_flush(c.get());
QVERIFY(windowHiddenSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(!window->isShown());
workspace()->screenEdges()->recreateEdges();
@ -462,7 +461,7 @@ void ScreenEdgesTest::testKdeNetWmScreenEdgeShow()
enableAutoHide(c.get(), windowId, ElectricNone);
xcb_flush(c.get());
QVERIFY(windowShownSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(window->isShown());
}
@ -470,12 +469,12 @@ void ScreenEdgesTest::testKdeNetWmScreenEdgeShow()
{
enableAutoHide(c.get(), windowId, ElectricBottom);
xcb_flush(c.get());
QVERIFY(windowHiddenSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(!window->isShown());
enableAutoHide(c.get(), windowId, ElectricNone);
xcb_flush(c.get());
QVERIFY(windowShownSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(window->isShown());
}
@ -484,7 +483,7 @@ void ScreenEdgesTest::testKdeNetWmScreenEdgeShow()
QSignalSpy approachingSpy(workspace()->screenEdges(), &ScreenEdges::approaching);
enableAutoHide(c.get(), windowId, ElectricBottom);
xcb_flush(c.get());
QVERIFY(windowHiddenSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(!window->isShown());
Test::pointerMotion(QPointF(640, 1020), timestamp++);
@ -494,7 +493,7 @@ void ScreenEdgesTest::testKdeNetWmScreenEdgeShow()
enableAutoHide(c.get(), windowId, ElectricNone);
xcb_flush(c.get());
QVERIFY(windowShownSpy.wait());
QVERIFY(hiddenChangedSpy.wait());
QVERIFY(window->isShown());
QVERIFY(approachingSpy.last().at(1).toReal() == 0.0);

View file

@ -56,11 +56,12 @@ EffectWindow::EffectWindow(WindowItem *windowItem)
d->m_waylandWindow = qobject_cast<KWin::WaylandWindow *>(d->m_window) != nullptr;
d->m_x11Window = qobject_cast<KWin::X11Window *>(d->m_window) != nullptr;
connect(d->m_window, &Window::windowShown, this, [this]() {
Q_EMIT windowShown(this);
});
connect(d->m_window, &Window::windowHidden, this, [this]() {
Q_EMIT windowHidden(this);
connect(d->m_window, &Window::hiddenChanged, this, [this]() {
if (d->m_window->isHidden()) {
Q_EMIT windowHidden(this);
} else {
Q_EMIT windowShown(this);
}
});
connect(d->m_window, &Window::maximizedChanged, this, [this]() {
const MaximizeMode mode = d->m_window->maximizeMode();

View file

@ -42,8 +42,7 @@ void IdleInhibition::registerClient(Window *client)
m_connections[client] = connect(client->surface(), &SurfaceInterface::inhibitsIdleChanged, this, updateInhibit);
connect(client, &Window::desktopsChanged, this, updateInhibit);
connect(client, &Window::minimizedChanged, this, updateInhibit);
connect(client, &Window::windowHidden, this, updateInhibit);
connect(client, &Window::windowShown, this, updateInhibit);
connect(client, &Window::hiddenChanged, this, updateInhibit);
connect(client, &Window::closed, this, [this, client]() {
uninhibit(client);
auto it = m_connections.find(client);

View file

@ -252,10 +252,9 @@ void InputMethod::setPanel(InputPanelV1Window *panel)
}
});
connect(m_panel, &Window::frameGeometryChanged, this, &InputMethod::updateInputPanelState);
connect(m_panel, &Window::windowHidden, this, &InputMethod::updateInputPanelState);
connect(m_panel, &Window::hiddenChanged, this, &InputMethod::updateInputPanelState);
connect(m_panel, &Window::closed, this, &InputMethod::updateInputPanelState);
connect(m_panel, &Window::windowShown, this, &InputMethod::visibleChanged);
connect(m_panel, &Window::windowHidden, this, &InputMethod::visibleChanged);
connect(m_panel, &Window::hiddenChanged, this, &InputMethod::visibleChanged);
connect(m_panel, &Window::closed, this, &InputMethod::visibleChanged);
Q_EMIT visibleChanged();
updateInputPanelState();