summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-02-21 23:28:57 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-02-21 23:28:57 +0800
commit3c073f1f63b54538d9e8814ef63e0402e60b26d8 (patch)
treeeaf5e829b4029fcf6bbf65c397857fab43625bc9
parentd10bd89e7ca542bd227281e81626adcaf65f9adb (diff)
downloadcompiz-with-glib-mainloop-3c073f1f63b54538d9e8814ef63e0402e60b26d8.tar.gz
compiz-with-glib-mainloop-3c073f1f63b54538d9e8814ef63e0402e60b26d8.tar.bz2
Fix down-left shift and wrong offsets for default decorations.
Initialize settings before creating decoration frames
-rw-r--r--gtk/window-decorator/events.c3
-rw-r--r--gtk/window-decorator/frames.c7
-rw-r--r--gtk/window-decorator/gtk-window-decorator.c81
-rw-r--r--gtk/window-decorator/gtk-window-decorator.h2
-rw-r--r--gtk/window-decorator/settings.c16
5 files changed, 54 insertions, 55 deletions
diff --git a/gtk/window-decorator/events.c b/gtk/window-decorator/events.c
index 1dea221..73e44ef 100644
--- a/gtk/window-decorator/events.c
+++ b/gtk/window-decorator/events.c
@@ -980,7 +980,8 @@ event_filter_func (GdkXEvent *gdkxevent,
if (screen)
{
- shadow_property_changed (screen);
+ if (shadow_property_changed (screen))
+ decorations_changed (screen);
}
}
else if (xevent->xproperty.atom == mwm_hints_atom)
diff --git a/gtk/window-decorator/frames.c b/gtk/window-decorator/frames.c
index c735e7b..06482c5 100644
--- a/gtk/window-decorator/frames.c
+++ b/gtk/window-decorator/frames.c
@@ -41,8 +41,6 @@ decor_frame_refresh (decor_frame_t *frame)
update_style (frame->style_window_rgba);
update_style (frame->style_window_rgb);
- /* Should really read gconf for that */
-
gchar *str = settings->font;
set_frame_scale (frame, str);
@@ -51,9 +49,8 @@ decor_frame_refresh (decor_frame_t *frame)
frame_update_titlebar_font (frame);
- /* FIXME */
- if (strcmp (frame->type, "bare") &&
- strcmp (frame->type, "switcher"))
+ if (strcmp (frame->type, "switcher") != 0 &&
+ strcmp (frame->type, "bare") != 0)
(*theme_update_border_extents) (frame);
opt_shadow.shadow_radius = settings->shadow_radius;
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index 545c7ed..86e684f 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -125,6 +125,7 @@ main (int argc, char *argv[])
#ifdef USE_METACITY
char *meta_theme = NULL;
+ MetaTheme *theme = NULL;
#endif
program_name = argv[0];
@@ -239,29 +240,6 @@ main (int argc, char *argv[])
}
}
- theme_draw_window_decoration = draw_window_decoration;
- theme_calc_decoration_size = calc_decoration_size;
- theme_update_border_extents = update_border_extents;
- theme_get_event_window_position = get_event_window_position;
- theme_get_button_position = get_button_position;
- theme_get_title_scale = get_title_scale;
-
-#ifdef USE_METACITY
- if (meta_theme)
- {
- meta_theme_set_current (meta_theme, TRUE);
- if (meta_theme_get_current ())
- {
- theme_draw_window_decoration = meta_draw_window_decoration;
- theme_calc_decoration_size = meta_calc_decoration_size;
- theme_update_border_extents = meta_update_border_extents;
- theme_get_event_window_position = meta_get_event_window_position;
- theme_get_button_position = meta_get_button_position;
- theme_get_title_scale = meta_get_title_scale;
- }
- }
-#endif
-
gdkdisplay = gdk_display_get_default ();
xdisplay = gdk_x11_display_get_xdisplay (gdkdisplay);
gdkscreen = gdk_display_get_default_screen (gdkdisplay);
@@ -320,6 +298,49 @@ main (int argc, char *argv[])
return 1;
}
+ screen = wnck_screen_get_default ();
+
+ initialize_decorations ();
+
+ if (!init_settings (screen))
+ {
+ free (settings);
+ fprintf (stderr, "%s: Failed to get necessary gtk settings\n", argv[0]);
+ return 1;
+ }
+
+ theme_draw_window_decoration = draw_window_decoration;
+ theme_calc_decoration_size = calc_decoration_size;
+ theme_update_border_extents = update_border_extents;
+ theme_get_event_window_position = get_event_window_position;
+ theme_get_button_position = get_button_position;
+ theme_get_title_scale = get_title_scale;
+
+#ifdef USE_METACITY
+ if (meta_theme)
+ {
+ meta_theme_set_current (meta_theme, TRUE);
+
+ theme = meta_theme_get_current ();
+
+ if (!theme)
+ g_warning ("specified a theme that does not exist! falling back to cairo decoration\n");
+ }
+ else
+ theme = meta_theme_get_current ();
+
+ if (theme)
+ {
+ fprintf (stderr, "setting procs\n");
+ theme_draw_window_decoration = meta_draw_window_decoration;
+ theme_calc_decoration_size = meta_calc_decoration_size;
+ theme_update_border_extents = meta_update_border_extents;
+ theme_get_event_window_position = meta_get_event_window_position;
+ theme_get_button_position = meta_get_button_position;
+ theme_get_title_scale = meta_get_title_scale;
+ }
+#endif
+
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
@@ -342,15 +363,14 @@ main (int argc, char *argv[])
return 1;
}
- screen = wnck_screen_get_default ();
wnck_set_client_type (WNCK_CLIENT_TYPE_PAGER);
gdk_window_add_filter (NULL,
selection_event_filter_func,
NULL);
- if (!minimal)
- {
+ if (!minimal)
+ {
GdkWindow *root = gdk_window_foreign_new_for_display (gdkdisplay,
gdk_x11_get_default_root_xwindow ());
@@ -383,8 +403,6 @@ main (int argc, char *argv[])
connect_screen (screen);
}
- initialize_decorations ();
-
/* Keep the default, bare and switcher decorations around
* since otherwise they will be spuriously recreated */
@@ -392,13 +410,6 @@ main (int argc, char *argv[])
bare_p = gwd_get_decor_frame ("bare");
switcher_p = gwd_get_decor_frame ("switcher");
- if (!init_settings (screen))
- {
- free (settings);
- fprintf (stderr, "%s: Failed to get necessary gtk settings\n", argv[0]);
- return 1;
- }
-
decor_set_dm_check_hint (xdisplay, gdk_screen_get_number (gdkscreen),
WINDOW_DECORATION_TYPE_PIXMAP |
WINDOW_DECORATION_TYPE_WINDOW);
diff --git a/gtk/window-decorator/gtk-window-decorator.h b/gtk/window-decorator/gtk-window-decorator.h
index 4e973e7..ab90085 100644
--- a/gtk/window-decorator/gtk-window-decorator.h
+++ b/gtk/window-decorator/gtk-window-decorator.h
@@ -611,7 +611,7 @@ update_event_windows (WnckWindow *win);
int
update_shadow (void);
-void
+gboolean
shadow_property_changed (WnckScreen *screen);
void
diff --git a/gtk/window-decorator/settings.c b/gtk/window-decorator/settings.c
index 3934554..0ceea0b 100644
--- a/gtk/window-decorator/settings.c
+++ b/gtk/window-decorator/settings.c
@@ -25,7 +25,7 @@
* instead - much much cleaner!
*/
-void
+gboolean
shadow_property_changed (WnckScreen *s)
{
GdkDisplay *display = gdk_display_get_default ();
@@ -44,7 +44,7 @@ shadow_property_changed (WnckScreen *s)
&format, &n, &left, &prop_data);
if (result != Success)
- return;
+ return FALSE;
if (n == 4)
{
@@ -102,8 +102,7 @@ shadow_property_changed (WnckScreen *s)
XFreeStringList (t_data);
}
- if (changed)
- decorations_changed (s);
+ return changed;
}
#ifdef USE_GCONF
@@ -540,17 +539,8 @@ init_settings (WnckScreen *screen)
g_object_unref (gconf);
#endif
-
- update_titlebar_font ();
-
- gwd_process_frames (update_frames_border_extents,
- window_type_frames,
- WINDOW_TYPE_FRAMES_NUM,
- NULL);
shadow_property_changed (screen);
- update_shadow ();
-
return TRUE;
}