[MPlayer-cvslog] r34639 - trunk/libvo/sdl_common.c

reimar subversion at mplayerhq.hu
Sun Jan 29 17:27:47 CET 2012


Author: reimar
Date: Sun Jan 29 17:27:46 2012
New Revision: 34639

Log:
Support -wid for vo_sdl.

Modified:
   trunk/libvo/sdl_common.c

Modified: trunk/libvo/sdl_common.c
==============================================================================
--- trunk/libvo/sdl_common.c	Sat Jan 28 15:55:15 2012	(r34638)
+++ trunk/libvo/sdl_common.c	Sun Jan 29 17:27:46 2012	(r34639)
@@ -55,9 +55,18 @@ int vo_sdl_init(void)
 {
     reinit = 0;
 
-    if (!SDL_WasInit(SDL_INIT_VIDEO) &&
-        SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) < 0)
-        return 0;
+    if (!SDL_WasInit(SDL_INIT_VIDEO)) {
+        // Unfortunately SDL_WINDOWID must be set at SDL_Init
+        // and is ignored afterwards, thus it cannot work per-file.
+        // Also, a value of 0 does not work for selecting the root window.
+        if (WinID > 0) {
+            char envstr[20];
+            snprintf(envstr, sizeof(envstr), "0x%"PRIx64, WinID);
+            setenv("SDL_WINDOWID", envstr, 1);
+        }
+        if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) < 0)
+            return 0;
+    }
 
     // Setup Keyrepeats (500/30 are defaults)
     SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 100 /*SDL_DEFAULT_REPEAT_INTERVAL*/);


More information about the MPlayer-cvslog mailing list