diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-04-25 10:44:53 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-04-25 10:44:53 +0000 |
commit | 3a34dbc927a4980606abb4331e7ba8ca6fc1a90d (patch) | |
tree | 64fef2ee69920e135ba17d98fca95b434a39a64d | |
parent | 4121ce1747db3ddb7336805aaa7bcfebf7044de5 (diff) | |
download | mpv-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
-rw-r--r-- | libvo/gl_common.c | 2 | ||||
-rw-r--r-- | libvo/sdl_common.c | 11 | ||||
-rw-r--r-- | libvo/video_out.h | 1 | ||||
-rw-r--r-- | libvo/vo_gl.c | 4 |
4 files changed, 18 insertions, 0 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c index c8d949e689..c8e3884f87 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1869,6 +1869,8 @@ static int sdl_check_events(void) { while (SDL_PollEvent(&event)) { res |= sdl_default_handle_event(&event); } + // poll "events" from within MPlayer code + res |= sdl_default_handle_event(NULL); if (res & VO_EVENT_RESIZE) sdl_set_mode(0, SDL_OPENGL | SDL_RESIZABLE); return res; 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; diff --git a/libvo/video_out.h b/libvo/video_out.h index 4e8716f13e..c1a5face11 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -33,6 +33,7 @@ #define VO_EVENT_EXPOSE 1 #define VO_EVENT_RESIZE 2 #define VO_EVENT_KEYPRESS 4 +#define VO_EVENT_REINIT 8 /* Obsolete: VOCTRL_QUERY_VAA 1 */ /* does the device support the required format */ diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index e376e260f4..3730059ffa 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -650,6 +650,10 @@ glconfig: static void check_events(void) { int e=glctx.check_events(); + if(e&VO_EVENT_REINIT) { + uninitGl(); + initGl(vo_dwidth, vo_dheight); + } if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight); if(e&VO_EVENT_EXPOSE && int_pause) redraw(); } |