forked from AuroraMiddleware/gtk
fontchooserwidget: Query dpi from CssStyle
This commit is contained in:
parent
fec8069e7b
commit
77cdbfde97
@ -29,6 +29,7 @@
|
|||||||
#include "gtkbuildable.h"
|
#include "gtkbuildable.h"
|
||||||
#include "gtkbox.h"
|
#include "gtkbox.h"
|
||||||
#include "gtkcellrenderertext.h"
|
#include "gtkcellrenderertext.h"
|
||||||
|
#include "gtkcssnumbervalueprivate.h"
|
||||||
#include "gtkentry.h"
|
#include "gtkentry.h"
|
||||||
#include "gtksearchentry.h"
|
#include "gtksearchentry.h"
|
||||||
#include "gtkgrid.h"
|
#include "gtkgrid.h"
|
||||||
@ -42,6 +43,7 @@
|
|||||||
#include "gtkscale.h"
|
#include "gtkscale.h"
|
||||||
#include "gtkscrolledwindow.h"
|
#include "gtkscrolledwindow.h"
|
||||||
#include "gtkspinbutton.h"
|
#include "gtkspinbutton.h"
|
||||||
|
#include "gtkstylecontextprivate.h"
|
||||||
#include "gtktextview.h"
|
#include "gtktextview.h"
|
||||||
#include "gtktreeselection.h"
|
#include "gtktreeselection.h"
|
||||||
#include "gtktreeview.h"
|
#include "gtktreeview.h"
|
||||||
@ -842,10 +844,14 @@ static int
|
|||||||
gtk_font_chooser_widget_get_preview_text_height (GtkFontChooserWidget *fontchooser)
|
gtk_font_chooser_widget_get_preview_text_height (GtkFontChooserWidget *fontchooser)
|
||||||
{
|
{
|
||||||
GtkWidget *treeview = fontchooser->priv->family_face_list;
|
GtkWidget *treeview = fontchooser->priv->family_face_list;
|
||||||
|
GtkStyleContext *context;
|
||||||
double dpi, font_size;
|
double dpi, font_size;
|
||||||
|
|
||||||
dpi = gdk_screen_get_resolution (gtk_widget_get_screen (treeview));
|
context = gtk_widget_get_style_context (treeview);
|
||||||
gtk_style_context_get (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),
|
gtk_widget_get_state_flags (treeview),
|
||||||
"font-size", &font_size,
|
"font-size", &font_size,
|
||||||
NULL);
|
NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user