mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
gui, widgets: Use system colors on Windows title bar...
...when System colors theme is set. Previously, we just checked if the theme was set to Light or not and used that to decide the title bar colors. With the System colors theme, this was no longer valid logic. This patch renames themes_win32_is_darkmode_active () to gimp_is_win32_system_theme_dark (), and moves it to gimpwidgets-utils.c so that it can be accessed by functions that need to determine Windows mode settings. We then use it to determine dark mode if the System colors theme is set, and use the original logic otherwise.
This commit is contained in:
parent
a989cec59c
commit
1ec2641941
3 changed files with 24 additions and 24 deletions
|
@ -65,10 +65,6 @@ static void themes_theme_settings_portal_changed (GDBusProxy *proxy
|
||||||
Gimp *gimp);
|
Gimp *gimp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
|
||||||
static gboolean themes_win32_is_darkmode_active (void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* private variables */
|
/* private variables */
|
||||||
|
|
||||||
|
@ -406,7 +402,7 @@ themes_apply_theme (Gimp *gimp,
|
||||||
#elif defined(G_OS_WIN32)
|
#elif defined(G_OS_WIN32)
|
||||||
if (config->theme_scheme == GIMP_THEME_SYSTEM)
|
if (config->theme_scheme == GIMP_THEME_SYSTEM)
|
||||||
{
|
{
|
||||||
prefer_dark_theme = themes_win32_is_darkmode_active ();
|
prefer_dark_theme = gimp_is_win32_system_theme_dark ();
|
||||||
color_scheme = prefer_dark_theme ? GIMP_THEME_DARK : GIMP_THEME_LIGHT;
|
color_scheme = prefer_dark_theme ? GIMP_THEME_DARK : GIMP_THEME_LIGHT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -874,22 +870,4 @@ themes_set_title_bar (Gimp *gimp)
|
||||||
if (windows)
|
if (windows)
|
||||||
g_list_free (windows);
|
g_list_free (windows);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
themes_win32_is_darkmode_active (void)
|
|
||||||
{
|
|
||||||
DWORD val = 0;
|
|
||||||
DWORD val_size = sizeof (val);
|
|
||||||
LSTATUS status;
|
|
||||||
|
|
||||||
status = RegGetValueA(HKEY_CURRENT_USER,
|
|
||||||
"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
|
|
||||||
"AppsUseLightTheme",
|
|
||||||
RRF_RT_REG_DWORD,
|
|
||||||
NULL,
|
|
||||||
&val,
|
|
||||||
&val_size);
|
|
||||||
|
|
||||||
return status == ERROR_SUCCESS && val == 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2677,6 +2677,9 @@ gimp_window_set_title_bar_theme (Gimp *gimp,
|
||||||
GimpGuiConfig *config;
|
GimpGuiConfig *config;
|
||||||
|
|
||||||
config = GIMP_GUI_CONFIG (gimp->config);
|
config = GIMP_GUI_CONFIG (gimp->config);
|
||||||
|
if (config->theme_scheme == GIMP_THEME_SYSTEM)
|
||||||
|
use_dark_mode = gimp_is_win32_system_theme_dark ();
|
||||||
|
else
|
||||||
use_dark_mode = (config->theme_scheme != GIMP_THEME_LIGHT);
|
use_dark_mode = (config->theme_scheme != GIMP_THEME_LIGHT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2706,4 +2709,22 @@ gimp_window_set_title_bar_theme (Gimp *gimp,
|
||||||
&use_dark_mode, sizeof (use_dark_mode));
|
&use_dark_mode, sizeof (use_dark_mode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gimp_is_win32_system_theme_dark (void)
|
||||||
|
{
|
||||||
|
DWORD val = 0;
|
||||||
|
DWORD val_size = sizeof (val);
|
||||||
|
LSTATUS status;
|
||||||
|
|
||||||
|
status = RegGetValueA(HKEY_CURRENT_USER,
|
||||||
|
"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
|
||||||
|
"AppsUseLightTheme",
|
||||||
|
RRF_RT_REG_DWORD,
|
||||||
|
NULL,
|
||||||
|
&val,
|
||||||
|
&val_size);
|
||||||
|
|
||||||
|
return status == ERROR_SUCCESS && val == 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -167,6 +167,7 @@ gboolean gimp_utils_are_menu_path_identical (const gchar *path1
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
void gimp_window_set_title_bar_theme (Gimp *gimp,
|
void gimp_window_set_title_bar_theme (Gimp *gimp,
|
||||||
GtkWidget *dialog);
|
GtkWidget *dialog);
|
||||||
|
gboolean gimp_is_win32_system_theme_dark (void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __APP_GIMP_WIDGETS_UTILS_H__ */
|
#endif /* __APP_GIMP_WIDGETS_UTILS_H__ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue