From 8b148fa11acea5784648f23164ce549e29efce45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 8 Apr 2016 10:11:27 +0200 Subject: [PATCH] Load and init the KWinX11Platform plugin in main_x11 kwin_x11 now also loads a platform plugin and initializes it. It doesn't do much except loading it and init it. Though it's also set up to continue startup only when screens are queried. --- main_x11.cpp | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/main_x11.cpp b/main_x11.cpp index 140acc49a9..194ee54f9a 100644 --- a/main_x11.cpp +++ b/main_x11.cpp @@ -22,12 +22,15 @@ along with this program. If not, see . #include "main_x11.h" #include // kwin +#include "platform.h" #include "sm.h" #include "workspace.h" #include "xcbutils.h" // KDE #include +#include +#include // Qt #include #include @@ -36,6 +39,7 @@ along with this program. If not, see . #ifdef HAVE_UNISTD_H #include #endif // HAVE_UNISTD_H +#include namespace KWin { @@ -179,11 +183,23 @@ void ApplicationX11::performStartup() } createInput(); - createWorkspace(); - Xcb::sync(); // Trigger possible errors, there's still a chance to abort + connect(platform(), &Platform::screensQueried, this, + [this] { + createWorkspace(); - notifyKSplash(); + Xcb::sync(); // Trigger possible errors, there's still a chance to abort + + notifyKSplash(); + } + ); + connect(platform(), &Platform::initFailed, this, + [] () { + std::cerr << "FATAL ERROR: backend failed to initialize, exiting now" << std::endl; + ::exit(1); + } + ); + platform()->init(); }); // we need to do an XSync here, otherwise the QPA might crash us later on Xcb::sync(); @@ -319,6 +335,19 @@ KWIN_EXPORT int kdemain(int argc, char * argv[]) exit(1); } + // find and load the X11 platform plugin + const auto plugins = KPluginLoader::findPluginsById(QStringLiteral("org.kde.kwin.platforms"), + QStringLiteral("KWinX11Platform")); + if (plugins.isEmpty()) { + std::cerr << "FATAL ERROR: KWin could not find the KWinX11Platform plugin" << std::endl; + return 1; + } + a.initPlatform(plugins.first()); + if (!a.platform()) { + std::cerr << "FATAL ERROR: could not instantiate the platform plugin" << std::endl; + return 1; + } + a.start(); KWin::SessionSaveDoneHelper helper;