[MPlayer-cvslog] r27961 - in trunk/libvo: vo_gl.c vo_gl2.c vo_x11.c vo_xmga.c vo_xover.c vo_xv.c vo_xvidix.c vo_xvmc.c x11_common.c
reimar
subversion at mplayerhq.hu
Wed Nov 19 21:19:26 CET 2008
Author: reimar
Date: Wed Nov 19 21:19:25 2008
New Revision: 27961
Log:
Factor common code like -wid handling, vo_gc creation etc. out into
x11_common.c
Modified:
trunk/libvo/vo_gl.c
trunk/libvo/vo_gl2.c
trunk/libvo/vo_x11.c
trunk/libvo/vo_xmga.c
trunk/libvo/vo_xover.c
trunk/libvo/vo_xv.c
trunk/libvo/vo_xvidix.c
trunk/libvo/vo_xvmc.c
trunk/libvo/x11_common.c
Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c (original)
+++ trunk/libvo/vo_gl.c Wed Nov 19 21:19:25 2008
@@ -473,14 +473,6 @@ config(uint32_t width, uint32_t height,
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)
Modified: trunk/libvo/vo_gl2.c
==============================================================================
--- trunk/libvo/vo_gl2.c (original)
+++ trunk/libvo/vo_gl2.c Wed Nov 19 21:19:25 2008
@@ -521,14 +521,6 @@ static int choose_glx_visual(Display *dp
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");
Modified: trunk/libvo/vo_x11.c
==============================================================================
--- trunk/libvo/vo_x11.c (original)
+++ trunk/libvo/vo_x11.c Wed Nov 19 21:19:25 2008
@@ -317,7 +317,6 @@ static int config(uint32_t width, uint32
int vm = 0;
#endif
- vo_mouse_autohide = 1;
old_vo_dwidth = -1;
old_vo_dheight = -1;
@@ -395,36 +394,10 @@ static int config(uint32_t width, uint32
}
#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)
Modified: trunk/libvo/vo_xmga.c
==============================================================================
--- trunk/libvo/vo_xmga.c (original)
+++ trunk/libvo/vo_xmga.c Wed Nov 19 21:19:25 2008
@@ -55,7 +55,6 @@ static const vo_info_t info = {
};
const LIBVO_EXTERN(xmga)
-static XGCValues wGCV;
static uint32_t mDepth;
static XWindowAttributes attribs;
@@ -142,7 +141,6 @@ static int config(uint32_t width, uint32
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 @@ static int config(uint32_t width, uint32
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)
- {
-
- 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);
+ xswamask = CWBackPixel | CWBorderPixel | CWColormap;
- } 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
Modified: trunk/libvo/vo_xover.c
==============================================================================
--- trunk/libvo/vo_xover.c (original)
+++ trunk/libvo/vo_xover.c Wed Nov 19 21:19:25 2008
@@ -51,7 +51,6 @@ LIBVO_EXTERN(xover)
/* X11 related variables */
/* Colorkey handling */
-static XGCValues mGCV;
static int colorkey;
/* Image parameters */
@@ -217,7 +216,6 @@ static int config(uint32_t width, uint32
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 @@ static int config(uint32_t width, uint32
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
Modified: trunk/libvo/vo_xv.c
==============================================================================
--- trunk/libvo/vo_xv.c (original)
+++ trunk/libvo/vo_xv.c Wed Nov 19 21:19:25 2008
@@ -166,7 +166,6 @@ static int config(uint32_t width, uint32
uint32_t format)
{
XVisualInfo vinfo;
- XGCValues xgcv;
XSetWindowAttributes xswa;
XWindowAttributes attribs;
unsigned long xswamask;
@@ -188,8 +187,6 @@ static int config(uint32_t width, uint32
return -1;
}
- vo_mouse_autohide = 1;
-
int_pause = 0;
visible_buf = -1;
@@ -246,38 +243,10 @@ static int config(uint32_t width, uint32
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)
{
Modified: trunk/libvo/vo_xvidix.c
==============================================================================
--- trunk/libvo/vo_xvidix.c (original)
+++ trunk/libvo/vo_xvidix.c Wed Nov 19 21:19:25 2008
@@ -49,7 +49,6 @@ LIBVO_EXTERN(xvidix)
#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 @@ static int config(uint32_t width, uint32
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 @@ static int config(uint32_t width, uint32
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
Modified: trunk/libvo/vo_xvmc.c
==============================================================================
--- trunk/libvo/vo_xvmc.c (original)
+++ trunk/libvo/vo_xvmc.c Wed Nov 19 21:19:25 2008
@@ -455,7 +455,6 @@ int numblocks,blocks_per_macroblock;//bp
//from vo_xv
XVisualInfo vinfo;
-XGCValues xgcv;
XSetWindowAttributes xswa;
XWindowAttributes attribs;
unsigned long xswamask;
@@ -633,8 +632,6 @@ found_subpic:
skip_surface_allocation:
- vo_mouse_autohide = 1;
-
#ifdef CONFIG_XF86VM
if( flags&VOFLAG_MODESWITCHING ) vm = 1;
#endif
@@ -663,29 +660,10 @@ skip_surface_allocation:
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 )
{
Modified: trunk/libvo/x11_common.c
==============================================================================
--- trunk/libvo/x11_common.c (original)
+++ trunk/libvo/x11_common.c Wed Nov 19 21:19:25 2008
@@ -1269,6 +1269,23 @@ void vo_x11_create_vo_window(XVisualInfo
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 @@ void vo_x11_create_vo_window(XVisualInfo
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,
More information about the MPlayer-cvslog
mailing list