From 1d020027198b94015d559f99943f49aebd98a690 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Thu, 22 Feb 2007 11:07:20 +0000 Subject: Add default for X servers that return DPI 0 and round the result as does Mozilla. --- (limited to 'lib') diff --git a/lib/src/sugar-utils.c b/lib/src/sugar-utils.c index 7aa896e..f7bf1c5 100644 --- a/lib/src/sugar-utils.c +++ b/lib/src/sugar-utils.c @@ -17,9 +17,11 @@ * Boston, MA 02111-1307, USA. */ -#include +#include #include +#include "sugar-utils.h" + gint sugar_get_screen_dpi(void) { @@ -27,8 +29,8 @@ sugar_get_screen_dpi(void) if (val) { char *e; double d = strtod(val, &e); - if (e != val) - return round(d); + if (d > 0.0) + return (int)(d+0.5); } return 96; -- cgit v0.9.1