frames: Rename layout to text_layout

... to differentiate PangoLayout from MetaFrameLayout.

https://bugzilla.gnome.org/show_bug.cgi?id=741917
This commit is contained in:
Florian Müllner 2014-09-27 08:10:59 +02:00 committed by Jasper St. Pierre
parent 5e9db422c9
commit ef32899b4d
2 changed files with 18 additions and 24 deletions

View File

@ -300,15 +300,14 @@ queue_recalc_func (gpointer key, gpointer value, gpointer data)
invalidate_whole_window (frames, frame); invalidate_whole_window (frames, frame);
meta_core_queue_frame_resize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), meta_core_queue_frame_resize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
frame->xwindow); frame->xwindow);
if (frame->layout) if (frame->text_layout)
{ {
/* save title to recreate layout */ /* save title to recreate layout */
g_free (frame->title); g_free (frame->title);
frame->title = g_strdup (pango_layout_get_text (frame->layout)); frame->title = g_strdup (pango_layout_get_text (frame->text_layout));
g_object_unref (G_OBJECT (frame->layout)); g_clear_object (&frame->text_layout);
frame->layout = NULL;
} }
} }
@ -399,31 +398,30 @@ meta_frames_ensure_layout (MetaFrames *frames,
if (style != frame->cache_style) if (style != frame->cache_style)
{ {
if (frame->layout) if (frame->text_layout)
{ {
/* save title to recreate layout */ /* save title to recreate layout */
g_free (frame->title); g_free (frame->title);
frame->title = g_strdup (pango_layout_get_text (frame->layout)); frame->title = g_strdup (pango_layout_get_text (frame->text_layout));
g_object_unref (G_OBJECT (frame->layout)); g_clear_object (&frame->text_layout);
frame->layout = NULL;
} }
} }
frame->cache_style = style; frame->cache_style = style;
if (frame->layout == NULL) if (frame->text_layout == NULL)
{ {
gpointer key, value; gpointer key, value;
PangoFontDescription *font_desc; PangoFontDescription *font_desc;
int size; int size;
frame->layout = gtk_widget_create_pango_layout (widget, frame->title); frame->text_layout = gtk_widget_create_pango_layout (widget, frame->title);
pango_layout_set_ellipsize (frame->layout, PANGO_ELLIPSIZE_END); pango_layout_set_ellipsize (frame->text_layout, PANGO_ELLIPSIZE_END);
pango_layout_set_auto_dir (frame->layout, FALSE); pango_layout_set_auto_dir (frame->text_layout, FALSE);
pango_layout_set_single_paragraph_mode (frame->layout, TRUE); pango_layout_set_single_paragraph_mode (frame->text_layout, TRUE);
font_desc = meta_style_info_create_font_desc (frame->style_info); font_desc = meta_style_info_create_font_desc (frame->style_info);
meta_frame_style_apply_scale (style, font_desc); meta_frame_style_apply_scale (style, font_desc);
@ -447,7 +445,7 @@ meta_frames_ensure_layout (MetaFrames *frames,
GINT_TO_POINTER (frame->text_height)); GINT_TO_POINTER (frame->text_height));
} }
pango_layout_set_font_description (frame->layout, pango_layout_set_font_description (frame->text_layout,
font_desc); font_desc);
pango_font_description_free (font_desc); pango_font_description_free (font_desc);
@ -565,7 +563,7 @@ meta_frames_manage_window (MetaFrames *frames,
frame->xwindow = xwindow; frame->xwindow = xwindow;
frame->cache_style = NULL; frame->cache_style = NULL;
frame->layout = NULL; frame->text_layout = NULL;
frame->text_height = -1; frame->text_height = -1;
frame->title = NULL; frame->title = NULL;
frame->shape_applied = FALSE; frame->shape_applied = FALSE;
@ -603,8 +601,8 @@ meta_frames_unmanage_window (MetaFrames *frames,
gdk_window_destroy (frame->window); gdk_window_destroy (frame->window);
if (frame->layout) if (frame->text_layout)
g_object_unref (G_OBJECT (frame->layout)); g_object_unref (G_OBJECT (frame->text_layout));
g_free (frame->title); g_free (frame->title);
@ -859,11 +857,7 @@ meta_frames_set_title (MetaFrames *frames,
g_free (frame->title); g_free (frame->title);
frame->title = g_strdup (title); frame->title = g_strdup (title);
if (frame->layout) g_clear_object (&frame->text_layout);
{
g_object_unref (frame->layout);
frame->layout = NULL;
}
invalidate_whole_window (frames, frame); invalidate_whole_window (frames, frame);
} }
@ -1756,7 +1750,7 @@ meta_frames_paint (MetaFrames *frames,
type, type,
flags, flags,
w, h, w, h,
frame->layout, frame->text_layout,
frame->text_height, frame->text_height,
&button_layout, &button_layout,
button_states, button_states,

View File

@ -76,7 +76,7 @@ struct _MetaUIFrame
GdkWindow *window; GdkWindow *window;
MetaStyleInfo *style_info; MetaStyleInfo *style_info;
MetaFrameStyle *cache_style; MetaFrameStyle *cache_style;
PangoLayout *layout; PangoLayout *text_layout;
int text_height; int text_height;
char *title; /* NULL once we have a layout */ char *title; /* NULL once we have a layout */
guint shape_applied : 1; guint shape_applied : 1;