# HG changeset patch # User John Tsiombikas # Date 1427689621 -10800 # Node ID 46291bf81d0a6f747d1969624d59032c9d47ea11 # Parent 6a3a9840c303d936ef0deb337cf6736ef5799906 delay switching to fullscreen until after the window has been resized diff -r 6a3a9840c303 -r 46291bf81d0a src/main.c --- a/src/main.c Wed Jan 21 11:29:30 2015 +0200 +++ b/src/main.c Mon Mar 30 07:27:01 2015 +0300 @@ -46,6 +46,8 @@ static SDL_GLContext ctx; static int win_width, win_height; +static int fullscr_pending; + static unsigned int fbo, fb_tex, fb_depth; static int fb_width, fb_height; static int fb_tex_width, fb_tex_height; @@ -218,7 +220,7 @@ void toggle_hmd_fullscreen(void) { - static int fullscr, prev_x, prev_y; + static int fullscr, prev_x, prev_y, prev_xsz, prev_ysz; fullscr = !fullscr; if(fullscr) { @@ -226,8 +228,11 @@ * to the rift's part of the desktop before going fullscreen */ SDL_GetWindowPosition(win, &prev_x, &prev_y); + SDL_GetWindowSize(win, &prev_xsz, &prev_ysz); + SDL_SetWindowSize(win, hmd->Resolution.h, hmd->Resolution.w); SDL_SetWindowPosition(win, hmd->WindowsPos.x, hmd->WindowsPos.y); - SDL_SetWindowFullscreen(win, SDL_WINDOW_FULLSCREEN_DESKTOP); + fullscr_pending = 1; + /*SDL_SetWindowFullscreen(win, SDL_WINDOW_FULLSCREEN_DESKTOP);*/ #ifdef OVR_OS_LINUX /* on linux for now we have to deal with screen rotation during rendering. The docs are promoting @@ -243,6 +248,7 @@ /* return to windowed mode and move the window back to its original position */ SDL_SetWindowFullscreen(win, 0); SDL_SetWindowPosition(win, prev_x, prev_y); + SDL_SetWindowSize(win, prev_xsz, prev_ysz); #ifdef OVR_OS_LINUX glcfg.OGL.Header.BackBufferSize = hmd->Resolution; @@ -502,6 +508,10 @@ case SDL_WINDOWEVENT: if(ev->window.event == SDL_WINDOWEVENT_RESIZED) { reshape(ev->window.data1, ev->window.data2); + if(fullscr_pending) { + SDL_SetWindowFullscreen(win, SDL_WINDOW_FULLSCREEN); + fullscr_pending = 0; + } } break;