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.
This commit is contained in:
parent
211d0c00fc
commit
e179d9cea1
8 changed files with 15 additions and 33 deletions
|
@ -140,7 +140,6 @@ void WaylandTestApplication::performStartup()
|
||||||
|
|
||||||
// try creating the Wayland Backend
|
// try creating the Wayland Backend
|
||||||
createInput();
|
createInput();
|
||||||
createPlugins();
|
|
||||||
createVirtualInputDevices();
|
createVirtualInputDevices();
|
||||||
|
|
||||||
if (!platform()->enabledOutputs().isEmpty()) {
|
if (!platform()->enabledOutputs().isEmpty()) {
|
||||||
|
@ -171,6 +170,7 @@ void WaylandTestApplication::continueStartupWithScene()
|
||||||
disconnect(Compositor::self(), &Compositor::sceneCreated, this, &WaylandTestApplication::continueStartupWithScene);
|
disconnect(Compositor::self(), &Compositor::sceneCreated, this, &WaylandTestApplication::continueStartupWithScene);
|
||||||
|
|
||||||
createWorkspace();
|
createWorkspace();
|
||||||
|
createPlugins();
|
||||||
|
|
||||||
if (!waylandServer()->start()) {
|
if (!waylandServer()->start()) {
|
||||||
qFatal("Failed to initialize the Wayland server, exiting now");
|
qFatal("Failed to initialize the Wayland server, exiting now");
|
||||||
|
|
|
@ -123,7 +123,6 @@ void Application::start()
|
||||||
Application::~Application()
|
Application::~Application()
|
||||||
{
|
{
|
||||||
delete options;
|
delete options;
|
||||||
destroyPlugins();
|
|
||||||
destroyColorManager();
|
destroyColorManager();
|
||||||
destroyAtoms();
|
destroyAtoms();
|
||||||
destroyPlatform();
|
destroyPlatform();
|
||||||
|
|
|
@ -115,6 +115,8 @@ ApplicationWayland::~ApplicationWayland()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroyPlugins();
|
||||||
|
|
||||||
// need to unload all effects prior to destroying X connection as they might do X calls
|
// need to unload all effects prior to destroying X connection as they might do X calls
|
||||||
if (effects) {
|
if (effects) {
|
||||||
static_cast<EffectsHandlerImpl *>(effects)->unloadAllEffects();
|
static_cast<EffectsHandlerImpl *>(effects)->unloadAllEffects();
|
||||||
|
@ -146,7 +148,6 @@ void ApplicationWayland::performStartup()
|
||||||
createInput();
|
createInput();
|
||||||
createInputMethod();
|
createInputMethod();
|
||||||
TabletModeManager::create(this);
|
TabletModeManager::create(this);
|
||||||
createPlugins();
|
|
||||||
|
|
||||||
WaylandCompositor::create();
|
WaylandCompositor::create();
|
||||||
|
|
||||||
|
@ -160,6 +161,7 @@ void ApplicationWayland::continueStartupWithScene()
|
||||||
|
|
||||||
// Note that we start accepting client connections after creating the Workspace.
|
// Note that we start accepting client connections after creating the Workspace.
|
||||||
createWorkspace();
|
createWorkspace();
|
||||||
|
createPlugins();
|
||||||
|
|
||||||
if (!waylandServer()->start()) {
|
if (!waylandServer()->start()) {
|
||||||
qFatal("Failed to initialze the Wayland server, exiting now");
|
qFatal("Failed to initialze the Wayland server, exiting now");
|
||||||
|
|
|
@ -182,6 +182,7 @@ ApplicationX11::ApplicationX11(int &argc, char **argv)
|
||||||
ApplicationX11::~ApplicationX11()
|
ApplicationX11::~ApplicationX11()
|
||||||
{
|
{
|
||||||
setTerminating();
|
setTerminating();
|
||||||
|
destroyPlugins();
|
||||||
destroyCompositor();
|
destroyCompositor();
|
||||||
destroyWorkspace();
|
destroyWorkspace();
|
||||||
if (!owner.isNull() && owner->ownerWindow() != XCB_WINDOW_NONE) { // If there was no --replace (no new WM)
|
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()
|
void ApplicationX11::lostSelection()
|
||||||
{
|
{
|
||||||
sendPostedEvents();
|
sendPostedEvents();
|
||||||
|
destroyPlugins();
|
||||||
destroyCompositor();
|
destroyCompositor();
|
||||||
destroyWorkspace();
|
destroyWorkspace();
|
||||||
// Remove windowmanager privileges
|
// Remove windowmanager privileges
|
||||||
|
|
|
@ -19,18 +19,8 @@
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
WindowsRunner::WindowsRunner()
|
WindowsRunner::WindowsRunner()
|
||||||
{
|
|
||||||
if (workspace()) {
|
|
||||||
initialize();
|
|
||||||
} else {
|
|
||||||
connect(kwinApp(), &Application::workspaceCreated, this, &WindowsRunner::initialize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WindowsRunner::~WindowsRunner() = default;
|
|
||||||
|
|
||||||
void WindowsRunner::initialize()
|
|
||||||
{
|
{
|
||||||
new Krunner1Adaptor(this);
|
new Krunner1Adaptor(this);
|
||||||
qDBusRegisterMetaType<RemoteMatch>();
|
qDBusRegisterMetaType<RemoteMatch>();
|
||||||
|
@ -42,6 +32,8 @@ void WindowsRunner::initialize()
|
||||||
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KWin"));
|
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KWin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WindowsRunner::~WindowsRunner() = default;
|
||||||
|
|
||||||
RemoteActions WindowsRunner::Actions()
|
RemoteActions WindowsRunner::Actions()
|
||||||
{
|
{
|
||||||
RemoteActions actions;
|
RemoteActions actions;
|
||||||
|
|
|
@ -56,7 +56,6 @@ private:
|
||||||
ActivateDesktopAction
|
ActivateDesktopAction
|
||||||
};
|
};
|
||||||
|
|
||||||
void initialize();
|
|
||||||
RemoteMatch desktopMatch(const VirtualDesktop *desktop, const WindowsRunnerAction action = ActivateDesktopAction, qreal relevance = 1.0) const;
|
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;
|
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;
|
bool actionSupported(const Window *window, const WindowsRunnerAction action) const;
|
||||||
|
|
|
@ -47,6 +47,7 @@ NightColorManager *NightColorManager::self()
|
||||||
|
|
||||||
NightColorManager::NightColorManager()
|
NightColorManager::NightColorManager()
|
||||||
{
|
{
|
||||||
|
NightColorSettings::instance(kwinApp()->config());
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
|
|
||||||
m_iface = new NightColorDBusInterface(this);
|
m_iface = new NightColorDBusInterface(this);
|
||||||
|
@ -73,22 +74,6 @@ NightColorManager::NightColorManager()
|
||||||
QDBusConnection::sessionBus().asyncCall(message);
|
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());
|
m_configWatcher = KConfigWatcher::create(kwinApp()->config());
|
||||||
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, &NightColorManager::reconfigure);
|
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, &NightColorManager::reconfigure);
|
||||||
|
|
||||||
|
@ -153,6 +138,11 @@ void NightColorManager::init()
|
||||||
hardReset();
|
hardReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NightColorManager::~NightColorManager()
|
||||||
|
{
|
||||||
|
s_instance = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void NightColorManager::hardReset()
|
void NightColorManager::hardReset()
|
||||||
{
|
{
|
||||||
cancelAllTimers();
|
cancelAllTimers();
|
||||||
|
|
|
@ -81,8 +81,6 @@ public:
|
||||||
explicit NightColorManager();
|
explicit NightColorManager();
|
||||||
~NightColorManager() override;
|
~NightColorManager() override;
|
||||||
|
|
||||||
void init();
|
|
||||||
|
|
||||||
void autoLocationUpdate(double latitude, double longitude);
|
void autoLocationUpdate(double latitude, double longitude);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue