{"text", GTK_DEBUG_TEXT},
{"tree", GTK_DEBUG_TREE},
{"updates", GTK_DEBUG_UPDATES},
- {"keybindings", GTK_DEBUG_KEYBINDINGS}
+ {"keybindings", GTK_DEBUG_KEYBINDINGS},
+ {"multihead", GTK_DEBUG_MULTIHEAD}
};
static const guint gtk_ndebug_keys = sizeof (gtk_debug_keys) / sizeof (GDebugKey);
gdk_colormap_unref (style->colormap);
style->colormap = NULL;
-
+
+ if (style->private_font_desc)
+ {
+ if (style->private_font)
+ {
+ gdk_font_unref (style->private_font);
+ style->private_font = NULL;
+ }
+
+ pango_font_description_free (style->private_font_desc);
+ style->private_font_desc = NULL;
+ }
+
g_object_unref (style);
}
}
if (state_type == GTK_STATE_INSENSITIVE)
gdk_draw_string (window,
- gtk_style_get_font_for_display (display, style),
+ gtk_style_get_font (style),
style->white_gc, x + 1, y + 1, string);
gdk_draw_string (window,
- gtk_style_get_font_for_display (display, style),
+ gtk_style_get_font (style),
style->fg_gc[state_type], x, y, string);
if (area)
}
/**
- * gtk_style_get_font_for_display:
- * @display : a #GdkDisplay
+ * gtk_style_get_font:
* @style: a #GtkStyle
*
* Gets the #GdkFont to use for the given style. This is
- * meant only as a replacement for direct access to style->font
+ * meant only as a replacement for direct access to @style->font
* and should not be used in new code. New code should
- * use style->font_desc instead.
+ * use @style->font_desc instead.
*
* Return value: the #GdkFont for the style. This font is owned
* by the style; if you want to keep around a copy, you must
* call gdk_font_ref().
**/
GdkFont *
-gtk_style_get_font_for_display (GdkDisplay *display,
- GtkStyle *style)
+gtk_style_get_font (GtkStyle *style)
{
- g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
if (style->private_font && style->private_font_desc)
if (!style->private_font)
{
+ GdkDisplay *display;
+
+ if (style->colormap)
+ {
+ display = gdk_screen_get_display (gdk_colormap_get_screen (style->colormap));
+ }
+ else
+ {
+ display = gdk_get_default_display ();
+ GTK_NOTE (MULTIHEAD,
+ g_warning ("gtk_style_get_font() should not be called on an unattached style"));
+ }
+
if (style->font_desc)
{
- /* no colormap, no screen */
style->private_font = gdk_font_from_description_for_display (display, style->font_desc);
style->private_font_desc = pango_font_description_copy (style->font_desc);
}
return style->private_font;
}
-/**
- * gtk_style_get_font:
- * @style: a #GtkStyle
- *
- * Gets the #GdkFont to use for the given style. This is
- * meant only as a replacement for direct access to @style->font
- * and should not be used in new code. New code should
- * use @style->font_desc instead.
- *
- * Return value: the #GdkFont for the style. This font is owned
- * by the style; if you want to keep around a copy, you must
- * call gdk_font_ref().
- **/
-GdkFont *
-gtk_style_get_font (GtkStyle *style)
-{
- g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
-
- return gtk_style_get_font_for_display (gdk_get_default_display (), style);
-}
-
/**
* gtk_style_set_font:
* @style: a #GtkStyle.
#define MARK_CURRENT_FONT(text, mark) \
((MARK_CURRENT_PROPERTY(mark)->flags & PROPERTY_FONT) ? \
MARK_CURRENT_PROPERTY(mark)->font->gdk_font : \
- gtk_style_get_font_for_display (gtk_widget_get_display (GTK_WIDGET (text)), \
- GTK_WIDGET (text)->style))
+ gtk_style_get_font (GTK_WIDGET (text)->style))
#define MARK_CURRENT_FORE(text, mark) \
((MARK_CURRENT_PROPERTY(mark)->flags & PROPERTY_FOREGROUND) ? \
&MARK_CURRENT_PROPERTY(mark)->fore_color : \
gtk_widget_ensure_style (widget);
if ((widget->style) &&
- (gtk_style_get_font_for_display (gtk_widget_get_display (widget), widget->style)->type == GDK_FONT_FONTSET))
+ (gtk_style_get_font (widget->style)->type == GDK_FONT_FONTSET))
{
text->use_wchar = TRUE;
g_free (text->text.ch);
if (text->current_font)
text_font_unref (text->current_font);
- text->current_font = get_text_font (gtk_style_get_font_for_display (gtk_widget_get_display (widget), widget->style));
+ text->current_font = get_text_font (gtk_style_get_font (widget->style));
}
static void
xthickness = widget->style->xthickness + TEXT_BORDER_ROOM;
ythickness = widget->style->ythickness + TEXT_BORDER_ROOM;
- font = gtk_style_get_font_for_display (gtk_widget_get_display (widget),
- widget->style);
+ font = gtk_style_get_font (widget->style);
char_height = MIN_TEXT_HEIGHT_LINES * (font->ascent +
font->descent);