summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2014-07-24 16:13:55 +0200
committerTor Andersson <tor.andersson@artifex.com>2015-10-06 11:21:22 +0200
commit2a09edfb8d0ebf8675b9b6d5c6f7155081a5f94c (patch)
tree0ad671b8d58150420a1433b7ef062ae6f4f7a552 /platform
parent91347ad807a69929d6b257cef5f5eaa4215b55ef (diff)
downloadmupdf-2a09edfb8d0ebf8675b9b6d5c6f7155081a5f94c.tar.xz
glut: Add fullscreen toggle (f).
Diffstat (limited to 'platform')
-rw-r--r--platform/glut/glut-main.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/platform/glut/glut-main.c b/platform/glut/glut-main.c
index b15006f6..704c0f9b 100644
--- a/platform/glut/glut-main.c
+++ b/platform/glut/glut-main.c
@@ -147,6 +147,28 @@ static int oldpage = 0, currentpage = 0;
static float oldzoom = DEFRES, currentzoom = DEFRES;
static float oldrotate = 0, currentrotate = 0;
+static void toggle_fullscreen(void)
+{
+ static int oldw = 100, oldh = 100, oldx = 0, oldy = 0;
+ static int isfullscreen = 0;
+
+ if (!isfullscreen)
+ {
+ oldw = glutGet(GLUT_WINDOW_WIDTH);
+ oldh = glutGet(GLUT_WINDOW_HEIGHT);
+ oldx = glutGet(GLUT_WINDOW_X);
+ oldy = glutGet(GLUT_WINDOW_Y);
+ glutFullScreen();
+ isfullscreen = 1;
+ }
+ else
+ {
+ glutPositionWindow(oldx, oldy);
+ glutReshapeWindow(oldw, oldh);
+ isfullscreen = 0;
+ }
+}
+
static void auto_zoom_w(void)
{
currentzoom = fz_clamp(currentzoom * screen_w / (float)page_w, MINRES, MAXRES);
@@ -213,6 +235,7 @@ static void keyboard(unsigned char key, int x, int y)
switch (key)
{
+ case 'f': toggle_fullscreen(); break;
case 'W': auto_zoom_w(); break;
case 'H': auto_zoom_h(); break;
case 'Z': auto_zoom(); break;