[wayland] AbstractBackend can emit an initFailed signal
Replaces the custom handling for Wayland and X11 Backend. Now they can just emit the initFailed signal.
This commit is contained in:
parent
0782252f72
commit
17d5839580
5 changed files with 10 additions and 10 deletions
|
@ -79,6 +79,7 @@ public:
|
|||
|
||||
Q_SIGNALS:
|
||||
void screensQueried();
|
||||
void initFailed();
|
||||
void cursorChanged();
|
||||
void readyChanged(bool);
|
||||
|
||||
|
|
|
@ -368,6 +368,7 @@ WaylandBackend::WaylandBackend(const QByteArray &display, QObject *parent)
|
|||
, m_displayName(display)
|
||||
{
|
||||
connect(this, &WaylandBackend::outputsChanged, this, &WaylandBackend::screensQueried);
|
||||
connect(this, &WaylandBackend::connectionFailed, this, &WaylandBackend::initFailed);
|
||||
}
|
||||
|
||||
WaylandBackend::~WaylandBackend()
|
||||
|
|
|
@ -100,6 +100,8 @@ void X11WindowedBackend::init()
|
|||
waylandServer()->seat()->setHasPointer(true);
|
||||
waylandServer()->seat()->setHasKeyboard(true);
|
||||
emit screensQueried();
|
||||
} else {
|
||||
emit initFailed();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,10 +57,6 @@ public:
|
|||
}
|
||||
xcb_window_t rootWindow() const;
|
||||
|
||||
bool isValid() const {
|
||||
return m_connection != nullptr && m_window != XCB_WINDOW_NONE;
|
||||
}
|
||||
|
||||
QSize size() const {
|
||||
return m_size;
|
||||
}
|
||||
|
|
|
@ -102,12 +102,6 @@ void ApplicationWayland::createBackend()
|
|||
if (m_windowed) {
|
||||
if (!m_waylandDisplay.isEmpty()) {
|
||||
Wayland::WaylandBackend *b = new Wayland::WaylandBackend(m_waylandDisplay, this);
|
||||
connect(b, &Wayland::WaylandBackend::connectionFailed, this,
|
||||
[] () {
|
||||
fputs(i18n("kwin_wayland: could not connect to Wayland Server, ensure WAYLAND_DISPLAY is set.\n").toLocal8Bit().constData(), stderr);
|
||||
::exit(1);
|
||||
}
|
||||
);
|
||||
backend = b;
|
||||
}
|
||||
if (!backend && !m_x11Display.isEmpty()) {
|
||||
|
@ -129,6 +123,12 @@ void ApplicationWayland::createBackend()
|
|||
|
||||
if (backend) {
|
||||
connect(backend, &AbstractBackend::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
|
||||
connect(backend, &AbstractBackend::initFailed, this,
|
||||
[] () {
|
||||
std::cerr << "FATAL ERROR: backend failed to initialize, exiting now" << std::endl;
|
||||
::exit(1);
|
||||
}
|
||||
);
|
||||
backend->init();
|
||||
} else {
|
||||
std::cerr << "FATAL ERROR: could not create a backend, exiting now" << std::endl;
|
||||
|
|
Loading…
Reference in a new issue