win32 color changes work, xp style changes work

This commit is contained in:
cinamod 2004-05-21 18:35:56 +00:00
parent 07ac527c6d
commit f8cdf240fe
2 changed files with 34 additions and 7 deletions

View File

@ -1,6 +1,7 @@
2004-05-21 Dom Lachowicz <cinamod@hotmail.com>
* src/Theme/gtk-2.0/gtkrc: Better icon sizes
* src/msw_theme_main.c: Enable XP theme switching
2004-03-20 Raymond Penners <raymond@dotsphinx.com>

View File

@ -31,6 +31,9 @@
#define WM_THEMECHANGED 0x031A /* winxp only */
#endif
static GModule * this_module = NULL;
static void (*msw_reset_rc_styles) (GtkSettings * settings) = NULL;
/* TODO - look into whether we need to handle these:
*
* WM_STYLECHANGED
@ -45,21 +48,26 @@ global_filter_func (void *xevent,
switch (msg->message)
{
#if ENABLE_THEME_CHANGING
/* We need to do something better than this check - if a theme builder has GTK 2.4.x
but the user has 2.2.x, he/she will run into trouble wrt unresolved symbols */
/* catch theme changes */
case WM_THEMECHANGED:
case WM_SYSCOLORCHANGE:
xp_theme_reset ();
msw_style_init ();
/* force all gtkwidgets to redraw */
gtk_rc_reparse_all_for_settings (gtk_settings_get_default(), TRUE);
if(msw_reset_rc_styles != NULL) {
xp_theme_reset ();
msw_style_init ();
/* force all gtkwidgets to redraw */
(*msw_reset_rc_styles) (gtk_settings_get_default());
}
return GDK_FILTER_REMOVE;
#endif
case WM_SETTINGCHANGE:
/* catch cursor blink, etc... changes */
msw_style_setup_system_settings ();
msw_style_setup_system_settings ();
return GDK_FILTER_REMOVE;
default:
@ -72,6 +80,19 @@ theme_init (GTypeModule *module)
{
msw_rc_style_register_type (module);
msw_style_register_type (module);
/* this craziness is required because only gtk 2.4.x and later have
gtk_rc_reset_styles(). But we want to be able to run acceptly well
on any GTK 2.x.x platform. */
if(gtk_check_version(2,4,0) == NULL) {
/* dlopen(this) */
this_module = g_module_open(NULL, 0);
if(this_module)
g_module_symbol (this_module, "gtk_rc_reset_styles",
(gpointer *)(&msw_reset_rc_styles));
}
msw_style_init ();
gdk_window_add_filter (NULL, global_filter_func, NULL);
}
@ -80,6 +101,11 @@ G_MODULE_EXPORT void
theme_exit (void)
{
gdk_window_remove_filter (NULL, global_filter_func, NULL);
if(this_module) {
g_module_close(this_module);
this_module = NULL;
}
}
G_MODULE_EXPORT GtkRcStyle *