mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Add UnsetWindowExtents method
This commit is contained in:
@@ -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()) {
|
||||
|
Reference in New Issue
Block a user