Skip to content

Commit

Permalink
Always use the dark window borders (#6624)
Browse files Browse the repository at this point in the history
  • Loading branch information
beviu authored Jun 22, 2020
1 parent 951f389 commit 26d6a37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
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;
};

0 comments on commit 26d6a37

Please sign in to comment.