From 8afeabf06c79c755e5aaffa224e06c4abc92d833 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Wed, 27 Jul 2016 08:11:13 +0300 Subject: [PATCH] fullscreen switching and missing goatvr_set_fb_size call --- src/app.cc | 15 +++++++++++++++ src/app.h | 2 +- src/main.cc | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/app.cc b/src/app.cc index aaee8cb..c3f6b39 100644 --- a/src/app.cc +++ b/src/app.cc @@ -143,6 +143,10 @@ void app_reshape(int x, int y) glMatrixMode(GL_PROJECTION); glLoadMatrixf(mat[0]); + + if(opt.vr) { + goatvr_set_fb_size(x, y, 1.0); + } } void app_keyboard(int key, bool pressed) @@ -153,6 +157,17 @@ void app_keyboard(int key, bool pressed) app_quit(); break; + case 'f': + if(!opt.vr || should_swap) { + /* we take the need to swap as a signal that our window is not managed + * by some VR compositor, and therefore it's safe to fullscreen without + * upsetting the VR rendering output + */ + opt.fullscreen = !opt.fullscreen; + app_fullscreen(opt.fullscreen); + } + break; + case ' ': if(opt.vr) { goatvr_recenter(); diff --git a/src/app.h b/src/app.h index 93f5f37..0030a9d 100644 --- a/src/app.h +++ b/src/app.h @@ -22,7 +22,7 @@ void app_mouse_motion(int x, int y); // the following functions are implemented by the window system backend void app_resize(int x, int y); -void app_fullscreen(int fs); +void app_fullscreen(bool fs); void app_quit(); void app_redraw(); void app_swap_buffers(); diff --git a/src/main.cc b/src/main.cc index ae84abd..04f8523 100644 --- a/src/main.cc +++ b/src/main.cc @@ -78,7 +78,7 @@ void app_resize(int x, int y) SDL_SetWindowSize(win, x, y); } -void app_fullscreen(int fs) +void app_fullscreen(bool fs) { SDL_SetWindowFullscreen(win, fs ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0); } -- 1.7.10.4