summaryrefslogtreecommitdiff
path: root/apps/x11_main.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-05-28 16:14:41 +0200
committerTor Andersson <tor@ghostscript.com>2010-05-28 16:14:41 +0200
commit0a9c06b78cc96eff4c8dbfc488aefa7093ae57c3 (patch)
treed8451a4db1a548f9ef30258208f1854877ff1e72 /apps/x11_main.c
parentd65bded0e788321bd09c0d3a9864ef7ee13dcddb (diff)
downloadmupdf-0a9c06b78cc96eff4c8dbfc488aefa7093ae57c3.tar.xz
Don't use UnmapWindow to signal closing the x11 viewer -- Unmap is used to iconify and hide windows.
Diffstat (limited to 'apps/x11_main.c')
-rw-r--r--apps/x11_main.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/apps/x11_main.c b/apps/x11_main.c
index 1a8304dc..21a81878 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -73,6 +73,7 @@ static Time copytime;
static char *filename;
static pdfapp_t gapp;
+static int closing = 0;
/*
* Dialog boxes
@@ -179,21 +180,6 @@ static void winopen(void)
x11fd = ConnectionNumber(xdpy);
}
-void winclose(pdfapp_t *app)
-{
- XFreePixmap(xdpy, xicon);
-
- XFreeCursor(xdpy, xcwait);
- XFreeCursor(xdpy, xchand);
- XFreeCursor(xdpy, xcarrow);
-
- XFreeGC(xdpy, xgc);
-
- XDestroyWindow(xdpy, xwin);
-
- XCloseDisplay(xdpy);
-}
-
void wincursor(pdfapp_t *app, int curs)
{
if (curs == ARROW)
@@ -479,10 +465,7 @@ static void onkey(int c)
if (c == 'P')
windrawpageno(&gapp);
else if (c == 'q')
- {
- XSelectInput(xdpy, xwin, StructureNotifyMask);
- XUnmapWindow(xdpy, xwin);
- }
+ closing = 1;
else
pdfapp_onkey(&gapp, c);
}
@@ -558,7 +541,6 @@ int main(int argc, char **argv)
int pageno = 1;
int wasshowingpage;
struct timeval tmo, tmo_at;
- int closing;
int fd;
while ((c = fz_getopt(argc, argv, "p:r:")) != -1)
@@ -684,11 +666,6 @@ int main(int argc, char **argv)
xevt.xselectionrequest.property,
xevt.xselectionrequest.time);
break;
-
- case UnmapNotify:
- winclose(&gapp);
- closing = 1;
- break;
}
}
while (!closing && XPending(xdpy));
@@ -707,5 +684,17 @@ int main(int argc, char **argv)
pdfapp_close(&gapp);
+ XDestroyWindow(xdpy, xwin);
+
+ XFreePixmap(xdpy, xicon);
+
+ XFreeCursor(xdpy, xcwait);
+ XFreeCursor(xdpy, xchand);
+ XFreeCursor(xdpy, xcarrow);
+
+ XFreeGC(xdpy, xgc);
+
+ XCloseDisplay(xdpy);
+
return 0;
}