Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhReInitializeTheme: runtime theme switching on ImmersiveColorSet message #2284

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d7c9146
Moved delayhook to phlib
DartVanya Nov 17, 2024
41e2bb4
Merge branch 'master' into master-dm
DartVanya Nov 18, 2024
f754e7b
objmgr cleanup and fixes
DartVanya Nov 18, 2024
5c82999
memsrcht show memory editor on double click
DartVanya Nov 18, 2024
a8177bc
Improve PhUiCloseHandles for protected handles
DartVanya Nov 18, 2024
c7ee979
theme custom colors cleanup
DartVanya Nov 18, 2024
9fa8c81
objmgr cleanup and improvements
DartVanya Nov 20, 2024
1b8c82a
Merge branch 'master' into master-dm
DartVanya Nov 20, 2024
b297c03
fix PhIsThemeTransparencyEnabled
DartVanya Nov 20, 2024
4aa8cab
PhReInitializeTheme: runtime theme switching on ImmersiveColorSet mes…
DartVanya Nov 22, 2024
53fe931
Merge branch 'master' into master-dm
DartVanya Nov 22, 2024
165f3a5
fix #2074
DartVanya Nov 22, 2024
b23b560
remove objmgr code
DartVanya Nov 23, 2024
114546f
Merge branch 'master' into master-dm
DartVanya Nov 23, 2024
f43888b
fix combo bug and cleanup indents
DartVanya Nov 23, 2024
64b39b8
move a8177bc4acb7c3da02d61e9c74d3c62db4da3580 to objmgr branch
DartVanya Nov 26, 2024
097d175
Merge branch 'winsiderss:master' into master-dm
DartVanya Nov 26, 2024
30442be
Merge branch 'master' into master-dm
DartVanya Nov 26, 2024
68e0704
moved hndlmenu to objmgr branch
DartVanya Nov 26, 2024
72e8930
fix SysLink color in TaskDialog on Windows 10
DartVanya Nov 28, 2024
5b0d7a9
Merge branch 'master' into master-dm
DartVanya Nov 28, 2024
b2d0b61
Merge branch 'master' into master-dm
DartVanya Nov 28, 2024
25bf4ff
Merge branch 'master' into master-dm
DartVanya Nov 29, 2024
db6ddb6
Merge branch 'master' into master-dm
DartVanya Dec 3, 2024
e4f0436
resolve conflicts and general cleanup
DartVanya Dec 3, 2024
b9752a8
Merge branch 'master' into master-dm
DartVanya Dec 3, 2024
791f590
Transition to IListView
DartVanya Dec 4, 2024
b9ac48c
hndlprp.h
DartVanya Dec 4, 2024
0919898
WindowExplorer auto refresh on find
DartVanya Dec 4, 2024
318e6a8
Merge branch 'master' into master-dm
DartVanya Dec 5, 2024
3f57779
Merge branch 'master' into master-dm
DartVanya Dec 5, 2024
309a514
fix PhOpenDriver regression from 95bc2fe8c1a077aeb2103c076e3991683294…
DartVanya Dec 5, 2024
64bc003
Merge branch 'master-temp' into master-dm
DartVanya Dec 5, 2024
ebac1fa
Improve streamer mode for ComboBox and ToolTips
DartVanya Dec 5, 2024
2348d01
Merge branch 'master' into master-dm
DartVanya Dec 9, 2024
2a49e11
Merge branch 'master' into master-dm
DartVanya Dec 10, 2024
5a58e99
Merge branch 'master' into master-dm
DartVanya Dec 10, 2024
69e87b9
delayhook automatic tooltip theme
DartVanya Dec 11, 2024
dfd11b5
fix graph automatic theme switching
DartVanya Dec 12, 2024
dafd8fc
graph fix new colors in dark theme
DartVanya Dec 12, 2024
3971519
[test] graph old colors - use theme colors for background and grid
DartVanya Dec 12, 2024
e4210cb
chcol ListBox fix dynamic theme switching
DartVanya Dec 17, 2024
edf884f
improve ListView group header drawing
DartVanya Dec 18, 2024
0c07b10
Merge branch 'master' into master-dm
DartVanya Jan 28, 2025
280a677
Merge branch 'master' into master-dm
DartVanya Jan 28, 2025
807a00a
objprp ListView indexes cleanup
DartVanya Jan 29, 2025
c8d8ee2
fix ForceNoParent for handle prop
DartVanya Jan 29, 2025
284fddd
Merge branch 'master' into master-dm
DartVanya Jan 29, 2025
e1d46b2
Merge branch 'master' into master-dm
DartVanya Mar 23, 2025
80b9219
Fix build, fix objmgr regressions, implement StatusBar
DartVanya Mar 23, 2025
a0a81ed
Merge branch 'master' into master-dm
DartVanya Mar 23, 2025
8faec91
Merge branch 'master' into master-dm
DartVanya Mar 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Moved delayhook to phlib
- phlib PhIsThemeSupportEnabled, exported for plugins.
- New option EnableThemeUseWindowsTheme - Use Windows app color mode. On default settings PH will use current Windows theme.
- New option EnableThemeTabBorders (default 0).
DartVanya committed Nov 17, 2024
commit d7c9146ab0a59f3bc1bd2a6c2ab0ab32d679536f
3 changes: 3 additions & 0 deletions SystemInformer/SystemInformer.def
Original file line number Diff line number Diff line change
@@ -916,6 +916,8 @@ EXPORTS
PhStdGetClientIdName @1857 NONAME
PhCallKphQueryFileInformationWithTimeout @1858 NONAME
PhGetSectionFileName @1859 NONAME
PhCreateHandleItem @2056 NONAME
PhShowHandlePropertiesEx @2057 NONAME

