win32: fix crash caused by "isWindowFixedSize()"

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2022-05-16 10:09:23 +08:00
parent 45be647baf
commit ff1605ee7b
1 changed files with 2 additions and 0 deletions

View File

@ -109,6 +109,7 @@ FRAMELESSHELPER_STRING_CONSTANT(FindWindowW)
// Hit-testing event should not be considered as a mouse event. // Hit-testing event should not be considered as a mouse event.
const bool isMouseEvent = (((uMsg >= WM_MOUSEFIRST) && (uMsg <= WM_MOUSELAST)) || const bool isMouseEvent = (((uMsg >= WM_MOUSEFIRST) && (uMsg <= WM_MOUSELAST)) ||
((uMsg >= WM_NCMOUSEMOVE) && (uMsg <= WM_NCXBUTTONDBLCLK))); ((uMsg >= WM_NCMOUSEMOVE) && (uMsg <= WM_NCXBUTTONDBLCLK)));
#if 0 // Need extra safe guard, otherwise will crash, but since it's not used, just comment them out.
// We only use this fallback title bar window to activate the snap layouts feature, if the parent // We only use this fallback title bar window to activate the snap layouts feature, if the parent
// window is not resizable, the snap layouts feature should also be disabled at the same time, // window is not resizable, the snap layouts feature should also be disabled at the same time,
// hence forward everything to the parent window, we don't need to handle anything here. // hence forward everything to the parent window, we don't need to handle anything here.
@ -128,6 +129,7 @@ FRAMELESSHELPER_STRING_CONSTANT(FindWindowW)
// For all other events just use the default handling. // For all other events just use the default handling.
return DefWindowProcW(hWnd, uMsg, wParam, lParam); return DefWindowProcW(hWnd, uMsg, wParam, lParam);
} }
#endif
const auto releaseButtons = [&data](const std::optional<SystemButtonType> exclude) -> void { const auto releaseButtons = [&data](const std::optional<SystemButtonType> exclude) -> void {
static constexpr const auto defaultButtonState = ButtonState::Unspecified; static constexpr const auto defaultButtonState = ButtonState::Unspecified;
if (!exclude.has_value() || (exclude.value() != SystemButtonType::WindowIcon)) { if (!exclude.has_value() || (exclude.value() != SystemButtonType::WindowIcon)) {