Mercurial > mplayer.hg
changeset 27927:6f199f065e15
Factor common code like -wid handling, vo_gc creation etc. out into
x11_common.c
author | reimar |
---|---|
date | Wed, 19 Nov 2008 20:19:25 +0000 |
parents | a02c39208d49 |
children | 6bc5182d635c |
files | libvo/vo_gl.c libvo/vo_gl2.c libvo/vo_x11.c libvo/vo_xmga.c libvo/vo_xover.c libvo/vo_xv.c libvo/vo_xvidix.c libvo/vo_xvmc.c libvo/x11_common.c |
diffstat | 9 files changed, 28 insertions(+), 189 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/vo_gl.c Wed Nov 19 16:41:59 2008 +0000 +++ b/libvo/vo_gl.c Wed Nov 19 20:19:25 2008 +0000 @@ -473,14 +473,6 @@ if (!vo_w32_config(d_width, d_height, flags)) return -1; #else - vo_mouse_autohide = 1; - if (WinID >= 0) { - vo_window = WinID ? (Window)WinID : mRootWin; - vo_x11_selectinput_witherr(mDisplay, vo_window, - StructureNotifyMask | KeyPressMask | PointerMotionMask | - ButtonPressMask | ButtonReleaseMask | ExposureMask); - goto glconfig; - } { XVisualInfo *vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib ); if (vinfo == NULL)
--- a/libvo/vo_gl2.c Wed Nov 19 16:41:59 2008 +0000 +++ b/libvo/vo_gl2.c Wed Nov 19 20:19:25 2008 +0000 @@ -521,14 +521,6 @@ 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) { XVisualInfo *vinfo, vinfo_buf; - vo_mouse_autohide = 1; - if (WinID >= 0) { - vo_window = WinID ? (Window)WinID : mRootWin; - vo_x11_selectinput_witherr(mDisplay, vo_window, - StructureNotifyMask | KeyPressMask | PointerMotionMask | - ButtonPressMask | ButtonReleaseMask | ExposureMask); - return 0; - } vinfo = choose_glx_visual(mDisplay,mScreen,&vinfo_buf) < 0 ? NULL : &vinfo_buf; if (vinfo == NULL) { mp_msg(MSGT_VO, MSGL_FATAL, "[gl2] no GLX support present\n");
--- a/libvo/vo_x11.c Wed Nov 19 16:41:59 2008 +0000 +++ b/libvo/vo_x11.c Wed Nov 19 20:19:25 2008 +0000 @@ -317,7 +317,6 @@ int vm = 0; #endif - vo_mouse_autohide = 1; old_vo_dwidth = -1; old_vo_dheight = -1; @@ -395,36 +394,10 @@ } #endif - if (WinID >= 0) - { - vo_window = WinID ? ((Window) WinID) : mRootWin; - if (WinID) - { - XUnmapWindow(mDisplay, vo_window); - XChangeWindowAttributes(mDisplay, vo_window, xswamask, - &xswa); - vo_x11_selectinput_witherr(mDisplay, vo_window, - StructureNotifyMask | - KeyPressMask | - PropertyChangeMask | - PointerMotionMask | - ButtonPressMask | - ButtonReleaseMask | - ExposureMask); - XMapWindow(mDisplay, vo_window); - depth = vo_x11_update_geometry(); - } else - XSelectInput(mDisplay, vo_window, ExposureMask); - } else - { vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, vo_dwidth, vo_dheight, flags, theCmap, "x11", title); - } - - if (vo_gc != None) - XFreeGC(mDisplay, vo_gc); - vo_gc = XCreateGC(mDisplay, vo_window, 0L, &xgcv); - XSync(mDisplay, False); + if (WinID > 0) + depth = vo_x11_update_geometry(); #ifdef CONFIG_XF86VM if (vm)
--- a/libvo/vo_xmga.c Wed Nov 19 16:41:59 2008 +0000 +++ b/libvo/vo_xmga.c Wed Nov 19 20:19:25 2008 +0000 @@ -55,7 +55,6 @@ }; const LIBVO_EXTERN(xmga) -static XGCValues wGCV; static uint32_t mDepth; static XWindowAttributes attribs; @@ -142,7 +141,6 @@ vo_dy += xinerama_y; vo_dwidth = d_width; vo_dheight = d_height; - vo_mouse_autohide = 1; r = (vo_colorkey & 0x00ff0000) >> 16; g = (vo_colorkey & 0x0000ff00) >> 8; @@ -189,44 +187,11 @@ XCreateColormap(mDisplay, mRootWin, vinfo.visual, AllocNone); xWAttribs.background_pixel = 0; xWAttribs.border_pixel = 0; - xWAttribs.event_mask = - StructureNotifyMask | ExposureMask | KeyPressMask | - ((WinID == - 0) ? 0 : (ButtonPressMask | ButtonReleaseMask | - PointerMotionMask | PropertyChangeMask)); - xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; - - if (WinID >= 0) - { + xswamask = CWBackPixel | CWBorderPixel | CWColormap; - vo_window = WinID ? ((Window) WinID) : mRootWin; - if (WinID) - { - XUnmapWindow(mDisplay, vo_window); - XChangeWindowAttributes(mDisplay, vo_window, xswamask, - &xWAttribs); - vo_x11_selectinput_witherr(mDisplay, vo_window, - StructureNotifyMask | - KeyPressMask | - PropertyChangeMask | - PointerMotionMask | - ButtonPressMask | - ButtonReleaseMask | - ExposureMask); - XMapWindow(mDisplay, vo_window); - } else - XSelectInput(mDisplay, vo_window, ExposureMask); - - } else - { vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height, flags, xWAttribs.colormap, "xmga", title); XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xWAttribs); - } - - if (vo_gc != None) - XFreeGC(mDisplay, vo_gc); - vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &wGCV); } // !GUI
--- a/libvo/vo_xover.c Wed Nov 19 16:41:59 2008 +0000 +++ b/libvo/vo_xover.c Wed Nov 19 20:19:25 2008 +0000 @@ -51,7 +51,6 @@ /* X11 related variables */ /* Colorkey handling */ -static XGCValues mGCV; static int colorkey; /* Image parameters */ @@ -217,7 +216,6 @@ image_height = height; image_width = width; image_format = format; - vo_mouse_autohide=1; aspect_save_orig(width, height); aspect_save_prescale(d_width, d_height); @@ -281,31 +279,13 @@ xswa.border_pixel = 0; xswa.colormap = XCreateColormap(mDisplay, RootWindow(mDisplay, mScreen), vinfo.visual, AllocNone); - xswa.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask | PropertyChangeMask | - ((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask)); - xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; + xswamask = CWBackPixel | CWBorderPixel | CWColormap; - if (WinID >= 0) - { - vo_window = WinID ? ((Window)WinID) : RootWindow(mDisplay, mScreen); - if ( WinID ) - { - XUnmapWindow(mDisplay, vo_window); - XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); - vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask ); - XMapWindow(mDisplay, vo_window); - } else XSelectInput( mDisplay,vo_window,ExposureMask ); - } - else - { vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, window_width, window_height, flags, xswa.colormap, "xvidix", title); XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); - } - if ( vo_gc != None ) XFreeGC( mDisplay,vo_gc ); - vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &mGCV); #ifdef CONFIG_GUI } #endif
--- a/libvo/vo_xv.c Wed Nov 19 16:41:59 2008 +0000 +++ b/libvo/vo_xv.c Wed Nov 19 20:19:25 2008 +0000 @@ -166,7 +166,6 @@ uint32_t format) { XVisualInfo vinfo; - XGCValues xgcv; XSetWindowAttributes xswa; XWindowAttributes attribs; unsigned long xswamask; @@ -188,8 +187,6 @@ return -1; } - vo_mouse_autohide = 1; - int_pause = 0; visible_buf = -1; @@ -246,38 +243,10 @@ xswa.border_pixel = 0; xswamask = CWBackPixel | CWBorderPixel; - if (WinID >= 0) - { - vo_window = WinID ? ((Window) WinID) : mRootWin; - if (WinID) - { - XUnmapWindow(mDisplay, vo_window); - XChangeWindowAttributes(mDisplay, vo_window, xswamask, - &xswa); - vo_x11_selectinput_witherr(mDisplay, vo_window, - StructureNotifyMask | - KeyPressMask | - PropertyChangeMask | - PointerMotionMask | - ButtonPressMask | - ButtonReleaseMask | - ExposureMask); - XMapWindow(mDisplay, vo_window); - vo_x11_update_geometry(); - aspect_save_prescale(vo_dwidth, vo_dheight); - } else - XSelectInput(mDisplay, vo_window, ExposureMask); - } else - { vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, vo_dwidth, vo_dheight, flags, CopyFromParent, "xv", title); XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); - } - if (vo_gc != None) - XFreeGC(mDisplay, vo_gc); - vo_gc = XCreateGC(mDisplay, vo_window, 0L, &xgcv); - XSync(mDisplay, False); #ifdef CONFIG_XF86VM if (vm) {
--- a/libvo/vo_xvidix.c Wed Nov 19 16:41:59 2008 +0000 +++ b/libvo/vo_xvidix.c Wed Nov 19 20:19:25 2008 +0000 @@ -49,7 +49,6 @@ #define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */ /* X11 related variables */ /* Colorkey handling */ -static XGCValues mGCV; static int colorkey; static vidix_grkey_t gr_key; @@ -205,7 +204,6 @@ image_height = height; image_width = width; image_format = format; - vo_mouse_autohide = 1; window_width = d_width; window_height = d_height; @@ -268,44 +266,13 @@ xswa.colormap = XCreateColormap(mDisplay, RootWindow(mDisplay, mScreen), vinfo.visual, AllocNone); - xswa.event_mask = - StructureNotifyMask | ExposureMask | KeyPressMask | - PropertyChangeMask | ((WinID == 0) ? 0 - : (ButtonPressMask | ButtonReleaseMask | - PointerMotionMask)); - xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; + xswamask = CWBackPixel | CWBorderPixel | CWColormap; - if (WinID >= 0) - { - vo_window = - WinID ? ((Window) WinID) : RootWindow(mDisplay, mScreen); - if (WinID) - { - XUnmapWindow(mDisplay, vo_window); - XChangeWindowAttributes(mDisplay, vo_window, xswamask, - &xswa); - vo_x11_selectinput_witherr(mDisplay, vo_window, - StructureNotifyMask | - KeyPressMask | - PropertyChangeMask | - PointerMotionMask | - ButtonPressMask | - ButtonReleaseMask | - ExposureMask); - XMapWindow(mDisplay, vo_window); - } else - XSelectInput(mDisplay, vo_window, ExposureMask); - } else - { vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, window_width, window_height, flags, CopyFromParent, "xvidix", title); XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); - } - if (vo_gc != None) - XFreeGC(mDisplay, vo_gc); - vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &mGCV); #ifdef CONFIG_GUI } #endif
--- a/libvo/vo_xvmc.c Wed Nov 19 16:41:59 2008 +0000 +++ b/libvo/vo_xvmc.c Wed Nov 19 20:19:25 2008 +0000 @@ -455,7 +455,6 @@ //from vo_xv XVisualInfo vinfo; -XGCValues xgcv; XSetWindowAttributes xswa; XWindowAttributes attribs; unsigned long xswamask; @@ -633,8 +632,6 @@ skip_surface_allocation: - vo_mouse_autohide = 1; - #ifdef CONFIG_XF86VM if( flags&VOFLAG_MODESWITCHING ) vm = 1; #endif @@ -663,29 +660,10 @@ xswa.border_pixel = 0; xswamask = CWBackPixel | CWBorderPixel; - if ( WinID>=0 ){ - vo_window = WinID ? ((Window)WinID) : mRootWin; - if ( WinID ) - { - Window mRoot; - uint32_t drwBorderWidth, drwDepth; - XUnmapWindow( mDisplay,vo_window ); - XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa ); - vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask ); - XMapWindow( mDisplay,vo_window ); - XGetGeometry(mDisplay, vo_window, &mRoot, - &drwX, &drwY, &vo_dwidth, &vo_dheight, - &drwBorderWidth, &drwDepth); - aspect_save_prescale(vo_dwidth, vo_dheight); - } - } else vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height, flags, CopyFromParent, "xvmc", title); XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); - if ( vo_gc != None ) XFreeGC( mDisplay,vo_gc ); - vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &xgcv); - XSync(mDisplay, False); #ifdef CONFIG_XF86VM if ( vm ) {
--- a/libvo/x11_common.c Wed Nov 19 16:41:59 2008 +0000 +++ b/libvo/x11_common.c Wed Nov 19 20:19:25 2008 +0000 @@ -1269,6 +1269,23 @@ Colormap col_map, const char *classname, const char *title) { + XGCValues xgcv; + if (WinID >= 0) { + vo_window = WinID ? (Window)WinID : mRootWin; + if (col_map != CopyFromParent) { + unsigned long xswamask = CWColormap; + XSetWindowAttributes xswa; + xswa.colormap = col_map; + XUnmapWindow(mDisplay, vo_window); + XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); + XMapWindow(mDisplay, vo_window); + } + if (WinID) vo_x11_update_geometry(); + vo_x11_selectinput_witherr(mDisplay, vo_window, + StructureNotifyMask | KeyPressMask | PointerMotionMask | + ButtonPressMask | ButtonReleaseMask | ExposureMask); + goto final; + } if (vo_window == None) { XSizeHints hint; XEvent xev; @@ -1304,6 +1321,12 @@ vo_x11_nofs_sizepos(vo_dx, vo_dy, width, height); if (!!vo_fs != !!(flags & VOFLAG_FULLSCREEN)) vo_x11_fullscreen(); +final: + if (vo_gc != None) + XFreeGC(mDisplay, vo_gc); + vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &xgcv); + XSync(mDisplay, False); + vo_mouse_autohide = 1; } void vo_x11_clearwindow_part(Display * mDisplay, Window vo_window,