Skip to content

Commit 581df78

Browse files
lostindarkCopilot
andcommitted
Update darkmodelib to latest upstream
Upstream win32-darkmodelib was updated with several commits including a breaking rename: - 9573105: DarkModeSubclass -> Darkmodelib, namespace DarkMode -> dmlib - Multiple tab/up-down/combo polish commits - Fix warnings, clang-tidy cleanup Updates: - Renamed darkmodelib/DarkModeSubclass.h/cpp -> Darkmodelib.h/cpp - Updated src/DarkMode.cpp and src/Notepad4.cpp: - #include "DarkModeSubclass.h" -> #include "Darkmodelib.h" - DarkMode:: -> dmlib:: - Updated build/VisualStudio/Notepad4.vcxproj file references - Refreshed all other darkmodelib files from upstream MinGW Makefile uses wildcards so no makefile change needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9fc61aa commit 581df78

18 files changed

Lines changed: 1548 additions & 1259 deletions

build/VisualStudio/Notepad4.vcxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="AVX2Debug|x64">
@@ -593,7 +593,7 @@
593593
<ClCompile Include="..\..\src\Notepad4.cpp" />
594594
<ClCompile Include="..\..\src\Styles.cpp" />
595595
<ClCompile Include="..\..\src\DarkMode.cpp" />
596-
<ClCompile Include="..\..\darkmodelib\DarkModeSubclass.cpp" />
596+
<ClCompile Include="..\..\darkmodelib\Darkmodelib.cpp" />
597597
<ClCompile Include="..\..\darkmodelib\DmlibColor.cpp" />
598598
<ClCompile Include="..\..\darkmodelib\DmlibDpi.cpp" />
599599
<ClCompile Include="..\..\darkmodelib\DmlibHook.cpp" />
@@ -769,7 +769,7 @@
769769
<ClInclude Include="..\..\src\SciCall.h" />
770770
<ClInclude Include="..\..\src\Styles.h" />
771771
<ClInclude Include="..\..\src\DarkMode.h" />
772-
<ClInclude Include="..\..\darkmodelib\DarkModeSubclass.h" />
772+
<ClInclude Include="..\..\darkmodelib\Darkmodelib.h" />
773773
<ClInclude Include="..\..\src\Version.h" />
774774
<ClInclude Include="..\..\src\VersionRev.h" />
775775
</ItemGroup>
Lines changed: 712 additions & 679 deletions
Large diffs are not rendered by default.
Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,22 @@
4141
#define DMLIB_API
4242
#endif
4343

44+
#if defined(__clang__)
45+
#pragma clang diagnostic push
46+
// identifier '_TASKDIALOGCONFIG' is reserved because it starts with '_' followed by a capital letter
47+
#pragma clang diagnostic ignored "-Wreserved-identifier"
48+
#endif
49+
4450
typedef struct _TASKDIALOGCONFIG TASKDIALOGCONFIG; // forward declaration, from <CommCtrl.h>
4551

