diff --git a/wayland_backend.cpp b/wayland_backend.cpp index 93d352c22a..f2bd79d5fa 100644 --- a/wayland_backend.cpp +++ b/wayland_backend.cpp @@ -44,6 +44,7 @@ along with this program. If not, see . #include #include #include +#include #include // xcb #include @@ -552,6 +553,7 @@ void WaylandBackend::initConnection() Qt::QueuedConnection); connect(m_connectionThreadObject, &ConnectionThread::connectionDied, this, [this]() { + m_ready = false; emit systemCompositorDied(); m_cursorTracker.reset(); m_seat.reset(); @@ -652,9 +654,18 @@ void WaylandBackend::checkBackendReady() return; } disconnect(this, &WaylandBackend::shellSurfaceSizeChanged, this, &WaylandBackend::checkBackendReady); + m_ready = 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); + } +} + } } // KWin diff --git a/wayland_backend.h b/wayland_backend.h index 635d2b51aa..f1a6bbcecd 100644 --- a/wayland_backend.h +++ b/wayland_backend.h @@ -190,6 +190,10 @@ public: KWayland::Client::Surface *surface() const; QSize shellSurfaceSize() const; void installCursorImage(Qt::CursorShape shape); + +protected: + void connectNotify(const QMetaMethod &signal) override; + Q_SIGNALS: void shellSurfaceSizeChanged(const QSize &size); void systemCompositorDied(); @@ -217,6 +221,7 @@ private: KWayland::Client::FullscreenShell *m_fullscreenShell; KWayland::Client::SubCompositor *m_subCompositor; WaylandCursor *m_cursor; + bool m_ready = false; KWIN_SINGLETON(WaylandBackend) };