summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-04-25 08:35:35 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-04-25 08:35:35 +0000
commita83117e972f528ceead87b70b249a5e233d4f13b (patch)
tree8ee3221cc24de7e9e23df13cfe2b4342c97e06cd /libvo
parent7c2bef4bb5a3275dc2e3fb75dfeb03ac1f1b5755 (diff)
downloadmpv-a83117e972f528ceead87b70b249a5e233d4f13b.tar.bz2
mpv-a83117e972f528ceead87b70b249a5e233d4f13b.tar.xz
Window resizing support for -vo gl with SDL backend.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31075 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/gl_common.c4
-rw-r--r--libvo/sdl_common.c12
-rw-r--r--libvo/sdl_common.h2
-rw-r--r--libvo/vo_gl.c9
4 files changed, 20 insertions, 7 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 2c4c001c00..0df3a16abc 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -1855,6 +1855,8 @@ static void *sdlgpa(const GLubyte *name) {
}
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 @@ static int sdl_check_events(void) {
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 --git a/libvo/sdl_common.c b/libvo/sdl_common.c
index 9116bcbe55..4ef83a7e24 100644
--- a/libvo/sdl_common.c
+++ b/libvo/sdl_common.c
@@ -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 --git a/libvo/sdl_common.h b/libvo/sdl_common.h
index b83161bfc1..7f4112276e 100644
--- a/libvo/sdl_common.h
+++ b/libvo/sdl_common.h
@@ -27,6 +27,8 @@
#else
#include <SDL.h>
#endif
+
+int sdl_set_mode(int bpp, uint32_t flags);
int sdl_default_handle_event(SDL_Event *event);
#endif
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 7d48e35d22..e6b14eb0e6 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -598,13 +598,8 @@ static int create_window(uint32_t d_width, uint32_t d_height, uint32_t flags, co
#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;