Make launcher window use dark mode

Co-Authored-By: Vlad Loktionov <13555921+VladWinner@users.noreply.github.com>
This commit is contained in:
fed 2023-04-04 11:48:30 +02:00
parent 37b40a0ab1
commit 3ee314f361
3 changed files with 17 additions and 1 deletions

View File

@ -288,6 +288,13 @@ namespace console
update();
break;
}
case VK_ESCAPE:
{
con.cursor = 0;
clear_output();
strncpy_s(con.buffer, "", sizeof(con.buffer));
break;
}
default:
{
const auto c = record.Event.KeyEvent.uChar.AsciiChar;
@ -356,7 +363,7 @@ namespace console
con.thread = utils::thread::create_named_thread("Console", []()
{
const auto handle = GetStdHandle(STD_INPUT_HANDLE);
HANDLE handles[2] = { handle, con.kill_event };
HANDLE handles[2] = {handle, con.kill_event};
MSG msg{};
INPUT_RECORD record{};

View File

@ -3,6 +3,10 @@
#include <utils/nt.hpp>
#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
#endif
std::mutex window::mutex_;
std::vector<window*> window::windows_;
@ -37,6 +41,10 @@ void window::create(const std::string& title, const int width, const int height,
this->handle_ = CreateWindowExA(NULL, this->wc_.lpszClassName, title.data(), flags, x, y, width, height, nullptr,
nullptr, this->wc_.hInstance, this);
BOOL value = TRUE;
DwmSetWindowAttribute(this->handle_,
DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(value));
SendMessageA(this->handle_, WM_DPICHANGED, 0, 0);
}

View File

@ -50,6 +50,7 @@
#include <atlbase.h>
#include <iphlpapi.h>
#include <wincrypt.h>
#include <dwmapi.h>
// min and max is required by gdi, therefore NOMINMAX won't work
#ifdef max