; lsasup
PhEnumeratePrivileges @1860 NONAME
@@ -976,6 +978,7 @@ EXPORTS
PhSetStringRefSetting @1909 NONAME
PhSaveSettings @1910 NONAME
PhUpdateCachedSettings @1911 NONAME
PhIsThemeSupportEnabled @2058 NONAME

; secedit
PhCreateSecurityPage @1912 NONAME
1 change: 0 additions & 1 deletion SystemInformer/SystemInformer.vcxproj
Original file line number Diff line number Diff line change
@@ -451,7 +451,6 @@
<ClCompile Include="colmgr.c" />
<ClCompile Include="colsetmgr.c" />
<ClCompile Include="dbgcon.c" />
<ClCompile Include="delayhook.c" />
<ClCompile Include="delayload.c" />
<ClCompile Include="devprv.c" />
<ClCompile Include="extmgr.c" />
3 changes: 0 additions & 3 deletions SystemInformer/SystemInformer.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -315,9 +315,6 @@
<ClCompile Include="ksisup.c">
<Filter>System Informer</Filter>
</ClCompile>
<ClCompile Include="delayhook.c">
<Filter>System Informer</Filter>
</ClCompile>
<ClCompile Include="ksyscall.c">
<Filter>System Informer</Filter>
</ClCompile>
2 changes: 1 addition & 1 deletion SystemInformer/chcol.c
Original file line number Diff line number Diff line change
@@ -261,7 +261,7 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
Button_Enable(context->MoveUpHandle, FALSE);
Button_Enable(context->MoveDownHandle, FALSE);

if (PhGetIntegerSetting(L"EnableThemeSupport"))
if (PhEnableThemeSupport)
{
context->BrushNormal = CreateSolidBrush(PhThemeWindowBackgroundColor);
context->BrushHot = CreateSolidBrush(PhThemeWindowHighlightColor);
2 changes: 1 addition & 1 deletion SystemInformer/main.c
Original file line number Diff line number Diff line change
@@ -1198,7 +1198,7 @@ VOID PhpInitializeSettings(
for (ULONG i = 0; i < PhMaxPrecisionUnit; i++)
PhMaxPrecisionLimit /= 10;
PhEnableWindowText = !!PhGetIntegerSetting(L"EnableWindowText");
PhEnableThemeSupport = !!PhGetIntegerSetting(L"EnableThemeSupport");
PhEnableThemeSupport = PhIsThemeSupportEnabled();
PhThemeWindowForegroundColor = PhGetIntegerSetting(L"ThemeWindowForegroundColor");
PhThemeWindowBackgroundColor = PhGetIntegerSetting(L"ThemeWindowBackgroundColor");
PhThemeWindowBackground2Color = PhGetIntegerSetting(L"ThemeWindowBackground2Color");
2 changes: 1 addition & 1 deletion SystemInformer/memedit.c
Original file line number Diff line number Diff line change
@@ -312,7 +312,7 @@ INT_PTR CALLBACK PhpMemoryEditorDlgProc(
}
}

PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);

context->LoadCompleted = TRUE;
}
8 changes: 6 additions & 2 deletions SystemInformer/options.c
Original file line number Diff line number Diff line change
@@ -1401,6 +1401,7 @@ typedef enum _PHP_OPTIONS_INDEX
PHP_OPTIONS_INDEX_ENABLE_MEMSTRINGS_TREE,
PHP_OPTIONS_INDEX_ENABLE_LASTTAB_SUPPORT,
PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT,
PHP_OPTIONS_INDEX_ENABLE_THEME_WINDOWS_THEME,
PHP_OPTIONS_INDEX_ENABLE_START_ASADMIN,
PHP_OPTIONS_INDEX_ENABLE_STREAM_MODE,
PHP_OPTIONS_INDEX_ENABLE_SILENT_CRASH_NOTIFY,
@@ -1452,7 +1453,8 @@ static VOID PhpAdvancedPageLoad(
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_MINIINFO_WINDOW, L"Enable tray information window", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_MEMSTRINGS_TREE, L"Enable new memory strings dialog", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_LASTTAB_SUPPORT, L"Remember last selected window", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT, L"Enable theme support (experimental)", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT, L"Enable theme support", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_WINDOWS_THEME, L"Use Windows app color mode", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_START_ASADMIN, L"Enable start as admin (experimental)", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_STREAM_MODE, L"Enable streamer mode (disable window capture) (experimental)", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_SILENT_CRASH_NOTIFY, L"Enable silent crash notification (experimental)", NULL);
@@ -1484,6 +1486,7 @@ static VOID PhpAdvancedPageLoad(
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_GRAPH_SCALING, L"EnableGraphMaxScale");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_CYCLE_CPU_USAGE, L"EnableCycleCpuUsage");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT, L"EnableThemeSupport");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_WINDOWS_THEME, L"EnableThemeUseWindowsTheme");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_START_ASADMIN, L"EnableStartAsAdmin");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_STREAM_MODE, L"EnableStreamerMode");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_SILENT_CRASH_NOTIFY, L"EnableSilentCrashNotify");
@@ -1675,6 +1678,7 @@ static VOID PhpAdvancedPageSave(
SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_GRAPH_SCALING, L"EnableGraphMaxScale");
SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_CYCLE_CPU_USAGE, L"EnableCycleCpuUsage");
SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT, L"EnableThemeSupport");
SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_WINDOWS_THEME, L"EnableThemeUseWindowsTheme");
SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_START_ASADMIN, L"EnableStartAsAdmin");
SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_STREAM_MODE, L"EnableStreamerMode");
SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_SILENT_CRASH_NOTIFY, L"EnableSilentCrashNotify");
@@ -1691,7 +1695,7 @@ static VOID PhpAdvancedPageSave(
SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_PROPAGATE_CPU_USAGE, L"PropagateCpuUsage");
SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_SHOW_ADVANCED_OPTIONS, L"EnableAdvancedOptions");

if (PhGetIntegerSetting(L"EnableThemeSupport"))
if (PhEnableThemeSupport)
{
PhSetIntegerSetting(L"GraphColorMode", 1); // HACK switch to dark theme. (dmex)
}
4 changes: 3 additions & 1 deletion SystemInformer/settings.c
Original file line number Diff line number Diff line change
@@ -78,11 +78,13 @@ VOID PhAddDefaultSettings(
PhpAddIntegerSetting(L"EnableShutdownCriticalMenu", L"0");
PhpAddIntegerSetting(L"EnableShutdownBootMenu", L"1");
PhpAddIntegerSetting(L"EnableSilentCrashNotify", L"0");
PhpAddIntegerSetting(L"EnableThemeSupport", L"0");
PhpAddIntegerSetting(L"EnableThemeSupport", L"1");
PhpAddIntegerSetting(L"EnableThemeUseWindowsTheme", L"1");
PhpAddIntegerSetting(L"EnableThemeAcrylicSupport", L"0");
PhpAddIntegerSetting(L"EnableThemeAcrylicWindowSupport", L"0");
PhpAddIntegerSetting(L"EnableThemeAnimation", L"1");
PhpAddIntegerSetting(L"EnableThemeNativeButtons", L"0");
PhpAddIntegerSetting(L"EnableThemeTabBorders", L"0");
PhpAddIntegerSetting(L"ThemeWindowForegroundColor", L"1c1c1c"); // RGB(28, 28, 28)
PhpAddIntegerSetting(L"ThemeWindowBackgroundColor", L"2b2b2b"); // RGB(43, 43, 43)
PhpAddIntegerSetting(L"ThemeWindowBackground2Color", L"414141"); // RGB(65, 65, 65)
36 changes: 19 additions & 17 deletions SystemInformer/delayhook.c → phlib/delayhook.c
Original file line number Diff line number Diff line change
@@ -5,11 +5,14 @@
*
* Authors:
*
* dmex 2022-2023
* dmex 2022-2023
* Dart Vanya 2024
*
*/

#include <phapp.h>
#include <ph.h>
#include <guisup.h>
#include <treenew.h>
#include <apiimport.h>
#include <mapldr.h>
#include <thirdparty.h>
@@ -28,9 +31,6 @@ static WNDPROC PhDefaultStaticWindowProcedure = NULL;
static WNDPROC PhDefaultStatusbarWindowProcedure = NULL;
static WNDPROC PhDefaultEditWindowProcedure = NULL;
static WNDPROC PhDefaultHeaderWindowProcedure = NULL;
static BOOLEAN PhDefaultEnableStreamerMode = FALSE;
static BOOLEAN PhDefaultEnableThemeAcrylicWindowSupport = FALSE;
static BOOLEAN PhDefaultEnableThemeAnimation = FALSE;

LRESULT CALLBACK PhMenuWindowHookProcedure(
_In_ HWND WindowHandle,
@@ -62,7 +62,7 @@ LRESULT CALLBACK PhMenuWindowHookProcedure(
{
//CREATESTRUCT* createStruct = (CREATESTRUCT*)lParam;

if (PhDefaultEnableStreamerMode)
if (PhEnableStreamerMode)
{
if (SetWindowDisplayAffinity_Import())
SetWindowDisplayAffinity_Import()(WindowHandle, WDA_EXCLUDEFROMCAPTURE);
@@ -115,13 +115,13 @@ LRESULT CALLBACK PhDialogWindowHookProcedure(

if (WindowHandle == GetAncestor(WindowHandle, GA_ROOT))
{
if (PhDefaultEnableStreamerMode)
if (PhEnableStreamerMode)
{
if (SetWindowDisplayAffinity_Import())
SetWindowDisplayAffinity_Import()(WindowHandle, WDA_EXCLUDEFROMCAPTURE);
}

if (PhEnableThemeSupport && PhDefaultEnableThemeAcrylicWindowSupport)
if (PhEnableThemeSupport && PhEnableThemeAcrylicWindowSupport)
{
// Note: DWM crashes if called from WM_NCCREATE (dmex)
PhSetWindowAcrylicCompositionColor(WindowHandle, MakeABGRFromCOLORREF(0, RGB(10, 10, 10)));
@@ -176,7 +176,7 @@ LRESULT CALLBACK PhComboBoxWindowHookProcedure(

if (SendMessage(WindowHandle, CB_GETCOMBOBOXINFO, 0, (LPARAM)&info))
{
if (PhDefaultEnableStreamerMode)
if (PhEnableStreamerMode)
{
if (SetWindowDisplayAffinity_Import())
SetWindowDisplayAffinity_Import()(info.hwndList, WDA_EXCLUDEFROMCAPTURE);
@@ -1578,13 +1578,13 @@ HWND PhCreateWindowExHook(

if (Parent == NULL)
{
if (PhDefaultEnableStreamerMode)
if (PhEnableStreamerMode)
{
if (SetWindowDisplayAffinity_Import())
SetWindowDisplayAffinity_Import()(windowHandle, WDA_EXCLUDEFROMCAPTURE);
}

if (PhEnableThemeSupport && PhDefaultEnableThemeAcrylicWindowSupport)
if (PhEnableThemeSupport && PhEnableThemeAcrylicWindowSupport)
{
PhSetWindowAcrylicCompositionColor(windowHandle, MakeABGRFromCOLORREF(0, RGB(10, 10, 10)));
}
@@ -1867,7 +1867,7 @@ BOOLEAN CALLBACK PhInitializeTaskDialogTheme(

if (CallbackData && !windowHasContext)
{
if (PhDefaultEnableStreamerMode)
if (PhEnableStreamerMode)
{
if (SetWindowDisplayAffinity_Import())
SetWindowDisplayAffinity_Import()(WindowHandle, WDA_EXCLUDEFROMCAPTURE);
@@ -2093,7 +2093,7 @@ VOID PhRegisterDetoursHooks(
goto CleanupExit;
if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultDrawThemeBackgroundEx, (PVOID)PhDrawThemeBackgroundExHook)))
goto CleanupExit;
if (!PhDefaultEnableThemeAnimation)
if (!PhEnableThemeAnimation)
{
if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultSystemParametersInfo, (PVOID)PhSystemParametersInfoHook)))
goto CleanupExit;
@@ -2151,21 +2151,23 @@ VOID PhInitializeSuperclassControls(
VOID
)
{
PhDefaultEnableStreamerMode = !!PhGetIntegerSetting(L"EnableStreamerMode");
PhEnableStreamerMode = !!PhGetIntegerSetting(L"EnableStreamerMode");

if (PhEnableThemeAcrylicSupport && !PhEnableThemeSupport)
PhEnableThemeAcrylicSupport = FALSE;
if (PhEnableThemeAcrylicSupport)
PhEnableThemeAcrylicSupport = PhIsThemeTransparencyEnabled();

if (PhEnableThemeSupport || PhDefaultEnableStreamerMode)
if (PhEnableThemeSupport || PhEnableStreamerMode)
{
if (WindowsVersion >= WINDOWS_11)
{
PhDefaultEnableThemeAcrylicWindowSupport = !!PhGetIntegerSetting(L"EnableThemeAcrylicWindowSupport");
PhEnableThemeAcrylicWindowSupport = !!PhGetIntegerSetting(L"EnableThemeAcrylicWindowSupport");
}

PhDefaultEnableThemeAnimation = !!PhGetIntegerSetting(L"EnableThemeAnimation");
PhEnableThemeAnimation = !!PhGetIntegerSetting(L"EnableThemeAnimation");
PhEnableThemeNativeButtons = !!PhGetIntegerSetting(L"EnableThemeNativeButtons");
PhEnableThemeTabBorders = !!PhGetIntegerSetting(L"EnableThemeTabBorders");

PhRegisterDialogSuperClass();
PhRegisterMenuSuperClass();
44 changes: 44 additions & 0 deletions phlib/guisup.c
Original file line number Diff line number Diff line change
@@ -76,6 +76,11 @@ static _DrawThemeBackground DrawThemeBackground_I = NULL;
static _DrawThemeTextEx DrawThemeTextEx_I = NULL;
static _AllowDarkModeForWindow AllowDarkModeForWindow_I = NULL; // Win10-RS5 (uxtheme.dll ordinal 133)
static _IsDarkModeAllowedForWindow IsDarkModeAllowedForWindow_I = NULL; // Win10-RS5 (uxtheme.dll ordinal 137)
static _ShouldAppsUseDarkMode ShouldAppsUseDarkMode_I = NULL; // Win10-RS5 (uxtheme.dll ordinal 132)
// Win10-RS5 (uxtheme.dll ordinal 135)
// Win10 build 17763: AllowDarkModeForApp(BOOL)
// Win10 build 18334: SetPreferredAppMode(enum PreferredAppMode)
static _SetPreferredAppMode SetPreferredAppMode_I = NULL;
static _GetDpiForMonitor GetDpiForMonitor_I = NULL; // win81+
static _GetDpiForWindow GetDpiForWindow_I = NULL; // win10rs1+
static _GetDpiForSystem GetDpiForSystem_I = NULL; // win10rs1+
@@ -127,6 +132,8 @@ VOID PhGuiSupportInitialization(
{
AllowDarkModeForWindow_I = PhGetDllBaseProcedureAddress(baseAddress, NULL, 133);
IsDarkModeAllowedForWindow_I = PhGetDllBaseProcedureAddress(baseAddress, NULL, 137);
ShouldAppsUseDarkMode_I = PhGetDllBaseProcedureAddress(baseAddress, NULL, 132);
SetPreferredAppMode_I = PhGetDllBaseProcedureAddress(baseAddress, NULL, 135);
}
}

@@ -428,6 +435,43 @@ BOOLEAN PhIsDarkModeAllowedForWindow(
return !!IsDarkModeAllowedForWindow_I(WindowHandle);
}

BOOLEAN PhShouldAppsUseDarkMode(
VOID
)
{
if (!ShouldAppsUseDarkMode_I)
return FALSE;

return !!ShouldAppsUseDarkMode_I();
}

BOOLEAN PhIsThemeSupportEnabled(
VOID
)
{
if (PhGetIntegerSetting(L"EnableThemeSupport"))
{
if (PhGetIntegerSetting(L"EnableThemeUseWindowsTheme"))
return PhShouldAppsUseDarkMode();
else
return TRUE;
}
else
{
return FALSE;
}
}

BOOLEAN PhSetPreferredAppMode(
_In_ PreferredAppMode AppMode
)
{
if (!SetPreferredAppMode_I)
return FALSE;

return !!SetPreferredAppMode_I(AppMode);
}

// rev from EtwRundown.dll!EtwpLogDPISettingsInfo (dmex)
//LONG PhGetUserOrMachineDpi(
// VOID
38 changes: 38 additions & 0 deletions phlib/include/guisup.h
Original file line number Diff line number Diff line change
@@ -223,6 +223,34 @@ PhIsDarkModeAllowedForWindow(
_In_ HWND WindowHandle
);

PHLIBAPI
BOOLEAN
NTAPI
PhShouldAppsUseDarkMode(
VOID
);

PHLIBAPI
BOOLEAN
NTAPI
PhIsThemeSupportEnabled(
VOID
);

typedef enum _PreferredAppMode
{
PreferredAppModeDisabled,
PreferredAppModeDarkOnDark,
PreferredAppModeDarkAlways
} PreferredAppMode;

PHLIBAPI
BOOLEAN
NTAPI
PhSetPreferredAppMode(
_In_ PreferredAppMode AppMode
);

PHLIBAPI
BOOLEAN
NTAPI
@@ -2092,6 +2120,9 @@ extern BOOLEAN PhEnableThemeSupport;
extern BOOLEAN PhEnableThemeAcrylicSupport;
extern BOOLEAN PhEnableThemeAcrylicWindowSupport;
extern BOOLEAN PhEnableThemeNativeButtons;
extern BOOLEAN PhEnableThemeTabBorders;
extern BOOLEAN PhEnableThemeAnimation;
extern BOOLEAN PhEnableStreamerMode;
extern BOOLEAN PhEnableThemeListviewBorder;
extern COLORREF PhThemeWindowForegroundColor;
extern COLORREF PhThemeWindowBackgroundColor;
@@ -2183,6 +2214,13 @@ PhThemeWindowDrawToolbar(
_In_ LPNMTBCUSTOMDRAW DrawInfo
);

PHLIBAPI
VOID
CALLBACK
PhInitializeSuperclassControls(
VOID
);

// Font support

FORCEINLINE
8 changes: 8 additions & 0 deletions phlib/include/guisupp.h
Original file line number Diff line number Diff line change
@@ -118,6 +118,14 @@ typedef BOOL(WINAPI* _IsDarkModeAllowedForWindow)(
_In_ HWND WindowHandle
);

typedef BOOL(WINAPI* _ShouldAppsUseDarkMode)(
VOID
);

typedef BOOL(WINAPI* _SetPreferredAppMode)(
_In_ PreferredAppMode AppMode
);

typedef HRESULT (WINAPI* _GetDpiForMonitor)(
_In_ HMONITOR hmonitor,
_In_ enum MONITOR_DPI_TYPE dpiType,
3 changes: 2 additions & 1 deletion phlib/phlib.vcxproj
Original file line number Diff line number Diff line change
@@ -316,6 +316,7 @@
<ClCompile Include="colorbox.c" />
<ClCompile Include="cpysave.c" />
<ClCompile Include="data.c" />
<ClCompile Include="delayhook.c" />
<ClCompile Include="directdraw.cpp" />
<ClCompile Include="dspick.c" />
<ClCompile Include="emenu.c" />
@@ -444,4 +445,4 @@
<ClInclude Include="include\workqueuep.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
</Project>
Loading