This is what it looks like:
**v1**
![Screenshot_20230213_212244](/uploads/14156031c91d4da29fc49ed9831b599a/Screenshot_20230213_212244.png)
**v2**
![winecfg](/uploads/f610908b8ed2fbece6ef09ee5bd4d13e/winecfg.png)
-- v3: winecfg: Add an option to enable WinRT app dark theme.
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+)
diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 1f5138051c9..e6ca74ef043 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2363,6 +2363,7 @@ StartType=3 ErrorControl=1
[ThemeManager] +HKCU,"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize","AppsUseLightTheme",0x10003,0x00000001 HKCU,"Software\Microsoft\Windows\CurrentVersion\ThemeManager","ThemeActive",2,"1" HKCU,"Software\Microsoft\Windows\CurrentVersion\ThemeManager","DllName",2,"%10%\resources\themes\light\light.msstyles" HKCU,"Software\Microsoft\Windows\CurrentVersion\ThemeManager","ColorName",2,"Blue"
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.ui/tests/uisettings.c | 4 ++-- programs/winecfg/resource.h | 27 ++++++++++++++------------- programs/winecfg/theme.c | 30 +++++++++++++++++++++++++++++- programs/winecfg/winecfg.rc | 8 +++++--- 4 files changed, 50 insertions(+), 19 deletions(-)
diff --git a/dlls/windows.ui/tests/uisettings.c b/dlls/windows.ui/tests/uisettings.c index bd1e7a02d20..9711d93d051 100644 --- a/dlls/windows.ui/tests/uisettings.c +++ b/dlls/windows.ui/tests/uisettings.c @@ -152,14 +152,14 @@ static void test_UISettings(void) type = UIColorType_Foreground; hr = IUISettings3_GetColorValue( uisettings3, type, &value ); ok( hr == S_OK, "GetColorValue returned %#lx\n", hr ); - todo_wine ok( value.A == 255 && value.R == 255 && value.G == 255 && value.B == 255, + ok( value.A == 255 && value.R == 255 && value.G == 255 && value.B == 255, "got unexpected value.A == %d value.R == %d value.G == %d value.B == %d\n", value.A, value.R, value.G, value.B );
reset_color( &value ); type = UIColorType_Background; hr = IUISettings3_GetColorValue( uisettings3, type, &value ); ok( hr == S_OK, "GetColorValue returned %#lx\n", hr ); - todo_wine ok( value.A == 255 && value.R == 0 && value.G == 0 && value.B == 0, + ok( value.A == 255 && value.R == 0 && value.G == 0 && value.B == 0, "got unexpected value.A == %d value.R == %d value.G == %d value.B == %d\n", value.A, value.R, value.G, value.B );
done: diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h index dd46bc71b40..8d7ff909bf6 100644 --- a/programs/winecfg/resource.h +++ b/programs/winecfg/resource.h @@ -163,19 +163,20 @@ #define IDC_THEME_SIZECOMBO 1403 #define IDC_THEME_SIZETEXT 1404 #define IDC_THEME_THEMECOMBO 1405 -#define IDC_THEME_INSTALL 1406 -#define IDC_LIST_SFPATHS 1407 -#define IDC_LINK_SFPATH 1408 -#define IDC_EDIT_SFPATH 1409 -#define IDC_BROWSE_SFPATH 1410 -#define IDC_SYSPARAM_COMBO 1411 -#define IDC_SYSPARAM_SIZE_TEXT 1412 -#define IDC_SYSPARAM_SIZE 1413 -#define IDC_SYSPARAM_SIZE_UD 1414 -#define IDC_SYSPARAM_COLOR_TEXT 1415 -#define IDC_SYSPARAM_COLOR 1416 -#define IDC_SYSPARAM_FONT 1417 -#define IDC_ENABLE_FILE_ASSOCIATIONS 1418 +#define IDC_THEME_APPCOMBO 1406 +#define IDC_THEME_INSTALL 1407 +#define IDC_LIST_SFPATHS 1408 +#define IDC_LINK_SFPATH 1409 +#define IDC_EDIT_SFPATH 1410 +#define IDC_BROWSE_SFPATH 1411 +#define IDC_SYSPARAM_COMBO 1412 +#define IDC_SYSPARAM_SIZE_TEXT 1413 +#define IDC_SYSPARAM_SIZE 1414 +#define IDC_SYSPARAM_SIZE_UD 1415 +#define IDC_SYSPARAM_COLOR_TEXT 1416 +#define IDC_SYSPARAM_COLOR 1417 +#define IDC_SYSPARAM_FONT 1418 +#define IDC_ENABLE_FILE_ASSOCIATIONS 1419
#define IDC_SYSPARAMS_BUTTON 8400 #define IDC_SYSPARAMS_BUTTON_TEXT 8401 diff --git a/programs/winecfg/theme.c b/programs/winecfg/theme.c index bbc4d3cc11f..643502563c7 100644 --- a/programs/winecfg/theme.c +++ b/programs/winecfg/theme.c @@ -45,6 +45,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
/* UXTHEME functions not in the headers */
+typedef struct +{ + DWORD value; + const WCHAR *descr; +} AppTheme; + typedef struct tagTHEMENAMES { WCHAR szName[MAX_PATH+1]; @@ -421,6 +427,19 @@ static void enable_size_and_color_controls (HWND dialog, BOOL enable)
static void init_dialog (HWND dialog) { + WCHAR *value = get_reg_key(HKEY_CURRENT_USER, L"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", + L"AppsUseLightTheme", L"\0001"); + int apps_use_light_theme = (!wcscmp(value, L"")) ? 0 : 1; + AppTheme app_themes[] = + { + { 1, L"Light" }, + { 0, L"Dark" }, + }; + + SendDlgItemMessageW(dialog, IDC_THEME_APPCOMBO, CB_RESETCONTENT, 0, 0); + SendDlgItemMessageW(dialog, IDC_THEME_APPCOMBO, CB_ADDSTRING, 0, (LPARAM)app_themes[0].descr); + SendDlgItemMessageW(dialog, IDC_THEME_APPCOMBO, CB_ADDSTRING, 0, (LPARAM)app_themes[1].descr); + SendDlgItemMessageW(dialog, IDC_THEME_APPCOMBO, CB_SETCURSEL, !apps_use_light_theme, 0); SendDlgItemMessageW(dialog, IDC_SYSPARAM_SIZE_UD, UDM_SETBUDDY, (WPARAM)GetDlgItem(dialog, IDC_SYSPARAM_SIZE), 0); } @@ -450,7 +469,9 @@ static void update_dialog (HWND dialog) }
static void on_theme_changed(HWND dialog) { - int index = SendMessageW (GetDlgItem (dialog, IDC_THEME_THEMECOMBO), + int index; + + index = SendMessageW (GetDlgItem (dialog, IDC_THEME_THEMECOMBO), CB_GETCURSEL, 0, 0); if (!update_color_and_size (index, GetDlgItem (dialog, IDC_THEME_COLORCOMBO), GetDlgItem (dialog, IDC_THEME_SIZECOMBO))) @@ -463,6 +484,12 @@ static void on_theme_changed(HWND dialog) { { enable_size_and_color_controls (dialog, TRUE); } + + index = SendMessageW (GetDlgItem (dialog, IDC_THEME_APPCOMBO), + CB_GETCURSEL, 0, 0); + set_reg_key_dword(HKEY_CURRENT_USER, L"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", + L"AppsUseLightTheme", !index); + theme_dirty = TRUE; }
@@ -1148,6 +1175,7 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) if (updating_ui) break; switch (LOWORD(wParam)) { + case IDC_THEME_APPCOMBO: /* fall through */ case IDC_THEME_THEMECOMBO: on_theme_changed(hDlg); break; case IDC_THEME_COLORCOMBO: /* fall through */ case IDC_THEME_SIZECOMBO: theme_dirty = TRUE; break; diff --git a/programs/winecfg/winecfg.rc b/programs/winecfg/winecfg.rc index 8775b3b691b..36390554c9d 100644 --- a/programs/winecfg/winecfg.rc +++ b/programs/winecfg/winecfg.rc @@ -283,9 +283,11 @@ STYLE WS_CHILD | WS_DISABLED FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Appearance",IDC_STATIC,8,4,244,90 - LTEXT "&Theme:",IDC_STATIC,15,15,130,8 - COMBOBOX IDC_THEME_THEMECOMBO,15,25,130,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Install theme...",IDC_THEME_INSTALL,152,25,93,13 + LTEXT "&Theme:",IDC_STATIC,15,15,70,8 + COMBOBOX IDC_THEME_THEMECOMBO,15,25,70,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "&WinRT app theme:",IDC_STATIC,90,15,70,8 + COMBOBOX IDC_THEME_APPCOMBO,90,25,70,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&Install theme...",IDC_THEME_INSTALL,165,25,80,13 LTEXT "&Color:",IDC_THEME_COLORTEXT,15,40,105,8 COMBOBOX IDC_THEME_COLORCOMBO,15,50,105,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "&Size:",IDC_THEME_SIZETEXT,126,40,120,8
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=129485
Your paranoid android.
=== debian11 (32 bit report) ===
Report validation errors: d3d11:d3d11 has no test summary line (early exit of the main process?) d3d11:d3d11 has unaccounted for failure messages d3d11:d3d11 has unaccounted for todo messages d3d11:d3d11 has unaccounted for skip messages
On Thu Feb 16 08:41:15 2023 +0000, Mohamad Al-Jaf wrote:
changed this line in [version 3 of the diff](/wine/wine/-/merge_requests/2183/diffs?diff_id=32913&start_sha=bae8840abfbd9b60f6d481a98dfa14d7d8aeaff3#652b2768b1d8284685e1bdde67ec6d9ca55b8485_49_48)
Sure, they're only being used twice so it's not really worth having a global variable.
On Thu Feb 16 08:41:15 2023 +0000, Mohamad Al-Jaf wrote:
changed this line in [version 3 of the diff](/wine/wine/-/merge_requests/2183/diffs?diff_id=32913&start_sha=bae8840abfbd9b60f6d481a98dfa14d7d8aeaff3#f66e40bde0908a5c3bca60d7a205d3f9024c741f_288_288)
Yeah, I thought it would be confusing and was going to suggest to rename it to Wine Theme instead of System Theme, but WinRT app theme works as well. I was basing it off of the Windows settings. Also, I think some Win32 apps can also use this setting directly through the registry.
On Wed Feb 15 11:52:50 2023 +0000, Zhiyi Zhang wrote:
configure --enable-maintainer-mode, I think.
Thanks, appreciate it.
And thanks for the review. :smiley: