changeset 34482:3c51a42da09c

SDL: Try to select a fullscreen mode that does not require resolution changes by default.
author reimar
date Sat, 14 Jan 2012 19:29:25 +0000
parents 887c198b5b78
children 161000f673d5
files libvo/sdl_common.c
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/sdl_common.c	Sat Jan 14 16:30:03 2012 +0000
+++ b/libvo/sdl_common.c	Sat Jan 14 19:29:25 2012 +0000
@@ -31,6 +31,26 @@
 static int mode_flags;
 static int reinit;
 
+/**
+ * Update vo_screenwidth and vo_screenheight.
+ *
+ * This function only works with SDL since 1.2.10 and
+ * even then only when called before the first
+ * SDL_SetVideoMode.
+ * Once there's a better way available implement an
+ * update_xinerama_info function.
+ */
+static void get_screensize(void) {
+    const SDL_VideoInfo *vi;
+    // TODO: better to use a check that gets the runtime version instead?
+    if (!SDL_VERSION_ATLEAST(1, 2, 10)) return;
+    // Keep user-provided settings
+    if (vo_screenwidth > 0 || vo_screenheight > 0) return;
+    vi = SDL_GetVideoInfo();
+    vo_screenwidth  = vi->current_w;
+    vo_screenheight = vi->current_h;
+}
+
 int vo_sdl_init(void)
 {
     reinit = 0;
@@ -50,6 +70,9 @@
     SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
     SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
 
+    // Try to get a sensible default for fullscreen.
+    get_screensize();
+
     return 1;
 }