Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always use the dark window borders #6624

Merged
merged 1 commit into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 5 additions & 30 deletions src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,39 +788,15 @@ void NonClientIslandWindow::_UpdateFrameMargins() const noexcept
return ret;
}

// Set the frame's theme before it is rendered (WM_NCPAINT) so that it is
// rendered with the correct theme.
_UpdateFrameTheme();
// This is a hack to make the window borders dark instead of light.
// It must be done before WM_NCPAINT so that the borders are rendered with
// the correct theme.
// For more information, see GH#6620.
LOG_IF_FAILED(TerminalTrySetDarkTheme(_window.get(), true));

return TRUE;
}

// Method Description:
// - Updates the window frame's theme depending on the application theme (light
// or dark). This doesn't invalidate the old frame so it will not be
// rerendered until the user resizes or focuses/unfocuses the window.
// Return Value:
// - <none>
void NonClientIslandWindow::_UpdateFrameTheme() const
{
bool isDarkMode;

switch (_theme)
{
case ElementTheme::Light:
isDarkMode = false;
break;
case ElementTheme::Dark:
isDarkMode = true;
break;
default:
isDarkMode = Application::Current().RequestedTheme() == ApplicationTheme::Dark;
break;
}

LOG_IF_FAILED(TerminalTrySetDarkTheme(_window.get(), isDarkMode));
}

// Method Description:
// - Called when the app wants to change its theme. We'll update the frame
// theme to match the new theme.
Expand All @@ -833,7 +809,6 @@ void NonClientIslandWindow::OnApplicationThemeChanged(const ElementTheme& reques
IslandWindow::OnApplicationThemeChanged(requestedTheme);

_theme = requestedTheme;
_UpdateFrameTheme();
}

// Method Description:
Expand Down
1 change: 0 additions & 1 deletion src/cascadia/WindowsTerminal/NonClientIslandWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class NonClientIslandWindow : public IslandWindow
void _UpdateFrameMargins() const noexcept;
void _UpdateMaximizedState();
void _UpdateIslandPosition(const UINT windowWidth, const UINT windowHeight);
void _UpdateFrameTheme() const;

void _OpenSystemMenu(const int mouseX, const int mouseY) const noexcept;
};