diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2011-01-04 02:28:19 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2011-01-04 03:06:20 +0100 |
commit | e4c509837f54098f4bcf67d19faa9dbab5c77033 (patch) | |
tree | e7654adfc291c6a68b479eb088e7a92df2ed5ccd /gtk/gtkentry.c | |
parent | 55145e0e4e57d56cf02b3258e4dd9c522dbea6cf (diff) | |
download | gtk+-e4c509837f54098f4bcf67d19faa9dbab5c77033.tar.gz |
GtkEntry: get font description from GtkStyleContext
Diffstat (limited to 'gtk/gtkentry.c')
-rw-r--r-- | gtk/gtkentry.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 69af6639ae..7bcb805082 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -6169,6 +6169,8 @@ gtk_entry_move_adjustments (GtkEntry *entry) GtkAdjustment *adjustment; PangoContext *context; PangoFontMetrics *metrics; + GtkStyleContext *style_context; + GtkStateFlags state; gint x, layout_x, border_x, border_y; gint char_width; @@ -6186,8 +6188,11 @@ gtk_entry_move_adjustments (GtkEntry *entry) /* Approximate width of a char, so user can see what is ahead/behind */ context = gtk_widget_get_pango_context (widget); - metrics = pango_context_get_metrics (context, - gtk_widget_get_style (widget)->font_desc, + style_context = gtk_widget_get_style_context (widget); + state = gtk_widget_get_state_flags (widget); + + metrics = pango_context_get_metrics (context, + gtk_style_context_get_font (style_context, state), pango_context_get_language (context)); char_width = pango_font_metrics_get_approximate_char_width (metrics) / PANGO_SCALE; |