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. - Added support for wayland idle timeouts.
- Changes to desktop entries are now tracked in real time. - Changes to desktop entries are now tracked in real time.
## Other Changes
- Added support for Qt 6.10
## Bug Fixes ## Bug Fixes
- Fixed volumes getting stuck on change for pipewire devices with few volume steps. - Fixed volumes getting stuck on change for pipewire devices with few volume steps.

View file

@ -10,10 +10,11 @@
QtWaylandClient::QWaylandShellSurface* QtWaylandClient::QWaylandShellSurface*
QSWaylandSessionLockIntegration::createShellSurface(QtWaylandClient::QWaylandWindow* window) { QSWaylandSessionLockIntegration::createShellSurface(QtWaylandClient::QWaylandWindow* window) {
auto* lock = LockWindowExtension::get(window->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 " qFatal() << "Visibility canary failed. A window with a LockWindowExtension MUST be set to "
"visible via LockWindowExtension::setVisible"; "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); 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) { void QSWaylandSessionLockSurface::setExtension(LockWindowExtension* ext) {
if (ext == nullptr) { if (ext == nullptr) {
if (this->window() != nullptr) this->window()->window()->close(); 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( void QSWaylandSessionLockSurface::ext_session_lock_surface_v1_configure(
quint32 serial, quint32 serial,
quint32 width, quint32 width,
@ -97,13 +82,41 @@ void QSWaylandSessionLockSurface::ext_session_lock_surface_v1_configure(
#else #else
this->window()->updateExposure(); this->window()->updateExposure();
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK(6, 10, 0)
if (this->visible) this->initVisible(); if (this->visible) this->initVisible();
#endif
} else { } else {
// applyConfigureWhenPossible runs too late and causes a protocol error on reconfigure. // applyConfigureWhenPossible runs too late and causes a protocol error on reconfigure.
this->window()->resizeFromApplyConfigure(this->size); 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) #if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
#include <private/qwaylandshmbackingstore_p.h> #include <private/qwaylandshmbackingstore_p.h>
@ -123,7 +136,7 @@ void QSWaylandSessionLockSurface::initVisible() {
this->window()->window()->setVisible(true); this->window()->window()->setVisible(true);
} }
#else #elif QT_VERSION < QT_VERSION_CHECK(6, 10, 0)
#include <cmath> #include <cmath>

View file

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