[gtk+/wip/otte/gtk4: 30/127] fontchooserwidget: Query dpi from CssStyle
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/gtk4: 30/127] fontchooserwidget: Query dpi from CssStyle
- Date: Sat, 8 Oct 2016 03:12:43 +0000 (UTC)
commit a707eda842ddb7bd4159b38b64e88c33f7724a0a
Author: Benjamin Otte <otte redhat com>
Date: Fri Sep 30 05:11:19 2016 +0200
fontchooserwidget: Query dpi from CssStyle
gtk/gtkfontchooserwidget.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index b7fbef1..afccbdc 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]