From f4b57edc48bc935d13afeabd77ef97ba960b58c5 Mon Sep 17 00:00:00 2001 From: plombo Date: Tue, 8 Feb 2011 05:02:13 +0000 Subject: [PATCH] sdl: Use the current monitor resolution for OpenGL fullscreen This prevents FCEUX from changing the screen resolution (antisocial behavior in X11) and fixes all aspect ratio issues. --- src/drivers/sdl/sdl-opengl.cpp | 8 ++++++++ src/drivers/sdl/sdl-video.cpp | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/drivers/sdl/sdl-opengl.cpp b/src/drivers/sdl/sdl-opengl.cpp index 53187751..02b38cc1 100644 --- a/src/drivers/sdl/sdl-opengl.cpp +++ b/src/drivers/sdl/sdl-opengl.cpp @@ -222,6 +222,14 @@ InitOpenGL(int l, InitBlitToHigh(4,0xFF,0xFF00,0xFF0000,efx&2,0,0); #endif } + + if(screen->flags & SDL_FULLSCREEN) + { + xscale=(double)screen->w / (double)(r-l); + yscale=(double)screen->h / (double)(b-t); + if(xscalecurrent_w; + } + if(s_nativeHeight < 0) { + s_nativeHeight = vinf->current_h; + } + // check if we are rendering fullscreen if(s_fullscreen) { flags |= SDL_FULLSCREEN; @@ -314,7 +324,9 @@ InitVideo(FCEUGI *gi) } - s_screen = SDL_SetVideoMode(xres, yres, desbpp, flags); + s_screen = SDL_SetVideoMode(s_useOpenGL ? s_nativeWidth : xres, + s_useOpenGL ? s_nativeHeight : yres, + desbpp, flags); if(!s_screen) { FCEUD_PrintError(SDL_GetError()); return -1; @@ -359,7 +371,7 @@ InitVideo(FCEUGI *gi) } #endif -#ifdef _GTK +#if defined(_GTK) && defined(SDL_VIDEO_DRIVER_X11) int noGui; g_config->getOption("SDL.NoGUI", &noGui); if(noGui == 0)