Commit 885e9acb authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Drop ApplicationWaylandAbstract

We gain nothing with it. XCB setup logic in the Xwayland server has to
be moved to the workspace layer anyway. For example, this move of
responsibilities will be needed to support running more than just one
instance of Xwayland. Architecture-wise, it would be cleaner too.

Unfortunately, it breaks encapsulation of the Application, but this can
be taken care later.
parent ed128064
Pipeline #205579 passed with stage
in 22 minutes and 37 seconds
......@@ -40,7 +40,7 @@ namespace KWin
{
WaylandTestApplication::WaylandTestApplication(OperationMode mode, int &argc, char **argv)
: ApplicationWaylandAbstract(mode, argc, argv)
: Application(mode, argc, argv)
{
QStandardPaths::setTestModeEnabled(true);
// TODO: add a test move to kglobalaccel instead?
......
......@@ -68,7 +68,7 @@ namespace Test
class VirtualInputDevice;
}
class WaylandTestApplication : public ApplicationWaylandAbstract
class WaylandTestApplication : public Application
{
Q_OBJECT
public:
......
......@@ -567,7 +567,12 @@ bool XcbEventFilter::nativeEventFilter(const QByteArray &eventType, void *messag
QProcessEnvironment Application::processStartupEnvironment() const
{
return QProcessEnvironment::systemEnvironment();
return m_processEnvironment;
}
void Application::setProcessStartupEnvironment(const QProcessEnvironment &environment)
{
m_processEnvironment = environment;
}
void Application::initPlatform(const KPluginMetaData &plugin)
......@@ -583,13 +588,4 @@ void Application::initPlatform(const KPluginMetaData &plugin)
}
}
ApplicationWaylandAbstract::ApplicationWaylandAbstract(OperationMode mode, int &argc, char **argv)
: Application(mode, argc, argv)
{
}
ApplicationWaylandAbstract::~ApplicationWaylandAbstract()
{
}
} // namespace
......@@ -190,6 +190,31 @@ public:
return m_defaultScreen;
}
/**
* Inheriting classes should use this method to set the X11 root window
* before accessing any X11 specific code pathes.
*/
void setX11RootWindow(xcb_window_t root)
{
m_rootWindow = root;
}
/**
* Inheriting classes should use this method to set the xcb connection
* before accessing any X11 specific code pathes.
*/
void setX11Connection(xcb_connection_t *c)
{
m_connection = c;
}
/**
* Inheriting classes should use this method to set the default screen
* before accessing any X11 specific code pathes.
*/
void setX11DefaultScreen(xcb_screen_t *screen)
{
m_defaultScreen = screen;
}
qreal xwaylandScale() const
{
return m_xwaylandScale;
......@@ -216,7 +241,8 @@ public:
}
#endif
virtual QProcessEnvironment processStartupEnvironment() const;
QProcessEnvironment processStartupEnvironment() const;
void setProcessStartupEnvironment(const QProcessEnvironment &environment);
void initPlatform(const KPluginMetaData &plugin);
Platform *platform() const
......@@ -229,6 +255,12 @@ public:
return m_terminating;
}
void installNativeX11EventFilter();
void removeNativeX11EventFilter();
void createAtoms();
void destroyAtoms();
static void setupMalloc();
static void setupLocalizedString();
......@@ -249,44 +281,16 @@ protected:
void notifyStarted();
void createInput();
void createWorkspace();
void createAtoms();
void createOptions();
void createPlugins();
void createColorManager();
void createInputMethod();
void installNativeX11EventFilter();
void removeNativeX11EventFilter();
void destroyInput();
void destroyWorkspace();
void destroyCompositor();
void destroyPlugins();
void destroyColorManager();
void destroyInputMethod();
/**
* Inheriting classes should use this method to set the X11 root window
* before accessing any X11 specific code pathes.
*/
void setX11RootWindow(xcb_window_t root)
{
m_rootWindow = root;
}
/**
* Inheriting classes should use this method to set the xcb connection
* before accessing any X11 specific code pathes.
*/
void setX11Connection(xcb_connection_t *c)
{
m_connection = c;
}
/**
* Inheriting classes should use this method to set the default screen
* before accessing any X11 specific code pathes.
*/
void setX11DefaultScreen(xcb_screen_t *screen)
{
m_defaultScreen = screen;
}
void destroyAtoms();
void destroyPlatform();
void setTerminating()
......@@ -316,6 +320,7 @@ private:
bool m_terminating = false;
bool m_isClosingX11Connection = false;
qreal m_xwaylandScale = 1;
QProcessEnvironment m_processEnvironment;
};
inline static Application *kwinApp()
......@@ -323,30 +328,6 @@ inline static Application *kwinApp()
return static_cast<Application *>(QCoreApplication::instance());
}
namespace Xwl
{
class Xwayland;
}
class KWIN_EXPORT ApplicationWaylandAbstract : public Application
{
Q_OBJECT
public:
~ApplicationWaylandAbstract() override = 0;
protected:
friend class Xwl::Xwayland;
ApplicationWaylandAbstract(OperationMode mode, int &argc, char **argv);
virtual void setProcessStartupEnvironment(const QProcessEnvironment &environment)
{
Q_UNUSED(environment);
}
virtual void startSession()
{
}
};
} // namespace
#endif
......@@ -104,7 +104,7 @@ Q_CONSTRUCTOR_FUNCTION(disableDrKonqi)
//************************************
ApplicationWayland::ApplicationWayland(int &argc, char **argv)
: ApplicationWaylandAbstract(OperationModeWaylandOnly, argc, argv)
: Application(OperationModeWaylandOnly, argc, argv)
{
}
......
......@@ -10,7 +10,6 @@
#define KWIN_MAIN_WAYLAND_H
#include "main.h"
#include <KConfigWatcher>
#include <QProcessEnvironment>
#include <QTimer>
namespace KWin
......@@ -20,7 +19,7 @@ namespace Xwl
class Xwayland;
}
class ApplicationWayland : public ApplicationWaylandAbstract
class ApplicationWayland : public Application
{
Q_OBJECT
public:
......@@ -51,33 +50,23 @@ public:
{
m_inputMethodServerToStart = inputMethodServer;
}
void setProcessStartupEnvironment(const QProcessEnvironment &environment) override
{
m_environment = environment;
}
void setSessionArgument(const QString &session)
{
m_sessionArgument = session;
}
QProcessEnvironment processStartupEnvironment() const override
{
return m_environment;
}
protected:
void performStartup() override;
private:
void continueStartupWithScene();
void finalizeStartup();
void startSession() override;
void startSession();
void refreshSettings(const KConfigGroup &group, const QByteArrayList &names);
bool m_startXWayland = false;
QStringList m_applicationsToStart;
QString m_inputMethodServerToStart;
QProcessEnvironment m_environment;
QString m_sessionArgument;
Xwl::Xwayland *m_xwayland = nullptr;
......
......@@ -73,7 +73,7 @@ bool XrandrEventFilter::event(xcb_generic_event_t *event)
return false;
}
Xwayland::Xwayland(ApplicationWaylandAbstract *app, QObject *parent)
Xwayland::Xwayland(Application *app, QObject *parent)
: XwaylandInterface(parent)
, m_app(app)
, m_launcher(new XwaylandLauncher(this))
......
......@@ -18,7 +18,7 @@ class QSocketNotifier;
namespace KWin
{
class Output;
class ApplicationWaylandAbstract;
class Application;
namespace Xwl
{
......@@ -30,7 +30,7 @@ class KWIN_EXPORT Xwayland : public XwaylandInterface
Q_OBJECT
public:
Xwayland(ApplicationWaylandAbstract *app, QObject *parent = nullptr);
Xwayland(Application *app, QObject *parent = nullptr);
~Xwayland() override;
void start();
......@@ -72,7 +72,7 @@ private:
KWaylandServer::AbstractDropHandler *xwlDropHandler() override;
QSocketNotifier *m_socketNotifier = nullptr;
ApplicationWaylandAbstract *m_app;
Application *m_app;
QScopedPointer<KSelectionOwner> m_selectionOwner;
XrandrEventFilter *m_xrandrEventsFilter = nullptr;
......
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