From 0f945f53fe36013e4ca8dba354fdc48be3b94b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 20 Feb 2015 14:53:03 +0100 Subject: [PATCH] Move creation of InputRedirection, Cursor and Screens out of Workspace Do not depend on Workspace and do not depend on X11 thus can be started earlier allowing to get more things started prior to depending on Workspace. --- main.cpp | 19 +++++++++++++++++++ main.h | 2 ++ main_x11.cpp | 1 + workspace.cpp | 9 ++------- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index 7e37e79079..3f32a81946 100644 --- a/main.cpp +++ b/main.cpp @@ -23,7 +23,11 @@ along with this program. If not, see . #include // kwin #include "atoms.h" +#include "cursor.h" +#include "input.h" +#include "logind.h" #include "options.h" +#include "screens.h" #include "sm.h" #include "workspace.h" #include "xcbutils.h" @@ -370,6 +374,21 @@ void Application::createWorkspace() (void) new Workspace(isSessionRestored()); } +void Application::createInput() +{ + LogindIntegration::create(this); + InputRedirection::create(this); + Cursor::create(this); +} + +void Application::createScreens() +{ + if (Screens::self()) { + return; + } + Screens::create(this); +} + void Application::createAtoms() { atoms = new Atoms; diff --git a/main.h b/main.h index da98168cbd..8a4adf5c53 100644 --- a/main.h +++ b/main.h @@ -99,6 +99,7 @@ public: } } void updateX11Time(xcb_generic_event_t *event); + void createScreens(); static void setCrashCount(int count); static bool wasCrash(); @@ -155,6 +156,7 @@ protected: virtual void performStartup() = 0; void notifyKSplash(); + void createInput(); void createWorkspace(); void createAtoms(); void createOptions(); diff --git a/main_x11.cpp b/main_x11.cpp index a0a6a4ae56..c50aad2d2a 100644 --- a/main_x11.cpp +++ b/main_x11.cpp @@ -169,6 +169,7 @@ void ApplicationX11::performStartup() ::exit(1); } + createInput(); createWorkspace(); Xcb::sync(); // Trigger possible errors, there's still a chance to abort diff --git a/workspace.cpp b/workspace.cpp index d38f3ac32a..2af9f6f5ab 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -141,17 +141,12 @@ Workspace::Workspace(bool restore) // first initialize the extensions Xcb::Extensions::self(); - LogindIntegration::create(this); - InputRedirection::create(this); - // start the Wayland Backend - will only be created if WAYLAND_DISPLAY is present #if HAVE_WAYLAND if (kwinApp()->operationMode() != Application::OperationModeX11) { connect(this, SIGNAL(stackingOrderChanged()), input(), SLOT(updatePointerWindow())); } #endif - // start the cursor support - Cursor::create(this); #ifdef KWIN_BUILD_ACTIVITIES Activities *activities = Activities::create(this); @@ -162,8 +157,7 @@ Workspace::Workspace(bool restore) reparseConfigFuture.waitForFinished(); // get screen support - Screens *screens = Screens::create(this); - connect(screens, SIGNAL(changed()), SLOT(desktopResized())); + connect(screens(), SIGNAL(changed()), SLOT(desktopResized())); options->loadConfig(); options->loadCompositingConfig(false); @@ -224,6 +218,7 @@ void Workspace::init() { updateXTime(); // Needed for proper initialization of user_time in Client ctor KSharedConfigPtr config = KSharedConfig::openConfig(); + kwinApp()->createScreens(); Screens *screens = Screens::self(); screens->setConfig(config); screens->reconfigure();