diff options
author | Sam Spilsbury <sam.spilsbury@canonical.com> | 2011-02-14 12:01:47 +0800 |
---|---|---|
committer | Sam Spilsbury <sam.spilsbury@canonical.com> | 2011-02-14 12:01:47 +0800 |
commit | 9001115166668e04eb06b8f08b3814be7c44a2ba (patch) | |
tree | cd986d4887cccf072b25388836b4c5e30e0ca995 | |
parent | c2e195a5eca99c3b03b740e1f609b900b6ef9a93 (diff) | |
download | compiz-with-glib-mainloop-9001115166668e04eb06b8f08b3814be7c44a2ba.tar.gz compiz-with-glib-mainloop-9001115166668e04eb06b8f08b3814be7c44a2ba.tar.bz2 |
Add support for drawing with different metacity theme types
-rw-r--r-- | gtk/window-decorator/gtk-window-decorator.h | 5 | ||||
-rw-r--r-- | gtk/window-decorator/metacity.c | 49 |
2 files changed, 36 insertions, 18 deletions
diff --git a/gtk/window-decorator/gtk-window-decorator.h b/gtk/window-decorator/gtk-window-decorator.h index 2bd8669..0074184 100644 --- a/gtk/window-decorator/gtk-window-decorator.h +++ b/gtk/window-decorator/gtk-window-decorator.h @@ -662,6 +662,10 @@ pixmap_new_from_pixbuf (GdkPixbuf *pixbuf, int depth); /* metacity.c */ #ifdef USE_METACITY + +MetaFrameType +meta_get_frame_type_for_win_type (WnckWindow *win); + void meta_draw_window_decoration (decor_t *d); @@ -671,6 +675,7 @@ meta_get_decoration_geometry (decor_t *d, MetaFrameFlags *flags, MetaFrameGeometry *fgeom, MetaButtonLayout *button_layout, + MetaFrameType frame_type, GdkRectangle *clip); void diff --git a/gtk/window-decorator/metacity.c b/gtk/window-decorator/metacity.c index 204b608..8f6fc93 100644 --- a/gtk/window-decorator/metacity.c +++ b/gtk/window-decorator/metacity.c @@ -407,6 +407,7 @@ meta_get_decoration_geometry (decor_t *d, MetaFrameFlags *flags, MetaFrameGeometry *fgeom, MetaButtonLayout *button_layout, + MetaFrameType frame_type, GdkRectangle *clip) { gint left_width, right_width, top_height, bottom_height; @@ -483,7 +484,7 @@ meta_get_decoration_geometry (decor_t *d, #endif meta_theme_get_frame_borders (theme, - META_FRAME_TYPE_NORMAL, + frame_type, text_height, *flags, &top_height, @@ -503,7 +504,7 @@ meta_get_decoration_geometry (decor_t *d, clip->height = d->border_layout.left.y2 - d->border_layout.left.y1; meta_theme_calc_geometry (theme, - META_FRAME_TYPE_NORMAL, + frame_type, text_height, *flags, clip->width, @@ -515,6 +516,12 @@ meta_get_decoration_geometry (decor_t *d, clip->height += top_height + bottom_height; } +MetaFrameType +meta_get_frame_type_for_win_type (WnckWindow *win) +{ + return META_FRAME_TYPE_NORMAL; +} + void meta_draw_window_decoration (decor_t *d) { @@ -526,6 +533,7 @@ meta_draw_window_decoration (decor_t *d) MetaButtonLayout button_layout; MetaFrameGeometry fgeom; MetaFrameFlags flags; + MetaFrameType frame_type; MetaTheme *theme; GtkStyle *style; cairo_t *cr; @@ -577,9 +585,10 @@ meta_draw_window_decoration (decor_t *d) cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); theme = meta_theme_get_current (); + frame_type = meta_get_frame_type_for_win_type (d->win); meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout, - &clip); + frame_type, &clip); /* we only have to redraw the shadow background when decoration changed size */ @@ -590,7 +599,7 @@ meta_draw_window_decoration (decor_t *d) button_states[i] = meta_button_state_for_button_type (d, i); frame_style = meta_theme_get_frame_style (theme, - META_FRAME_TYPE_NORMAL, + frame_type, flags); bg_color = style->bg[GTK_STATE_NORMAL]; @@ -651,7 +660,7 @@ meta_draw_window_decoration (decor_t *d) pixmap, &rect, 0, 0, - META_FRAME_TYPE_NORMAL, + frame_type, flags, clip.width - fgeom.left_width - fgeom.right_width, @@ -691,7 +700,7 @@ meta_draw_window_decoration (decor_t *d) &rect, 0, -(clip.height - fgeom.bottom_height), - META_FRAME_TYPE_NORMAL, + frame_type, flags, clip.width - fgeom.left_width - fgeom.right_width, @@ -768,7 +777,7 @@ meta_draw_window_decoration (decor_t *d) &rect, 0, -fgeom.top_height, - META_FRAME_TYPE_NORMAL, + frame_type, flags, clip.width - fgeom.left_width - fgeom.right_width, @@ -808,7 +817,7 @@ meta_draw_window_decoration (decor_t *d) &rect, -(clip.width - fgeom.right_width), -fgeom.top_height, - META_FRAME_TYPE_NORMAL, + frame_type, flags, clip.width - fgeom.left_width - fgeom.right_width, @@ -935,18 +944,19 @@ meta_calc_button_size (decor_t *d) } gboolean -meta_get_button_position (decor_t *d, - gint i, - gint width, - gint height, - gint *x, - gint *y, - gint *w, - gint *h) +meta_get_button_position (decor_t *d, + gint i, + gint width, + gint height, + gint *x, + gint *y, + gint *w, + gint *h) { MetaButtonLayout button_layout; MetaFrameGeometry fgeom; MetaFrameFlags flags; + MetaFrameType frame_type; MetaTheme *theme; GdkRectangle clip; @@ -963,9 +973,10 @@ meta_get_button_position (decor_t *d, } theme = meta_theme_get_current (); + frame_type = meta_get_frame_type_for_win_type (d->win); meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout, - &clip); + frame_type, &clip); switch (i) { case BUTTON_MENU: @@ -1183,12 +1194,14 @@ meta_get_event_window_position (decor_t *d, MetaFrameGeometry fgeom; MetaFrameFlags flags; MetaTheme *theme; + MetaFrameType frame_type; GdkRectangle clip; theme = meta_theme_get_current (); + frame_type = meta_get_frame_type_for_win_type (d->win); meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout, - &clip); + frame_type, &clip); width += fgeom.right_width + fgeom.left_width; height += fgeom.top_height + fgeom.bottom_height; |