diff options
author | Benjamin Otte <otte@redhat.com> | 2016-09-30 05:11:19 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-10-16 18:17:21 +0200 |
commit | 77cdbfde97d847d88e643a8b347b657cfbad48e2 (patch) | |
tree | a457ee562cacc6b365b932215af813c1bb26c338 /gtk/gtkfontchooserwidget.c | |
parent | fec8069e7bf2907bcf19cd1a7c5535ee89ba1ed9 (diff) | |
download | gtk+-77cdbfde97d847d88e643a8b347b657cfbad48e2.tar.gz |
fontchooserwidget: Query dpi from CssStyle
Diffstat (limited to 'gtk/gtkfontchooserwidget.c')
-rw-r--r-- | gtk/gtkfontchooserwidget.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c index b7fbef1f90..afccbdc345 100644 --- a/gtk/gtkfontchooserwidget.c +++ b/gtk/gtkfontchooserwidget.c @@ -29,6 +29,7 @@ #include "gtkbuildable.h" #include "gtkbox.h" #include "gtkcellrenderertext.h" +#include "gtkcssnumbervalueprivate.h" #include "gtkentry.h" #include "gtksearchentry.h" #include "gtkgrid.h" @@ -42,6 +43,7 @@ #include "gtkscale.h" #include "gtkscrolledwindow.h" #include "gtkspinbutton.h" +#include "gtkstylecontextprivate.h" #include "gtktextview.h" #include "gtktreeselection.h" #include "gtktreeview.h" @@ -842,10 +844,14 @@ static int gtk_font_chooser_widget_get_preview_text_height (GtkFontChooserWidget *fontchooser) { GtkWidget *treeview = fontchooser->priv->family_face_list; + GtkStyleContext *context; double dpi, font_size; - dpi = gdk_screen_get_resolution (gtk_widget_get_screen (treeview)); - gtk_style_context_get (gtk_widget_get_style_context (treeview), + context = gtk_widget_get_style_context (treeview); + dpi = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, + GTK_CSS_PROPERTY_DPI), + 100); + gtk_style_context_get (context, gtk_widget_get_state_flags (treeview), "font-size", &font_size, NULL); |