wayland: Add windows when readyForPainting changes
A window is added to the workspace when it's mapped. It's assumed that the first Window::windowShown signal indicates that. But it's not entirely true. For example, if setHidden(false); setHidden(true); are called in succession, the window will be marked as ready for painting even though it isn't. The Window::readyForPaintingChanged() signal fixes that. It's emitted when the window is actually mapped.
This commit is contained in:
parent
b05fa94d32
commit
e23cb52a16
5 changed files with 10 additions and 4 deletions
|
@ -119,8 +119,8 @@ void WobblyWindowsShadeTest::testShadeMove()
|
|||
QVERIFY(!window->isShade());
|
||||
QVERIFY(window->isActive());
|
||||
|
||||
QSignalSpy windowShownSpy(window, &Window::windowShown);
|
||||
QVERIFY(windowShownSpy.wait());
|
||||
QSignalSpy readyForPaintingChangedSpy(window, &Window::readyForPaintingChanged);
|
||||
QVERIFY(readyForPaintingChangedSpy.wait());
|
||||
|
||||
// now shade the window
|
||||
workspace()->slotWindowShade();
|
||||
|
|
|
@ -39,6 +39,9 @@ WindowItem::WindowItem(Window *window, Scene *scene, Item *parent)
|
|||
if (waylandServer()) {
|
||||
connect(waylandServer(), &WaylandServer::lockStateChanged, this, &WindowItem::updateVisibility);
|
||||
}
|
||||
if (!window->readyForPainting()) {
|
||||
connect(window, &Window::readyForPaintingChanged, this, &WindowItem::updateVisibility);
|
||||
}
|
||||
connect(window, &Window::lockScreenOverlayChanged, this, &WindowItem::updateVisibility);
|
||||
connect(window, &Window::minimizedChanged, this, &WindowItem::updateVisibility);
|
||||
connect(window, &Window::hiddenChanged, this, &WindowItem::updateVisibility);
|
||||
|
|
|
@ -209,7 +209,9 @@ void WaylandServer::registerWindow(Window *window)
|
|||
if (window->readyForPainting()) {
|
||||
Q_EMIT windowAdded(window);
|
||||
} else {
|
||||
connect(window, &Window::windowShown, this, &WaylandServer::windowAdded, Qt::SingleShotConnection);
|
||||
connect(window, &Window::readyForPaintingChanged, this, [this, window]() {
|
||||
Q_EMIT windowAdded(window);
|
||||
});
|
||||
}
|
||||
m_windows << window;
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ void Window::setReadyForPainting()
|
|||
{
|
||||
if (!ready_for_painting) {
|
||||
ready_for_painting = true;
|
||||
Q_EMIT windowShown(this);
|
||||
Q_EMIT readyForPaintingChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1434,6 +1434,7 @@ Q_SIGNALS:
|
|||
void hiddenChanged();
|
||||
void hiddenByShowDesktopChanged();
|
||||
void lockScreenOverlayChanged();
|
||||
void readyForPaintingChanged();
|
||||
|
||||
protected:
|
||||
Window();
|
||||
|
|
Loading…
Reference in a new issue