# HG changeset patch # User reimar # Date 1272184535 0 # Node ID 8d1080e9c92d7631d77c9e271d9087a0981cfce5 # Parent 362425fe3de88b06f8184209cffabef20fb934d8 Window resizing support for -vo gl with SDL backend. diff -r 362425fe3de8 -r 8d1080e9c92d libvo/gl_common.c --- a/libvo/gl_common.c Sun Apr 25 08:17:23 2010 +0000 +++ b/libvo/gl_common.c Sun Apr 25 08:35:35 2010 +0000 @@ -1855,6 +1855,8 @@ } static int setGlWindow_sdl(MPGLContext *ctx) { + if (sdl_set_mode(0, SDL_OPENGL | SDL_RESIZABLE) < 0) + return SET_WINDOW_FAILED; SDL_GL_LoadLibrary(NULL); getFunctions(sdlgpa, NULL); return SET_WINDOW_OK; @@ -1866,6 +1868,8 @@ while (SDL_PollEvent(&event)) { res |= sdl_default_handle_event(&event); } + if (res & VO_EVENT_RESIZE) + sdl_set_mode(0, SDL_OPENGL | SDL_RESIZABLE); return res; } diff -r 362425fe3de8 -r 8d1080e9c92d libvo/sdl_common.c --- a/libvo/sdl_common.c Sun Apr 25 08:17:23 2010 +0000 +++ b/libvo/sdl_common.c Sun Apr 25 08:35:35 2010 +0000 @@ -26,6 +26,18 @@ #include "input/mouse.h" #include "video_out.h" +int sdl_set_mode(int bpp, uint32_t flags) +{ + SDL_Surface *s = SDL_SetVideoMode(vo_dwidth, vo_dheight, bpp, flags); + if (!s) { + mp_msg(MSGT_VO, MSGL_FATAL, "SDL SetVideoMode failed: %s\n", SDL_GetError()); + return -1; + } + vo_dwidth = s->w; + vo_dheight = s->h; + return 0; +} + #define shift_key (event->key.keysym.mod==(KMOD_LSHIFT||KMOD_RSHIFT)) int sdl_default_handle_event(SDL_Event *event) { diff -r 362425fe3de8 -r 8d1080e9c92d libvo/sdl_common.h --- a/libvo/sdl_common.h Sun Apr 25 08:17:23 2010 +0000 +++ b/libvo/sdl_common.h Sun Apr 25 08:35:35 2010 +0000 @@ -27,6 +27,8 @@ #else #include #endif + +int sdl_set_mode(int bpp, uint32_t flags); int sdl_default_handle_event(SDL_Event *event); #endif diff -r 362425fe3de8 -r 8d1080e9c92d libvo/vo_gl.c --- a/libvo/vo_gl.c Sun Apr 25 08:17:23 2010 +0000 +++ b/libvo/vo_gl.c Sun Apr 25 08:35:35 2010 +0000 @@ -598,13 +598,8 @@ #endif #ifdef CONFIG_GL_SDL if (glctx.type == GLTYPE_SDL) { - SDL_Surface *s = SDL_SetVideoMode(d_width, d_height, 0, SDL_OPENGL | SDL_RESIZABLE); - if (!s) { - mp_msg(MSGT_VO, MSGL_FATAL, "SDL SetVideoMode failed: %s\n", SDL_GetError()); - return -1; - } - vo_dwidth = s->w; - vo_dheight = s->h; + vo_dwidth = d_width; + vo_dheight = d_height; } #endif return 0;