forked from github_mirror/framelesshelper
add more comments
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
6a46844853
commit
55fe04000e
|
@ -99,5 +99,7 @@ void Dialog::setupUi()
|
|||
helper->setSystemButton(titleBar->minimizeButton(), SystemButtonType::Minimize);
|
||||
helper->setSystemButton(titleBar->maximizeButton(), SystemButtonType::Maximize);
|
||||
helper->setSystemButton(titleBar->closeButton(), SystemButtonType::Close);
|
||||
// Special hack to disable the overriding of the mouse cursor, it's totally different
|
||||
// with making the window un-resizable, so we don't use setFixedSize() here.
|
||||
FramelessWidgetsHelperPrivate::get(helper)->setProperty(FRAMELESSHELPER_BYTEARRAY_LITERAL("FRAMELESSHELPER_DONT_OVERRIDE_CURSOR"), true);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
const int exec = QCoreApplication::exec();
|
||||
|
||||
// Not necessary, but if you don't call it, there will be some small memory leaks.
|
||||
FramelessHelper::Widgets::uninitialize();
|
||||
|
||||
return exec;
|
||||
|
|
|
@ -52,6 +52,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
const int exec = QCoreApplication::exec();
|
||||
|
||||
// Not necessary, but if you don't call it, there will be some small memory leaks.
|
||||
FramelessHelper::Widgets::uninitialize();
|
||||
|
||||
return exec;
|
||||
|
|
|
@ -104,6 +104,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
const int exec = QCoreApplication::exec();
|
||||
|
||||
// Not necessary, but if you don't call it, there will be some small memory leaks.
|
||||
FramelessHelper::Widgets::uninitialize();
|
||||
|
||||
return exec;
|
||||
|
|
|
@ -52,6 +52,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
const int exec = QCoreApplication::exec();
|
||||
|
||||
// Not necessary, but if you don't call it, there will be some small memory leaks.
|
||||
FramelessHelper::Widgets::uninitialize();
|
||||
|
||||
return exec;
|
||||
|
|
|
@ -69,6 +69,8 @@ Q_SIGNALS:
|
|||
|
||||
private:
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
|
||||
// Due to a Qt bug, we can't initialize the QPointer objects with nullptr.
|
||||
// The bug was fixed in Qt 5.15.
|
||||
QPointer<QWidget> m_targetWidget;
|
||||
QPointer<QScreen> m_screen;
|
||||
#else
|
||||
|
|
|
@ -46,7 +46,8 @@ Q_LOGGING_CATEGORY(lcFramelessHelperWin, "wangwenx190.framelesshelper.core.impl.
|
|||
|
||||
using namespace Global;
|
||||
|
||||
static constexpr const wchar_t kFallbackTitleBarWindowClassName[] = L"org.wangwenx190.FramelessHelper.FallbackTitleBarWindow\0";
|
||||
[[maybe_unused]] static constexpr const wchar_t kFallbackTitleBarWindowClassName[] =
|
||||
L"org.wangwenx190.FramelessHelper.FallbackTitleBarWindow\0";
|
||||
FRAMELESSHELPER_BYTEARRAY_CONSTANT2(Win32MessageTypeName, "windows_generic_MSG")
|
||||
FRAMELESSHELPER_STRING_CONSTANT(MonitorFromWindow)
|
||||
FRAMELESSHELPER_STRING_CONSTANT(GetMonitorInfoW)
|
||||
|
@ -74,6 +75,12 @@ FRAMELESSHELPER_STRING_CONSTANT(FindWindowW)
|
|||
FRAMELESSHELPER_STRING_CONSTANT(UnregisterClassW)
|
||||
FRAMELESSHELPER_BYTEARRAY_CONSTANT2(DontOverrideCursor, "FRAMELESSHELPER_DONT_OVERRIDE_CURSOR")
|
||||
FRAMELESSHELPER_STRING_CONSTANT(DestroyWindow)
|
||||
[[maybe_unused]] static constexpr const char kFallbackTitleBarErrorMessage[] =
|
||||
"FramelessHelper is unable to create the fallback title bar window, and thus the snap layout feature will be disabled"
|
||||
" unconditionally. You can ignore this error and continue running your application, nothing else will be affected, "
|
||||
"no need to worry. But if you really need the snap layout feature, please add a manifest file to your application and "
|
||||
"explicitly declare Windows 11 compatibility in it. If you just want to hide this error message, please use the "
|
||||
"FramelessConfig class to officially disable the snap layout feature for Windows 11.";
|
||||
|
||||
struct Win32HelperData
|
||||
{
|
||||
|
@ -451,14 +458,10 @@ Q_GLOBAL_STATIC(Win32Helper, g_win32Helper)
|
|||
const HWND fallbackTitleBarWindowHandle = CreateWindowExW((WS_EX_LAYERED | WS_EX_NOREDIRECTIONBITMAP),
|
||||
kFallbackTitleBarWindowClassName, nullptr, WS_CHILD, 0, 0, 0, 0,
|
||||
parentWindowHandle, nullptr, instance, nullptr);
|
||||
Q_ASSERT_X(fallbackTitleBarWindowHandle, "createFallbackTitleBarWindow()",
|
||||
"FramelessHelper is unable to create the fallback title bar window, and thus the snap layout feature will be disabled. "
|
||||
"You can ignore this error and continue running your application, nothing else will be affected, so no need to worry. "
|
||||
"But if you need the snap layout feature, please add a manifest file to your application and explicitly declare Windows"
|
||||
" 11 compatibility in it. If you want to hide this error dialog, please use the FramelessConfig class to disable the "
|
||||
" snap layout feature for Windows 11.");
|
||||
Q_ASSERT_X(fallbackTitleBarWindowHandle, "createFallbackTitleBarWindow()", kFallbackTitleBarErrorMessage);
|
||||
if (!fallbackTitleBarWindowHandle) {
|
||||
WARNING << Utils::getSystemErrorMessage(kCreateWindowExW);
|
||||
WARNING << kFallbackTitleBarErrorMessage;
|
||||
return false;
|
||||
}
|
||||
// Layered windows won't become visible unless we call the SetLayeredWindowAttributes()
|
||||
|
|
Loading…
Reference in New Issue