Move creating WaylandBackend into ApplicationWayland

Early creation to ensure that we can abort if there is no Wayland
display to connect to.
This commit is contained in:
Martin Gräßlin 2014-08-12 09:45:43 +02:00
parent f9a7b94ee7
commit 670973efdb
3 changed files with 11 additions and 3 deletions

View file

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "main_wayland.h"
#include <config-kwin.h>
// 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);
}

View file

@ -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:

View file

@ -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()));
}