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.

From-SVN: r83698
This commit is contained in:
Andreas Tobler 2004-06-26 05:44:38 +02:00 committed by Andreas Tobler
parent c520979797
commit d168da7484
2 changed files with 20 additions and 4 deletions

View 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> 2004-06-24 Bryce McKinlay <mckinlay@redhat.com>
* testsuite/libjava.jacks/jacks.xfail: Remove * testsuite/libjava.jacks/jacks.xfail: Remove

View File

@ -231,9 +231,15 @@ init_dpi_conversion_factor ()
{ {
int int_dpi; int int_dpi;
g_object_get (settings, "gtk-xft-dpi", &int_dpi, NULL); 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_signal_connect (settings, "notify::gtk-xft-dpi",
G_CALLBACK (dpi_changed_cb), NULL); G_CALLBACK (dpi_changed_cb), NULL);
} }
else else
/* Approximate. */ /* Approximate. */
@ -242,9 +248,12 @@ init_dpi_conversion_factor ()
static void static void
dpi_changed_cb (GtkSettings *settings, dpi_changed_cb (GtkSettings *settings,
GParamSpec *pspec) GParamSpec *pspec __attribute__((unused)))
{ {
int int_dpi; int int_dpi;
g_object_get (settings, "gtk-xft-dpi", &int_dpi, NULL); 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);
} }