summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2011-09-29 22:38:16 +0200
committerUoti Urpala <uau@mplayer2.org>2011-10-24 06:18:29 +0300
commitf045abb4c06c66dd7ee751d4f4c0de40cf1bc810 (patch)
tree80c7d102c9ae42fd5535874c391c58a7e6ab1f03
parentbb8781a00a590412926f240fd0731a25127eb046 (diff)
downloadmpv-f045abb4c06c66dd7ee751d4f4c0de40cf1bc810.tar.bz2
mpv-f045abb4c06c66dd7ee751d4f4c0de40cf1bc810.tar.xz
vo_gl/sdl: use desktop resolution for fullscreen mode
Before the SDL code would change screen resolution when switching to fullscreen. Try to keep existing desktop resolution instead.
-rw-r--r--libvo/gl_common.c2
-rw-r--r--libvo/sdl_common.c17
-rw-r--r--libvo/sdl_common.h1
3 files changed, 20 insertions, 0 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 16e05fb688..aab89045b6 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -1961,6 +1961,7 @@ static int sdl_check_events(struct vo *vo)
return res;
}
+static void new_sdl_update_xinerama_info(struct vo *vo) { sdl_update_xinerama_info(); }
static void new_vo_sdl_fullscreen(struct vo *vo) { vo_sdl_fullscreen(); }
#endif
@@ -2048,6 +2049,7 @@ MPGLContext *init_mpglcontext(enum MPGLType type, struct vo *vo)
SDL_Init(SDL_INIT_VIDEO);
ctx->setGlWindow = setGlWindow_sdl;
ctx->swapGlBuffers = swapGlBuffers_sdl;
+ ctx->update_xinerama_info = new_sdl_update_xinerama_info;
ctx->check_events = sdl_check_events;
ctx->fullscreen = new_vo_sdl_fullscreen;
//the SDL code is hardcoded to use the deprecated vo API
diff --git a/libvo/sdl_common.c b/libvo/sdl_common.c
index 32c95ef4c8..5d493afd71 100644
--- a/libvo/sdl_common.c
+++ b/libvo/sdl_common.c
@@ -25,11 +25,13 @@
#include "input/keycodes.h"
#include "input/input.h"
#include "video_out.h"
+#include "aspect.h"
static int old_w;
static int old_h;
static int mode_flags;
static int reinit;
+static int screen_w, screen_h;
int vo_sdl_init(void)
{
@@ -39,6 +41,12 @@ int vo_sdl_init(void)
SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) < 0)
return 0;
+ if (screen_w == 0) {
+ const SDL_VideoInfo *vi = SDL_GetVideoInfo();
+ screen_w = vi->current_w;
+ screen_h = vi->current_h;
+ }
+
// Setup Keyrepeats (500/30 are defaults)
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 100 /*SDL_DEFAULT_REPEAT_INTERVAL*/);
@@ -59,6 +67,15 @@ void vo_sdl_uninit(void)
SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
+void sdl_update_xinerama_info(void)
+{
+ if (vo_screenwidth <= 0 || vo_screenheight <= 0) {
+ vo_screenwidth = screen_w;
+ vo_screenheight = screen_h;
+ }
+ aspect_save_screenres(vo_screenwidth, vo_screenheight);
+}
+
void vo_sdl_fullscreen(void)
{
if (vo_fs) {
diff --git a/libvo/sdl_common.h b/libvo/sdl_common.h
index cc9ec60e21..a1a5311bfc 100644
--- a/libvo/sdl_common.h
+++ b/libvo/sdl_common.h
@@ -30,6 +30,7 @@
int vo_sdl_init(void);
void vo_sdl_uninit(void);
+void sdl_update_xinerama_info(void);
void vo_sdl_fullscreen(void);
int sdl_set_mode(int bpp, uint32_t flags);
int sdl_default_handle_event(SDL_Event *event);