summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-11-04 18:31:55 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-11-04 18:31:55 +0000
commita594c4f593d349e7067050726c6567f0e8c04ef9 (patch)
tree7f43f000b84ea896c4f95c4c345b52f3ae6b726c /libvo
parent2cb78b4cb89e14179fde02dc5aa209dc4eea1916 (diff)
downloadmpv-a594c4f593d349e7067050726c6567f0e8c04ef9.tar.bz2
mpv-a594c4f593d349e7067050726c6567f0e8c04ef9.tar.xz
more fullscreen fixes and gl2 uses setGlWindow.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13872 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_gl.c3
-rw-r--r--libvo/vo_gl2.c75
-rw-r--r--libvo/x11_common.c4
3 files changed, 26 insertions, 56 deletions
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index dac83135fa..bd790d05d1 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -256,8 +256,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
XVisualInfo *vinfo;
XEvent xev;
- vo_dwidth = d_width;
- vo_dheight = d_height;
+ vo_fs = VO_FALSE;
hint.x = 0;
hint.y = 0;
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c
index 8e3ba4e8d7..359e26046b 100644
--- a/libvo/vo_gl2.c
+++ b/libvo/vo_gl2.c
@@ -73,7 +73,8 @@ static unsigned char *ImageData=NULL;
//static int texture_id=1;
#ifndef GL_WIN32
- static GLXContext wsGLXContext;
+ static XVisualInfo *gl_vinfo = NULL;
+ static GLXContext gl_context = 0;
#endif
static uint32_t image_width;
@@ -670,6 +671,8 @@ static int choose_glx_visual(Display *dpy, int scr, XVisualInfo *res_vi)
}
static int config_glx(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) {
+ if ( vo_window == None )
+ {
XSizeHints hint;
XVisualInfo *vinfo, vinfo_buf;
XEvent xev;
@@ -692,8 +695,6 @@ static int config_glx(uint32_t width, uint32_t height, uint32_t d_width, uint32_
return -1;
}
- if ( vo_window == None )
- {
vo_fs = VO_FALSE;
vo_window = vo_x11_create_smooth_window(mDisplay, RootWindow(mDisplay,mScreen),
vinfo->visual, hint.x, hint.y, hint.width, hint.height, vinfo->depth, vo_x11_create_colormap(vinfo));
@@ -718,49 +719,30 @@ static int config_glx(uint32_t width, uint32_t height, uint32_t d_width, uint32_
XNextEvent(mDisplay, &xev);
}
while (xev.type != MapNotify || xev.xmap.event != vo_window);
- }
- else {
- vo_x11_sizehint( hint.x, hint.y, hint.width, hint.height,0 );
- // for changing from fullscreen to fullscreen we do fullscreen to
- // window and back to fullscreen, so that vo_x11_fullscreen saves
- // the correct size for _this_ video (and doesn't take the values from
- // the previous one)
- if (vo_fs)
- vo_x11_fullscreen ();
- XMoveResizeWindow( mDisplay,vo_window,hint.x,hint.y,hint.width,hint.height );
- }
-
- // these would normally be set by the event handler, but here we have to
- // do it manually
- vo_dwidth = d_width;
- vo_dheight = d_height;
-
- if (flags & VOFLAG_FULLSCREEN)
- vo_x11_fullscreen();
vo_x11_classhint( mDisplay,vo_window,"gl2" );
vo_hidecursor(mDisplay,vo_window);
- if ( vo_config_count ) glXDestroyContext( mDisplay,wsGLXContext );
-
- wsGLXContext=glXCreateContext( mDisplay,vinfo,NULL,True );
-
- glXMakeCurrent( mDisplay,vo_window,wsGLXContext );
-
XSync(mDisplay, False);
//XSelectInput(mDisplay, vo_window, StructureNotifyMask); // !!!!
vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
| ButtonPressMask | ButtonReleaseMask | ExposureMask
);
+ }
+ vo_x11_nofs_sizepos(0, 0, d_width, d_height);
+ if (vo_fs ^ (flags & VOFLAG_FULLSCREEN))
+ vo_x11_fullscreen();
+
+ setGlWindow(&gl_vinfo, &gl_context, vo_window);
- if(glXGetConfig(mDisplay,vinfo,GLX_RED_SIZE, &r_sz)!=0)
+ if(glXGetConfig(mDisplay,gl_vinfo,GLX_RED_SIZE, &r_sz)!=0)
r_sz=0;
- if(glXGetConfig(mDisplay,vinfo,GLX_GREEN_SIZE, &g_sz)!=0)
+ if(glXGetConfig(mDisplay,gl_vinfo,GLX_GREEN_SIZE, &g_sz)!=0)
g_sz=0;
- if(glXGetConfig(mDisplay,vinfo,GLX_BLUE_SIZE, &b_sz)!=0)
+ if(glXGetConfig(mDisplay,gl_vinfo,GLX_BLUE_SIZE, &b_sz)!=0)
b_sz=0;
- if(glXGetConfig(mDisplay,vinfo,GLX_ALPHA_SIZE, &a_sz)!=0)
+ if(glXGetConfig(mDisplay,gl_vinfo,GLX_ALPHA_SIZE, &a_sz)!=0)
a_sz=0;
return 0;
@@ -768,31 +750,15 @@ static int config_glx(uint32_t width, uint32_t height, uint32_t d_width, uint32_
#ifdef HAVE_NEW_GUI
static int config_glx_gui(uint32_t d_width, uint32_t d_height) {
- XWindowAttributes xw_attr;
- XVisualInfo *vinfo, vinfo_template;
- int tmp;
vo_dwidth = d_width;
vo_dheight = d_height;
guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window
- XGetWindowAttributes(mDisplay, vo_window, &xw_attr);
- vinfo_template.visualid=XVisualIDFromVisual(xw_attr.visual);
- vinfo = XGetVisualInfo(mDisplay, VisualIDMask, &vinfo_template, &tmp);
-
- if ( vo_config_count ) glXDestroyContext( mDisplay,wsGLXContext );
- wsGLXContext = glXCreateContext( mDisplay,vinfo,NULL,True );
- if (wsGLXContext == NULL) {
- mp_msg(MSGT_VO, MSGL_FATAL, "[gl2] Could not create GLX context!\n");
- XFree(vinfo);
- return -1;
- }
- glXMakeCurrent( mDisplay,vo_window,wsGLXContext );
- XSync(mDisplay, False);
-
- if (glXGetConfig(mDisplay,vinfo,GLX_RED_SIZE, &r_sz) != 0) r_sz = 0;
- if (glXGetConfig(mDisplay,vinfo,GLX_GREEN_SIZE, &g_sz) != 0) g_sz = 0;
- if (glXGetConfig(mDisplay,vinfo,GLX_BLUE_SIZE, &b_sz) != 0) b_sz = 0;
- if (glXGetConfig(mDisplay,vinfo,GLX_ALPHA_SIZE, &a_sz) != 0) a_sz = 0;
- XFree(vinfo);
+ setGlWindow(&gl_vinfo, &gl_context, vo_window);
+
+ if (glXGetConfig(mDisplay,gl_vinfo,GLX_RED_SIZE, &r_sz) != 0) r_sz = 0;
+ if (glXGetConfig(mDisplay,gl_vinfo,GLX_GREEN_SIZE, &g_sz) != 0) g_sz = 0;
+ if (glXGetConfig(mDisplay,gl_vinfo,GLX_BLUE_SIZE, &b_sz) != 0) b_sz = 0;
+ if (glXGetConfig(mDisplay,gl_vinfo,GLX_ALPHA_SIZE, &a_sz) != 0) a_sz = 0;
return 0;
}
#endif
@@ -1170,6 +1136,7 @@ static void
uninit(void)
{
if ( !vo_config_count ) return;
+ releaseGlContext(&gl_vinfo, &gl_context);
if (texgrid) {
free(texgrid);
texgrid = NULL;
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index fd97843f39..cd7fdf8255 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -1145,7 +1145,11 @@ void vo_x11_nofs_sizepos(int x, int y, int width, int height)
vo_old_height = height;
}
else
+ {
+ vo_dwidth = width;
+ vo_dheight = height;
XMoveResizeWindow(mDisplay, vo_window, x, y, width, height);
+ }
}
void vo_x11_sizehint(int x, int y, int width, int height, int max)