[wayland] AbstractBackend provides signal screensQueried

With this change all backends need to emit the screensQueried signal
at some point. So far only x11 backend did not provide the signal,
wayland had a comparable delayed init mechanism. Now all backends use
the same mechanism.
This commit is contained in:
Martin Gräßlin 2015-05-06 09:03:54 +02:00
parent b2f5873a28
commit 0782252f72
6 changed files with 9 additions and 28 deletions

View file

@ -78,6 +78,7 @@ public:
void touchFrame();
Q_SIGNALS:
void screensQueried();
void cursorChanged();
void readyChanged(bool);

View file

@ -76,7 +76,6 @@ public:
void bufferDestroyed(DrmBuffer *b);
Q_SIGNALS:
void screensQueried();
void outputRemoved(KWin::DrmOutput *output);
void outputAdded(KWin::DrmOutput *output);

View file

@ -69,9 +69,6 @@ public:
}
QImage::Format imageFormat() const;
Q_SIGNALS:
void screensQueried();
private:
void openFrameBuffer();
bool queryScreenInfo();

View file

@ -367,6 +367,7 @@ WaylandBackend::WaylandBackend(const QByteArray &display, QObject *parent)
, m_cursor(nullptr)
, m_displayName(display)
{
connect(this, &WaylandBackend::outputsChanged, this, &WaylandBackend::screensQueried);
}
WaylandBackend::~WaylandBackend()

View file

@ -99,6 +99,7 @@ void X11WindowedBackend::init()
setReady(true);
waylandServer()->seat()->setHasPointer(true);
waylandServer()->seat()->setHasKeyboard(true);
emit screensQueried();
}
}

View file

@ -94,9 +94,6 @@ void ApplicationWayland::performStartup()
// try creating the Wayland Backend
createInput();
createBackend();
if (dynamic_cast<X11WindowedBackend*>(waylandServer()->backend())) {
continueStartupWithScreens();
}
}
void ApplicationWayland::createBackend()
@ -111,37 +108,29 @@ void ApplicationWayland::createBackend()
::exit(1);
}
);
connect(b, &Wayland::WaylandBackend::outputsChanged, this, &ApplicationWayland::continueStartupWithScreens);
b->init();
backend = b;
}
if (!backend && !m_x11Display.isEmpty()) {
KWin::X11WindowedBackend *x11Backend = new KWin::X11WindowedBackend(m_x11Display, m_backendSize, this);
x11Backend->init();
if (x11Backend->isValid()) {
backend = x11Backend;
} else {
delete x11Backend;
}
backend = x11Backend;
}
}
#if HAVE_DRM
if (m_drm) {
DrmBackend *b = new DrmBackend(this);
connect(b, &DrmBackend::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
b->init();
backend = b;
}
#endif
if (!m_framebuffer.isEmpty()) {
FramebufferBackend *b = new FramebufferBackend(this);
connect(b, &FramebufferBackend::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
b->setDevice(m_framebuffer);
b->init();
backend = b;
}
if (!backend) {
if (backend) {
connect(backend, &AbstractBackend::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
backend->init();
} else {
std::cerr << "FATAL ERROR: could not create a backend, exiting now" << std::endl;
::exit(1);
}
@ -149,14 +138,7 @@ void ApplicationWayland::createBackend()
void ApplicationWayland::continueStartupWithScreens()
{
if (Wayland::WaylandBackend *w = dynamic_cast<Wayland::WaylandBackend *>(waylandServer()->backend())) {
disconnect(w, &Wayland::WaylandBackend::outputsChanged, this, &ApplicationWayland::continueStartupWithScreens);
}
#if HAVE_DRM
if (DrmBackend *b = dynamic_cast<DrmBackend*>(waylandServer()->backend())) {
disconnect(b, &DrmBackend::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
}
#endif
disconnect(waylandServer()->backend(), &AbstractBackend::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
createScreens();
waylandServer()->initOutputs();