diff --git a/changelog/next.md b/changelog/next.md new file mode 100644 index 0000000..5a6954c --- /dev/null +++ b/changelog/next.md @@ -0,0 +1,3 @@ +## Bug Fixes + +- Fixed ScreencopyView not displaying when only lock surfaces are shown. diff --git a/src/wayland/session_lock.cpp b/src/wayland/session_lock.cpp index 2ebe3fd..95f6ccf 100644 --- a/src/wayland/session_lock.cpp +++ b/src/wayland/session_lock.cpp @@ -19,6 +19,7 @@ #include "../core/qmlglobal.hpp" #include "../core/qmlscreen.hpp" #include "../core/reload.hpp" +#include "../window/proxywindow.hpp" #include "session_lock/session_lock.hpp" void WlSessionLock::onReload(QObject* oldInstance) { @@ -216,7 +217,7 @@ void WlSessionLockSurface::onReload(QObject* oldInstance) { } if (this->window == nullptr) { - this->window = new QQuickWindow(); + this->window = new QsQuickWindowBase(); // needed for vulkan dmabuf import, qt ignores these if not applicable auto graphicsConfig = this->window->graphicsConfiguration(); diff --git a/src/window/proxywindow.cpp b/src/window/proxywindow.cpp index 116d3df..8e98ba7 100644 --- a/src/window/proxywindow.cpp +++ b/src/window/proxywindow.cpp @@ -612,9 +612,11 @@ void ProxyWindowAttached::setWindow(ProxyWindowBase* window) { emit this->windowChanged(); } -ProxiedWindow::ProxiedWindow(ProxyWindowBase* proxy, QWindow* parent) - : QQuickWindow(parent) - , mProxy(proxy) { +namespace { +QList> SCENEGRAPH_INIT_CALLBACKS; // NOLINT +} + +QsQuickWindowBase::QsQuickWindowBase(QWindow* parent): QQuickWindow(parent) { QObject::connect( this, &QQuickWindow::sceneGraphInitialized, @@ -623,15 +625,7 @@ ProxiedWindow::ProxiedWindow(ProxyWindowBase* proxy, QWindow* parent) ); } -namespace { -QList> SCENEGRAPH_INIT_CALLBACKS; // NOLINT -} - -void ProxiedWindow::callOnScenegraphInit(std::function cb) { // NOLINT - SCENEGRAPH_INIT_CALLBACKS.emplaceBack(cb); -} - -void ProxiedWindow::onSceneGraphInitialized() { +void QsQuickWindowBase::onSceneGraphInitialized() { for (auto& cb: SCENEGRAPH_INIT_CALLBACKS) { cb(this); } @@ -639,6 +633,10 @@ void ProxiedWindow::onSceneGraphInitialized() { SCENEGRAPH_INIT_CALLBACKS.clear(); } +void QsQuickWindowBase::callOnScenegraphInit(std::function cb) { // NOLINT + SCENEGRAPH_INIT_CALLBACKS.emplaceBack(cb); +} + bool ProxiedWindow::event(QEvent* event) { if (event->type() == QEvent::DevicePixelRatioChange) { emit this->devicePixelRatioChanged(); diff --git a/src/window/proxywindow.hpp b/src/window/proxywindow.hpp index 8adcefa..f03416c 100644 --- a/src/window/proxywindow.hpp +++ b/src/window/proxywindow.hpp @@ -252,24 +252,33 @@ private: void setWindow(ProxyWindowBase* window); }; -class ProxiedWindow: public QQuickWindow { +class QsQuickWindowBase: public QQuickWindow { Q_OBJECT; public: - explicit ProxiedWindow(ProxyWindowBase* proxy, QWindow* parent = nullptr); + explicit QsQuickWindowBase(QWindow* parent = nullptr); + + static void callOnScenegraphInit(std::function cb); + +private slots: + void onSceneGraphInitialized(); +}; + +class ProxiedWindow: public QsQuickWindowBase { + Q_OBJECT; + +public: + explicit ProxiedWindow(ProxyWindowBase* proxy, QWindow* parent = nullptr) + : QsQuickWindowBase(parent) + , mProxy(proxy) {} [[nodiscard]] ProxyWindowBase* proxy() const { return this->mProxy; } void setProxy(ProxyWindowBase* proxy) { this->mProxy = proxy; } - static void callOnScenegraphInit(std::function cb); - signals: void exposed(); void devicePixelRatioChanged(); -private slots: - void onSceneGraphInitialized(); - protected: bool event(QEvent* event) override; void exposeEvent(QExposeEvent* event) override;