summaryrefslogtreecommitdiff
path: root/platform/gl
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2017-02-18 13:07:17 +0100
committerTor Andersson <tor.andersson@artifex.com>2017-03-15 09:47:01 +0100
commitd7a849bef3cb481060103fe444b62cdab5b0d274 (patch)
treed63349c69686d2fb2d0e30d498b010a9aa259aa9 /platform/gl
parentbe98e926dfde735a306ed5913d3d0a8850addad4 (diff)
downloadmupdf-d7a849bef3cb481060103fe444b62cdab5b0d274.tar.xz
gl: implement fullscreen support
Diffstat (limited to 'platform/gl')
-rw-r--r--platform/gl/gl-main.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c
index a968e8bd..3f063b92 100644
--- a/platform/gl/gl-main.c
+++ b/platform/gl/gl-main.c
@@ -714,25 +714,24 @@ static void do_forms(float xofs, float yofs)
static void toggle_fullscreen(void)
{
-#if 0
- static int oldw = 100, oldh = 100, oldx = 0, oldy = 0;
-
+ GLFWmonitor *monitor = glfwGetPrimaryMonitor();
+ static int win_x = 0, win_y = 0;
+ static int win_w = 100, win_h = 100;
+ static int win_rr = 60;
if (!isfullscreen)
{
- oldw = glutGet(GLUT_WINDOW_WIDTH);
- oldh = glutGet(GLUT_WINDOW_HEIGHT);
- oldx = glutGet(GLUT_WINDOW_X);
- oldy = glutGet(GLUT_WINDOW_Y);
- glutFullScreen();
+ glfwGetWindowPos(window, &win_x, &win_y);
+ glfwGetWindowSize(window, &win_w, &win_h);
+ const GLFWvidmode *mode = glfwGetVideoMode(monitor);
+ win_rr = mode->refreshRate;
+ glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate);
isfullscreen = 1;
}
else
{
- glutPositionWindow(oldx, oldy);
- glutReshapeWindow(oldw, oldh);
+ glfwSetWindowMonitor(window, NULL, win_x, win_y, win_w, win_h, win_rr);
isfullscreen = 0;
}
-#endif
}
static void shrinkwrap(void)