summaryrefslogtreecommitdiffstats
path: root/libvo/sdl_common.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-04-25 10:44:53 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-04-25 10:44:53 +0000
commit3a34dbc927a4980606abb4331e7ba8ca6fc1a90d (patch)
tree64fef2ee69920e135ba17d98fca95b434a39a64d /libvo/sdl_common.c
parent4121ce1747db3ddb7336805aaa7bcfebf7044de5 (diff)
downloadmpv-3a34dbc927a4980606abb4331e7ba8ca6fc1a90d.tar.bz2
mpv-3a34dbc927a4980606abb4331e7ba8ca6fc1a90d.tar.xz
Add reinitialization support. Necessary for fullscreen on OSX.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31085 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/sdl_common.c')
-rw-r--r--libvo/sdl_common.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libvo/sdl_common.c b/libvo/sdl_common.c
index 0c8f880044..ed895fd81f 100644
--- a/libvo/sdl_common.c
+++ b/libvo/sdl_common.c
@@ -29,9 +29,12 @@
static int old_w;
static int old_h;
static int mode_flags;
+static int reinit;
int vo_sdl_init(void)
{
+ reinit = 0;
+
if (!SDL_WasInit(SDL_INIT_VIDEO) &&
SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) < 0)
return 0;
@@ -70,6 +73,9 @@ void vo_sdl_fullscreen(void)
}
vo_fs = !vo_fs;
sdl_set_mode(0, mode_flags);
+ // on OSX at least we now need to do a full reinit.
+ // TODO: this should only be set if really necessary.
+ reinit = 1;
}
int sdl_set_mode(int bpp, uint32_t flags)
@@ -111,6 +117,11 @@ static const struct mp_keymap keysym_map[] = {
int sdl_default_handle_event(SDL_Event *event)
{
int mpkey;
+ if (!event) {
+ int res = reinit ? VO_EVENT_REINIT : 0;
+ reinit = 0;
+ return res;
+ }
switch (event->type) {
case SDL_VIDEORESIZE:
vo_dwidth = event->resize.w;