Cache QWindow native interface check in WindowMarginsSupported()

It couldn't be changed at runtime anyway
This commit is contained in:
Ilya Fedin 2023-11-16 00:29:58 +04:00 committed by John Preston
parent 164877a0dc
commit e0c2500127

View file

@ -533,10 +533,14 @@ std::optional<bool> IsOverlapped(
bool WindowMarginsSupported() { bool WindowMarginsSupported() {
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
using namespace QNativeInterface::Private; static const auto WaylandResult = [] {
QWindow window; using namespace QNativeInterface::Private;
window.create(); QWindow window;
if (window.nativeInterface<QWaylandWindow>()) { window.create();
return bool(window.nativeInterface<QWaylandWindow>());
}();
if (WaylandResult) {
return true; return true;
} }
#endif // Qt >= 6.5.0 #endif // Qt >= 6.5.0