52+
#if defined(__clang__)
53+
#pragma clang diagnostic pop
54+
#endif
4655
/**
47-
* @namespace DarkMode
56+
* @namespace dmlib
4857
* @brief Provides dark mode theming, subclassing, and rendering utilities for most Win32 controls.
4958
*/
50-
namespace DarkMode
59+
namespace dmlib
5160
{
5261
struct Colors
5362
{
@@ -117,9 +126,9 @@ namespace DarkMode
117126
* - `light`: Light mode appearance.
118127
* - `dark`: Dark mode appearance.
119128
*
120-
* Set via configuration and used by style evaluators (e.g. @ref DarkMode::calculateTreeViewStyle).
129+
* Set via configuration and used by style evaluators (e.g. @ref dmlib::calculateTreeViewStyle).
121130
*
122-
* @see DarkMode::calculateTreeViewStyle()
131+
* @see dmlib::calculateTreeViewStyle()
123132
*/
124133
enum class TreeViewStyle : unsigned char
125134
{
@@ -131,10 +140,10 @@ namespace DarkMode
131140
/**
132141
* @brief Describes metadata fields and compile-time features of the dark mode library.
133142
*
134-
* Values of this enum are used with @ref DarkMode::getLibInfo to retrieve version numbers and
143+
* Values of this enum are used with @ref dmlib::getLibInfo to retrieve version numbers and
135144
* determine whether specific features were enabled during compilation.
136145
*
137-
* @see DarkMode::getLibInfo()
146+
* @see dmlib::getLibInfo()
138147
*/
139148
enum class LibInfo : unsigned char
140149
{
@@ -153,13 +162,13 @@ namespace DarkMode
153162
/**
154163
* @brief Defines the available dark mode types for manual configurations.
155164
*
156-
* Can be used in `DarkMode::initDarkModeConfig` and in `DarkMode::setDarkModeConfigEx`
165+
* Can be used in `dmlib::initDarkModeConfig` and in `dmlib::setDarkModeConfigEx`
157166
* with static_cast<UINT>(DarkModeType::'value').
158167
*
159168
* @note Also used internally to distinguish between light, dark, and classic modes.
160169
*
161-
* @see DarkMode::initDarkModeConfig()
162-
* @see DarkMode::setDarkModeConfigEx()
170+
* @see dmlib::initDarkModeConfig()
171+
* @see dmlib::setDarkModeConfigEx()
163172
*/
164173
enum class DarkModeType : unsigned char
165174
{
@@ -471,7 +480,7 @@ namespace DarkMode
471480

472481
/// Applies theming and/or subclassing to all child controls of a parent window.
473482
DMLIB_API void setChildCtrlsSubclassAndThemeEx(HWND hParent, bool subclass, bool theme);
474-
/// Wrapper for `DarkMode::setChildCtrlsSubclassAndThemeEx`.
483+
/// Wrapper for `dmlib::setChildCtrlsSubclassAndThemeEx`.
475484
DMLIB_API void setChildCtrlsSubclassAndTheme(HWND hParent);
476485
/// Applies theming to all child controls of a parent window.
477486
DMLIB_API void setChildCtrlsTheme(HWND hParent);
@@ -528,7 +537,7 @@ namespace DarkMode
528537
/// Applies "DarkMode_Explorer" visual style to scroll bars.
529538
DMLIB_API void setDarkScrollBar(HWND hWnd);
530539
/// Applies "DarkMode_Explorer" visual style to tooltip controls based on context.
531-
DMLIB_API void setDarkTooltips(HWND hWnd, int tooltipType);
540+
DMLIB_API void setDarkTooltips(HWND hWnd, UINT tooltipType);
532541
/// Applies "DarkMode_DarkTheme" visual style if supported and experimental mode is active.
533542
DMLIB_API void setDarkThemeTheme(HWND hWnd);
534543

@@ -708,7 +717,7 @@ namespace DarkMode
708717
*
709718
* CHOOSEFONT cf{};
710719
* cf.Flags |= CF_ENABLEHOOK | CF_ENABLETEMPLATE;
711-
* cf.lpfnHook = static_cast<LPCFHOOKPROC>(DarkMode::HookDlgProc);
720+
* cf.lpfnHook = static_cast<LPCFHOOKPROC>(dmlib::HookDlgProc);
712721
* cf.hInstance = GetModuleHandle(nullptr);
713722
* cf.lpTemplateName = MAKEINTRESOURCE(IDD_DARK_FONT_DIALOG);
714723
* ```
@@ -731,7 +740,7 @@ namespace DarkMode
731740
* @brief Wrapper for `TaskDialogIndirect` with dark mode support.
732741
*
733742
* Parameters are same as for `TaskDialogIndirect`.
734-
* Should be used with `DarkMode::setDarkTaskDlg`
743+
* Should be used with `dmlib::setDarkTaskDlg`
735744
* used in task dialog callback procedure.
736745
*
737746
* ## Example of Callback Procedure
@@ -746,27 +755,25 @@ namespace DarkMode
746755
* {
747756
* if (uMsg == TDN_DIALOG_CONSTRUCTED)
748757
* {
749-
* DarkMode::setDarkTaskDlg(hWnd);
758+
* dmlib::setDarkTaskDlg(hWnd);
750759
* }
751760
* return S_OK;
752761
* }
753762
* ```
754763
*
755-
* @see DarkMode::DarkTaskDlgCallback()
756-
* @see DarkMode::setDarkTaskDlg()
764+
* @see dmlib::DarkTaskDlgCallback()
765+
* @see dmlib::setDarkTaskDlg()
757766
*/
758767
DMLIB_API HRESULT darkTaskDialogIndirect(const TASKDIALOGCONFIG* pTaskConfig, int* pnButton, int* pnRadioButton, BOOL* pfVerificationFlagChecked);
759768

760-
/**
761-
* @brief Displays a message box as task dialog with themed styling.
762-
*/
769+
/// Displays a message box as task dialog with themed styling.
763770
DMLIB_API HRESULT darkMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
764771

765772
#ifdef __cplusplus
766773
} // extern "C"
767774
#endif
768775

769-
} // namespace DarkMode
776+
} // namespace dmlib
770777

771778
#else
772779
#define _DARKMODELIB_NOT_USED

darkmodelib/DmlibColor.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MPL-2.0
22

33
/*
4-
* Copyright (c) 2025 ozone10
4+
* Copyright (c) 2025-2026 ozone10
55
* This Source Code Form is subject to the terms of the Mozilla Public
66
* License, v. 2.0. If a copy of the MPL was not distributed with this
77
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
@@ -19,16 +19,16 @@
1919

2020
#include <cmath>
2121

22-
#include "DarkModeSubclass.h"
22+
#include "Darkmodelib.h"
2323

2424
namespace dmlib_win32api
2525
{
2626
[[nodiscard]] bool IsDarkModeActive() noexcept;
27-
}
27+
} // namespace dmlib_win32api
2828

29-
DarkMode::Colors dmlib_color::getLightColors() noexcept
29+
dmlib::Colors dmlib_color::getLightColors() noexcept
3030
{
31-
return DarkMode::Colors{
31+
return dmlib::Colors{
3232
::GetSysColor(COLOR_3DFACE), // background
3333
::GetSysColor(COLOR_WINDOW), // ctrlBackground
3434
dmlib_color::HEXRGB(0xC0DCF3), // hotBackground
@@ -115,12 +115,10 @@ static COLORREF adjustClrLightness(COLORREF clr, bool useDark) noexcept
115115
l += luminanceAdjustment;
116116
return useDark ? ::ColorHLSToRGB(h, l, s) : clr;
117117
}
118-
else
119-
{
120-
s += saturationAdjustment;
121-
l -= luminanceAdjustment;
122-
return useDark ? clr : ::ColorHLSToRGB(h, l, s);
123-
}
118+
119+
s += saturationAdjustment;
120+
l -= luminanceAdjustment;
121+
return useDark ? clr : ::ColorHLSToRGB(h, l, s);
124122
}
125123

126124
COLORREF dmlib_color::getAccentColor(bool adjust) noexcept

0 commit comments

Comments
 (0)