From d168da7484c329c59021cadbd34c24844c6466ce Mon Sep 17 00:00:00 2001 From: Andreas Tobler Date: Sat, 26 Jun 2004 05:44:38 +0200 Subject: [PATCH] 2004-06-26 Andreas Tobler * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c (init_dpi_conversion_factor): Check for int_dpi < 0 in case gtk-xft-dpi can not calculate the right value. (dpi_changed_cb): Likewise. Mark *pspec as unused. From-SVN: r83698 --- libjava/ChangeLog | 7 +++++++ .../gnu_java_awt_peer_gtk_GtkMainThread.c | 17 +++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index d6474a0eb22..cf9ae71ee3e 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,10 @@ +2004-06-26 Andreas Tobler + + * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c + (init_dpi_conversion_factor): Check for int_dpi < 0 in case gtk-xft-dpi + can not calculate the right value. + (dpi_changed_cb): Likewise. Mark *pspec as unused. + 2004-06-24 Bryce McKinlay * testsuite/libjava.jacks/jacks.xfail: Remove diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c index 817bee75200..fdd42531251 100644 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c +++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c @@ -231,9 +231,15 @@ init_dpi_conversion_factor () { int int_dpi; g_object_get (settings, "gtk-xft-dpi", &int_dpi, NULL); - dpi_conversion_factor = PANGO_SCALE * 72.0 / (int_dpi / PANGO_SCALE); + /* If int_dpi == -1 gtk-xft-dpi returns the default value. So we + have to do approximate calculation here. */ + if (int_dpi < 0) + dpi_conversion_factor = PANGO_SCALE * 72.0 / 96.; + else + dpi_conversion_factor = PANGO_SCALE * 72.0 / (int_dpi / PANGO_SCALE); + g_signal_connect (settings, "notify::gtk-xft-dpi", - G_CALLBACK (dpi_changed_cb), NULL); + G_CALLBACK (dpi_changed_cb), NULL); } else /* Approximate. */ @@ -242,9 +248,12 @@ init_dpi_conversion_factor () static void dpi_changed_cb (GtkSettings *settings, - GParamSpec *pspec) + GParamSpec *pspec __attribute__((unused))) { int int_dpi; g_object_get (settings, "gtk-xft-dpi", &int_dpi, NULL); - dpi_conversion_factor = PANGO_SCALE * 72.0 / (int_dpi / PANGO_SCALE); + if (int_dpi < 0) + dpi_conversion_factor = PANGO_SCALE * 72.0 / 96.; + else + dpi_conversion_factor = PANGO_SCALE * 72.0 / (int_dpi / PANGO_SCALE); } -- 2.30.2