ports/graphics/mupdf/files/patch-apps_x11_main.c
Michael Scheidell 75d6e7bd3b - Update to 1.0
PR:		ports/166745
Submitted by:	Zhihao Yuan <lichray@gmail.com> (maintainer)
2012-06-04 00:02:49 +00:00

27 lines
605 B
C

--- apps/x11_main.c.orig 2012-03-29 05:46:53.000000000 -0500
+++ apps/x11_main.c 2012-04-07 14:37:40.754315181 -0500
@@ -602,6 +602,24 @@ static void usage(void)
exit(1);
}
+/* reference:
+ * http://stackoverflow.com/questions/2621439/how-to-get-screen-dpi-linux-mac-programatically
+ */
+int get_dpi(void)
+{
+ Display *xdpy;
+ int xscr;
+ int x = 0;
+
+ if ((xdpy = XOpenDisplay(NULL))) {
+ xscr = DefaultScreen(xdpy);
+ x = (int) (DisplayWidth(xdpy, xscr) * 25.4 /
+ DisplayWidthMM(xdpy, xscr) + 0.5);
+ XCloseDisplay(xdpy);
+ }
+ return x;
+}
+
int main(int argc, char **argv)
{
int c;