From 45681c4fe502b18a346f36a7c2488ec611f414ea Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Fri, 4 Nov 2022 15:54:02 +0100 Subject: [PATCH] GdkWin32: Detect the high contrast setting And set the theme name accordingly ("Default-hc") --- gdk/win32/gdkproperty-win32.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c index 9b65b8d86a..5a5b12253a 100644 --- a/gdk/win32/gdkproperty-win32.c +++ b/gdk/win32/gdkproperty-win32.c @@ -147,6 +147,23 @@ _gdk_win32_get_setting (const char *name, g_value_set_boolean (value, FALSE); return TRUE; } + else if (strcmp ("gtk-theme-name", name) == 0) + { + HIGHCONTRASTW hc; + memset (&hc, 0, sizeof (hc)); + hc.cbSize = sizeof (hc); + if (API_CALL (SystemParametersInfoW, (SPI_GETHIGHCONTRAST, sizeof (hc), &hc, 0))) + { + if (hc.dwFlags & HCF_HIGHCONTRASTON) + { + const char *theme_name = "Default-hc"; + + GDK_NOTE(MISC, g_print("gdk_display_get_setting(\"%s\") : %s\n", name, theme_name)); + g_value_set_string (value, theme_name); + return TRUE; + } + } + } else if (strcmp ("gtk-xft-antialias", name) == 0) { GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : 1\n", name));