Commit 3503ab4e authored by Mohamad Al-Jaf's avatar Mohamad Al-Jaf Committed by Alexandre Julliard

winecfg: Add an option to set WinRT app dark theme.

parent 585ac559
......@@ -152,15 +152,15 @@ 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,
"got unexpected value.A == %d value.R == %d value.G == %d value.B == %d\n", value.A, value.R, value.G, value.B );
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,
"got unexpected value.A == %d value.R == %d value.G == %d value.B == %d\n", value.A, value.R, value.G, value.B );
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:
set_app_theme( default_theme );
......
......@@ -163,19 +163,22 @@
#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_APPCOMBO_LIGHT 1407
#define IDC_THEME_APPCOMBO_DARK 1408
#define IDC_THEME_INSTALL 1409
#define IDC_LIST_SFPATHS 1410
#define IDC_LINK_SFPATH 1411
#define IDC_EDIT_SFPATH 1412
#define IDC_BROWSE_SFPATH 1413
#define IDC_SYSPARAM_COMBO 1414
#define IDC_SYSPARAM_SIZE_TEXT 1415
#define IDC_SYSPARAM_SIZE 1416
#define IDC_SYSPARAM_SIZE_UD 1417
#define IDC_SYSPARAM_COLOR_TEXT 1418
#define IDC_SYSPARAM_COLOR 1419
#define IDC_SYSPARAM_FONT 1420
#define IDC_ENABLE_FILE_ASSOCIATIONS 1421
#define IDC_SYSPARAMS_BUTTON 8400
#define IDC_SYSPARAMS_BUTTON_TEXT 8401
......
......@@ -418,11 +418,48 @@ static void enable_size_and_color_controls (HWND dialog, BOOL enable)
EnableWindow (GetDlgItem (dialog, IDC_THEME_SIZECOMBO), enable);
EnableWindow (GetDlgItem (dialog, IDC_THEME_SIZETEXT), enable);
}
static DWORD get_app_theme(void)
{
DWORD ret = 0, len = sizeof(ret), type;
HKEY hkey;
if (RegOpenKeyExW( HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", 0, KEY_QUERY_VALUE, &hkey ))
return 1;
if (RegQueryValueExW( hkey, L"AppsUseLightTheme", NULL, &type, (BYTE *)&ret, &len ) || type != REG_DWORD)
ret = 1;
RegCloseKey( hkey );
return ret;
}
static void init_dialog (HWND dialog)
{
SendDlgItemMessageW(dialog, IDC_SYSPARAM_SIZE_UD, UDM_SETBUDDY,
(WPARAM)GetDlgItem(dialog, IDC_SYSPARAM_SIZE), 0);
DWORD apps_use_light_theme;
WCHAR apps_theme_str[256];
static const struct
{
int id;
DWORD value;
}
app_themes[] =
{
{ IDC_THEME_APPCOMBO_LIGHT, 1 },
{ IDC_THEME_APPCOMBO_DARK, 0 },
};
SendDlgItemMessageW( dialog, IDC_THEME_APPCOMBO, CB_RESETCONTENT, 0, 0 );
LoadStringW( GetModuleHandleW(NULL), app_themes[0].id, apps_theme_str, ARRAY_SIZE(apps_theme_str) );
SendDlgItemMessageW( dialog, IDC_THEME_APPCOMBO, CB_ADDSTRING, 0, (LPARAM)apps_theme_str );
LoadStringW( GetModuleHandleW(NULL), app_themes[1].id, apps_theme_str, ARRAY_SIZE(apps_theme_str) );
SendDlgItemMessageW( dialog, IDC_THEME_APPCOMBO, CB_ADDSTRING, 0, (LPARAM)apps_theme_str );
apps_use_light_theme = get_app_theme();
SendDlgItemMessageW( dialog, IDC_THEME_APPCOMBO, CB_SETCURSEL, app_themes[apps_use_light_theme].value, 0 );
SendDlgItemMessageW( dialog, IDC_SYSPARAM_SIZE_UD, UDM_SETBUDDY, (WPARAM)GetDlgItem(dialog, IDC_SYSPARAM_SIZE), 0 );
}
static void update_dialog (HWND dialog)
......@@ -450,8 +487,9 @@ static void update_dialog (HWND dialog)
}
static void on_theme_changed(HWND dialog) {
int index = SendMessageW (GetDlgItem (dialog, IDC_THEME_THEMECOMBO),
CB_GETCURSEL, 0, 0);
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 +501,11 @@ 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 +1191,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;
......
......@@ -94,6 +94,12 @@ END
STRINGTABLE
BEGIN
IDC_THEME_APPCOMBO_LIGHT "Light"
IDC_THEME_APPCOMBO_DARK "Dark"
END
STRINGTABLE
BEGIN
IDC_SYSPARAMS_BUTTON "Controls Background"
IDC_SYSPARAMS_BUTTON_TEXT "Controls Text"
IDC_SYSPARAMS_DESKTOP "#msgctxt#display name#Desktop"
......@@ -157,7 +163,7 @@ BEGIN
PUSHBUTTON "Add appli&cation...",IDC_APP_ADDAPP, 15,174,112,14
PUSHBUTTON "&Remove application",IDC_APP_REMOVEAPP, 133,174,112,14
LTEXT "&Windows Version:",IDC_STATIC,17,196,80,8
COMBOBOX IDC_WINVER,100,194,145,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_WINVER,100,194,145,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_GRAPHCFG DIALOG 0, 0, 260, 220
......@@ -195,7 +201,7 @@ BEGIN
LTEXT "Existing &overrides:",IDC_STATIC,16,86,100,8
LISTBOX IDC_DLLS_LIST,16,96,140,112,WS_BORDER | WS_TABSTOP | WS_VSCROLL
PUSHBUTTON "&Edit...",IDC_DLLS_EDITDLL,164,96,82,14
PUSHBUTTON "&Remove",IDC_DLLS_REMOVEDLL,164,114,82,14
PUSHBUTTON "&Remove",IDC_DLLS_REMOVEDLL,164,114,82,14
END
IDD_LOADORDER DIALOG 80, 90, 160, 92
......@@ -238,10 +244,10 @@ BEGIN
LTEXT "&Path:",IDC_STATIC_PATH,15,123,42,9
EDITTEXT IDC_EDIT_PATH,59,120,122,13,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "&Browse...",IDC_BUTTON_BROWSE_PATH,186,120,60,13
LTEXT "&Type:",IDC_STATIC_TYPE,15,138,42,10
COMBOBOX IDC_COMBO_TYPE,59,135,77,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Show Advan&ced",IDC_BUTTON_SHOW_HIDE_ADVANCED,146,135,100,13
LTEXT "De&vice:",IDC_STATIC_DEVICE,15,153,42,9
EDITTEXT IDC_EDIT_DEVICE,59,150,122,13,ES_AUTOHSCROLL | WS_TABSTOP
......@@ -283,13 +289,15 @@ 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 "&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
COMBOBOX IDC_THEME_SIZECOMBO,126,50,120,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "&Theme:",IDC_STATIC,15,15,105,8
COMBOBOX IDC_THEME_THEMECOMBO,15,25,105,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "&WinRT app theme:",IDC_STATIC,126,15,119,8
COMBOBOX IDC_THEME_APPCOMBO,126,25,119,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Install theme...",IDC_THEME_INSTALL,157,50,88,13
LTEXT "&Color:",IDC_THEME_COLORTEXT,15,40,60,8
COMBOBOX IDC_THEME_COLORCOMBO,15,50,60,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "&Size:",IDC_THEME_SIZETEXT,80,40,71,8
COMBOBOX IDC_THEME_SIZECOMBO,80,50,71,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "It&em:",IDC_STATIC,15,65,105,8
COMBOBOX IDC_SYSPARAM_COMBO,15,75,105,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT
LTEXT "C&olor:",IDC_SYSPARAM_COLOR_TEXT,126,65,25,8,WS_DISABLED
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment