Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b5f4a6a4
Commit
b5f4a6a4
authored
Oct 19, 2023
by
Louis Lenders
Committed by
Alexandre Julliard
Oct 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uxtheme: Add ShouldAppsUseDarkMode.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=55821
parent
2e2f9bdb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
0 deletions
+50
-0
system.c
dlls/uxtheme/system.c
+17
-0
system.c
dlls/uxtheme/tests/system.c
+32
-0
uxtheme.spec
dlls/uxtheme/uxtheme.spec
+1
-0
No files found.
dlls/uxtheme/system.c
View file @
b5f4a6a4
...
...
@@ -1273,3 +1273,20 @@ BOOL WINAPI ShouldSystemUseDarkMode(void)
return
!
light_theme
;
}
/**********************************************************************
* ShouldAppsUseDarkMode (UXTHEME.132)
*
* RETURNS
* Whether or not apps should use dark mode.
*/
BOOL
WINAPI
ShouldAppsUseDarkMode
(
void
)
{
DWORD
light_theme
=
TRUE
,
light_theme_size
=
sizeof
(
light_theme
);
RegGetValueW
(
HKEY_CURRENT_USER
,
L"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Themes
\\
Personalize"
,
L"AppsUseLightTheme"
,
RRF_RT_REG_DWORD
,
NULL
,
&
light_theme
,
&
light_theme_size
);
return
!
light_theme
;
}
dlls/uxtheme/tests/system.c
View file @
b5f4a6a4
...
...
@@ -49,6 +49,7 @@ static HRESULT (WINAPI *pGetBufferedPaintTargetRect)(HPAINTBUFFER, RECT *);
static
HRESULT
(
WINAPI
*
pGetThemeIntList
)(
HTHEME
,
int
,
int
,
int
,
INTLIST
*
);
static
HRESULT
(
WINAPI
*
pGetThemeTransitionDuration
)(
HTHEME
,
int
,
int
,
int
,
int
,
DWORD
*
);
static
BOOL
(
WINAPI
*
pShouldSystemUseDarkMode
)(
void
);
static
BOOL
(
WINAPI
*
pShouldAppsUseDarkMode
)(
void
);
static
LONG
(
WINAPI
*
pDisplayConfigGetDeviceInfo
)(
DISPLAYCONFIG_DEVICE_INFO_HEADER
*
);
static
LONG
(
WINAPI
*
pDisplayConfigSetDeviceInfo
)(
DISPLAYCONFIG_DEVICE_INFO_HEADER
*
);
...
...
@@ -76,6 +77,7 @@ static void init_funcs(void)
HMODULE
uxtheme
=
GetModuleHandleA
(
"uxtheme.dll"
);
pShouldSystemUseDarkMode
=
(
void
*
)
GetProcAddress
(
uxtheme
,
MAKEINTRESOURCEA
(
138
));
pShouldAppsUseDarkMode
=
(
void
*
)
GetProcAddress
(
uxtheme
,
MAKEINTRESOURCEA
(
132
));
#define GET_PROC(module, func) \
p##func = (void *)GetProcAddress(module, #func); \
...
...
@@ -2629,6 +2631,35 @@ static void test_ShouldSystemUseDarkMode(void)
ok
(
result
==
!
light_theme
,
"Expected value %d, got %d.
\n
"
,
!
light_theme
,
result
);
}
static
void
test_ShouldAppsUseDarkMode
(
void
)
{
DWORD
light_theme
,
light_theme_size
=
sizeof
(
light_theme
),
last_error
;
BOOL
result
;
LSTATUS
ls
;
if
(
!
pShouldAppsUseDarkMode
)
{
win_skip
(
"ShouldAppsUseDarkMode() is unavailable
\n
"
);
return
;
}
ls
=
RegGetValueW
(
HKEY_CURRENT_USER
,
L"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Themes
\\
Personalize"
,
L"AppsUseLightTheme"
,
RRF_RT_REG_DWORD
,
NULL
,
&
light_theme
,
&
light_theme_size
);
if
(
ls
==
ERROR_FILE_NOT_FOUND
)
{
skip
(
"AppsUseLightTheme registry value not found.
\n
"
);
return
;
}
ok
(
ls
==
0
,
"RegGetValue failed: %ld.
\n
"
,
ls
);
SetLastError
(
0xdeadbeef
);
result
=
pShouldAppsUseDarkMode
();
last_error
=
GetLastError
();
ok
(
last_error
==
0xdeadbeef
,
"ShouldAppsUseDarkMode set last error: %ld.
\n
"
,
last_error
);
ok
(
result
==
!
light_theme
,
"Expected value %d, got %d
\n
"
,
!
light_theme
,
result
);
}
START_TEST
(
system
)
{
ULONG_PTR
ctx_cookie
;
...
...
@@ -2655,6 +2686,7 @@ START_TEST(system)
test_GetThemeBackgroundRegion
();
test_theme
();
test_ShouldSystemUseDarkMode
();
test_ShouldAppsUseDarkMode
();
if
(
load_v6_module
(
&
ctx_cookie
,
&
ctx
))
{
...
...
dlls/uxtheme/uxtheme.spec
View file @
b5f4a6a4
...
...
@@ -42,6 +42,7 @@
61 stdcall OpenThemeDataEx(ptr wstr long)
62 stub -noname ServerClearStockObjects
63 stub -noname MarkSelection
132 stdcall -noname ShouldAppsUseDarkMode()
138 stdcall -noname ShouldSystemUseDarkMode()
# Standard functions
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment