Commit e179d9ce authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Load plugins after Workspace is created

The original intention behind creating plugins before the workspace was
to handle the case where kwin_wayland may need to wait until outputs are
available. However, since things have changed a lot in that regard,
plugins can be loaded after the workspace now.

The main benefit behind this is that plugins can be simpler, they won't
need to track when the workspace is created.

On X11, plugins are already loaded after the workspace is instantiated.
parent 211d0c00
Pipeline #207683 passed with stage
in 22 minutes and 12 seconds
......@@ -140,7 +140,6 @@ void WaylandTestApplication::performStartup()
// try creating the Wayland Backend
createInput();
createPlugins();
createVirtualInputDevices();
if (!platform()->enabledOutputs().isEmpty()) {
......@@ -171,6 +170,7 @@ void WaylandTestApplication::continueStartupWithScene()
disconnect(Compositor::self(), &Compositor::sceneCreated, this, &WaylandTestApplication::continueStartupWithScene);
createWorkspace();
createPlugins();
if (!waylandServer()->start()) {
qFatal("Failed to initialize the Wayland server, exiting now");
......
......@@ -123,7 +123,6 @@ void Application::start()
Application::~Application()
{
delete options;
destroyPlugins();
destroyColorManager();
destroyAtoms();
destroyPlatform();
......
......@@ -115,6 +115,8 @@ ApplicationWayland::~ApplicationWayland()
return;
}
destroyPlugins();
// need to unload all effects prior to destroying X connection as they might do X calls
if (effects) {
static_cast<EffectsHandlerImpl *>(effects)->unloadAllEffects();
......@@ -146,7 +148,6 @@ void ApplicationWayland::performStartup()
createInput();
createInputMethod();
TabletModeManager::create(this);
createPlugins();
WaylandCompositor::create();
......@@ -160,6 +161,7 @@ void ApplicationWayland::continueStartupWithScene()
// Note that we start accepting client connections after creating the Workspace.
createWorkspace();
createPlugins();
if (!waylandServer()->start()) {
qFatal("Failed to initialze the Wayland server, exiting now");
......
......@@ -182,6 +182,7 @@ ApplicationX11::ApplicationX11(int &argc, char **argv)
ApplicationX11::~ApplicationX11()
{
setTerminating();
destroyPlugins();
destroyCompositor();
destroyWorkspace();
if (!owner.isNull() && owner->ownerWindow() != XCB_WINDOW_NONE) { // If there was no --replace (no new WM)
......@@ -197,6 +198,7 @@ void ApplicationX11::setReplace(bool replace)
void ApplicationX11::lostSelection()
{
sendPostedEvents();
destroyPlugins();
destroyCompositor();
destroyWorkspace();
// Remove windowmanager privileges
......
......@@ -19,18 +19,8 @@
namespace KWin
{
WindowsRunner::WindowsRunner()
{
if (workspace()) {
initialize();
} else {
connect(kwinApp(), &Application::workspaceCreated, this, &WindowsRunner::initialize);
}
}
WindowsRunner::~WindowsRunner() = default;
void WindowsRunner::initialize()
WindowsRunner::WindowsRunner()
{
new Krunner1Adaptor(this);
qDBusRegisterMetaType<RemoteMatch>();
......@@ -42,6 +32,8 @@ void WindowsRunner::initialize()
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KWin"));
}
WindowsRunner::~WindowsRunner() = default;
RemoteActions WindowsRunner::Actions()
{
RemoteActions actions;
......
......@@ -56,7 +56,6 @@ private:
ActivateDesktopAction
};
void initialize();
RemoteMatch desktopMatch(const VirtualDesktop *desktop, const WindowsRunnerAction action = ActivateDesktopAction, qreal relevance = 1.0) const;
RemoteMatch windowsMatch(const Window *window, const WindowsRunnerAction action = ActivateAction, qreal relevance = 1.0, Plasma::QueryMatch::Type type = Plasma::QueryMatch::ExactMatch) const;
bool actionSupported(const Window *window, const WindowsRunnerAction action) const;
......
......@@ -47,6 +47,7 @@ NightColorManager *NightColorManager::self()
NightColorManager::NightColorManager()
{
NightColorSettings::instance(kwinApp()->config());
s_instance = this;
m_iface = new NightColorDBusInterface(this);
......@@ -73,22 +74,6 @@ NightColorManager::NightColorManager()
QDBusConnection::sessionBus().asyncCall(message);
});
if (workspace()) {
init();
} else {
connect(kwinApp(), &Application::workspaceCreated, this, &NightColorManager::init);
}
}
NightColorManager::~NightColorManager()
{
s_instance = nullptr;
}
void NightColorManager::init()
{
NightColorSettings::instance(kwinApp()->config());
m_configWatcher = KConfigWatcher::create(kwinApp()->config());
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, &NightColorManager::reconfigure);
......@@ -153,6 +138,11 @@ void NightColorManager::init()
hardReset();
}
NightColorManager::~NightColorManager()
{
s_instance = nullptr;
}
void NightColorManager::hardReset()
{
cancelAllTimers();
......
......@@ -81,8 +81,6 @@ public:
explicit NightColorManager();
~NightColorManager() override;
void init();
void autoLocationUpdate(double latitude, double longitude);
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment