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() {
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
static const auto WaylandResult = [] {
using namespace QNativeInterface::Private;
QWindow window;
window.create();
if (window.nativeInterface<QWaylandWindow>()) {
return bool(window.nativeInterface<QWaylandWindow>());
}();
if (WaylandResult) {
return true;
}
#endif // Qt >= 6.5.0