summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-11-13 11:24:31 +0100
committerTor Andersson <tor.andersson@artifex.com>2017-11-13 16:58:04 +0100
commited2d66f6e780e2146fcc9c6aaa119442d609a6fa (patch)
treed4f3c9f180b67da70aee432e60639ec917d847d0
parenta8047c876f7f82cbce82c5210a865991f83caa26 (diff)
downloadmupdf-ed2d66f6e780e2146fcc9c6aaa119442d609a6fa.tar.xz
gl: Fix busy loop.
glutMainLoopEvent does not sleep for events, so use glutMainLoop instead and destroy the window when 'q' is pressed rather than just setting the quit flag.
-rw-r--r--platform/gl/gl-main.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c
index a07512d8..38c7c937 100644
--- a/platform/gl/gl-main.c
+++ b/platform/gl/gl-main.c
@@ -176,6 +176,7 @@ static float oldzoom = DEFRES, currentzoom = DEFRES;
static float oldrotate = 0, currentrotate = 0;
static fz_matrix page_ctm, page_inv_ctm;
static int loaded = 0;
+static int window = 0;
static int isfullscreen = 0;
static int showoutline = 0;
@@ -1343,6 +1344,12 @@ static void run_main_loop(void)
do_app();
+ if (doquit)
+ {
+ glutDestroyWindow(window);
+ return;
+ }
+
canvas_w = window_w - canvas_x;
canvas_h = window_h - canvas_y;
@@ -1636,7 +1643,7 @@ int main(int argc, char **argv)
glutInitWarningFunc(on_warning);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glutInitWindowSize(page_tex.w, page_tex.h);
- glutCreateWindow(title);
+ window = glutCreateWindow(title);
glutReshapeFunc(on_reshape);
glutDisplayFunc(on_display);
@@ -1666,8 +1673,7 @@ int main(int argc, char **argv)
render_page();
update_title();
- while (!doquit)
- glutMainLoopEvent();
+ glutMainLoop();
ui_finish_fonts(ctx);