| | |
| | | // Copyright (C) 2023-2024 Stdware Collections |
| | | // SPDX-License-Identifier: Apache-2.0 |
| | | |
| | | #include "win32windowcontext_p.h" |
| | | |
| | | #include <optional> |
| | |
| | | } |
| | | |
| | | QVariant Win32WindowContext::windowAttribute(const QString &key) const { |
| | | if (key == QStringLiteral("title-bar-rect")) { |
| | | if (key == QStringLiteral("window-rect")) { |
| | | if (!m_windowHandle) |
| | | return {}; |
| | | |
| | |
| | | } else { |
| | | ::AdjustWindowRectEx(&frame, style, FALSE, exStyle); |
| | | } |
| | | frame.left = std::abs(frame.left); |
| | | frame.top = std::abs(frame.top); |
| | | frame.right = std::abs(frame.right); |
| | | frame.bottom = std::abs(frame.bottom); |
| | | return QVariant::fromValue(rect2qrect(frame)); |
| | | } |
| | | |
| | |
| | | static auto margins = QVariant::fromValue(QMargins(1, 1, 1, 1)); |
| | | |
| | | // If we remove the system border, the window will lose its shadow. If dwm is enabled, |
| | | // then you need to set at least 1px margins, otherwise the following operation will |
| | | // then we need to set at least 1px margins, otherwise the following operation will |
| | | // fail with no effect. |
| | | setWindowAttribute(QStringLiteral("extra-margins"), margins); |
| | | } |
| | | |
| | | // We should disable WS_SYSMENU, otherwise the system button icons will be visible if mica |
| | | // is enabled and the title bar is transparent |
| | | // is enabled and the title bar is transparent. |
| | | { |
| | | auto style = ::GetWindowLongPtrW(hWnd, GWL_STYLE); |
| | | if (isSystemBorderEnabled()) { |