Skip to content

Commit

Permalink
fix: 修正显示窗口时最大化按钮的状态
Browse files Browse the repository at this point in the history
  • Loading branch information
Blinue committed Dec 29, 2024
1 parent 33e17a2 commit 303b90a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Magpie/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ LRESULT MainWindow::_MessageHandler(UINT msg, WPARAM wParam, LPARAM lParam) noex
{
LRESULT ret = base_type::_MessageHandler(WM_SIZE, wParam, lParam);
_ResizeTitleBarWindow();
Content()->TitleBar().CaptionButtons().IsWindowMaximized(_IsMaximized());

// 以最大化显示时实际上是先窗口化显示然后改为最大化,确保最大化按钮状态正确
Content()->TitleBar().CaptionButtons().IsWindowMaximized(
_IsMaximized() || _IsInitialMaximized());
return ret;
}
case WM_GETMINMAXINFO:
Expand Down
4 changes: 4 additions & 0 deletions src/Magpie/XamlWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ class XamlWindowT : public WindowBaseT<T> {
_isInitialMaximized = value;
}

bool _IsInitialMaximized() const noexcept {
return _isInitialMaximized;
}

private:
void _UpdateIslandPosition(int width, int height) const noexcept {
// 当窗口以最大化显示时,为了修正动画,实际上是先窗口化显示然后改为最大化。这个过程中此函数
Expand Down

0 comments on commit 303b90a

Please sign in to comment.