summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2011-10-02 13:52:21 +0200
committerTor Andersson <tor.andersson@artifex.com>2011-10-12 13:44:14 +0200
commit0d82bc58cd51f92c3806f9cfdf0d601f9e1a42e7 (patch)
treec4a652b39f4c720b7a22d1d14e78b777ab51d66d /apps
parent7f69791dd7e5fd047253ed337f004ab1bfc0bb5b (diff)
downloadmupdf-0d82bc58cd51f92c3806f9cfdf0d601f9e1a42e7.tar.xz
Ask for screen resolution in X11 viewer.
Based on a patch by Zhihao Yuan <lichray@gmail.com>.
Diffstat (limited to 'apps')
-rw-r--r--apps/x11_main.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/apps/x11_main.c b/apps/x11_main.c
index 1b45c5ec..b8f041cf 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -214,6 +214,12 @@ void winclose(pdfapp_t *app)
closing = 1;
}
+static int winresolution()
+{
+ return DisplayWidth(xdpy, xscr) * 25.4 /
+ DisplayWidthMM(xdpy, xscr) + 0.5;
+}
+
void wincursor(pdfapp_t *app, int curs)
{
if (curs == ARROW)
@@ -562,7 +568,7 @@ int main(int argc, char **argv)
KeySym keysym;
int oldx = 0;
int oldy = 0;
- int resolution = 72;
+ int resolution = -1;
int pageno = 1;
int accelerate = 1;
int fd;
@@ -586,11 +592,6 @@ int main(int argc, char **argv)
}
}
- if (resolution < MINRES)
- resolution = MINRES;
- if (resolution > MAXRES)
- resolution = MAXRES;
-
if (argc - fz_optind == 0)
usage();
@@ -604,6 +605,13 @@ int main(int argc, char **argv)
winopen();
+ if (resolution == -1)
+ resolution = winresolution();
+ if (resolution < MINRES)
+ resolution = MINRES;
+ if (resolution > MAXRES)
+ resolution = MAXRES;
+
pdfapp_init(&gapp);
gapp.scrw = DisplayWidth(xdpy, xscr);
gapp.scrh = DisplayHeight(xdpy, xscr);