diff --git a/main_wayland.cpp b/main_wayland.cpp
index 0baf84aa87..8223fc68af 100644
--- a/main_wayland.cpp
+++ b/main_wayland.cpp
@@ -20,6 +20,7 @@ along with this program. If not, see .
#include "main_wayland.h"
#include
// kwin
+#include "wayland_backend.h"
#include "xcbutils.h"
// KDE
@@ -48,6 +49,7 @@ ApplicationWayland::ApplicationWayland(int &argc, char **argv)
ApplicationWayland::~ApplicationWayland()
{
destroyWorkspace();
+ delete Wayland::WaylandBackend::self();
// TODO: only if we support X11
Xcb::setInputFocus(XCB_INPUT_FOCUS_POINTER_ROOT);
}
@@ -75,7 +77,14 @@ void ApplicationWayland::performStartup()
XCB_CW_EVENT_MASK,
maskValues)));
if (!redirectCheck.isNull()) {
- fputs(i18n("kwin: an X11 window manager is running on the X11 Display.\n").toLocal8Bit().constData(), stderr);
+ fputs(i18n("kwin_wayland: an X11 window manager is running on the X11 Display.\n").toLocal8Bit().constData(), stderr);
+ ::exit(1);
+ }
+
+ // try creating the Wayland Backend
+ Wayland::WaylandBackend *backend = Wayland::WaylandBackend::create();
+ if (!backend) {
+ fputs(i18n("kwin_wayland: could not connect to Wayland Server, ensure WAYLAND_DISPLAY is set.\n").toLocal8Bit().constData(), stderr);
::exit(1);
}
diff --git a/wayland_backend.h b/wayland_backend.h
index c704700031..7745be2557 100644
--- a/wayland_backend.h
+++ b/wayland_backend.h
@@ -204,7 +204,7 @@ private:
* It creates the connection to the Wayland Compositor, sets up the registry and creates
* the Wayland surface and its shell mapping.
*/
-class WaylandBackend : public QObject
+class KWIN_EXPORT WaylandBackend : public QObject
{
Q_OBJECT
public:
diff --git a/workspace.cpp b/workspace.cpp
index 14606fd902..9e915612a3 100644
--- a/workspace.cpp
+++ b/workspace.cpp
@@ -149,7 +149,6 @@ Workspace::Workspace(bool restore)
// start the Wayland Backend - will only be created if WAYLAND_DISPLAY is present
#if HAVE_WAYLAND
- Wayland::WaylandBackend::create(this);
if (kwinApp()->operationMode() != Application::OperationModeX11) {
connect(this, SIGNAL(stackingOrderChanged()), input(), SLOT(updatePointerWindow()));
}