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.
This commit is contained in:
Martin Gräßlin 2015-02-20 14:53:03 +01:00
parent 00739867b4
commit 0f945f53fe
4 changed files with 24 additions and 7 deletions

View file

@ -23,7 +23,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <config-kwin.h>
// 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;

2
main.h
View file

@ -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();

View file

@ -169,6 +169,7 @@ void ApplicationX11::performStartup()
::exit(1);
}
createInput();
createWorkspace();
Xcb::sync(); // Trigger possible errors, there's still a chance to abort

View file

@ -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();