terminal/src/types/ThemeUtils.cpp
greg904 5dfc021d8e Use standard 1px window borders on NC Island Window (#3394)
We take the standard window frame except that we remove the top part
(see `NonClientIslandWindow::_OnNcCalcSize`), then we put little 1 pixel
wide top border back in the client area using
`DwmExtendFrameIntoClientArea` and then we put the XAML island and the
drag bar on top.

Most of this PR is comments to explain how the code works and also
removing complex code that was needed to handle the weird cases when the
borders were custom.

I've also refactored a little bit the `NonClientIslandWindow` class.

* Fix DwmExtendFrameIntoClientArea values
* Fix WM_NCHITTEST handling
* Position the XAML island window correctly
* Fix weird colors in drag bar and hide old title bar buttons
* Fix the window's position when maximized
* Add support for dark theme on the frame
* DRY shared code between conhost and new terminal
* Fix drag bar and remove dead code
* Remove dead code and use cached DPI
* Refactor code
* Remove impossible TODO
* Use system metrics instead of hardcoding resize border height
* Use theme from app settings instead of system theme. Improve comments. Remove unused DWM frame on maximize.
* Fix initial position DPI handling bug and apply review changes
* Fix thick borders with DPI > 96

Closes #3064.
Closes #1307.
Closes #3136.
Closes #1897.
Closes #3222.
Closes #1859.
2019-11-04 15:45:40 -08:00

20 lines
687 B
C++

#include "precomp.h"
#include "inc/ThemeUtils.h"
namespace Microsoft::Console::ThemeUtils
{
// Routine Description:
// - Attempts to enable/disable the dark mode on the frame of a window.
// Arguments:
// - hwnd: handle to the window to change
// - enabled: whether to enable or not the dark mode on the window's frame
// Return Value:
// - S_OK or suitable HRESULT from DWM engines.
[[nodiscard]] HRESULT SetWindowFrameDarkMode(HWND /* hwnd */, bool /* enabled */) noexcept
{
// TODO:GH #3425 implement the new DWM API and change
// src/interactivity/win32/windowtheme.cpp to use it.
return S_OK;
}
}