diff --git a/gtk/gtkwin32theme.c b/gtk/gtkwin32theme.c index e73957ae3b..5e4041f1ff 100644 --- a/gtk/gtkwin32theme.c +++ b/gtk/gtkwin32theme.c @@ -27,11 +27,8 @@ #ifdef G_OS_WIN32 -#include #include -typedef HANDLE HTHEME; - #define UXTHEME_DLL "uxtheme.dll" static HINSTANCE uxtheme_dll = NULL; @@ -139,13 +136,15 @@ _gtk_win32_theme_init (void) hthemes_by_class = g_hash_table_new (g_str_hash, g_str_equal); } -static HTHEME -lookup_htheme_by_classname (const char *class) +HTHEME +_gtk_win32_lookup_htheme_by_classname (const char *class) { HTHEME theme; guint16 *wclass; char *lower; + _gtk_win32_theme_init (); + lower = g_ascii_strdown (class, -1); theme = (HTHEME) g_hash_table_lookup (hthemes_by_class, lower); @@ -173,15 +172,13 @@ lookup_htheme_by_classname (const char *class) #else -typedef void * HTHEME; - static void _gtk_win32_theme_init (void) { } -static HTHEME -lookup_htheme_by_classname (const char *class) +HTHEME +_gtk_win32_lookup_htheme_by_classname (const char *class) { return NULL; } @@ -219,7 +216,7 @@ _gtk_win32_theme_part_new (const char *class, part = g_slice_new0 (GtkWin32ThemePart); part->ref_count = 1; - part->theme = lookup_htheme_by_classname (class); + part->theme = _gtk_win32_lookup_htheme_by_classname (class); part->part = xp_part; part->state = state; part->part2 = xp_part2; @@ -568,7 +565,7 @@ _gtk_win32_theme_int_parse (GtkCssParser *parser, #ifdef G_OS_WIN32 if (use_xp_theme && get_theme_sys_metric != NULL) { - HTHEME theme = lookup_htheme_by_classname (class); + HTHEME theme = _gtk_win32_lookup_htheme_by_classname (class); /* If theme is NULL it will just return the GetSystemMetrics value */ *value = get_theme_sys_metric (theme, arg); @@ -632,7 +629,7 @@ _gtk_win32_theme_color_resolve (const char *theme_class, if (use_xp_theme && get_theme_sys_color != NULL) { - HTHEME theme = lookup_htheme_by_classname (theme_class); + HTHEME theme = _gtk_win32_lookup_htheme_by_classname (theme_class); /* if theme is NULL, it will just return the GetSystemColor() value */ diff --git a/gtk/gtkwin32themeprivate.h b/gtk/gtkwin32themeprivate.h index 25349d2e37..575f829414 100644 --- a/gtk/gtkwin32themeprivate.h +++ b/gtk/gtkwin32themeprivate.h @@ -24,6 +24,18 @@ #include "gtkcssparserprivate.h" +#ifdef G_OS_WIN32 + +#include + +typedef HANDLE HTHEME; + +#else /* !G_OS_WIN32 */ + +typedef void * HTHEME; + +#endif /* G_OS_WIN32 */ + G_BEGIN_DECLS #define GTK_WIN32_THEME_SYMBOLIC_COLOR_NAME "-gtk-win32-color" @@ -32,6 +44,8 @@ typedef struct _GtkWin32ThemePart GtkWin32ThemePart; #define GTK_TYPE_WIN32_THEME_PART (_gtk_win32_theme_part_get_type ()) +HTHEME _gtk_win32_lookup_htheme_by_classname (const char *classname); + GType _gtk_win32_theme_part_get_type (void) G_GNUC_CONST; GtkWin32ThemePart *_gtk_win32_theme_part_ref (GtkWin32ThemePart *part);