frames: Support rendering layouts

This commit is contained in:
Jasper St. Pierre 2012-05-03 21:33:40 -04:00
parent 0a9bc8995a
commit 2666303045
3 changed files with 19 additions and 5 deletions

View File

@ -616,7 +616,7 @@ meta_frames_render_background (MetaFrames *frames,
META_CORE_GET_END);
meta_frames_calc_geometry (frames, frame, &fgeom);
meta_theme_render_background (frame->tv->style_context, cr, flags, &fgeom);
meta_theme_render_background (frame->tv->style_context, cr, flags, &fgeom, frame->layout);
}
/* The client rectangle surrounds client window; it subtracts both

View File

@ -1012,7 +1012,8 @@ double meta_theme_get_title_scale (MetaTheme *theme,
void meta_theme_render_background (GtkStyleContext *style,
cairo_t *cr,
MetaFrameFlags flags,
const MetaFrameGeometry *fgeom);
const MetaFrameGeometry *fgeom,
PangoLayout *title_layout);
void meta_theme_draw_frame (MetaTheme *theme,
GtkWidget *widget,

View File

@ -4083,7 +4083,8 @@ void
meta_theme_render_background (GtkStyleContext *style_gtk,
cairo_t *cr,
MetaFrameFlags flags,
const MetaFrameGeometry *fgeom)
const MetaFrameGeometry *fgeom,
PangoLayout *title_layout)
{
GdkRectangle visible_rect;
const MetaFrameBorders *borders;
@ -4111,6 +4112,19 @@ meta_theme_render_background (GtkStyleContext *style_gtk,
visible_rect.width,
visible_rect.height);
if (title_layout != NULL)
{
PangoRectangle title_rect;
pango_layout_get_pixel_extents (title_layout,
NULL, &title_rect);
gtk_render_layout (style_gtk, cr,
borders->invisible.left + fgeom->width / 2.0 - title_rect.width / 2.0,
borders->invisible.top + borders->visible.top / 2.0 - title_rect.height / 2.0,
title_layout);
}
gtk_style_context_restore (style_gtk);
}
@ -4128,7 +4142,7 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style,
GdkPixbuf *mini_icon,
GdkPixbuf *icon)
{
meta_theme_render_background (style_gtk, cr, flags, fgeom);
meta_theme_render_background (style_gtk, cr, flags, fgeom, title_layout);
#if 0
int i, j;
@ -4138,7 +4152,6 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style,
GdkRectangle bottom_titlebar_edge;
GdkRectangle top_titlebar_edge;
GdkRectangle left_edge, right_edge, bottom_edge;
PangoRectangle logical_rect;
MetaDrawInfo draw_info;
titlebar_rect.x = visible_rect.x;