2004-06-26 Andreas Tobler <a.tobler@schweiz.ch>
authorAndreas Tobler <a.tobler@schweiz.ch>
Sat, 26 Jun 2004 03:44:38 +0000 (05:44 +0200)
committerAndreas Tobler <andreast@gcc.gnu.org>
Sat, 26 Jun 2004 03:44:38 +0000 (05:44 +0200)
* 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
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c

index d6474a0eb2285b7e3c6a5051fbf8fd3b553e34c8..cf9ae71ee3ed8be42340e9f034bf77e44e67ec5d 100644 (file)
@@ -1,3 +1,10 @@
+2004-06-26  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * 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  <mckinlay@redhat.com>
 
        * testsuite/libjava.jacks/jacks.xfail: Remove
index 817bee7520082923968a545768ee46c81a4dd330..fdd4253125178576fed14707c9dfe4022bccd3ed 100644 (file)
@@ -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);
 }