From 1993a585183ce17bf9ddb7e66619b6ee58df6060 Mon Sep 17 00:00:00 2001 From: cinamod Date: Fri, 3 Oct 2003 15:54:20 +0000 Subject: catch theme and color changes --- modules/engines/ms-windows/ChangeLog.old | 4 +++ modules/engines/ms-windows/wimp_theme_main.c | 41 +++++++++++++++++++++++++++- modules/engines/ms-windows/xp_theme.c | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/engines/ms-windows/ChangeLog.old b/modules/engines/ms-windows/ChangeLog.old index d619689e2d..9b2fbc4380 100755 --- a/modules/engines/ms-windows/ChangeLog.old +++ b/modules/engines/ms-windows/ChangeLog.old @@ -1,3 +1,7 @@ +2003-10-03 Dom Lachowicz + + * src/wimp_style_main.c: Catch theme and color changes. Needs more testing and fine-tuning + 2003-10-02 Dom Lachowicz * src/wimp_style.c: Deallocate used HDCs diff --git a/modules/engines/ms-windows/wimp_theme_main.c b/modules/engines/ms-windows/wimp_theme_main.c index 504727a07c..a54d01ad2e 100755 --- a/modules/engines/ms-windows/wimp_theme_main.c +++ b/modules/engines/ms-windows/wimp_theme_main.c @@ -20,28 +20,67 @@ * Boston, MA 02111-1307, USA. */ +#include #include #include #include "wimp_style.h" #include "wimp_rc_style.h" +#ifndef WM_THEMECHANGED +#define WM_THEMECHANGED 0x031A /* winxp only */ +#endif + +static GdkFilterReturn +global_filter_func (void *xevent, + GdkEvent *event, + gpointer data) +{ + MSG *msg = (MSG *) xevent; + GList * toplevels, *iter; + GtkWidget * toplevel; + + switch (msg->message) + { + case WM_THEMECHANGED: + case WM_SYSCOLORCHANGE: + toplevels = gtk_window_list_toplevels (); + if (toplevels) { + xp_theme_exit(); + for (iter = g_list_first(toplevels); + iter; + iter = g_list_next (iter)) { + toplevel = (GtkWidget*)iter->data; + if (toplevel) + gtk_widget_reset_rc_styles (toplevel); + } + g_list_free (toplevels); + } + return GDK_FILTER_REMOVE; + default: + return GDK_FILTER_CONTINUE; + } +} + G_MODULE_EXPORT void theme_init (GTypeModule *module) { wimp_rc_style_register_type (module); wimp_style_register_type (module); + + gdk_window_add_filter (NULL, global_filter_func, NULL); } G_MODULE_EXPORT void theme_exit (void) { + gdk_window_remove_filter (NULL, global_filter_func, NULL); } G_MODULE_EXPORT GtkRcStyle * theme_create_rc_style (void) { - return GTK_RC_STYLE (g_object_new (WIMP_TYPE_RC_STYLE, NULL)); + return GTK_RC_STYLE (g_object_new (WIMP_TYPE_RC_STYLE, NULL)); } /* The following function will be called by GTK+ when the module diff --git a/modules/engines/ms-windows/xp_theme.c b/modules/engines/ms-windows/xp_theme.c index 96f1b70dd6..44166d1d2e 100755 --- a/modules/engines/ms-windows/xp_theme.c +++ b/modules/engines/ms-windows/xp_theme.c @@ -135,7 +135,7 @@ xp_theme_exit() if(!uxtheme_dll) return; - for (i=0; i