Sync EffectsHandler::windowAdded with Workspace::windowAdded

This change makes the EffectsHandler emit the windowAdded signal as soon
as the Workspace::windowAdded signal is received and minimize the
difference between the states observed in kwin core and effects.
This commit is contained in:
Vlad Zahorodnii 2023-06-02 15:12:45 +03:00
parent a43ffb8182
commit 712fd3396c
4 changed files with 6 additions and 20 deletions

View file

@ -196,7 +196,7 @@ void SlidingPopupsTest::testWithOtherEffect()
QVERIFY(window->isNormalWindow());
// sliding popups should be active
QVERIFY(windowAddedSpy.wait());
QCOMPARE(windowAddedSpy.count(), 1);
QTRY_VERIFY(slidingPoupus->isActive());
QVERIFY(!otherEffect->isActive());

View file

@ -133,7 +133,7 @@ void TranslucencyTest::testMoveAfterDesktopChange()
QCOMPARE(window->window(), windowId);
QVERIFY(window->isDecorated());
QVERIFY(windowAddedSpy.wait());
QCOMPARE(windowAddedSpy.count(), 1);
QVERIFY(!m_translucencyEffect->isActive());
// let's send the window to desktop 2
VirtualDesktopManager *vds = VirtualDesktopManager::self();
@ -200,7 +200,7 @@ void TranslucencyTest::testDialogClose()
QVERIFY(window->isDecorated());
QVERIFY(window->isDialog());
QVERIFY(windowAddedSpy.wait());
QCOMPARE(windowAddedSpy.count(), 1);
QTRY_VERIFY(m_translucencyEffect->isActive());
// and destroy the window again
xcb_unmap_window(c.get(), windowId);

View file

@ -158,11 +158,8 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, WorkspaceScene *s
Q_EMIT desktopChangingCancelled();
});
connect(ws, &Workspace::windowAdded, this, [this](Window *window) {
if (window->readyForPainting()) {
slotWindowShown(window);
} else {
connect(window, &Window::windowShown, this, &EffectsHandlerImpl::slotWindowShown, Qt::SingleShotConnection);
}
setupWindowConnections(window);
Q_EMIT windowAdded(window->effectWindow());
});
connect(ws, &Workspace::windowActivated, this, [this](Window *window) {
Q_EMIT windowActivated(window ? window->effectWindow() : nullptr);
@ -226,11 +223,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, WorkspaceScene *s
// connect all clients
for (Window *window : ws->windows()) {
if (window->readyForPainting()) {
setupWindowConnections(window);
} else {
connect(window, &Window::windowShown, this, &EffectsHandlerImpl::slotWindowShown);
}
setupWindowConnections(window);
}
connect(ws, &Workspace::outputAdded, this, &EffectsHandlerImpl::slotOutputAdded);
@ -463,12 +456,6 @@ void EffectsHandlerImpl::slotOpacityChanged(Window *window, qreal oldOpacity)
Q_EMIT windowOpacityChanged(window->effectWindow(), oldOpacity, (qreal)window->opacity());
}
void EffectsHandlerImpl::slotWindowShown(Window *window)
{
setupWindowConnections(window);
Q_EMIT windowAdded(window->effectWindow());
}
void EffectsHandlerImpl::slotClientModalityChanged()
{
Q_EMIT windowModalityChanged(static_cast<X11Window *>(sender())->effectWindow());

View file

@ -266,7 +266,6 @@ public Q_SLOTS:
Q_SCRIPTABLE QString debug(const QString &name, const QString &parameter = QString()) const;
protected Q_SLOTS:
void slotWindowShown(KWin::Window *);
void slotOpacityChanged(KWin::Window *window, qreal oldOpacity);
void slotClientModalityChanged();
void slotWindowDamaged(KWin::Window *window);