[wayland] A backend can mark whether it is ready
Replaces the functionality of the WaylandBackend and makes it available to all backends by providing the functionality directly in AbstractBackend. By default a backend is not ready and the implementation must call setReady(true) to indicate that setup has finished successfully. The compositor won't start till the backend indicates that it is ready.
This commit is contained in:
parent
8ff394a020
commit
2afaa60dc5
8 changed files with 31 additions and 21 deletions
|
@ -298,4 +298,13 @@ void AbstractBackend::repaint(const QRect &rect)
|
||||||
Compositor::self()->addRepaint(rect);
|
Compositor::self()->addRepaint(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AbstractBackend::setReady(bool ready)
|
||||||
|
{
|
||||||
|
if (m_ready == ready) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_ready = ready;
|
||||||
|
emit readyChanged(m_ready);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,9 @@ public:
|
||||||
bool handlesOutputs() const {
|
bool handlesOutputs() const {
|
||||||
return m_handlesOutputs;
|
return m_handlesOutputs;
|
||||||
}
|
}
|
||||||
|
bool isReady() const {
|
||||||
|
return m_ready;
|
||||||
|
}
|
||||||
|
|
||||||
void pointerMotion(const QPointF &position, quint32 time);
|
void pointerMotion(const QPointF &position, quint32 time);
|
||||||
void pointerButtonPressed(quint32 button, quint32 time);
|
void pointerButtonPressed(quint32 button, quint32 time);
|
||||||
|
@ -75,6 +78,7 @@ public:
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void cursorChanged();
|
void cursorChanged();
|
||||||
|
void readyChanged(bool);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit AbstractBackend(QObject *parent = nullptr);
|
explicit AbstractBackend(QObject *parent = nullptr);
|
||||||
|
@ -85,6 +89,7 @@ protected:
|
||||||
m_handlesOutputs = true;
|
m_handlesOutputs = true;
|
||||||
}
|
}
|
||||||
void repaint(const QRect &rect);
|
void repaint(const QRect &rect);
|
||||||
|
void setReady(bool ready);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void installThemeCursor(quint32 id, const QPoint &hotspot);
|
void installThemeCursor(quint32 id, const QPoint &hotspot);
|
||||||
|
@ -99,6 +104,7 @@ private:
|
||||||
} m_cursor;
|
} m_cursor;
|
||||||
WaylandCursorTheme *m_cursorTheme = nullptr;
|
WaylandCursorTheme *m_cursorTheme = nullptr;
|
||||||
bool m_handlesOutputs = false;
|
bool m_handlesOutputs = false;
|
||||||
|
bool m_ready = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,6 +232,7 @@ void DrmBackend::openDrm()
|
||||||
m_udevMonitor->enable();
|
m_udevMonitor->enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setReady(true);
|
||||||
|
|
||||||
initCursor();
|
initCursor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,7 @@ void FramebufferBackend::openFrameBuffer()
|
||||||
}
|
}
|
||||||
m_fd = fd;
|
m_fd = fd;
|
||||||
queryScreenInfo();
|
queryScreenInfo();
|
||||||
|
setReady(true);
|
||||||
emit screensQueried();
|
emit screensQueried();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -458,7 +458,7 @@ void WaylandBackend::initConnection()
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
connect(m_connectionThreadObject, &ConnectionThread::connectionDied, this,
|
connect(m_connectionThreadObject, &ConnectionThread::connectionDied, this,
|
||||||
[this]() {
|
[this]() {
|
||||||
m_ready = false;
|
setReady(false);
|
||||||
emit systemCompositorDied();
|
emit systemCompositorDied();
|
||||||
m_seat.reset();
|
m_seat.reset();
|
||||||
m_shm->destroy();
|
m_shm->destroy();
|
||||||
|
@ -581,16 +581,7 @@ void WaylandBackend::checkBackendReady()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
disconnect(this, &WaylandBackend::shellSurfaceSizeChanged, this, &WaylandBackend::checkBackendReady);
|
disconnect(this, &WaylandBackend::shellSurfaceSizeChanged, this, &WaylandBackend::checkBackendReady);
|
||||||
m_ready = true;
|
setReady(true);
|
||||||
emit backendReady();
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaylandBackend::connectNotify(const QMetaMethod &signal)
|
|
||||||
{
|
|
||||||
if (m_ready && signal == QMetaMethod::fromSignal(&WaylandBackend::backendReady)) {
|
|
||||||
// backend is already ready, let's emit the signal
|
|
||||||
signal.invoke(this, Qt::QueuedConnection);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Screens *WaylandBackend::createScreens(QObject *parent)
|
Screens *WaylandBackend::createScreens(QObject *parent)
|
||||||
|
|
|
@ -150,13 +150,9 @@ public:
|
||||||
OpenGLBackend *createOpenGLBackend() override;
|
OpenGLBackend *createOpenGLBackend() override;
|
||||||
QPainterBackend *createQPainterBackend() override;
|
QPainterBackend *createQPainterBackend() override;
|
||||||
|
|
||||||
protected:
|
|
||||||
void connectNotify(const QMetaMethod &signal) override;
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void shellSurfaceSizeChanged(const QSize &size);
|
void shellSurfaceSizeChanged(const QSize &size);
|
||||||
void systemCompositorDied();
|
void systemCompositorDied();
|
||||||
void backendReady();
|
|
||||||
void outputsChanged();
|
void outputsChanged();
|
||||||
void connectionFailed();
|
void connectionFailed();
|
||||||
private:
|
private:
|
||||||
|
@ -179,7 +175,6 @@ private:
|
||||||
KWayland::Client::FullscreenShell *m_fullscreenShell;
|
KWayland::Client::FullscreenShell *m_fullscreenShell;
|
||||||
KWayland::Client::SubCompositor *m_subCompositor;
|
KWayland::Client::SubCompositor *m_subCompositor;
|
||||||
WaylandCursor *m_cursor;
|
WaylandCursor *m_cursor;
|
||||||
bool m_ready = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
|
|
@ -77,6 +77,7 @@ X11WindowedBackend::X11WindowedBackend(const QByteArray &display, const QSize &s
|
||||||
XRenderUtils::init(m_connection, m_screen->root);
|
XRenderUtils::init(m_connection, m_screen->root);
|
||||||
createWindow();
|
createWindow();
|
||||||
startEventReading();
|
startEventReading();
|
||||||
|
setReady(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "compositingprefs.h"
|
#include "compositingprefs.h"
|
||||||
#include "xcbutils.h"
|
#include "xcbutils.h"
|
||||||
#if HAVE_WAYLAND
|
#if HAVE_WAYLAND
|
||||||
#include "backends/wayland/wayland_backend.h"
|
#include "abstract_backend.h"
|
||||||
#include "wayland_server.h"
|
#include "wayland_server.h"
|
||||||
#endif
|
#endif
|
||||||
#include "decorations/decoratedclient.h"
|
#include "decorations/decoratedclient.h"
|
||||||
|
@ -119,12 +119,18 @@ Compositor::Compositor(QObject* workspace)
|
||||||
connect(&m_unusedSupportPropertyTimer, SIGNAL(timeout()), SLOT(deleteUnusedSupportProperties()));
|
connect(&m_unusedSupportPropertyTimer, SIGNAL(timeout()), SLOT(deleteUnusedSupportProperties()));
|
||||||
#if HAVE_WAYLAND
|
#if HAVE_WAYLAND
|
||||||
if (kwinApp()->operationMode() != Application::OperationModeX11) {
|
if (kwinApp()->operationMode() != Application::OperationModeX11) {
|
||||||
if (Wayland::WaylandBackend *w = dynamic_cast<Wayland::WaylandBackend *>(waylandServer()->backend())) {
|
if (waylandServer()->backend()->isReady()) {
|
||||||
connect(w, &Wayland::WaylandBackend::systemCompositorDied, this, &Compositor::finish);
|
|
||||||
connect(w, &Wayland::WaylandBackend::backendReady, this, &Compositor::setup);
|
|
||||||
} else {
|
|
||||||
QMetaObject::invokeMethod(this, "setup", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "setup", Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
connect(waylandServer()->backend(), &AbstractBackend::readyChanged, this,
|
||||||
|
[this] (bool ready) {
|
||||||
|
if (ready) {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}, Qt::QueuedConnection
|
||||||
|
);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue