From 244bbfa0436de0c1eaa071e973cbc4eaf1af49a2 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 16 Mar 2007 00:53:09 +0000 Subject: [PATCH] Merged from gtk-2-10: 2007-03-15 Federico Mena Quintero Merged from gtk-2-10: * gtk/gtkfilechooserdefault.c (find_good_size_from_style): PANGO_PIXELS() gives us device units, which are *points* in pangocairo's parlance, but we want actual pixels. So, get the screen's resolution to compute the actual number of pixels. Fixes bug #418585. svn path=/trunk/; revision=17530 --- ChangeLog | 10 ++++++++++ gtk/gtkfilechooserdefault.c | 14 +++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 77670501ad..aed7a8d5de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-03-15 Federico Mena Quintero + + Merged from gtk-2-10: + + * gtk/gtkfilechooserdefault.c (find_good_size_from_style): + PANGO_PIXELS() gives us device units, which are *points* in + pangocairo's parlance, but we want actual pixels. So, get the + screen's resolution to compute the actual number of pixels. + Fixes bug #418585. + 2007-03-15 Emmanuele Bassi * gtk/gtkrecentmanager.c (gtk_recent_manager_add_item): Remove diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 27f45241e9..95d42b679a 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -7134,12 +7134,24 @@ find_good_size_from_style (GtkWidget *widget, gint default_width, default_height; int font_size; GtkRequisition req; + GdkScreen *screen; + double resolution; g_assert (widget->style != NULL); impl = GTK_FILE_CHOOSER_DEFAULT (widget); + screen = gtk_widget_get_screen (widget); + if (screen) + { + resolution = gdk_screen_get_resolution (screen); + if (resolution < 0.0) /* will be -1 if the resolution is not defined in the GdkScreen */ + resolution = 96.0; + } + else + resolution = 96.0; /* wheeee */ + font_size = pango_font_description_get_size (widget->style->font_desc); - font_size = PANGO_PIXELS (font_size); + font_size = PANGO_PIXELS (font_size) * resolution / 72.0; default_width = font_size * NUM_CHARS; default_height = font_size * NUM_LINES;