summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-02-15 23:49:34 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-02-15 23:49:34 +0800
commitb1389c1325695a18584bf638bc3271362d872bd1 (patch)
treed149a39931e344e8362c21889e7290c0552bec40
parent634d13819298ae359713a1664e520e74ad82f2d6 (diff)
downloadcompiz-with-glib-mainloop-b1389c1325695a18584bf638bc3271362d872bd1.tar.gz
compiz-with-glib-mainloop-b1389c1325695a18584bf638bc3271362d872bd1.tar.bz2
Fix crash when changing theme
Connect up the signal handler for the style change correctly.
-rw-r--r--gtk/window-decorator/gtk-window-decorator.c28
-rw-r--r--gtk/window-decorator/gtk-window-decorator.h2
-rw-r--r--gtk/window-decorator/settings.c1
-rw-r--r--gtk/window-decorator/style.c6
4 files changed, 19 insertions, 18 deletions
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index 1cc2039..1f681c1 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -208,12 +208,12 @@ initialize_decorations ()
gtk_window_move (GTK_WINDOW (decor_frames[i].style_window_rgba), -100, -100);
gtk_widget_show_all (decor_frames[i].style_window_rgba);
- g_signal_connect_object (decor_frames[i].style_window_rgba, "style-set",
- G_CALLBACK (style_changed),
- 0, 0);
-
decor_frames[i].pango_context = gtk_widget_create_pango_context (decor_frames[i].style_window_rgba);
+ g_signal_connect_data (decor_frames[i].style_window_rgba, "style-set",
+ G_CALLBACK (style_changed),
+ (gpointer) decor_frames[i].pango_context, 0, 0);
+
decor_frames[i].style_window_rgb = gtk_window_new (GTK_WINDOW_POPUP);
colormap = gdk_screen_get_rgb_colormap (gdkscreen);
@@ -226,9 +226,9 @@ initialize_decorations ()
gtk_window_move (GTK_WINDOW (decor_frames[i].style_window_rgb), -100, -100);
gtk_widget_show_all (decor_frames[i].style_window_rgb);
- g_signal_connect_object (decor_frames[i].style_window_rgb, "style-set",
- G_CALLBACK (style_changed),
- 0, 0);
+ g_signal_connect_data (decor_frames[i].style_window_rgb, "style-set",
+ G_CALLBACK (style_changed),
+ (gpointer) decor_frames[i].pango_context, 0, 0);
update_style (decor_frames[i].style_window_rgba);
update_style (decor_frames[i].style_window_rgb);
@@ -264,12 +264,12 @@ initialize_decorations ()
gtk_window_move (GTK_WINDOW (_default_decoration.style_window_rgba), -100, -100);
gtk_widget_show_all (_default_decoration.style_window_rgba);
- g_signal_connect_object (_default_decoration.style_window_rgba, "style-set",
- G_CALLBACK (style_changed),
- 0, 0);
-
_default_decoration.pango_context = gtk_widget_create_pango_context (_default_decoration.style_window_rgba);
+ g_signal_connect_data (_default_decoration.style_window_rgba, "style-set",
+ G_CALLBACK (style_changed),
+ (gpointer) _default_decoration.pango_context, 0, 0);
+
_default_decoration.style_window_rgb = gtk_window_new (GTK_WINDOW_POPUP);
colormap = gdk_screen_get_rgb_colormap (gdkscreen);
@@ -282,9 +282,9 @@ initialize_decorations ()
gtk_window_move (GTK_WINDOW (_default_decoration.style_window_rgb), -100, -100);
gtk_widget_show_all (_default_decoration.style_window_rgb);
- g_signal_connect_object (_default_decoration.style_window_rgb, "style-set",
- G_CALLBACK (style_changed),
- 0, 0);
+ g_signal_connect_data (_default_decoration.style_window_rgb, "style-set",
+ G_CALLBACK (style_changed),
+ (gpointer) _default_decoration.pango_context, 0, 0);
update_style (_default_decoration.style_window_rgba);
update_style (_default_decoration.style_window_rgb);
diff --git a/gtk/window-decorator/gtk-window-decorator.h b/gtk/window-decorator/gtk-window-decorator.h
index 0ef0a0e..507305f 100644
--- a/gtk/window-decorator/gtk-window-decorator.h
+++ b/gtk/window-decorator/gtk-window-decorator.h
@@ -976,7 +976,7 @@ void
update_style (GtkWidget *widget);
void
-style_changed (PangoContext *context, GtkWidget *widget);
+style_changed (GtkWidget *widget, void *user_data /* PangoContext */);
/* settings.c */
diff --git a/gtk/window-decorator/settings.c b/gtk/window-decorator/settings.c
index d22baa4..02c511f 100644
--- a/gtk/window-decorator/settings.c
+++ b/gtk/window-decorator/settings.c
@@ -301,7 +301,6 @@ titlebar_font_changed (GConfClient *client)
for (i = 0; i < NUM_DECOR_FRAMES; i++)
{
- fprintf (stderr, "i is %i\n", i);
decor_frame_t *frame = &decor_frames[i];
gfloat scale = 1.0f;
if (frame->titlebar_font)
diff --git a/gtk/window-decorator/style.c b/gtk/window-decorator/style.c
index d25a884..481c084 100644
--- a/gtk/window-decorator/style.c
+++ b/gtk/window-decorator/style.c
@@ -23,13 +23,15 @@ update_style (GtkWidget *widget)
}
void
-style_changed (PangoContext *context,
- GtkWidget *widget)
+style_changed (GtkWidget *widget,
+ void *user_data)
{
GdkDisplay *gdkdisplay;
GdkScreen *gdkscreen;
WnckScreen *screen;
+ PangoContext *context = (PangoContext *) user_data;
+
gdkdisplay = gdk_display_get_default ();
gdkscreen = gdk_display_get_default_screen (gdkdisplay);
screen = wnck_screen_get_default ();