summaryrefslogtreecommitdiff
path: root/apps/x11_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/x11_main.c')
-rw-r--r--apps/x11_main.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/apps/x11_main.c b/apps/x11_main.c
index a2d36ac5..5b19a176 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -105,7 +105,7 @@ void winwarn(pdfapp_t *app, char *msg)
void winerror(pdfapp_t *app, fz_error error)
{
- fz_catch(error, "aborting");
+ fz_error_handle(error, "aborting");
exit(1);
}
@@ -127,7 +127,7 @@ static void winopen(void)
xdpy = XOpenDisplay(NULL);
if (!xdpy)
- winerror(&gapp, fz_throw("cannot open display"));
+ winerror(&gapp, fz_error_make("cannot open display"));
XA_TARGETS = XInternAtom(xdpy, "TARGETS", False);
XA_TIMESTAMP = XInternAtom(xdpy, "TIMESTAMP", False);
@@ -161,7 +161,7 @@ static void winopen(void)
0,
NULL);
if (xwin == None)
- winerror(&gapp, fz_throw("cannot create window"));
+ winerror(&gapp, fz_error_make("cannot create window"));
XSetWindowColormap(xdpy, xwin, ximage_get_colormap());
XSelectInput(xdpy, xwin,
@@ -501,7 +501,7 @@ void winreloadfile(pdfapp_t *app)
fd = open(filename, O_BINARY | O_RDONLY, 0666);
if (fd < 0)
- winerror(app, fz_throw("cannot reload file '%s'", filename));
+ winerror(app, fz_error_make("cannot reload file '%s'", filename));
pdfapp_open(app, filename, fd, 1);
}
@@ -581,10 +581,14 @@ int main(int argc, char **argv)
fd_set fds;
int width = -1;
int height = -1;
+<<<<<<< HEAD
+ fz_context *ctx;
+=======
struct timeval tmo_at;
struct timeval now;
struct timeval tmo;
struct timeval *timeout;
+>>>>>>> master
while ((c = fz_getopt(argc, argv, "p:r:b:A")) != -1)
{
@@ -609,8 +613,18 @@ int main(int argc, char **argv)
if (accelerate)
fz_accelerate();
+ ctx = fz_new_context();
+ if (ctx == NULL)
+ {
+ fprintf(stderr, "failed to initialise context");
+ exit(1);
+ }
+
winopen();
+<<<<<<< HEAD
+ pdfapp_init(ctx, &gapp);
+=======
if (resolution == -1)
resolution = winresolution();
if (resolution < MINRES)
@@ -619,6 +633,7 @@ int main(int argc, char **argv)
resolution = MAXRES;
pdfapp_init(&gapp);
+>>>>>>> master
gapp.scrw = DisplayWidth(xdpy, xscr);
gapp.scrh = DisplayHeight(xdpy, xscr);
gapp.resolution = resolution;
@@ -626,7 +641,7 @@ int main(int argc, char **argv)
fd = open(filename, O_BINARY | O_RDONLY, 0666);
if (fd < 0)
- winerror(&gapp, fz_throw("cannot open file '%s'", filename));
+ winerror(&gapp, fz_error_make("cannot open file '%s'", filename));
pdfapp_open(&gapp, filename, fd, 0);
@@ -812,5 +827,7 @@ int main(int argc, char **argv)
XCloseDisplay(xdpy);
+ fz_free_context(ctx);
+
return 0;
}