From 2935698c0cb7165a511e20888293a0ac8ffffc88 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 13 Nov 2022 21:37:58 +0200 Subject: [PATCH] kwin: add new KWin::Compositor::starting() method and use it in during startup I have a feeling even that will not be enough Signed-off-by: Ivailo Monev --- kwin/composite.h | 8 ++++++++ kwin/main.cpp | 13 ++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/kwin/composite.h b/kwin/composite.h index e6df5a72..42b10bec 100644 --- a/kwin/composite.h +++ b/kwin/composite.h @@ -122,6 +122,14 @@ public: static bool compositing() { return s_compositor != NULL && s_compositor->isActive(); } + /** + * @brief Static check to test whether the Compositor is still starting. + * + * @return bool @c true if there is a Compositor and it is still starting, @c false otherwise + **/ + static bool starting() { + return s_compositor != NULL && s_compositor->m_starting; + } // for delayed supportproperty management of effects void keepSupportProperty(xcb_atom_t atom); diff --git a/kwin/main.cpp b/kwin/main.cpp index 1a920fc4..c1b60d74 100644 --- a/kwin/main.cpp +++ b/kwin/main.cpp @@ -60,6 +60,7 @@ along with this program. If not, see . #include "utils.h" #include "effects.h" #include "workspace.h" +#include "composite.h" #include "xcbutils.h" #include @@ -488,7 +489,17 @@ int main(int argc, char * argv[]) return 1; } - a.processEvents(); // trigger any events before resuming such as compositor setup + // wait for the workspace initialization to complete before resuming + while (KWin::Workspace::self() && KWin::Workspace::self()->initializing()) { + a.processEvents(); + } + // and the compositor + while (KWin::Compositor::starting()) { + a.processEvents(); + } + // and one more iteration just in case + a.processEvents(); + ksmserver.resumeStartup("kwin"); KWin::SessionManager weAreIndeed; KWin::SessionSaveDoneHelper helper;