--- /dev/null
+// This file contains code from
+// https://github.com/stevemk14ebr/PolyHook_2_0/blob/master/sources/IatHook.cpp
+// which is licensed under the MIT License.
+// See PolyHook_2_0-LICENSE for more information.
+
+#pragma once
+
+template <typename T, typename T1, typename T2>
+constexpr T RVA2VA(T1 base, T2 rva)
+{
+ return reinterpret_cast<T>(reinterpret_cast<ULONG_PTR>(base) + rva);
+}
+
+template <typename T>
+constexpr T DataDirectoryFromModuleBase(void *moduleBase, size_t entryID)
+{
+ auto dosHdr = reinterpret_cast<PIMAGE_DOS_HEADER>(moduleBase);
+ auto ntHdr = RVA2VA<PIMAGE_NT_HEADERS>(moduleBase, dosHdr->e_lfanew);
+ auto dataDir = ntHdr->OptionalHeader.DataDirectory;
+ return RVA2VA<T>(moduleBase, dataDir[entryID].VirtualAddress);
+}
+
+PIMAGE_THUNK_DATA FindAddressByName(void *moduleBase, PIMAGE_THUNK_DATA impName, PIMAGE_THUNK_DATA impAddr, const char *funcName)
+{
+ for (; impName->u1.Ordinal; ++impName, ++impAddr)
+ {
+ if (IMAGE_SNAP_BY_ORDINAL(impName->u1.Ordinal))
+ continue;
+
+ auto import = RVA2VA<PIMAGE_IMPORT_BY_NAME>(moduleBase, impName->u1.AddressOfData);
+ if (strcmp(import->Name, funcName) != 0)
+ continue;
+ return impAddr;
+ }
+ return nullptr;
+}
+
+PIMAGE_THUNK_DATA FindAddressByOrdinal(void *moduleBase, PIMAGE_THUNK_DATA impName, PIMAGE_THUNK_DATA impAddr, uint16_t ordinal)
+{
+ for (; impName->u1.Ordinal; ++impName, ++impAddr)
+ {
+ if (IMAGE_SNAP_BY_ORDINAL(impName->u1.Ordinal) && IMAGE_ORDINAL(impName->u1.Ordinal) == ordinal)
+ return impAddr;
+ }
+ return nullptr;
+}
+
+PIMAGE_THUNK_DATA FindIatThunkInModule(void *moduleBase, const char *dllName, const char *funcName)
+{
+ auto imports = DataDirectoryFromModuleBase<PIMAGE_IMPORT_DESCRIPTOR>(moduleBase, IMAGE_DIRECTORY_ENTRY_IMPORT);
+ for (; imports->Name; ++imports)
+ {
+ if (_stricmp(RVA2VA<LPCSTR>(moduleBase, imports->Name), dllName) != 0)
+ continue;
+
+ auto origThunk = RVA2VA<PIMAGE_THUNK_DATA>(moduleBase, imports->OriginalFirstThunk);
+ auto thunk = RVA2VA<PIMAGE_THUNK_DATA>(moduleBase, imports->FirstThunk);
+ return FindAddressByName(moduleBase, origThunk, thunk, funcName);
+ }
+ return nullptr;
+}
+
+PIMAGE_THUNK_DATA FindDelayLoadThunkInModule(void *moduleBase, const char *dllName, const char *funcName)
+{
+ auto imports = DataDirectoryFromModuleBase<PIMAGE_DELAYLOAD_DESCRIPTOR>(moduleBase, IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT);
+ for (; imports->DllNameRVA; ++imports)
+ {
+ if (_stricmp(RVA2VA<LPCSTR>(moduleBase, imports->DllNameRVA), dllName) != 0)
+ continue;
+
+ auto impName = RVA2VA<PIMAGE_THUNK_DATA>(moduleBase, imports->ImportNameTableRVA);
+ auto impAddr = RVA2VA<PIMAGE_THUNK_DATA>(moduleBase, imports->ImportAddressTableRVA);
+ return FindAddressByName(moduleBase, impName, impAddr, funcName);
+ }
+ return nullptr;
+}
+
+PIMAGE_THUNK_DATA FindDelayLoadThunkInModule(void *moduleBase, const char *dllName, uint16_t ordinal)
+{
+ auto imports = DataDirectoryFromModuleBase<PIMAGE_DELAYLOAD_DESCRIPTOR>(moduleBase, IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT);
+ for (; imports->DllNameRVA; ++imports)
+ {
+ if (_stricmp(RVA2VA<LPCSTR>(moduleBase, imports->DllNameRVA), dllName) != 0)
+ continue;
+
+ auto impName = RVA2VA<PIMAGE_THUNK_DATA>(moduleBase, imports->ImportNameTableRVA);
+ auto impAddr = RVA2VA<PIMAGE_THUNK_DATA>(moduleBase, imports->ImportAddressTableRVA);
+ return FindAddressByOrdinal(moduleBase, impName, impAddr, ordinal);
+ }
+ return nullptr;
+}
--- /dev/null
+
+#include <climits>
+#include <cstdint>
+
+#define WIN32_LEAN_AND_MEAN
+#define NOMINMAX
+#include <Windows.h>
+#include <CommCtrl.h>
+#include <Uxtheme.h>
+#include <WindowsX.h>
+#include <Vssym32.h>
+
+#pragma comment(lib, "Comctl32.lib")
+#pragma comment(lib, "Uxtheme.lib")
+
+#include "resource.h"
+
+#include "darkmode.h"
+
+#include "IatHook.h"
+
+extern void write_log(const char *, ...);
+
+bool g_darkModeSupported = false;
+bool g_darkModeEnabled = false;
+int darkModeForced = 0;
+DWORD g_buildNumber = 0;
+
+fnSetWindowCompositionAttribute _SetWindowCompositionAttribute = nullptr;
+fnShouldAppsUseDarkMode _ShouldAppsUseDarkMode = nullptr;
+fnAllowDarkModeForWindow _AllowDarkModeForWindow = nullptr;
+fnAllowDarkModeForApp _AllowDarkModeForApp = nullptr;
+fnFlushMenuThemes _FlushMenuThemes = nullptr;
+fnRefreshImmersiveColorPolicyState _RefreshImmersiveColorPolicyState = nullptr;
+fnIsDarkModeAllowedForWindow _IsDarkModeAllowedForWindow = nullptr;
+fnGetIsImmersiveColorUsingHighContrast _GetIsImmersiveColorUsingHighContrast = nullptr;
+fnOpenNcThemeData _OpenNcThemeData = nullptr;
+// 1903 18362
+fnShouldSystemUseDarkMode _ShouldSystemUseDarkMode = nullptr;
+fnSetPreferredAppMode _SetPreferredAppMode = nullptr;
+
+COLORREF dark_text_color, dark_bg_color;
+
+bool AllowDarkModeForWindow(HWND hWnd, bool allow)
+{
+ if (g_darkModeSupported)
+ return _AllowDarkModeForWindow(hWnd, allow);
+ return false;
+}
+
+bool IsHighContrast()
+{
+ HIGHCONTRASTW highContrast = { sizeof(highContrast) };
+ if (SystemParametersInfoW(SPI_GETHIGHCONTRAST, sizeof(highContrast), &highContrast, FALSE))
+ return highContrast.dwFlags & HCF_HIGHCONTRASTON;
+ return false;
+}
+
+void RefreshTitleBarThemeColor(HWND hWnd)
+{
+ BOOL dark = FALSE;
+ if (_IsDarkModeAllowedForWindow(hWnd) &&
+ _ShouldAppsUseDarkMode() &&
+ !IsHighContrast())
+ {
+ dark = TRUE;
+ }
+ if (g_buildNumber < 18362)
+ SetPropW(hWnd, L"UseImmersiveDarkModeColors", reinterpret_cast<HANDLE>(static_cast<INT_PTR>(dark)));
+ else if (_SetWindowCompositionAttribute)
+ {
+ WINDOWCOMPOSITIONATTRIBDATA data = { WCA_USEDARKMODECOLORS, &dark, sizeof(dark) };
+ _SetWindowCompositionAttribute(hWnd, &data);
+ }
+}
+
+bool IsColorSchemeChangeMessage(LPARAM lParam)
+{
+ bool is = false;
+ if (lParam && CompareStringOrdinal(reinterpret_cast<LPCWCH>(lParam), -1, L"ImmersiveColorSet", -1, TRUE) == CSTR_EQUAL)
+ {
+ _RefreshImmersiveColorPolicyState();
+ is = true;
+ }
+ _GetIsImmersiveColorUsingHighContrast(IHCM_REFRESH);
+ return is;
+}
+
+bool IsColorSchemeChangeMessage(UINT message, LPARAM lParam)
+{
+ if (message == WM_SETTINGCHANGE)
+ return IsColorSchemeChangeMessage(lParam);
+ return false;
+}
+
+void AllowDarkModeForApp(PreferredAppMode dark)
+{
+ if (_AllowDarkModeForApp)
+ _AllowDarkModeForApp(dark != PreferredAppMode::Default);
+ else if (_SetPreferredAppMode)
+ _SetPreferredAppMode(dark);
+}
+
+static void FixDarkScrollBar()
+{
+ HMODULE hComctl = LoadLibraryExW(L"comctl32.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
+ if (hComctl)
+ {
+ auto addr = FindDelayLoadThunkInModule(hComctl, "uxtheme.dll", 49); // OpenNcThemeData
+ if (addr)
+ {
+ DWORD oldProtect;
+ if (VirtualProtect(addr, sizeof(IMAGE_THUNK_DATA), PAGE_READWRITE, &oldProtect))
+ {
+ auto MyOpenThemeData = [](HWND hWnd, LPCWSTR classList) -> HTHEME {
+ if (wcscmp(classList, L"ScrollBar") == 0)
+ {
+ hWnd = nullptr;
+ classList = L"Explorer::ScrollBar";
+ }
+ return _OpenNcThemeData(hWnd, classList);
+ };
+
+ addr->u1.Function = reinterpret_cast<ULONG_PTR>(static_cast<fnOpenNcThemeData>(MyOpenThemeData));
+ VirtualProtect(addr, sizeof(IMAGE_THUNK_DATA), oldProtect, &oldProtect);
+ }
+ }
+ }
+}
+
+static void GetDarkmodeFontColor(void)
+{
+
+ HTHEME hTheme = OpenThemeData(nullptr, L"ItemsView");
+ if (hTheme) {
+ COLORREF color;
+ if (SUCCEEDED(GetThemeColor(hTheme, 0, 0, TMT_TEXTCOLOR, &color)))
+ {
+ dark_text_color = color;
+ }
+ if (SUCCEEDED(GetThemeColor(hTheme, 0, 0, TMT_FILLCOLOR, &color)))
+ {
+ dark_bg_color = color;
+ }
+ CloseThemeData(hTheme);
+ }
+
+}
+
+constexpr bool CheckBuildNumber(DWORD buildNumber)
+{
+ return buildNumber <= 22621;
+}
+
+void InitDarkMode(int enable)
+{
+ auto RtlGetNtVersionNumbers = reinterpret_cast<fnRtlGetNtVersionNumbers>(GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "RtlGetNtVersionNumbers"));
+ if (RtlGetNtVersionNumbers)
+ {
+ DWORD major, minor;
+ RtlGetNtVersionNumbers(&major, &minor, &g_buildNumber);
+ g_buildNumber &= ~0xF0000000;
+ if (major == 10 && minor == 0 && CheckBuildNumber(g_buildNumber))
+ {
+ HMODULE hUxtheme = LoadLibraryExW(L"uxtheme.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
+ if (hUxtheme)
+ {
+ _OpenNcThemeData = reinterpret_cast<fnOpenNcThemeData>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(49)));
+ _RefreshImmersiveColorPolicyState = reinterpret_cast<fnRefreshImmersiveColorPolicyState>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(104)));
+ _GetIsImmersiveColorUsingHighContrast = reinterpret_cast<fnGetIsImmersiveColorUsingHighContrast>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(106)));
+ _ShouldAppsUseDarkMode = reinterpret_cast<fnShouldAppsUseDarkMode>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(132)));
+ _AllowDarkModeForWindow = reinterpret_cast<fnAllowDarkModeForWindow>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(133)));
+
+ auto ord135 = GetProcAddress(hUxtheme, MAKEINTRESOURCEA(135));
+ if (g_buildNumber < 18362)
+ _AllowDarkModeForApp = reinterpret_cast<fnAllowDarkModeForApp>(ord135);
+ else
+ _SetPreferredAppMode = reinterpret_cast<fnSetPreferredAppMode>(ord135);
+
+ //_FlushMenuThemes = reinterpret_cast<fnFlushMenuThemes>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(136)));
+ _IsDarkModeAllowedForWindow = reinterpret_cast<fnIsDarkModeAllowedForWindow>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(137)));
+
+ _SetWindowCompositionAttribute = reinterpret_cast<fnSetWindowCompositionAttribute>(GetProcAddress(GetModuleHandleW(L"user32.dll"), "SetWindowCompositionAttribute"));
+
+ if (_OpenNcThemeData &&
+ _RefreshImmersiveColorPolicyState &&
+ _ShouldAppsUseDarkMode &&
+ _AllowDarkModeForWindow &&
+ (_AllowDarkModeForApp || _SetPreferredAppMode) &&
+ _IsDarkModeAllowedForWindow)
+ {
+ g_darkModeSupported = true;
+
+ if (darkModeForced > 0) {
+ AllowDarkModeForApp(PreferredAppMode::ForceDark);
+ } else if (darkModeForced < 0) {
+ AllowDarkModeForApp(PreferredAppMode::ForceLight);
+ } else if (enable == -1 || enable == 1) {
+ AllowDarkModeForApp(PreferredAppMode::AllowDark);
+ } else {
+ AllowDarkModeForApp(PreferredAppMode::Default);
+ }
+ _RefreshImmersiveColorPolicyState();
+
+ g_darkModeEnabled = _ShouldAppsUseDarkMode() && !IsHighContrast();
+
+ if (g_darkModeEnabled && enable < -1) {
+ AllowDarkModeForApp(PreferredAppMode::ForceDark);
+ }
+
+ if (!g_darkModeEnabled && enable > 0 && darkModeForced >= 0) {
+ AllowDarkModeForApp(PreferredAppMode::ForceDark);
+ _RefreshImmersiveColorPolicyState();
+ g_darkModeEnabled = _ShouldAppsUseDarkMode() && !IsHighContrast();
+ }
+
+ if (g_darkModeEnabled) {
+ FixDarkScrollBar();
+ GetDarkmodeFontColor();
+ }
+ }
+ }
+ }
+ }
+
+ if (!enable && g_darkModeSupported) {
+ AllowDarkModeForApp(PreferredAppMode::Default);
+ if (_RefreshImmersiveColorPolicyState != NULL) {
+ _RefreshImmersiveColorPolicyState();
+ }
+ g_darkModeEnabled = false;
+ }
+}
+
+
+struct SubClassData
+{
+ HTHEME hTheme = nullptr;
+ COLORREF headerTextColor;
+ int iStateID = 0;
+
+ ~SubClassData()
+ {
+ CloseTheme();
+ }
+
+ bool EnsureTheme(HWND hwnd, const TCHAR *theme)
+ {
+ if (!hTheme)
+ {
+ hTheme = OpenThemeData(hwnd, theme);
+ }
+ return hTheme != nullptr;
+ }
+
+ void CloseTheme()
+ {
+ if (hTheme)
+ {
+ CloseThemeData(hTheme);
+ hTheme = nullptr;
+ }
+ }
+};
+
+static void RenderButton(HWND hwnd, HDC hdc, HTHEME hTheme, int iPartID, int iStateID)
+{
+ RECT rcClient = { 0 };
+ TCHAR szText[256] = { 0 };
+ DWORD nState = static_cast<DWORD>(SendMessage(hwnd, BM_GETSTATE, 0, 0));
+ DWORD uiState = static_cast<DWORD>(SendMessage(hwnd, WM_QUERYUISTATE, 0, 0));
+ DWORD nStyle = GetWindowLong(hwnd, GWL_STYLE);
+
+ HFONT hFont = nullptr;
+ HFONT hOldFont = nullptr;
+ HFONT hCreatedFont = nullptr;
+ LOGFONT lf = { 0 };
+ if (SUCCEEDED(GetThemeFont(hTheme, hdc, iPartID, iStateID, TMT_FONT, &lf)))
+ {
+ hCreatedFont = CreateFontIndirect(&lf);
+ hFont = hCreatedFont;
+ }
+
+ if (!hFont) {
+ hFont = reinterpret_cast<HFONT>(SendMessage(hwnd, WM_GETFONT, 0, 0));
+ }
+
+ hOldFont = (HFONT)SelectObject(hdc, hFont);
+
+ DWORD dtFlags = DT_LEFT; // DT_LEFT is 0
+ dtFlags |= (nStyle & BS_MULTILINE) ? DT_WORDBREAK : DT_SINGLELINE;
+ dtFlags |= ((nStyle & BS_CENTER) == BS_CENTER) ? DT_CENTER : (nStyle & BS_RIGHT) ? DT_RIGHT : 0;
+ dtFlags |= ((nStyle & BS_VCENTER) == BS_VCENTER) ? DT_VCENTER : (nStyle & BS_BOTTOM) ? DT_BOTTOM : 0;
+ dtFlags |= (uiState & UISF_HIDEACCEL) ? DT_HIDEPREFIX : 0;
+
+ if (!(nStyle & BS_MULTILINE) && !(nStyle & BS_BOTTOM) && !(nStyle & BS_TOP))
+ {
+ dtFlags |= DT_VCENTER;
+ }
+
+ GetClientRect(hwnd, &rcClient);
+ GetWindowText(hwnd, szText, sizeof(szText) / sizeof(TCHAR));
+
+ SIZE szBox = { 13, 13 };
+ GetThemePartSize(hTheme, hdc, iPartID, iStateID, NULL, TS_DRAW, &szBox);
+
+ RECT rcText = rcClient;
+ GetThemeBackgroundContentRect(hTheme, hdc, iPartID, iStateID, &rcClient, &rcText);
+
+ RECT rcBackground = rcClient;
+ if (dtFlags & DT_SINGLELINE)
+ {
+ rcBackground.top += (rcText.bottom - rcText.top - szBox.cy) / 2;
+ }
+ rcBackground.bottom = rcBackground.top + szBox.cy;
+ rcBackground.right = rcBackground.left + szBox.cx;
+ rcText.left = rcBackground.right + 3;
+
+ DrawThemeParentBackground(hwnd, hdc, &rcClient);
+ DrawThemeBackground(hTheme, hdc, iPartID, iStateID, &rcBackground, nullptr);
+
+ DTTOPTS dtto = { sizeof(DTTOPTS), DTT_TEXTCOLOR };
+ dtto.crText = dark_text_color;
+
+ DrawThemeTextEx(hTheme, hdc, iPartID, iStateID, szText, -1, dtFlags, &rcText, &dtto);
+
+ if ((nState & BST_FOCUS) && !(uiState & UISF_HIDEFOCUS))
+ {
+ RECT rcTextOut = rcText;
+ dtto.dwFlags |= DTT_CALCRECT;
+ DrawThemeTextEx(hTheme, hdc, iPartID, iStateID, szText, -1, dtFlags | DT_CALCRECT, &rcTextOut, &dtto);
+ RECT rcFocus = rcTextOut;
+ rcFocus.bottom++;
+ rcFocus.left--;
+ rcFocus.right++;
+ DrawFocusRect(hdc, &rcFocus);
+ }
+
+ if (hCreatedFont) DeleteObject(hCreatedFont);
+ SelectObject(hdc, hOldFont);
+}
+
+static void PaintButton(HWND hwnd, HDC hdc, SubClassData &buttonData)
+{
+ DWORD nState = static_cast<DWORD>(SendMessage(hwnd, BM_GETSTATE, 0, 0));
+ DWORD nStyle = GetWindowLong(hwnd, GWL_STYLE);
+ DWORD nButtonStyle = nStyle & 0xF;
+
+ int iPartID = BP_PUSHBUTTON;
+ if (nButtonStyle == BS_CHECKBOX || nButtonStyle == BS_AUTOCHECKBOX || nButtonStyle == BS_3STATE || nButtonStyle == BS_AUTO3STATE) {
+ iPartID = BP_CHECKBOX;
+ } else if (nButtonStyle == BS_RADIOBUTTON || nButtonStyle == BS_AUTORADIOBUTTON) {
+ iPartID = BP_RADIOBUTTON;
+ } else {
+ return;
+ }
+
+ // states of BP_CHECKBOX and BP_RADIOBUTTON are the same
+ int iStateID = RBS_UNCHECKEDNORMAL;
+
+ if (nStyle & WS_DISABLED)
+ iStateID = RBS_UNCHECKEDDISABLED;
+ else if (nState & BST_PUSHED)
+ iStateID = RBS_UNCHECKEDPRESSED;
+ else if (nState & BST_HOT)
+ iStateID = RBS_UNCHECKEDHOT;
+
+ if (nState & BST_CHECKED)
+ iStateID += 4;
+ else if ((nButtonStyle == BS_3STATE || nButtonStyle == BS_AUTO3STATE) && (nStyle & BST_INDETERMINATE))
+ iStateID += 8;
+
+ if (BufferedPaintRenderAnimation(hwnd, hdc)) {
+ return;
+ }
+
+ BP_ANIMATIONPARAMS animParams = { sizeof(animParams) };
+ animParams.style = BPAS_LINEAR;
+ if (iStateID != buttonData.iStateID) {
+ GetThemeTransitionDuration(buttonData.hTheme, iPartID, buttonData.iStateID, iStateID, TMT_TRANSITIONDURATIONS, &animParams.dwDuration);
+ }
+
+ RECT rcClient = { 0 };
+ GetClientRect(hwnd, &rcClient);
+
+ HDC hdcFrom = nullptr;
+ HDC hdcTo = nullptr;
+ HANIMATIONBUFFER hbpAnimation = BeginBufferedAnimation(hwnd, hdc, &rcClient, BPBF_COMPATIBLEBITMAP, nullptr, &animParams, &hdcFrom, &hdcTo);
+ if (hbpAnimation) {
+ if (hdcFrom) {
+ RenderButton(hwnd, hdcFrom, buttonData.hTheme, iPartID, buttonData.iStateID);
+ }
+ if (hdcTo) {
+ RenderButton(hwnd, hdcTo, buttonData.hTheme, iPartID, iStateID);
+ }
+ buttonData.iStateID = iStateID;
+ EndBufferedAnimation(hbpAnimation, TRUE);
+ } else {
+ RenderButton(hwnd, hdc, buttonData.hTheme, iPartID, iStateID);
+ buttonData.iStateID = iStateID;
+ }
+}
+
+
+static void PaintGroupbox(HWND hwnd, HDC hdc, SubClassData &buttonData)
+{
+ DWORD nStyle = GetWindowLong(hwnd, GWL_STYLE);
+ int iPartID = BP_GROUPBOX;
+ int iStateID = GBS_NORMAL;
+
+ if (nStyle & WS_DISABLED) {
+ iStateID = GBS_DISABLED;
+ }
+
+ RECT rcClient = { 0 };
+ GetClientRect(hwnd, &rcClient);
+
+ RECT rcText = rcClient;
+ RECT rcBackground = rcClient;
+
+ HFONT hFont = nullptr;
+ HFONT hOldFont = nullptr;
+ HFONT hCreatedFont = nullptr;
+ LOGFONT lf = { 0 };
+ if (SUCCEEDED(GetThemeFont(buttonData.hTheme, hdc, iPartID, iStateID, TMT_FONT, &lf))) {
+ hCreatedFont = CreateFontIndirect(&lf);
+ hFont = hCreatedFont;
+ }
+
+ if (!hFont) {
+ hFont = reinterpret_cast<HFONT>(SendMessage(hwnd, WM_GETFONT, 0, 0));
+ }
+
+ hOldFont = (HFONT)SelectObject(hdc, hFont);
+
+ TCHAR szText[256] = { 0 };
+ GetWindowText(hwnd, szText, sizeof(szText) / sizeof(TCHAR));
+
+ if (szText[0]) {
+ SIZE textSize = { 0 };
+ GetTextExtentPoint32(hdc, szText, static_cast<int>(wcslen(szText)), &textSize);
+ rcBackground.top += textSize.cy / 2;
+ rcText.left += 7;
+ rcText.bottom = rcText.top + textSize.cy;
+ rcText.right = rcText.left + textSize.cx + 4;
+ ExcludeClipRect(hdc, rcText.left, rcText.top, rcText.right, rcText.bottom);
+ } else {
+ SIZE textSize = { 0 };
+ GetTextExtentPoint32(hdc, L"M", 1, &textSize);
+ rcBackground.top += textSize.cy / 2;
+ }
+
+ RECT rcContent = rcBackground;
+ GetThemeBackgroundContentRect(buttonData.hTheme, hdc, BP_GROUPBOX, iStateID, &rcBackground, &rcContent);
+ ExcludeClipRect(hdc, rcContent.left, rcContent.top, rcContent.right, rcContent.bottom);
+
+ DrawThemeParentBackground(hwnd, hdc, &rcClient);
+ DrawThemeBackground(buttonData.hTheme, hdc, BP_GROUPBOX, iStateID, &rcBackground, nullptr);
+
+ SelectClipRgn(hdc, nullptr);
+
+ if (szText[0]) {
+ rcText.right -= 2;
+ rcText.left += 2;
+ DTTOPTS dtto = { sizeof(DTTOPTS), DTT_TEXTCOLOR };
+ dtto.crText = dark_text_color;
+ DrawThemeTextEx(buttonData.hTheme, hdc, BP_GROUPBOX, iStateID, szText, -1, DT_LEFT | DT_SINGLELINE, &rcText, &dtto);
+ }
+
+ if (hCreatedFont) DeleteObject(hCreatedFont);
+ SelectObject(hdc, hOldFont);
+}
+
+void SubclassButtonControl(HWND hwnd)
+{
+ if (g_darkModeSupported && g_darkModeEnabled) {
+ SetWindowSubclass(hwnd, [](HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR /*uIdSubclass*/, DWORD_PTR dwRefData) -> LRESULT {
+ auto data = reinterpret_cast<SubClassData *>(dwRefData);
+ switch (uMsg)
+ {
+ case WM_UPDATEUISTATE:
+ if (HIWORD(wParam) & (UISF_HIDEACCEL | UISF_HIDEFOCUS))
+ {
+ InvalidateRect(hWnd, nullptr, FALSE);
+ }
+ break;
+ case WM_NCDESTROY:
+ {
+ delete data;
+ }
+ break;
+ case WM_ERASEBKGND:
+ {
+ if (g_darkModeEnabled && data->EnsureTheme(hWnd, L"Button")) {
+ return TRUE;
+ } else {
+ break;
+ }
+ }
+ case WM_THEMECHANGED:
+ data->CloseTheme();
+ break;
+ case WM_PRINTCLIENT:
+ case WM_PAINT:
+ if (g_darkModeEnabled && data->EnsureTheme(hWnd, L"Button")) {
+ DWORD nStyle = GetWindowLong(hWnd, GWL_STYLE);
+ DWORD nButtonStyle = nStyle & 0xF;
+ if (nButtonStyle == BS_CHECKBOX || nButtonStyle == BS_AUTOCHECKBOX || nButtonStyle == BS_RADIOBUTTON || nButtonStyle == BS_AUTORADIOBUTTON ||
+ nButtonStyle == BS_3STATE || nButtonStyle == BS_AUTO3STATE || nButtonStyle == BS_GROUPBOX) {
+ PAINTSTRUCT ps = { 0 };
+ HDC hdc = reinterpret_cast<HDC>(wParam);
+ if (!hdc) {
+ hdc = BeginPaint(hWnd, &ps);
+ }
+ if (nButtonStyle == BS_GROUPBOX) {
+ PaintGroupbox(hWnd, hdc, *data);
+ } else {
+ PaintButton(hWnd, hdc, *data);
+ }
+ if (ps.hdc) {
+ EndPaint(hWnd, &ps);
+ }
+ return 0;
+ }
+ }
+ break;
+ case WM_SIZE:
+ case WM_DESTROY:
+ BufferedPaintStopAllAnimations(hWnd);
+ break;
+ }
+ return DefSubclassProc(hWnd, uMsg, wParam, lParam);
+ }, 0, reinterpret_cast<DWORD_PTR>(new SubClassData{}));
+ }
+ SendMessageW(hwnd, WM_THEMECHANGED, 0, 0);
+}
+
+void SubclassListViewControl(HWND hListView)
+{
+ if (g_darkModeSupported && g_darkModeEnabled) {
+ HWND hHeader = ListView_GetHeader(hListView);
+
+ SetWindowSubclass(hListView, [](HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR /*uIdSubclass*/, DWORD_PTR dwRefData) -> LRESULT {
+ switch (uMsg)
+ {
+ case WM_NOTIFY:
+ {
+ if (reinterpret_cast<LPNMHDR>(lParam)->code == NM_CUSTOMDRAW) {
+ LPNMCUSTOMDRAW nmcd = reinterpret_cast<LPNMCUSTOMDRAW>(lParam);
+ switch (nmcd->dwDrawStage)
+ {
+ case CDDS_PREPAINT:
+ return CDRF_NOTIFYITEMDRAW;
+ case CDDS_ITEMPREPAINT:
+ {
+ auto info = reinterpret_cast<SubClassData*>(dwRefData);
+ SetTextColor(nmcd->hdc, info->headerTextColor);
+ return CDRF_DODEFAULT;
+ }
+ }
+ }
+ }
+ break;
+ case WM_THEMECHANGED:
+ {
+ if (g_darkModeSupported) {
+ HWND hHeader = ListView_GetHeader(hWnd);
+
+ AllowDarkModeForWindow(hWnd, g_darkModeEnabled);
+ if (hHeader) {
+ AllowDarkModeForWindow(hHeader, g_darkModeEnabled);
+ }
+
+ HTHEME hTheme = OpenThemeData(nullptr, L"ItemsView");
+ if (hTheme) {
+ COLORREF color;
+ if (SUCCEEDED(GetThemeColor(hTheme, 0, 0, TMT_TEXTCOLOR, &color)))
+ {
+ ListView_SetTextColor(hWnd, color);
+ }
+ if (SUCCEEDED(GetThemeColor(hTheme, 0, 0, TMT_FILLCOLOR, &color)))
+ {
+ ListView_SetTextBkColor(hWnd, color);
+ ListView_SetBkColor(hWnd, color);
+ }
+ CloseThemeData(hTheme);
+ }
+
+ hTheme = OpenThemeData(hHeader, L"Header");
+ if (hTheme) {
+ auto info = reinterpret_cast<SubClassData*>(dwRefData);
+ GetThemeColor(hTheme, HP_HEADERITEM, 0, TMT_TEXTCOLOR, &(info->headerTextColor));
+ CloseThemeData(hTheme);
+ }
+
+ if (hHeader != NULL) {
+ SendMessageW(hHeader, WM_THEMECHANGED, wParam, lParam);
+ }
+
+ RedrawWindow(hWnd, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE);
+ }
+ }
+ break;
+ case WM_DESTROY:
+ {
+ auto data = reinterpret_cast<SubClassData*>(dwRefData);
+ delete data;
+ }
+ break;
+ }
+ return DefSubclassProc(hWnd, uMsg, wParam, lParam);
+ }, 0, reinterpret_cast<DWORD_PTR>(new SubClassData{}));
+
+ ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_HEADERDRAGDROP);
+
+ // Hide focus dots
+ SendMessage(hListView, WM_CHANGEUISTATE, MAKELONG(UIS_SET, UISF_HIDEFOCUS), 0);
+
+ if (hHeader != NULL) {
+ SetWindowTheme(hHeader, L"ItemsView", nullptr); // DarkMode
+ }
+ SetWindowTheme(hListView, L"ItemsView", nullptr); // DarkMode
+ }
+}
+
+void SubclassTreeViewControl(HWND hListView)
+{
+ if (g_darkModeSupported && g_darkModeEnabled) {
+ SetWindowSubclass(hListView, [](HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR /*uIdSubclass*/, DWORD_PTR dwRefData) -> LRESULT {
+ switch (uMsg)
+ {
+ case WM_NOTIFY:
+ {
+ if (reinterpret_cast<LPNMHDR>(lParam)->code == NM_CUSTOMDRAW && 0)
+ {
+ LPNMCUSTOMDRAW nmcd = reinterpret_cast<LPNMCUSTOMDRAW>(lParam);
+ switch (nmcd->dwDrawStage)
+ {
+ case CDDS_PREPAINT:
+ return CDRF_NOTIFYITEMDRAW;
+ case CDDS_ITEMPREPAINT:
+ {
+ auto info = reinterpret_cast<SubClassData*>(dwRefData);
+ SetTextColor(nmcd->hdc, info->headerTextColor);
+ return CDRF_DODEFAULT;
+ }
+ }
+ }
+ }
+ break;
+ case WM_THEMECHANGED:
+ {
+ if (g_darkModeSupported) {
+ AllowDarkModeForWindow(hWnd, g_darkModeEnabled);
+
+ HTHEME hTheme = OpenThemeData(nullptr, L"ItemsView");
+ if (hTheme) {
+ COLORREF color;
+ if (SUCCEEDED(GetThemeColor(hTheme, 0, 0, TMT_TEXTCOLOR, &color))) {
+ TreeView_SetTextColor(hWnd, color);
+ }
+ if (SUCCEEDED(GetThemeColor(hTheme, 0, 0, TMT_FILLCOLOR, &color))) {
+ TreeView_SetBkColor(hWnd, color);
+ }
+ CloseThemeData(hTheme);
+ }
+
+ RedrawWindow(hWnd, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE);
+ }
+ }
+ break;
+ case WM_DESTROY:
+ {
+ auto data = reinterpret_cast<SubClassData*>(dwRefData);
+ delete data;
+ }
+ break;
+ }
+ return DefSubclassProc(hWnd, uMsg, wParam, lParam);
+ }, 0, reinterpret_cast<DWORD_PTR>(new SubClassData{}));
+
+ SendMessageW(hListView, WM_THEMECHANGED, 0, 0);
+ }
+}
+
+
+void SubClassStatusBar(HWND hwnd)
+{
+ if (g_darkModeSupported && g_darkModeEnabled) {
+ SetWindowSubclass(hwnd, [](HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR /*uIdSubclass*/, DWORD_PTR dwRefData) -> LRESULT {
+ switch (uMsg)
+ {
+ case WM_ERASEBKGND:
+ {
+ if (g_darkModeEnabled) {
+ HDC hdc = (HDC)wParam;
+ HBRUSH brush = CreateSolidBrush(dark_bg_color);
+ RECT rect;
+ GetClientRect(hWnd, &rect);
+ FillRect(hdc, &rect, brush);
+ DeleteObject(brush);
+ return TRUE;
+ } else {
+ break;
+ }
+ }
+ }
+ return DefSubclassProc(hWnd, uMsg, wParam, lParam);
+ }, 0, reinterpret_cast<DWORD_PTR>(new SubClassData{}));
+ }
+ SendMessageW(hwnd, WM_THEMECHANGED, 0, 0);
+}
--- /dev/null
+#pragma once
+
+enum IMMERSIVE_HC_CACHE_MODE
+{
+ IHCM_USE_CACHED_VALUE,
+ IHCM_REFRESH
+};
+
+// 1903 18362
+enum PreferredAppMode
+{
+ Default,
+ AllowDark,
+ ForceDark,
+ ForceLight,
+ Max
+};
+
+enum WINDOWCOMPOSITIONATTRIB
+{
+ WCA_UNDEFINED = 0,
+ WCA_NCRENDERING_ENABLED = 1,
+ WCA_NCRENDERING_POLICY = 2,
+ WCA_TRANSITIONS_FORCEDISABLED = 3,
+ WCA_ALLOW_NCPAINT = 4,
+ WCA_CAPTION_BUTTON_BOUNDS = 5,
+ WCA_NONCLIENT_RTL_LAYOUT = 6,
+ WCA_FORCE_ICONIC_REPRESENTATION = 7,
+ WCA_EXTENDED_FRAME_BOUNDS = 8,
+ WCA_HAS_ICONIC_BITMAP = 9,
+ WCA_THEME_ATTRIBUTES = 10,
+ WCA_NCRENDERING_EXILED = 11,
+ WCA_NCADORNMENTINFO = 12,
+ WCA_EXCLUDED_FROM_LIVEPREVIEW = 13,
+ WCA_VIDEO_OVERLAY_ACTIVE = 14,
+ WCA_FORCE_ACTIVEWINDOW_APPEARANCE = 15,
+ WCA_DISALLOW_PEEK = 16,
+ WCA_CLOAK = 17,
+ WCA_CLOAKED = 18,
+ WCA_ACCENT_POLICY = 19,
+ WCA_FREEZE_REPRESENTATION = 20,
+ WCA_EVER_UNCLOAKED = 21,
+ WCA_VISUAL_OWNER = 22,
+ WCA_HOLOGRAPHIC = 23,
+ WCA_EXCLUDED_FROM_DDA = 24,
+ WCA_PASSIVEUPDATEMODE = 25,
+ WCA_USEDARKMODECOLORS = 26,
+ WCA_LAST = 27
+};
+
+struct WINDOWCOMPOSITIONATTRIBDATA
+{
+ WINDOWCOMPOSITIONATTRIB Attrib;
+ PVOID pvData;
+ SIZE_T cbData;
+};
+
+using fnRtlGetNtVersionNumbers = void (WINAPI *)(LPDWORD major, LPDWORD minor, LPDWORD build);
+using fnSetWindowCompositionAttribute = BOOL(WINAPI *)(HWND hWnd, WINDOWCOMPOSITIONATTRIBDATA *);
+// 1809 17763
+using fnShouldAppsUseDarkMode = bool (WINAPI *)(); // ordinal 132
+using fnAllowDarkModeForWindow = bool (WINAPI *)(HWND hWnd, bool allow); // ordinal 133
+using fnAllowDarkModeForApp = bool (WINAPI *)(bool allow); // ordinal 135, in 1809
+using fnFlushMenuThemes = void (WINAPI *)(); // ordinal 136
+using fnRefreshImmersiveColorPolicyState = void (WINAPI *)(); // ordinal 104
+using fnIsDarkModeAllowedForWindow = bool (WINAPI *)(HWND hWnd); // ordinal 137
+using fnGetIsImmersiveColorUsingHighContrast = bool (WINAPI *)(IMMERSIVE_HC_CACHE_MODE mode); // ordinal 106
+using fnOpenNcThemeData = HTHEME(WINAPI *)(HWND hWnd, LPCWSTR pszClassList); // ordinal 49
+// 1903 18362
+using fnShouldSystemUseDarkMode = bool (WINAPI *)(); // ordinal 138
+using fnSetPreferredAppMode = PreferredAppMode(WINAPI *)(PreferredAppMode appMode); // ordinal 135, in 1903
+using fnIsDarkModeAllowedForApp = bool (WINAPI *)(); // ordinal 139
+
+extern bool g_darkModeSupported;
+extern bool g_darkModeEnabled;
+extern int darkModeForced;
+extern COLORREF dark_text_color, dark_bg_color;;
+
+bool AllowDarkModeForWindow(HWND hWnd, bool allow);
+void InitDarkMode(int enable);
+void RefreshTitleBarThemeColor(HWND hWnd);
+extern fnAllowDarkModeForWindow _AllowDarkModeForWindow;
+void AllowDarkModeForApp(bool allow);
+void SubclassListViewControl(HWND hListView);
+void SubclassTreeViewControl(HWND hListView);
+void SubclassButtonControl(HWND hwnd);
+void SubClassStatusBar(HWND hwnd);
\ No newline at end of file
#define IDC_SER_CTSRTS 1554
#define IDC_GUI_FULLSCREEN 1554
#define IDC_SER_DIRECT 1555
+#define IDC_GUI_DARKMODE 1555
#define IDC_PSPRINTER 1556
#define IDC_PSPRINTERDETECT 1557
#define IDC_UAESERIAL 1558
CONTROL "Double, fields+",IDC_LM_IDOUBLED3,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,299,281,90,10
END
-IDD_MEMORY DIALOGEX 0, 0, 396, 303
+IDD_MEMORY DIALOGEX 0, 0, 396, 304
STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
EXSTYLE WS_EX_CONTEXTHELP
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
- GROUPBOX "Memory Settings",IDC_STATIC,1,26,393,117
+ GROUPBOX "Memory Settings",IDC_STATIC,1,20,393,117
RTEXT "Chip:",IDC_STATIC,7,44,60,15,SS_CENTERIMAGE
CONTROL "Slider1",IDC_CHIPMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,68,41,60,20
EDITTEXT IDC_CHIPRAM,135,44,40,12,ES_CENTER | ES_READONLY
CONTROL "",IDC_Z3CHIPMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,248,90,60,20
EDITTEXT IDC_Z3CHIPRAM,311,95,40,12,ES_CENTER | ES_READONLY
EDITTEXT IDC_MAX32RAM,14,118,366,12,ES_CENTER | ES_READONLY
- GROUPBOX "Advanced Memory Settings",IDC_STATIC,1,134,393,161
+ GROUPBOX "Advanced Memory Settings",IDC_STATIC,1,141,393,157
COMBOBOX IDC_MEMORYSELECT,14,170,228,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "",IDC_MEMORYMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,253,164,68,20
EDITTEXT IDC_MEMORYRAM,328,167,40,12,ES_CENTER | ES_READONLY
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "",IDC_MISCLIST,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,3,5,258,232
- GROUPBOX "Miscellaneous Options",IDC_STATIC,266,2,128,123
+ GROUPBOX "Miscellaneous Options",IDC_STATIC,266,2,128,111
CTEXT "SCSI and CD/DVD access:",IDC_STATIC,272,14,117,10,SS_CENTERIMAGE
COMBOBOX IDC_SCSIMODE,273,28,114,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "Windowed style:",IDC_STATIC,272,45,117,10,SS_CENTERIMAGE
COMBOBOX IDC_WINDOWEDMODE,273,59,114,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
- CTEXT "Graphics API:",IDC_STATIC,272,76,117,10,SS_CENTERIMAGE
- COMBOBOX IDC_DXMODE,273,89,114,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_DXMODE_OPTIONS,273,107,114,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
- GROUPBOX "GUI",IDC_STATIC,266,125,128,112
- COMBOBOX IDC_LANGUAGE,273,138,114,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- PUSHBUTTON "GUI Font...",IDC_GUI_FONT,272,155,54,14
- PUSHBUTTON "Set default",IDC_GUI_DEFAULT,272,174,54,14
- COMBOBOX IDC_GUI_SIZE,333,175,54,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- PUSHBUTTON "Reset list customizations",IDC_GUI_LVDEFAULT,272,192,115,14
- CONTROL "Resizeable GUI",IDC_GUI_RESIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,273,209,114,11
- CONTROL "Fullscreen GUI",IDC_GUI_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,273,222,114,11
+ COMBOBOX IDC_DXMODE,273,77,114,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_DXMODE_OPTIONS,273,95,114,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ GROUPBOX "GUI",IDC_STATIC,266,117,128,121
+ COMBOBOX IDC_LANGUAGE,273,129,114,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "GUI Font...",IDC_GUI_FONT,272,146,54,14
+ PUSHBUTTON "Set default",IDC_GUI_DEFAULT,272,165,54,14
+ COMBOBOX IDC_GUI_SIZE,333,166,54,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Reset list customizations",IDC_GUI_LVDEFAULT,272,183,115,14
+ CONTROL "Resizeable GUI",IDC_GUI_RESIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,273,199,114,11
+ CONTROL "Fullscreen GUI",IDC_GUI_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,273,212,114,11
GROUPBOX "State Files",IDC_STATIC,1,242,393,38
COMBOBOX IDC_STATENAME,5,258,232,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
CONTROL "",IDC_STATECLEAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,244,261,9,10
COMBOBOX IDC_KBLED2,97,295,64,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_KBLED3,184,295,64,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "USB mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,296,64,11
+ CONTROL "Dark mode",IDC_GUI_DARKMODE,"Button",BS_AUTO3STATE | WS_TABSTOP,273,224,114,11
END
IDD_HARDFILE DIALOGEX 0, 0, 397, 292
COMBOBOX IDC_INPUTAMIGA,33,248,286,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Test [] Test input mappings.",IDC_INPUTTEST,324,248,34,14
PUSHBUTTON "Remap [] Find and remap quickly.",IDC_INPUTREMAP,361,248,34,14
- RTEXT "Joystick dead zone (%):",-1,5,271,106,10,SS_CENTERIMAGE
- EDITTEXT IDC_INPUTDEADZONE,116,270,29,12,ES_NUMBER
- RTEXT "Autofire rate (lines):",-1,5,288,106,10,SS_CENTERIMAGE
- EDITTEXT IDC_INPUTAUTOFIRERATE,116,286,29,12,ES_NUMBER
- RTEXT "Digital joy-mouse speed:",-1,147,271,108,10,SS_CENTERIMAGE
- EDITTEXT IDC_INPUTSPEEDD,260,270,29,12,ES_NUMBER
- RTEXT "Analog joy-mouse speed:",-1,147,288,108,10,SS_CENTERIMAGE
- EDITTEXT IDC_INPUTSPEEDA,260,287,29,12,ES_NUMBER
- PUSHBUTTON "Copy from:",IDC_INPUTCOPY,324,268,70,14
- COMBOBOX IDC_INPUTCOPYFROM,324,286,70,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
- PUSHBUTTON "Swap 1<>2",IDC_INPUTSWAP,324,303,70,14
- CONTROL "Swap Backslash/F11",IDC_KEYBOARD_SWAPHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,303,87,10
+ RTEXT "Joystick dead zone (%):",-1,5,270,106,10,SS_CENTERIMAGE
+ EDITTEXT IDC_INPUTDEADZONE,116,269,29,12,ES_NUMBER
+ RTEXT "Autofire rate (lines):",-1,5,287,106,10,SS_CENTERIMAGE
+ EDITTEXT IDC_INPUTAUTOFIRERATE,116,285,29,12,ES_NUMBER
+ RTEXT "Digital joy-mouse speed:",-1,147,270,108,10,SS_CENTERIMAGE
+ EDITTEXT IDC_INPUTSPEEDD,260,269,29,12,ES_NUMBER
+ RTEXT "Analog joy-mouse speed:",-1,147,287,108,10,SS_CENTERIMAGE
+ EDITTEXT IDC_INPUTSPEEDA,260,286,29,12,ES_NUMBER
+ PUSHBUTTON "Copy from:",IDC_INPUTCOPY,324,267,70,14
+ COMBOBOX IDC_INPUTCOPYFROM,324,285,70,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Swap 1<>2",IDC_INPUTSWAP,324,302,70,14
+ CONTROL "Swap Backslash/F11",IDC_KEYBOARD_SWAPHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,302,87,10
END
IDD_FILTER DIALOGEX 0, 0, 396, 316
STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
- GROUPBOX "Expansion Board Settings",IDC_STATIC,1,42,394,88
- COMBOBOX IDC_SCSIROMSELECTCAT,12,59,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_SCSIROMSELECT,12,78,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_SCSIROMSUBSELECT,12,95,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_EXPANSIONBOARDITEMSELECTOR,12,112,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_SCSIROMSELECTNUM,175,78,22,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- CONTROL "24-bit DMA",IDC_SCSIROM24BITDMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,61,84,12
- RTEXT "Controller ID:",IDC_STATIC,281,59,70,15,SS_CENTERIMAGE
- COMBOBOX IDC_SCSIROMID,356,60,29,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_SCSIROMFILE,202,78,171,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- PUSHBUTTON "...",IDC_SCSIROMCHOOSER,376,78,10,15
- CONTROL "Autoboot disabled",IDC_SCSIROMFILEAUTOBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,98,94,12
- CONTROL "PCMCIA inserted",IDC_SCSIROMFILEPCMCIA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,301,98,84,12
- CONTROL "",IDC_EXPANSIONBOARDCHECKBOX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,112,99,12
- GROUPBOX "Accelerator Board Settings",IDC_STATIC,1,133,394,91
+ GROUPBOX "Expansion Board Settings",IDC_STATIC,1,27,394,104
+ COMBOBOX IDC_SCSIROMSELECTCAT,12,43,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_SCSIROMSELECT,12,62,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_SCSIROMSUBSELECT,12,79,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_EXPANSIONBOARDITEMSELECTOR,12,104,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_SCSIROMSELECTNUM,175,62,22,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ CONTROL "24-bit DMA",IDC_SCSIROM24BITDMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,45,84,12
+ RTEXT "Controller ID:",IDC_STATIC,281,43,70,15,SS_CENTERIMAGE
+ COMBOBOX IDC_SCSIROMID,356,44,29,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_SCSIROMFILE,202,62,171,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "...",IDC_SCSIROMCHOOSER,376,62,10,15
+ CONTROL "Autoboot disabled",IDC_SCSIROMFILEAUTOBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,82,94,12
+ CONTROL "PCMCIA inserted",IDC_SCSIROMFILEPCMCIA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,301,82,84,12
+ CONTROL "",IDC_EXPANSIONBOARDCHECKBOX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,104,99,12
+ GROUPBOX "Accelerator Board Settings",IDC_STATIC,1,133,394,104
COMBOBOX IDC_CPUBOARD_TYPE,13,154,117,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_CPUBOARD_SUBTYPE,13,173,117,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Accelerator board ROM file:",IDC_STATIC,203,141,170,15,SS_CENTERIMAGE
RTEXT "Accelerator board memory:",IDC_STATIC,155,181,104,15,SS_CENTERIMAGE
CONTROL "",IDC_CPUBOARDMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,269,179,68,20
EDITTEXT IDC_CPUBOARDRAM,343,183,40,12,ES_CENTER | ES_READONLY
- COMBOBOX IDC_ACCELERATORBOARDITEMSELECTOR,12,205,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_ACCELERATORBOARDSELECTOR,202,205,171,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- GROUPBOX "Miscellaneous Expansions",IDC_STATIC,1,228,394,51
+ COMBOBOX IDC_ACCELERATORBOARDITEMSELECTOR,12,213,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_ACCELERATORBOARDSELECTOR,202,213,171,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ GROUPBOX "Miscellaneous Expansions",IDC_STATIC,1,245,394,51
CONTROL "bsdsocket.library [] bsdsocket network library emulation.",IDC_SOCKETS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,243,179,11
- CONTROL "uaescsi.device",IDC_SCSIDEVICE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,259,180,11
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,260,179,11
+ CONTROL "uaescsi.device",IDC_SCSIDEVICE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,276,180,11
CONTROL "uaenet.device [] Sana 2 compatible network device emulation.",IDC_SANA2,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,243,187,11
- EDITTEXT IDC_EXPANSIONBOARDSTRINGBOX,202,112,172,14,ES_AUTOHSCROLL
- COMBOBOX IDC_EXPANSIONBOARDSELECTOR,202,112,171,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- CONTROL "",IDC_ACCELERATORBOARDCHECKBOX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,206,99,12
- CONTROL "Enabled",IDC_SCSIROMSELECTED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,79,99,12
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,260,187,11
+ EDITTEXT IDC_EXPANSIONBOARDSTRINGBOX,202,104,172,14,ES_AUTOHSCROLL
+ COMBOBOX IDC_EXPANSIONBOARDSELECTOR,202,104,171,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ CONTROL "",IDC_ACCELERATORBOARDCHECKBOX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,214,99,12
+ CONTROL "Enabled",IDC_SCSIROMSELECTED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,63,99,12
+ GROUPBOX "",IDC_STATIC,6,94,384,30,0,WS_EX_TRANSPARENT
+ GROUPBOX "",IDC_STATIC,5,202,384,30,0,WS_EX_TRANSPARENT
END
IDD_CHSQUERY DIALOGEX 0, 0, 396, 85
IDD_MEMORY, DIALOG
BEGIN
- BOTTOMMARGIN, 289
END
IDD_CPU, DIALOG
IDD_EXPANSION, DIALOG
BEGIN
- BOTTOMMARGIN, 198
+ BOTTOMMARGIN, 246
END
IDD_INPUTMAP, DIALOG
#include <Cfgmgr32.h>
#include <shellscalingapi.h>
#include <dinput.h>
+#include <dwmapi.h>
#include "resource.h"
#include "debug.h"
#include "disasm.h"
+#include "darkmode.h"
+
const static GUID GUID_DEVINTERFACE_HID = { 0x4D1E55B2L, 0xF16F, 0x11CF,
{ 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 } };
const static GUID GUID_DEVINTERFACE_KEYBOARD = { 0x884b96c3, 0x56ef, 0x11d1,
FillRect(lpDIS->hDC, &lpDIS->rcItem, mon->hStatusBkgB);
if (txt) {
SetBkMode(lpDIS->hDC, TRANSPARENT);
- oc = SetTextColor(lpDIS->hDC, RGB(0x00, 0x00, 0x00));
+ oc = SetTextColor(lpDIS->hDC, g_darkModeEnabled ? dark_text_color : RGB(0x00, 0x00, 0x00));
DrawText(lpDIS->hDC, txt, uaetcslen(txt), &lpDIS->rcItem, flags);
SetTextColor(lpDIS->hDC, oc);
}
} else if (tflags & 8) {
oc = SetTextColor (lpDIS->hDC, RGB(0x00, 0xcc, 0x00)); // playing
} else {
- oc = SetTextColor (lpDIS->hDC, GetSysColor ((tflags & 2) ? COLOR_BTNTEXT : COLOR_GRAYTEXT));
+ COLORREF c;
+ if (g_darkModeEnabled) {
+ c = (tflags & 2) ? dark_text_color : (dark_text_color & 0xfefefe) >> 1;
+ } else {
+ c = GetSysColor((tflags & 2) ? COLOR_BTNTEXT : COLOR_GRAYTEXT);
+ }
+ oc = SetTextColor (lpDIS->hDC, c);
}
if (tflags & 32) {
;
}
}
- typedef HRESULT(CALLBACK* DWMISCOMPOSITIONENABLED)(BOOL*);
- HMODULE dwmapihandle;
- DWMISCOMPOSITIONENABLED pDwmIsCompositionEnabled;
- dwmapihandle = LoadLibrary(_T("dwmapi.dll"));
- if (dwmapihandle) {
- pDwmIsCompositionEnabled = (DWMISCOMPOSITIONENABLED)GetProcAddress(dwmapihandle, "DwmIsCompositionEnabled");
- if (pDwmIsCompositionEnabled) {
- pDwmIsCompositionEnabled(&os_dwm_enabled);
- }
- FreeLibrary(dwmapihandle);
- }
+ DwmIsCompositionEnabled(&os_dwm_enabled);
return 1;
}
}
return 2;
}
+ if (!_tcscmp(arg, _T("theme"))) {
+ if (!_tcsicmp(np, _T("dark"))) {
+ darkModeForced = 1;
+ } else if (!_tcsicmp(np, _T("light"))) {
+ darkModeForced = -1;
+ }
+ return 2;
+ }
#endif
return 0;
return GetCurrentThreadId() == mainthreadid;
}
+void InitializeDarkMode(int v)
+{
+ static int initialized = -10;
+ if (darkModeForced) {
+ v = 1;
+ }
+ if (initialized != v) {
+ InitDarkMode(v);
+ write_log("dark mode supported: %d enabled: %d\n", g_darkModeSupported, g_darkModeEnabled);
+ initialized = v;
+ }
+ if (initialized && g_darkModeEnabled && !v) {
+ InitDarkMode(0);
+ initialized = 0;
+ }
+}
+
typedef BOOL (CALLBACK* CHANGEWINDOWMESSAGEFILTER)(UINT, DWORD);
typedef DPI_AWARENESS_CONTEXT (CALLBACK* GETTHREADDPIAWARENESSCONTEXT)(void);
typedef DPI_AWARENESS (CALLBACK* GETAWARENESSFROMDPIAWARENESSCONTEXT)(DPI_AWARENESS_CONTEXT);
extern void updatewinrect(struct AmigaMonitor*, bool);
int getdpiformonitor(HMONITOR mon);
int getdpiforwindow(HWND hwnd);
+void InitializeDarkMode(int v);
extern bool resumepaused (int priority);
extern bool setpaused (int priority);
#include "statusline.h"
#include "devices.h"
+#include "darkmode.h"
+
#define DM_DX_FULLSCREEN 1
#define DM_W_FULLSCREEN 2
#define DM_D3D_FULLSCREEN 16
c = 1024;
} else if (display_change_requested == 2) {
c = 512;
+ } else if (display_change_requested == 4) {
+ c = 32;
} else {
c = 2;
keepfsmode = 0;
0, 0, 0, 0, mon->hMainWnd, (HMENU) 1, hInst, NULL);
if (!mon->hStatusWnd)
return;
+ if (g_darkModeSupported) {
+ BOOL value = g_darkModeEnabled;
+ DwmSetWindowAttribute(mon->hStatusWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(value));
+ if (g_darkModeEnabled) {
+ SubClassStatusBar(mon->hStatusWnd);
+ }
+ }
wi.cbSize = sizeof wi;
GetWindowInfo(mon->hMainWnd, &wi);
extra = wi.rcClient.top - wi.rcWindow.top;
if (lpParts) {
int i = 0, i1;
// left side, msg area
- lpParts[i] = rc.left + 2;
+ lpParts[i] = rc.left;
i++;
window_led_msg_start = i;
/* Calculate the right edge coordinate for each part, and copy the coords to the array. */
else
ny = rc.top + (rc.bottom - rc.top - nh);
}
+
if (w != nw || h != nh || x != nx || y != ny || sbheight != mon->window_extra_height_bar || dpi != mon->dpi) {
w = nw;
h = nh;
}
break;
}
+ if (g_darkModeSupported) {
+ BOOL value = g_darkModeEnabled;
+ DwmSetWindowAttribute(mon->hMainWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(value));
+ }
GetWindowRect(mon->hMainWnd, &rc2);
mon->window_extra_width = rc2.right - rc2.left - mon->currentmode.current_width;
mon->window_extra_height = rc2.bottom - rc2.top - mon->currentmode.current_height;
close_hwnds(mon);
return 0;
}
+ if (g_darkModeSupported) {
+ BOOL value = g_darkModeEnabled;
+ DwmSetWindowAttribute(mon->hAmigaWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(value));
+ }
if (mon->hMainWnd == NULL) {
mon->hMainWnd = mon->hAmigaWnd;
registertouch(mon->hAmigaWnd);
#include <shobjidl.h>
#include <dbt.h>
#include <Cfgmgr32.h>
+#include <dwmapi.h>
#include "resource.h"
#include "sysconfig.h"
#include "floppybridge/floppybridge_lib.h"
#endif
+#include <Vssym32.h>
+#include "darkmode.h"
+
#define GUI_SCALE_DEFAULT 100
static HMODULE hHtmlHelp;
pathtype path_type;
+static void darkmode_initdialog(HWND hDlg)
+{
+ if (g_darkModeSupported)
+ {
+ SendMessageW(hDlg, WM_THEMECHANGED, 0, 0);
+ }
+}
+static void darkmode_themechanged(HWND hDlg)
+{
+ if (g_darkModeSupported)
+ {
+ RefreshTitleBarThemeColor(hDlg);
+ UpdateWindow(hDlg);
+ }
+}
+static INT_PTR darkmode_ctlcolor(WPARAM wParam, bool *handled)
+{
+ constexpr COLORREF darkBkColor = 0x383838;
+ constexpr COLORREF darkTextColor = 0xFFFFFF;
+ static HBRUSH hbrBkgnd = nullptr;
+
+ if (g_darkModeSupported && g_darkModeEnabled)
+ {
+ HDC hdc = reinterpret_cast<HDC>(wParam);
+ SetTextColor(hdc, darkTextColor);
+ SetBkColor(hdc, darkBkColor);
+ if (!hbrBkgnd)
+ hbrBkgnd = CreateSolidBrush(darkBkColor);
+ *handled = true;
+ return reinterpret_cast<INT_PTR>(hbrBkgnd);
+ }
+ *handled = false;
+ return 0;
+}
+
void HtmlHelp(const TCHAR *panel)
{
TCHAR help_file[MAX_DPATH];
return table[posn];
}
-static void commonproc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR commonproc2(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam, bool *handled)
{
+ if (msg == WM_INITDIALOG) {
+ darkmode_initdialog(hDlg);
+ } else if (msg == WM_CTLCOLORDLG || msg == WM_CTLCOLORSTATIC) {
+ INT_PTR v = darkmode_ctlcolor(wParam, handled);
+ if (*handled) {
+ return v;
+ }
+ } else if (msg == WM_THEMECHANGED) {
+ darkmode_themechanged(hDlg);
+ }
+ *handled = false;
+ return 0;
+}
+
+static INT_PTR commonproc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam, bool *handled)
+{
+ *handled = false;
if (msg == WM_DPICHANGED) {
RECT *const r = (RECT *)lParam;
SetWindowPos(hDlg, NULL, r->left, r->top, r->right - r->left, r->bottom - r->top, SWP_NOZORDER | SWP_NOACTIVATE);
+ *handled = true;
+ } else {
+ INT_PTR v = commonproc2(hDlg, msg, wParam, lParam, handled);
+ if (*handled) {
+ return v;
+ }
}
+ return 0;
}
static int stringboxdialogactive;
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return v;
+ }
+
switch(msg)
{
case WM_DESTROY:
}
break;
}
- commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return v;
+ }
+
switch(msg)
{
case WM_DESTROY:
}
break;
}
- commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
static bool scan_rom_hook (const TCHAR *name, int line)
}
static int gui_width, gui_height;
-int gui_fullscreen;
+int gui_fullscreen, gui_darkmode;
static RECT gui_fullscreen_rect;
static bool gui_resize_enabled = true;
static bool gui_resize_allowed = true;
}
list = GetDlgItem(hDlg, listview_id);
+ SubclassListViewControl(list);
listview_type = lv_type;
listview_columns = listview_num_columns;
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return v;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
recursive--;
break;
}
- commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
{
HIMAGELIST himl = ImageList_Create (16, 16, ILC_COLOR8 | ILC_MASK, 3, 0);
HWND TVhDlg = GetDlgItem(hDlg, IDC_CONFIGTREE);
+ SubclassTreeViewControl(TVhDlg);
HTREEITEM parent;
TCHAR path[MAX_DPATH];
break;
case IDC_SETINFO:
InfoSettingsProcConfig = config;
- if (CustomDialogBox(IDD_SETINFO, hDlg, InfoSettingsProc))
+ if (CustomCreateDialog(IDD_SETINFO, hDlg, InfoSettingsProc))
EnableWindow( GetDlgItem( hDlg, IDC_VIEWINFO ), workprefs.info[0] );
break;
}
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return v;
+ }
+
switch (msg) {
case WM_COMMAND:
if (wParam == IDOK) {
xSendDlgItemMessage (hDlg, IDC_ERRORLOGMESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat);
return TRUE;
}
- commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return v;
+ }
+
switch (msg) {
case WM_COMMAND:
if (wParam == ID_OK) {
xSendDlgItemMessage (hDlg, IDC_CONTRIBUTORS, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat);
return TRUE;
}
- commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
static void DisplayContributors (HWND hDlg)
{
- CustomDialogBox (IDD_CONTRIBUTORS, hDlg, ContributorsProc);
+ CustomCreateDialog(IDD_CONTRIBUTORS, hDlg, ContributorsProc);
}
typedef struct url_info
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch(msg)
{
case WM_INITDIALOG:
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch( msg )
{
case WM_INITDIALOG:
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg) {
case WM_INITDIALOG:
{
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg) {
case WM_INITDIALOG:
{
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
pages[BOARD_ID] = hDlg;
currentpage = BOARD_ID;
setchecked(hDlg, IDC_AUTOCONFIGCUSTOMSORT, workprefs.autoconfig_custom_sort);
- ew(hDlg, IDC_BOARDLIST, workprefs.autoconfig_custom_sort != 0 && full_property_sheet);
+ if (!g_darkModeEnabled) { // dark mode makes disabled list bright..
+ ew(hDlg, IDC_BOARDLIST, workprefs.autoconfig_custom_sort != 0 && full_property_sheet);
+ }
ew(hDlg, IDC_BOARDS_UP, FALSE);
ew(hDlg, IDC_BOARDS_DOWN, FALSE);
ew(hDlg, IDC_AUTOCONFIGCUSTOMSORT, full_property_sheet);
case IDC_AUTOCONFIGCUSTOMSORT:
workprefs.autoconfig_custom_sort = ischecked(hDlg, IDC_AUTOCONFIGCUSTOMSORT);
expansion_set_autoconfig_sort(&workprefs);
- ew(hDlg, IDC_BOARDLIST, workprefs.autoconfig_custom_sort != 0);
+ if (!g_darkModeEnabled) { // dark mode makes disabled list bright..
+ ew(hDlg, IDC_BOARDLIST, workprefs.autoconfig_custom_sort != 0);
+ }
InitializeListView(hDlg);
break;
case IDC_BOARDS_UP:
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
if (currentpage == MISC1_ID) {
- misc_kbled (hDlg, IDC_KBLED1, workprefs.keyboard_leds[0]);
- misc_kbled (hDlg, IDC_KBLED2, workprefs.keyboard_leds[1]);
- misc_kbled (hDlg, IDC_KBLED3, workprefs.keyboard_leds[2]);
- CheckDlgButton (hDlg, IDC_KBLED_USB, workprefs.win32_kbledmode);
- CheckDlgButton (hDlg, IDC_GUI_RESIZE, gui_resize_enabled);
- CheckDlgButton (hDlg, IDC_GUI_FULLSCREEN, gui_fullscreen > 0);
- ew (hDlg, IDC_GUI_RESIZE, gui_resize_allowed);
+ misc_kbled(hDlg, IDC_KBLED1, workprefs.keyboard_leds[0]);
+ misc_kbled(hDlg, IDC_KBLED2, workprefs.keyboard_leds[1]);
+ misc_kbled(hDlg, IDC_KBLED3, workprefs.keyboard_leds[2]);
+ CheckDlgButton(hDlg, IDC_KBLED_USB, workprefs.win32_kbledmode);
+ CheckDlgButton(hDlg, IDC_GUI_RESIZE, gui_resize_enabled);
+ CheckDlgButton(hDlg, IDC_GUI_FULLSCREEN, gui_fullscreen > 0);
+ ew(hDlg, IDC_GUI_DARKMODE, os_win10 && !rp_isactive() && !darkModeForced);
+ if (!os_win10) {
+ gui_darkmode = 0;
+ }
+ if (darkModeForced > 0 || gui_darkmode > 0) {
+ CheckDlgButton(hDlg, IDC_GUI_DARKMODE, 1);
+ } else if (darkModeForced < 0 || gui_darkmode == 0) {
+ CheckDlgButton(hDlg, IDC_GUI_DARKMODE, 0);
+ } else {
+ CheckDlgButton(hDlg, IDC_GUI_DARKMODE, BST_INDETERMINATE);
+ }
+ ew(hDlg, IDC_GUI_RESIZE, gui_resize_allowed);
misc_scsi (hDlg);
misc_lang (hDlg);
static int recursive;
TCHAR tmp[MAX_DPATH];
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
if (recursive)
return FALSE;
recursive++;
gui_size_changed = 10;
break;
case IDC_GUI_FULLSCREEN:
- gui_fullscreen = ischecked (hDlg, IDC_GUI_FULLSCREEN);
+ gui_fullscreen = ischecked(hDlg, IDC_GUI_FULLSCREEN);
if (!gui_fullscreen) {
gui_fullscreen = -1;
getstoredguisize();
}
gui_size_changed = 10;
- break;
+ break;
+ case IDC_GUI_DARKMODE:
+ {
+ int v = IsDlgButtonChecked(hDlg, IDC_GUI_DARKMODE);
+ if (!rp_isactive() && !darkModeForced) {
+ if (v == BST_INDETERMINATE) {
+ gui_darkmode = -1;
+ } else if (v) {
+ gui_darkmode = 1;
+ } else {
+ gui_darkmode = 0;
+ }
+ regsetint(NULL, _T("GUIDarkMode"), gui_darkmode);
+ gui_size_changed = 10;
+ if (!full_property_sheet) {
+ WIN32GFX_DisplayChangeRequested(4);
+ }
+ }
+ }
+ break;
case IDC_ASSOCIATE_ON:
for (i = 0; exts[i].ext; i++)
exts[i].enabled = 1;
setstatefilename (hDlg);
break;
case IDC_DOLOADSTATE:
- if (DiskSelection(hDlg, wParam, 10, &workprefs, NULL, NULL))
+ if (DiskSelection(hDlg, wParam, 10, &workprefs, NULL, NULL)) {
savestate_state = STATE_DORESTORE;
- _tcscpy (workprefs.statefile, savestate_fname);
- setstatefilename (hDlg);
+ _tcscpy (workprefs.statefile, savestate_fname);
+ setstatefilename (hDlg);
+ }
break;
case IDC_INACTIVE_NOJOY:
if (!ischecked(hDlg, IDC_INACTIVE_NOJOY))
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg) {
case WM_INITDIALOG:
recursive++;
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg) {
case WM_INITDIALOG:
{
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return v;
+ }
+
switch (msg) {
case WM_INITDIALOG:
{
recursive--;
break;
}
- commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return v;
+ }
+
switch (msg) {
case WM_INITDIALOG:
recursive--;
break;
}
- commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return v;
+ }
+
switch (msg) {
case WM_INITDIALOG:
recursive--;
break;
}
- commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg) {
case WM_DROPFILES:
dragdrop (hDlg, (HDROP)wParam, &changed_prefs, -2);
break;
}
- commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg) {
case WM_INITDIALOG:
{
recursive--;
break;
}
- commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
if (uci->ci.type == UAEDEV_CD) {
memcpy (¤t_cddlg.ci, uci, sizeof (struct uaedev_config_info));
- if (CustomDialogBox (IDD_CDDRIVE, hDlg, CDDriveSettingsProc)) {
+ if (CustomCreateDialog(IDD_CDDRIVE, hDlg, CDDriveSettingsProc)) {
new_cddrive (hDlg, entry);
}
} else if (uci->ci.type == UAEDEV_TAPE) {
memcpy (¤t_tapedlg.ci, uci, sizeof (struct uaedev_config_info));
- if (CustomDialogBox (IDD_TAPEDRIVE, hDlg, TapeDriveSettingsProc)) {
+ if (CustomCreateDialog(IDD_TAPEDRIVE, hDlg, TapeDriveSettingsProc)) {
new_tapedrive (hDlg, entry);
}
}
{
current_hfdlg.forcedcylinders = uci->ci.highcyl;
memcpy (¤t_hfdlg.ci, uci, sizeof (struct uaedev_config_info));
- if (CustomDialogBox (IDD_HARDFILE, hDlg, HardfileSettingsProc)) {
+ if (CustomCreateDialog(IDD_HARDFILE, hDlg, HardfileSettingsProc)) {
new_hardfile (hDlg, entry);
}
}
else if (type == FILESYS_HARDDRIVE) /* harddisk */
{
memcpy (¤t_hfdlg.ci, uci, sizeof (struct uaedev_config_info));
- if (CustomDialogBox (IDD_HARDDRIVE, hDlg, HarddriveSettingsProc)) {
+ if (CustomCreateDialog(IDD_HARDDRIVE, hDlg, HarddriveSettingsProc)) {
new_harddrive (hDlg, entry);
}
}
{
memcpy (¤t_fsvdlg.ci, uci, sizeof (struct uaedev_config_info));
archivehd = -1;
- if (CustomDialogBox (IDD_FILESYS, hDlg, VolumeSettingsProc)) {
+ if (CustomCreateDialog(IDD_FILESYS, hDlg, VolumeSettingsProc)) {
new_filesys (hDlg, entry);
}
}
case IDC_NEW_FS:
default_fsvdlg (¤t_fsvdlg);
archivehd = 0;
- if (CustomDialogBox (IDD_FILESYS, hDlg, VolumeSettingsProc))
+ if (CustomCreateDialog(IDD_FILESYS, hDlg, VolumeSettingsProc))
new_filesys (hDlg, -1);
return 1;
case IDC_NEW_FSARCH:
archivehd = 1;
default_fsvdlg (¤t_fsvdlg);
- if (CustomDialogBox (IDD_FILESYS, hDlg, VolumeSettingsProc))
+ if (CustomCreateDialog(IDD_FILESYS, hDlg, VolumeSettingsProc))
new_filesys (hDlg, -1);
return 1;
case IDC_NEW_HF:
default_hfdlg (¤t_hfdlg, false);
- if (CustomDialogBox (IDD_HARDFILE, hDlg, HardfileSettingsProc))
+ if (CustomCreateDialog(IDD_HARDFILE, hDlg, HardfileSettingsProc))
new_hardfile (hDlg, -1);
return 1;
case IDC_NEW_CD:
- if (CustomDialogBox (IDD_CDDRIVE, hDlg, CDDriveSettingsProc))
+ if (CustomCreateDialog(IDD_CDDRIVE, hDlg, CDDriveSettingsProc))
new_cddrive (hDlg, -1);
return 1;
case IDC_NEW_TAPE:
default_tapedlg (¤t_tapedlg);
- if (CustomDialogBox (IDD_TAPEDRIVE, hDlg, TapeDriveSettingsProc))
+ if (CustomCreateDialog(IDD_TAPEDRIVE, hDlg, TapeDriveSettingsProc))
new_tapedrive (hDlg, -1);
return 1;
WIN32GUI_LoadUIString (IDS_NOHARDDRIVES, tmp, sizeof (tmp) / sizeof (TCHAR));
gui_message (tmp);
} else {
- if (CustomDialogBox (IDD_HARDDRIVE, hDlg, HarddriveSettingsProc))
+ if (CustomCreateDialog(IDD_HARDDRIVE, hDlg, HarddriveSettingsProc))
new_harddrive (hDlg, -1);
}
return 1;
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg) {
case WM_INITDIALOG:
clicked_entry = 0;
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
recursive++;
pages[GAMEPORTS_ID] = hDlg;
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
static void input_remapspecials(HWND hDlg)
{
- CustomDialogBox(IDD_LIST, hDlg, RemapSpecialsProc);
+ CustomCreateDialog(IDD_LIST, hDlg, RemapSpecialsProc);
}
static INT_PTR CALLBACK InputMapDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return v;
+ }
+
static int recursive;
HWND h = GetDlgItem (hDlg, IDC_INPUTMAPLIST);
TCHAR tmp[256];
break;
}
handlerawinput (hDlg, msg, wParam, lParam);
- commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return v;
+ }
+
static int recursive = 0;
HWND list = GetDlgItem (hDlg, IDC_LISTDIALOG_LIST);
-
switch (msg)
{
case WM_INITDIALOG:
recursive--;
break;
}
- commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
if (evt <= 0)
name[0] = 0;
- CustomDialogBox (IDD_LIST, hDlg, QualifierProc);
+ CustomCreateDialog(IDD_LIST, hDlg, QualifierProc);
#if 0
int item = genericpopupmenu (hDlg, names, mflags, MAX_INPUT_QUALIFIERS * 2);
if (item >= 0)
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_INITDIALOG:
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch(msg)
{
case WM_INITDIALOG:
}
TVhDlg = GetDlgItem (hDlg, IDC_PANELTREE);
+ SubclassTreeViewControl(TVhDlg);
SetWindowRedraw(TVhDlg, FALSE);
TreeView_SetImageList (TVhDlg, himl, TVSIL_NORMAL);
if (dialog_inhibit)
return 0;
+ bool handled;
+ INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
+ if (handled) {
+ return vv;
+ }
+
switch (msg)
{
case WM_DPICHANGED:
{
case IDC_ERRORLOG:
{
- CustomDialogBox (IDD_ERRORLOG, hDlg, ErrorLogProc);
+ CustomCreateDialog(IDD_ERRORLOG, hDlg, ErrorLogProc);
ShowWindow (GetDlgItem (guiDlg, IDC_ERRORLOG), is_error_log () ? SW_SHOW : SW_HIDE);
}
break;
}
break;
}
+
case WM_DWMCOMPOSITIONCHANGED:
- case WM_THEMECHANGED:
gui_size_changed = 1;
return 0;
}
return h;
}
-HWND CustomCreateDialog (int templ, HWND hDlg, DLGPROC proc)
+HWND CustomCreateDialog(int templ, HWND hDlg, DLGPROC proc)
{
struct newresource *res;
struct dlgcontext dctx;
regexists = regqueryint (NULL, _T("GUIResize"), &v);
gui_fullscreen = 0;
gui_resize_allowed = true;
+ v = -1;
+ regqueryint(NULL, _T("GUIDarkMode"), &v);
+ gui_darkmode = v;
+ if (rp_isactive()) {
+ v = -2;
+ }
+ InitializeDarkMode(v);
v = 0;
regqueryint(NULL, _T("GUIFullscreen"), &v);
if (v) {
if (!regexists) {
scaleresource_setdefaults(hwnd);
fmultx = 0;
- write_log (_T("GUI default size\n"));
- regsetint (NULL, _T("GUIResize"), 0);
- regsetint (NULL, _T("GUIFullscreen"), 0);
+ write_log(_T("GUI default size\n"));
+ regsetint(NULL, _T("GUIResize"), 0);
+ regsetint(NULL, _T("GUIFullscreen"), 0);
} else {
if (gui_width < MIN_GUI_INTERNAL_WIDTH || gui_width > 8192 || gui_height < MIN_GUI_INTERNAL_HEIGHT || gui_height > 8192) {
scaleresource_setdefaults(hwnd);
start_gui_height = h;
}
+ if (g_darkModeSupported && g_darkModeEnabled) {
+ BOOL value = TRUE;
+ DwmSetWindowAttribute(dhwnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(value));
+ }
setguititle (dhwnd);
RedrawWindow(dhwnd, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
ShowWindow (dhwnd, SW_SHOW);
#include "xwin.h"
#include "zfile.h"
+#include "darkmode.h"
+
#define MAX_GUI_FONTS 2
#define DEFAULT_FONTSIZE_OLD 8
#define DEFAULT_FONTSIZE_NEW 9
hwndDefButton = hwndCtrl;
dlgInfo->idResult = GetWindowLongPtrA(hwndCtrl, GWLP_ID);
}
+ if (g_darkModeSupported) {
+ _AllowDarkModeForWindow(hwndCtrl, g_darkModeEnabled);
+ if (g_darkModeEnabled) {
+ //write_log(_T("%s\n"), info.className);
+ if (!_tcsicmp(info.className, _T("Button"))) {
+ SubclassButtonControl(hwndCtrl);
+ } else if (!_tcsicmp(info.className, _T("ComboBox")) || !_tcsicmp(info.className, _T("Edit"))) {
+ SetWindowTheme(hwndCtrl, L"CFD", nullptr);
+ } else if (!_tcsicmp(info.className, _T("SysListView32")) || !_tcsicmp(info.className, _T("SysTreeView32"))) {
+ //
+ } else {
+ SetWindowTheme(hwndCtrl, L"Explorer", nullptr);
+ }
+ SendMessageW(hwndCtrl, WM_THEMECHANGED, 0, 0);
+ }
+ }
}
return TRUE;
}
mon_info.cbSize = sizeof(mon_info);
if (tmpl->style & DS_CENTER)
{
- monitor = MonitorFromWindow(owner ? owner : GetActiveWindow(), MONITOR_DEFAULTTOPRIMARY);
- GetMonitorInfoW(monitor, &mon_info);
- pos.x = (mon_info.rcWork.left + mon_info.rcWork.right - size.cx) / 2;
- pos.y = (mon_info.rcWork.top + mon_info.rcWork.bottom - size.cy) / 2;
+ if (!owner) {
+ monitor = MonitorFromWindow(owner ? owner : GetActiveWindow(), MONITOR_DEFAULTTOPRIMARY);
+ GetMonitorInfoW(monitor, &mon_info);
+ pos.x = (mon_info.rcWork.left + mon_info.rcWork.right - size.cx) / 2;
+ pos.y = (mon_info.rcWork.top + mon_info.rcWork.bottom - size.cy) / 2;
+ } else {
+ RECT r;
+ GetWindowRect(owner, &r);
+ pos.x = (r.left + r.right - size.cx) / 2;
+ pos.y = (r.top + r.bottom - size.cy) / 2;
+ }
}
else if (tmpl->style & DS_CENTERMOUSE)
{
if (dlgProc && dlgInfo->hUserFont)
SendMessage(hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0);
+ if (g_darkModeSupported) {
+ _AllowDarkModeForWindow(hwnd, g_darkModeEnabled);
+ }
+
/* Create controls */
if (createcontrols(hwnd, res))
return hwnd;
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;winio.lib;setupapi.lib;wininet.lib;shlwapi.lib;libpng16.lib;lglcd.lib;openal32.lib;portaudio_x86.lib;vfw32.lib;wtsapi32.lib;enet.lib;lzmalib.lib;prowizard.lib;libFLAC_static.lib;hid.lib;zlibstat.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;winio.lib;setupapi.lib;wininet.lib;shlwapi.lib;libpng16.lib;lglcd.lib;openal32.lib;portaudio_x86.lib;vfw32.lib;wtsapi32.lib;enet.lib;lzmalib.lib;prowizard.lib;libFLAC_static.lib;hid.lib;zlibstat.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;Dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\</AdditionalLibraryDirectories>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;winio.lib;setupapi.lib;wininet.lib;shlwapi.lib;libpng16.lib;lglcd.lib;openal32.lib;portaudio_x86.lib;vfw32.lib;wtsapi32.lib;enet.lib;lzmalib.lib;prowizard.lib;libFLAC_static.lib;hid.lib;zlibstat.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;winio.lib;setupapi.lib;wininet.lib;shlwapi.lib;libpng16.lib;lglcd.lib;openal32.lib;portaudio_x86.lib;vfw32.lib;wtsapi32.lib;enet.lib;lzmalib.lib;prowizard.lib;libFLAC_static.lib;hid.lib;zlibstat.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;Dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\</AdditionalLibraryDirectories>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;winio.lib;setupapi.lib;wininet.lib;shlwapi.lib;libpng16.lib;lglcd.lib;openal32.lib;portaudio_x86.lib;vfw32.lib;wtsapi32.lib;enet.lib;lzmalib.lib;prowizard.lib;libFLAC_static.lib;hid.lib;zlibstat.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;winio.lib;setupapi.lib;wininet.lib;shlwapi.lib;libpng16.lib;lglcd.lib;openal32.lib;portaudio_x86.lib;vfw32.lib;wtsapi32.lib;enet.lib;lzmalib.lib;prowizard.lib;libFLAC_static.lib;hid.lib;zlibstat.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;Dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\</AdditionalLibraryDirectories>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;Dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;Dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;Dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;Dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;Dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;Dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;winio.lib;setupapi.lib;wininet.lib;shlwapi.lib;libpng16.lib;lglcd.lib;openal32.lib;portaudio_x86.lib;vfw32.lib;wtsapi32.lib;enet.lib;lzmalib.lib;prowizard.lib;libFLAC_static.lib;hid.lib;zlibstat.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;winio.lib;setupapi.lib;wininet.lib;shlwapi.lib;libpng16.lib;lglcd.lib;openal32.lib;portaudio_x86.lib;vfw32.lib;wtsapi32.lib;enet.lib;lzmalib.lib;prowizard.lib;libFLAC_static.lib;hid.lib;zlibstat.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;Dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\</AdditionalLibraryDirectories>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;Dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;openal32.lib;libpng16.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;softfloat.lib;gdiplus.lib;effects11.lib;Msimg32.lib;Dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<ClCompile Include="..\caps\caps_win32.cpp" />
<ClCompile Include="..\cda_play.cpp" />
<ClCompile Include="..\clipboard_win32.cpp" />
+ <ClCompile Include="..\darkmode.cpp" />
<ClCompile Include="..\debug_win32.cpp" />
<ClCompile Include="..\dinput.cpp" />
<ClCompile Include="..\direct3d.cpp" />
<ClCompile Include="..\gdirender.cpp">
<Filter>win32</Filter>
</ClCompile>
+ <ClCompile Include="..\darkmode.cpp">
+ <Filter>win32</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\resources\35floppy.ico">