[Mono-winforms-list] Libgdiplus couldn't get DPI -> Programs didn't run

Mart Roosmaa Mart Roosmaa <roosmaa@gmail.com>
Mon, 27 Sep 2004 21:48:32 +0300


------=_Part_202_6500610.1096310912647
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

There was(is) this little problem w/ libgdiplus, it couldn't get my
dpi, so the program raised division by zero exception...
So I made a _little_ patch: If X window is running, but can't get DPI
then use default...
Maybe someone could add this to the CVS?

Mart

------=_Part_202_6500610.1096310912647
Content-Type: text/x-patch; name="libgdiplus_dpi.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="libgdiplus_dpi.patch"

diff -Nru a/src/general.c b/src/general.c
--- a/src/general.c=092004-07-12 14:35:35.000000000 +0300
+++ b/src/general.c=092004-09-25 18:02:04.000000000 +0300
@@ -214,6 +214,9 @@
             char *val =3D XGetDefault(GDIP_display, "Xft", "dpi");
             if (val) {
                 dpis =3D atof(val);
+            } else {
+            =09// If XGetDefault should return NULL for some reason, use d=
efault dpi
+            =09dpis =3D 72.0f;
             }
         }
     }

------=_Part_202_6500610.1096310912647--