diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-02-22 11:07:20 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-02-22 11:07:20 (GMT) |
commit | 1d020027198b94015d559f99943f49aebd98a690 (patch) | |
tree | 630e14a55f82ac0349eea64227ec398f909ff2f4 /lib | |
parent | 1b5ac988d786199a2ec2732775e8acd67833458d (diff) |
Add default for X servers that return DPI 0 and round the result as does Mozilla.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/src/sugar-utils.c | 8 |
1 files changed, 5 insertions, 3 deletions
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 <math.h> +#include <stdlib.h> #include <gdk/gdkx.h> +#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; |