2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add UnsetWindowExtents method

This commit is contained in:
Ilya Fedin
2020-08-29 01:00:09 +04:00
committed by John Preston
parent 3c8c059447
commit c77f1bf082
4 changed files with 60 additions and 5 deletions

View File

@@ -720,6 +720,35 @@ bool SetXCBFrameExtents(QWindow *window, const QMargins &extents) {
return true;
}
bool UnsetXCBFrameExtents(QWindow *window) {
const auto native = QGuiApplication::platformNativeInterface();
if (!native) {
return false;
}
const auto connection = reinterpret_cast<xcb_connection_t*>(
native->nativeResourceForIntegration(QByteArray("connection")));
if (!connection) {
return false;
}
const auto frameExtentsAtom = GetXCBAtom(
connection,
kXCBFrameExtentsAtomName.utf16());
if (!frameExtentsAtom.has_value()) {
return false;
}
xcb_delete_property(
connection,
window->winId(),
*frameExtentsAtom);
return true;
}
bool SetWaylandWindowGeometry(QWindow *window, const QRect &geometry) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) || defined DESKTOP_APP_QT_PATCHED
if (const auto waylandWindow = static_cast<QWaylandWindow*>(
@@ -1091,6 +1120,15 @@ bool SetWindowExtents(QWindow *window, const QMargins &extents) {
}
}
bool UnsetWindowExtents(QWindow *window) {
if (IsWayland()) {
const auto geometry = QRect(QPoint(), window->size());
return SetWaylandWindowGeometry(window, geometry);
} else {
return UnsetXCBFrameExtents(window);
}
}
bool WindowsNeedShadow() {
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) || defined DESKTOP_APP_QT_PATCHED
if (IsWayland()) {