/* catch theme changes */\r
case WM_THEMECHANGED:\r
case WM_SYSCOLORCHANGE:\r
- \r
+\r
if(msw_reset_rc_styles != NULL) {\r
xp_theme_reset ();\r
msw_style_init ();\r
- \r
+\r
/* force all gtkwidgets to redraw */\r
(*msw_reset_rc_styles) (gtk_settings_get_default());\r
}\r
- \r
+\r
return GDK_FILTER_REMOVE;\r
\r
case WM_SETTINGCHANGE:\r
on any GTK 2.x.x platform. */\r
if(gtk_check_version(2,4,0) == NULL) {\r
this_module = g_module_open(NULL, 0);\r
- \r
+\r
if(this_module)\r
g_module_symbol (this_module, "gtk_rc_reset_styles",\r
(gpointer *)(&msw_reset_rc_styles));\r
}\r
- \r
+\r
msw_style_init ();\r
gdk_window_add_filter (NULL, global_filter_func, NULL);\r
}\r
const gchar*\r
g_module_check_init (GModule *module)\r
{\r
- return gtk_check_version (GTK_MAJOR_VERSION,\r
- GTK_MINOR_VERSION,\r
- GTK_MICRO_VERSION - GTK_INTERFACE_AGE);\r
+ return gtk_check_version (2,0,0);\r
}\r
const RECT *pRect, const RECT *pClipRect);
typedef HRESULT (FAR PASCAL *EnableThemeDialogTextureFunc)(HWND hwnd, DWORD dwFlags);
typedef BOOL (FAR PASCAL *IsThemeActiveFunc)(VOID);
+typedef BOOL (FAR PASCAL *IsAppThemedFunc)(VOID);
static GetThemeSysFontFunc get_theme_sys_font_func = NULL;
static GetThemeSysColorFunc get_theme_sys_color_func = NULL;
static DrawThemeBackgroundFunc draw_theme_background_func = NULL;
static EnableThemeDialogTextureFunc enable_theme_dialog_texture_func = NULL;
static IsThemeActiveFunc is_theme_active_func = NULL;
-
-static gboolean was_theming_active = FALSE;
+static IsAppThemedFunc is_app_themed_func = NULL;
static void
xp_theme_close_open_handles (void)
uxtheme_dll = LoadLibrary("uxtheme.dll");
if (!uxtheme_dll) {
- was_theming_active = FALSE;
return;
}
- is_theme_active_func = (IsThemeActiveFunc) GetProcAddress(uxtheme_dll, "IsThemeActive");
- open_theme_data_func = (OpenThemeDataFunc) GetProcAddress(uxtheme_dll, "OpenThemeData");
- close_theme_data_func = (CloseThemeDataFunc) GetProcAddress(uxtheme_dll, "CloseThemeData");
- draw_theme_background_func = (DrawThemeBackgroundFunc) GetProcAddress(uxtheme_dll, "DrawThemeBackground");
- enable_theme_dialog_texture_func = (EnableThemeDialogTextureFunc) GetProcAddress(uxtheme_dll, "EnableThemeDialogTexture");
- get_theme_sys_font_func = (GetThemeSysFontFunc) GetProcAddress(uxtheme_dll, "GetThemeSysFont");
- get_theme_sys_color_func = (GetThemeSysColorFunc) GetProcAddress(uxtheme_dll, "GetThemeSysColor");
- get_theme_sys_metric_func = (GetThemeSysSizeFunc) GetProcAddress(uxtheme_dll, "GetThemeSysSize");
-
- if (is_theme_active_func)
- {
- was_theming_active = (*is_theme_active_func) ();
- }
+ is_app_themed_func = (IsAppThemedFunc) GetProcAddress(uxtheme_dll, "IsAppThemed");
+
+ if(is_app_themed_func) {
+ is_theme_active_func = (IsThemeActiveFunc) GetProcAddress(uxtheme_dll, "IsThemeActive");
+ open_theme_data_func = (OpenThemeDataFunc) GetProcAddress(uxtheme_dll, "OpenThemeData");
+ close_theme_data_func = (CloseThemeDataFunc) GetProcAddress(uxtheme_dll, "CloseThemeData");
+ draw_theme_background_func = (DrawThemeBackgroundFunc) GetProcAddress(uxtheme_dll, "DrawThemeBackground");
+ enable_theme_dialog_texture_func = (EnableThemeDialogTextureFunc) GetProcAddress(uxtheme_dll, "EnableThemeDialogTexture");
+ get_theme_sys_font_func = (GetThemeSysFontFunc) GetProcAddress(uxtheme_dll, "GetThemeSysFont");
+ get_theme_sys_color_func = (GetThemeSysColorFunc) GetProcAddress(uxtheme_dll, "GetThemeSysColor");
+ get_theme_sys_metric_func = (GetThemeSysSizeFunc) GetProcAddress(uxtheme_dll, "GetThemeSysSize");
+ }
}
void
xp_theme_reset (void)
{
xp_theme_close_open_handles ();
- was_theming_active = is_theme_active_func
- ? (*is_theme_active_func) () : FALSE;
}
void
FreeLibrary (uxtheme_dll);
uxtheme_dll = NULL;
+ is_app_themed_func = NULL;
is_theme_active_func = NULL;
open_theme_data_func = NULL;
close_theme_data_func = NULL;
return TRUE;
}
+static gboolean
+xp_theme_is_active (void)
+{
+ gboolean active = FALSE;
+
+ if (is_app_themed_func)
+ {
+ active = (*is_app_themed_func) ();
+
+ if (active && is_theme_active_func)
+ {
+ active = (*is_theme_active_func) ();
+ }
+ }
+
+ return active;
+}
+
gboolean
xp_theme_is_drawable (XpThemeElement element)
{
- if (is_theme_active_func)
- {
- gboolean active = (*is_theme_active_func) ();
- /* A bit of a hack, but it at least detects theme
- switches between XP and classic looks on systems
- using older GTK+ version (2.2.0-?) that do not
- support theme switch detection (gdk_window_add_filter). */
- if (active != was_theming_active)
- {
- xp_theme_reset ();
- }
-
- if (active)
- {
- return (xp_theme_get_handle_by_element (element) != NULL);
- }
- }
+ if (xp_theme_is_active ())
+ return (xp_theme_get_handle_by_element (element) != NULL);
return FALSE;
}