diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2011-10-02 13:52:21 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-10-12 13:44:14 +0200 |
commit | 0d82bc58cd51f92c3806f9cfdf0d601f9e1a42e7 (patch) | |
tree | c4a652b39f4c720b7a22d1d14e78b777ab51d66d /apps/x11_main.c | |
parent | 7f69791dd7e5fd047253ed337f004ab1bfc0bb5b (diff) | |
download | mupdf-0d82bc58cd51f92c3806f9cfdf0d601f9e1a42e7.tar.xz |
Ask for screen resolution in X11 viewer.
Based on a patch by Zhihao Yuan <lichray@gmail.com>.
Diffstat (limited to 'apps/x11_main.c')
-rw-r--r-- | apps/x11_main.c | 20 |
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); |