# HG changeset patch # User reimar # Date 1272192293 0 # Node ID 80036ef586ff0cad724460cd1d25a40ad336195d # Parent 91eb3b0b9b7ab29df535b372751725e051f21c19 Add reinitialization support. Necessary for fullscreen on OSX. diff -r 91eb3b0b9b7a -r 80036ef586ff libvo/gl_common.c --- a/libvo/gl_common.c Sun Apr 25 10:34:58 2010 +0000 +++ b/libvo/gl_common.c Sun Apr 25 10:44:53 2010 +0000 @@ -1869,6 +1869,8 @@ 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 -r 91eb3b0b9b7a -r 80036ef586ff libvo/sdl_common.c --- a/libvo/sdl_common.c Sun Apr 25 10:34:58 2010 +0000 +++ b/libvo/sdl_common.c Sun Apr 25 10:44:53 2010 +0000 @@ -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 @@ } 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 @@ 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 -r 91eb3b0b9b7a -r 80036ef586ff libvo/video_out.h --- a/libvo/video_out.h Sun Apr 25 10:34:58 2010 +0000 +++ b/libvo/video_out.h Sun Apr 25 10:44:53 2010 +0000 @@ -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 -r 91eb3b0b9b7a -r 80036ef586ff libvo/vo_gl.c --- a/libvo/vo_gl.c Sun Apr 25 10:34:58 2010 +0000 +++ b/libvo/vo_gl.c Sun Apr 25 10:44:53 2010 +0000 @@ -650,6 +650,10 @@ 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(); }