wayland/lock: support Qt 6.10

This commit is contained in:
outfoxxed 2025-10-04 12:36:28 -07:00
parent 9662234759
commit 3bcc1993f4
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
4 changed files with 45 additions and 20 deletions

View file

@ -4,6 +4,9 @@
- Added support for wayland idle timeouts.
- Changes to desktop entries are now tracked in real time.
## Other Changes
- Added support for Qt 6.10
## Bug Fixes
- Fixed volumes getting stuck on change for pipewire devices with few volume steps.

View file

@ -10,10 +10,11 @@
QtWaylandClient::QWaylandShellSurface*
QSWaylandSessionLockIntegration::createShellSurface(QtWaylandClient::QWaylandWindow* window) {
auto* lock = LockWindowExtension::get(window->window());
if (lock == nullptr || lock->surface == nullptr || !lock->surface->isExposed()) {
if (lock == nullptr || lock->surface == nullptr) {
qFatal() << "Visibility canary failed. A window with a LockWindowExtension MUST be set to "
"visible via LockWindowExtension::setVisible";
}
return lock->surface;
QSWaylandSessionLockSurface* surface = lock->surface; // shut up the unused include linter
return surface;
}

View file

@ -48,16 +48,6 @@ void QSWaylandSessionLockSurface::applyConfigure() {
this->window()->resizeFromApplyConfigure(this->size);
}
bool QSWaylandSessionLockSurface::handleExpose(const QRegion& region) {
if (this->initBuf != nullptr) {
// at this point qt's next commit to the surface will have a new buffer, and we can safely delete this one.
delete this->initBuf;
this->initBuf = nullptr;
}
return this->QtWaylandClient::QWaylandShellSurface::handleExpose(region);
}
void QSWaylandSessionLockSurface::setExtension(LockWindowExtension* ext) {
if (ext == nullptr) {
if (this->window() != nullptr) this->window()->window()->close();
@ -71,11 +61,6 @@ void QSWaylandSessionLockSurface::setExtension(LockWindowExtension* ext) {
}
}
void QSWaylandSessionLockSurface::setVisible() {
if (this->configured && !this->visible) this->initVisible();
this->visible = true;
}
void QSWaylandSessionLockSurface::ext_session_lock_surface_v1_configure(
quint32 serial,
quint32 width,
@ -97,13 +82,41 @@ void QSWaylandSessionLockSurface::ext_session_lock_surface_v1_configure(
#else
this->window()->updateExposure();
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 10, 0)
if (this->visible) this->initVisible();
#endif
} else {
// applyConfigureWhenPossible runs too late and causes a protocol error on reconfigure.
this->window()->resizeFromApplyConfigure(this->size);
}
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
bool QSWaylandSessionLockSurface::commitSurfaceRole() const { return false; }
void QSWaylandSessionLockSurface::setVisible() { this->window()->window()->setVisible(true); }
#else
bool QSWaylandSessionLockSurface::handleExpose(const QRegion& region) {
if (this->initBuf != nullptr) {
// at this point qt's next commit to the surface will have a new buffer, and we can safely delete this one.
delete this->initBuf;
this->initBuf = nullptr;
}
return this->QtWaylandClient::QWaylandShellSurface::handleExpose(region);
}
void QSWaylandSessionLockSurface::setVisible() {
if (this->configured && !this->visible) this->initVisible();
this->visible = true;
}
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
#include <private/qwaylandshmbackingstore_p.h>
@ -123,7 +136,7 @@ void QSWaylandSessionLockSurface::initVisible() {
this->window()->window()->setVisible(true);
}
#else
#elif QT_VERSION < QT_VERSION_CHECK(6, 10, 0)
#include <cmath>

View file

@ -5,6 +5,7 @@
#include <private/qwaylandwindow_p.h>
#include <qregion.h>
#include <qtclasshelpermacros.h>
#include <qtversionchecks.h>
#include <qtypes.h>
#include <qwayland-ext-session-lock-v1.h>
@ -20,7 +21,12 @@ public:
[[nodiscard]] bool isExposed() const override;
void applyConfigure() override;
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
[[nodiscard]] bool commitSurfaceRole() const override;
#else
bool handleExpose(const QRegion& region) override;
#endif
void setExtension(LockWindowExtension* ext);
void setVisible();
@ -29,11 +35,13 @@ private:
void
ext_session_lock_surface_v1_configure(quint32 serial, quint32 width, quint32 height) override;
#if QT_VERSION < QT_VERSION_CHECK(6, 10, 0)
void initVisible();
bool visible = false;
QtWaylandClient::QWaylandShmBuffer* initBuf = nullptr;
#endif
LockWindowExtension* ext = nullptr;
QSize size;
bool configured = false;
bool visible = false;
QtWaylandClient::QWaylandShmBuffer* initBuf = nullptr;
};