diff options
author | cinamod <cinamod> | 2003-10-03 15:54:20 +0000 |
---|---|---|
committer | cinamod <cinamod> | 2003-10-03 15:54:20 +0000 |
commit | 1993a585183ce17bf9ddb7e66619b6ee58df6060 (patch) | |
tree | 488697713eb304e01a77e08f1677c3e15c7e3ea8 /modules | |
parent | 84841faf7fc3f70344f814338c32048f3207bae6 (diff) | |
download | gtk+-1993a585183ce17bf9ddb7e66619b6ee58df6060.tar.gz |
catch theme and color changes
Diffstat (limited to 'modules')
-rwxr-xr-x | modules/engines/ms-windows/ChangeLog.old | 4 | ||||
-rwxr-xr-x | modules/engines/ms-windows/wimp_theme_main.c | 41 | ||||
-rwxr-xr-x | modules/engines/ms-windows/xp_theme.c | 2 |
3 files changed, 45 insertions, 2 deletions
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 <cinamod@hotmail.com>
+
+ * src/wimp_style_main.c: Catch theme and color changes. Needs more testing and fine-tuning
+
2003-10-02 Dom Lachowicz <cinamod@hotmail.com>
* 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 <windows.h>
#include <gmodule.h>
#include <gtk/gtk.h>
#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<XP_THEME_CLASS__SIZEOF; i++) + for (i=0; i < XP_THEME_CLASS__SIZEOF; i++) { if (open_themes[i]) { |