wayland: Setup compositing when window is mapped ready for painting
This prevents creating a WindowItem until we know that the window is actually going to be visible on the screen.
This commit is contained in:
parent
5cd99b27fd
commit
c191902026
6 changed files with 16 additions and 24 deletions
|
@ -384,7 +384,8 @@ void Compositor::startupWithWorkspace()
|
|||
|
||||
m_state = State::On;
|
||||
|
||||
for (X11Window *window : Workspace::self()->clientList()) {
|
||||
const auto windows = workspace()->allClientList();
|
||||
for (Window *window : windows) {
|
||||
window->setupCompositing();
|
||||
}
|
||||
for (Unmanaged *window : Workspace::self()->unmanagedList()) {
|
||||
|
@ -394,13 +395,6 @@ void Compositor::startupWithWorkspace()
|
|||
window->setupCompositing();
|
||||
}
|
||||
|
||||
if (auto *server = waylandServer()) {
|
||||
const auto windows = server->windows();
|
||||
for (Window *window : windows) {
|
||||
window->setupCompositing();
|
||||
}
|
||||
}
|
||||
|
||||
// Sets also the 'effects' pointer.
|
||||
kwinApp()->createEffectsHandler(this, m_scene.get());
|
||||
|
||||
|
@ -515,7 +509,8 @@ void Compositor::stop()
|
|||
effects = nullptr;
|
||||
|
||||
if (Workspace::self()) {
|
||||
for (X11Window *window : Workspace::self()->clientList()) {
|
||||
const auto windows = workspace()->allClientList();
|
||||
for (Window *window : windows) {
|
||||
window->finishCompositing();
|
||||
}
|
||||
for (Unmanaged *window : Workspace::self()->unmanagedList()) {
|
||||
|
@ -536,13 +531,6 @@ void Compositor::stop()
|
|||
disconnect(workspace(), &Workspace::outputRemoved, this, &Compositor::removeOutput);
|
||||
}
|
||||
|
||||
if (waylandServer()) {
|
||||
const QList<Window *> toFinishCompositing = waylandServer()->windows();
|
||||
for (Window *window : toFinishCompositing) {
|
||||
window->finishCompositing();
|
||||
}
|
||||
}
|
||||
|
||||
const auto superlayers = m_superlayers;
|
||||
for (auto it = superlayers.begin(); it != superlayers.end(); ++it) {
|
||||
removeSuperLayer(*it);
|
||||
|
|
|
@ -189,7 +189,7 @@ void InputPanelV1Window::maybeShow()
|
|||
{
|
||||
const bool shouldShow = m_mode == Mode::Overlay || (m_mode == Mode::VirtualKeyboard && m_allowed && m_virtualKeyboardShouldBeShown);
|
||||
if (shouldShow && !isZombie() && surface()->isMapped()) {
|
||||
setReadyForPainting();
|
||||
markAsMapped();
|
||||
reposition();
|
||||
showClient();
|
||||
}
|
||||
|
|
|
@ -250,7 +250,7 @@ void LayerShellV1Window::handleUnmapped()
|
|||
void LayerShellV1Window::handleCommitted()
|
||||
{
|
||||
if (surface()->buffer()) {
|
||||
setReadyForPainting();
|
||||
markAsMapped();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ WaylandWindow::WaylandWindow(SurfaceInterface *surface)
|
|||
{
|
||||
setSurface(surface);
|
||||
setDepth(32);
|
||||
setupCompositing();
|
||||
|
||||
connect(surface, &SurfaceInterface::shadowChanged,
|
||||
this, &WaylandWindow::updateShadow);
|
||||
|
@ -323,4 +322,12 @@ void WaylandWindow::updateGeometry(const QRectF &rect)
|
|||
Q_EMIT geometryShapeChanged(oldFrameGeometry);
|
||||
}
|
||||
|
||||
void WaylandWindow::markAsMapped()
|
||||
{
|
||||
if (Q_UNLIKELY(!ready_for_painting)) {
|
||||
setupCompositing();
|
||||
setReadyForPainting();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace KWin
|
||||
|
|
|
@ -47,6 +47,7 @@ protected:
|
|||
|
||||
void cleanGrouping();
|
||||
void updateGeometry(const QRectF &rect);
|
||||
void markAsMapped();
|
||||
|
||||
private:
|
||||
void updateClientOutputs();
|
||||
|
|
|
@ -52,10 +52,6 @@ XdgSurfaceWindow::XdgSurfaceWindow(XdgSurfaceInterface *shellSurface)
|
|||
this, &XdgSurfaceWindow::destroyWindow);
|
||||
connect(shellSurface->surface(), &SurfaceInterface::committed,
|
||||
this, &XdgSurfaceWindow::handleCommit);
|
||||
#if 0 // TODO: Refactor kwin core in order to uncomment this code.
|
||||
connect(shellSurface->surface(), &SurfaceInterface::mapped,
|
||||
this, &XdgSurfaceWindow::setReadyForPainting);
|
||||
#endif
|
||||
connect(shellSurface, &XdgSurfaceInterface::aboutToBeDestroyed,
|
||||
this, &XdgSurfaceWindow::destroyWindow);
|
||||
connect(shellSurface->surface(), &SurfaceInterface::aboutToBeDestroyed,
|
||||
|
@ -174,7 +170,7 @@ void XdgSurfaceWindow::handleCommit()
|
|||
m_lastAcknowledgedConfigure.reset();
|
||||
m_lastAcknowledgedConfigureSerial.reset();
|
||||
|
||||
setReadyForPainting();
|
||||
markAsMapped();
|
||||
}
|
||||
|
||||
void XdgSurfaceWindow::handleRolePrecommit()
|
||||
|
|
Loading…
Reference in a new issue