Store xdg-decoration support with std::optional
This commit is contained in:
parent
627abc6728
commit
cf906f14bd
1 changed files with 5 additions and 8 deletions
|
|
@ -27,8 +27,7 @@ namespace Ui {
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
|
|
||||||
struct WaylandIntegration::Private : public AutoDestroyer<QtWayland::wl_registry> {
|
struct WaylandIntegration::Private : public AutoDestroyer<QtWayland::wl_registry> {
|
||||||
bool xdgDecorationSupported = false;
|
std::optional<uint32_t> xdgDecoration;
|
||||||
uint32_t xdgDecorationName = 0;
|
|
||||||
rpl::lifetime lifetime;
|
rpl::lifetime lifetime;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -37,15 +36,13 @@ protected:
|
||||||
const QString &interface,
|
const QString &interface,
|
||||||
uint32_t version) override {
|
uint32_t version) override {
|
||||||
if (interface == qstr("zxdg_decoration_manager_v1")) {
|
if (interface == qstr("zxdg_decoration_manager_v1")) {
|
||||||
xdgDecorationSupported = true;
|
xdgDecoration = name;
|
||||||
xdgDecorationName = name;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void registry_global_remove(uint32_t name) override {
|
void registry_global_remove(uint32_t name) override {
|
||||||
if (name == xdgDecorationName) {
|
if (xdgDecoration && name == *xdgDecoration) {
|
||||||
xdgDecorationSupported = false;
|
xdgDecoration = std::nullopt;
|
||||||
xdgDecorationName = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -82,7 +79,7 @@ WaylandIntegration *WaylandIntegration::Instance() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WaylandIntegration::xdgDecorationSupported() {
|
bool WaylandIntegration::xdgDecorationSupported() {
|
||||||
return _private->xdgDecorationSupported;
|
return _private->xdgDecoration.has_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WaylandIntegration::windowExtentsSupported() {
|
bool WaylandIntegration::windowExtentsSupported() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue