mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-27 02:54:36 +00:00
wayland/lock: run scenegraph callbacks for lock surfaces
Fixes ScreencopyView never initializing if only using lock surfaces.
This commit is contained in:
4 files changed
+31
-20
No files matched your search
@@ -0,0 +1,3 @@
|
||||
## Bug Fixes
|
||||
|
||||
- Fixed ScreencopyView not displaying when only lock surfaces are shown.
|
||||
@@ -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();
|
||||
|
||||
+10
-12
@@ -612,9 +612,11 @@ void ProxyWindowAttached::setWindow(ProxyWindowBase* window) {
|
||||
emit this->windowChanged();
|
||||
}
|
||||
|
||||
ProxiedWindow::ProxiedWindow(ProxyWindowBase* proxy, QWindow* parent)
|
||||
: QQuickWindow(parent)
|
||||
, mProxy(proxy) {
|
||||
namespace {
|
||||
QList<std::function<void(QQuickWindow*)>> 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<std::function<void(QQuickWindow*)>> SCENEGRAPH_INIT_CALLBACKS; // NOLINT
|
||||
}
|
||||
|
||||
void ProxiedWindow::callOnScenegraphInit(std::function<void(QQuickWindow*)> 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<void(QQuickWindow*)> cb) { // NOLINT
|
||||
SCENEGRAPH_INIT_CALLBACKS.emplaceBack(cb);
|
||||
}
|
||||
|
||||
bool ProxiedWindow::event(QEvent* event) {
|
||||
if (event->type() == QEvent::DevicePixelRatioChange) {
|
||||
emit this->devicePixelRatioChanged();
|
||||
|
||||
@@ -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<void(QQuickWindow*)> 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<void(QQuickWindow*)> cb);
|
||||
|
||||
signals:
|
||||
void exposed();
|
||||
void devicePixelRatioChanged();
|
||||
|
||||
private slots:
|
||||
void onSceneGraphInitialized();
|
||||
|
||||
protected:
|
||||
bool event(QEvent* event) override;
|
||||
void exposeEvent(QExposeEvent* event) override;
|
||||
|
||||
Reference in new issue
Block a user