Mercurial > mplayer.hg
changeset 4993:53c569d36b2c
small changes in libvo's X11 support
author | pontscho |
---|---|
date | Fri, 08 Mar 2002 20:14:08 +0000 |
parents | e2f8b4b74c25 |
children | e74227031a12 |
files | libvo/vo_x11.c libvo/vo_xmga.c libvo/vo_xv.c libvo/x11_common.c libvo/x11_common.h |
diffstat | 5 files changed, 44 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/vo_x11.c Fri Mar 08 17:37:25 2002 +0000 +++ b/libvo/vo_x11.c Fri Mar 08 20:14:08 2002 +0000 @@ -584,6 +584,8 @@ case VOCTRL_GUISUPPORT: return VO_TRUE; case VOCTRL_FULLSCREEN: + vo_x11_fullscreen(); +/* if ((vo_fs_oldwidth == -1) && (vo_fs_oldheight == -1)) { int foo; @@ -605,7 +607,7 @@ mp_msg(MSGT_VO,MSGL_V,"X11 Fullscreen: saved old place: %dx%d-%dx%d\n", vo_fs_oldx, vo_fs_oldy, vo_fs_oldwidth, vo_fs_oldheight); - /* resize */ + // resize vo_dwidth = vo_screenwidth; vo_dheight = vo_screenheight; vo_x11_decoration( mDisplay,vo_window,0 ); @@ -621,16 +623,17 @@ #ifdef LOCAL_LOOKUP - /* restore */ + // restore vo_dwidth = vo_fs_oldwidth; vo_dheight = vo_fs_oldheight; #endif - /* clean */ + // clean vo_fs_oldwidth = -1; vo_fs_oldheight = -1; XSync(mDisplay, False); } +*/ return VO_TRUE; } return VO_NOTIMPL;
--- a/libvo/vo_xmga.c Fri Mar 08 17:37:25 2002 +0000 +++ b/libvo/vo_xmga.c Fri Mar 08 20:14:08 2002 +0000 @@ -61,7 +61,7 @@ static vo_info_t vo_info = { - "X11 (Matrox G200/G400 overlay in window using /dev/mga_vid)", + "X11 (Matrox G200/G4x0/G550 overlay in window using /dev/mga_vid)", "xmga", "Zoltan Ponekker <pontscho@makacs.poliod.hu>", "" @@ -90,10 +90,6 @@ static uint32_t drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth; static uint32_t drwcX,drwcY,dwidth,dheight; -//#ifdef HAVE_NEW_GUI - static uint32_t mdwidth,mdheight; -//#endif - static XSetWindowAttributes xWAttribs; #define VO_XMGA @@ -111,14 +107,8 @@ static void set_window(){ - dwidth=mdwidth; dheight=mdheight; - if ( vo_fs ) - { - dwidth=vo_screenwidth; - dheight=vo_screenwidth * mdheight / mdwidth; - } - XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth ); + fprintf( stderr,"[xmga] x: %d y: %d w: %d h: %d\n",drwX,drwY,drwWidth,drwHeight ); drwX=0; drwY=0; // drwWidth=wndWidth; drwHeight=wndHeight; XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot ); fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); @@ -273,7 +263,6 @@ aspect(&d_width,&d_height,A_NOZOOM); #ifdef HAVE_NEW_GUI - mdwidth=width; mdheight=height; if ( vo_window == None ) { #endif @@ -311,15 +300,10 @@ vinfo.visual,xswamask,&xWAttribs ); vo_x11_classhint( mDisplay,vo_window,"xmga" ); vo_hidecursor(mDisplay,vo_window); + vo_x11_sizehint( wndX,wndY,wndWidth,wndHeight ); if ( vo_fs ) vo_x11_decoration( mDisplay,vo_window,0 ); - XGetNormalHints( mDisplay,vo_window,&hint ); - hint.x=wndX; hint.y=wndY; - hint.width=wndWidth; hint.height=wndHeight; - hint.base_width=wndWidth; hint.base_height=wndHeight; - hint.flags=USPosition | USSize; - XSetNormalHints( mDisplay,vo_window,&hint ); XStoreName( mDisplay,vo_window,mTitle ); XMapWindow( mDisplay,vo_window );
--- a/libvo/vo_xv.c Fri Mar 08 17:37:25 2002 +0000 +++ b/libvo/vo_xv.c Fri Mar 08 20:14:08 2002 +0000 @@ -94,10 +94,6 @@ static uint32_t drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth; static uint32_t drwcX,drwcY,dwidth,dheight; -#ifdef HAVE_NEW_GUI - static uint32_t mdwidth,mdheight; -#endif - static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); static void draw_alpha_yv12(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ @@ -337,11 +333,6 @@ image_width = width; image_format=format; -#ifdef HAVE_NEW_GUI - mdwidth=width; - mdheight=height; -#endif - vo_fs=flags&1; if ( vo_fs ) { vo_old_width=d_width; vo_old_height=d_height; } @@ -501,17 +492,6 @@ current_buf=0; -#ifdef HAVE_NEW_GUI - if ( vo_window != None ) - { - dwidth=mdwidth; dheight=mdheight; - if ( vo_fs ) - { - dwidth=vo_screenwidth; - dheight=vo_screenwidth * mdheight / mdwidth; - } - } -#endif set_gamma_correction(); XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth ); @@ -583,15 +563,6 @@ XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot ); printf( "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); - #ifdef HAVE_NEW_GUI - dwidth=mdwidth; dheight=mdheight; - if ( vo_fs ) - { - dwidth=vo_screenwidth; - dheight=vo_screenwidth * mdheight / mdwidth; - } - #endif - aspect(&dwidth,&dheight,A_NOZOOM); if ( vo_fs ) {
--- a/libvo/x11_common.c Fri Mar 08 17:37:25 2002 +0000 +++ b/libvo/x11_common.c Fri Mar 08 20:14:08 2002 +0000 @@ -397,9 +397,16 @@ { memset( &vo_MotifWmHints,0,sizeof( MotifWmHints ) ); vo_MotifWmHints.flags=MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; - vo_MotifWmHints.functions=MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE; - if ( d ) d=MWM_DECOR_ALL; + if ( d ) + { + vo_MotifWmHints.functions=MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE; + d=MWM_DECOR_ALL; + } +#if 0 vo_MotifWmHints.decorations=d|((vo_fsmode&2)?0:MWM_DECOR_MENU); +#else + vo_MotifWmHints.decorations=d|((vo_fsmode&2)?MWM_DECOR_MENU:0); +#endif XChangeProperty( vo_Display,w,vo_MotifHints,vo_MotifHints,32, PropModeReplace,(unsigned char *)&vo_MotifWmHints,(vo_fsmode&4)?4:5 ); } @@ -412,8 +419,9 @@ XSetClassHint(display,window,&wmClass); } -Window vo_window = None; -GC vo_gc; +Window vo_window = None; +GC vo_gc; +XSizeHints vo_hint; #ifdef HAVE_NEW_GUI void vo_setwindow( Window w,GC g ) { @@ -509,6 +517,14 @@ return ret; } +void vo_x11_sizehint( int x, int y, int width, int height ) +{ + vo_hint.flags=PPosition | PSize | PWinGravity; + vo_hint.x=x; vo_hint.y=y; vo_hint.width=width; vo_hint.height=height; + vo_hint.win_gravity=StaticGravity; + XSetWMNormalHints( mDisplay,vo_window,&vo_hint ); +} + void vo_x11_fullscreen( void ) { XUnmapWindow( mDisplay,vo_window ); @@ -516,6 +532,11 @@ { vo_fs=VO_TRUE; vo_old_x=vo_dx; vo_old_y=vo_dy; vo_old_width=vo_dwidth; vo_old_height=vo_dheight; + { + Window root; int foo, foo2; +// XGetGeometry( mDisplay,vo_window,&root,&vo_old_x,&vo_old_y,&vo_old_width,vo_old_height,&foo,&foo2 ); +// XTranslateCoordinates( mDisplay,vo_window,root,0,0,&vo_old_x,&vo_old_y,(Window *)&foo); + } vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_x11_decoration( mDisplay,vo_window,0 ); } @@ -525,9 +546,10 @@ vo_dx=vo_old_x; vo_dy=vo_old_y; vo_dwidth=vo_old_width; vo_dheight=vo_old_height; vo_x11_decoration( mDisplay,vo_window,1 ); } - XMapWindow( mDisplay,vo_window ); + vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight ); XMoveResizeWindow( mDisplay,vo_window,vo_dx,vo_dy,vo_dwidth,vo_dheight ); - return; + XMapWindow( mDisplay,vo_window ); + XSync( mDisplay,False ); } void saver_on(Display *mDisplay) {
--- a/libvo/x11_common.h Fri Mar 08 17:37:25 2002 +0000 +++ b/libvo/x11_common.h Fri Mar 08 20:14:08 2002 +0000 @@ -4,6 +4,9 @@ #ifdef X11_FULLSCREEN +#include <X11/Xlib.h> +#include <X11/Xutil.h> + extern int vo_depthonscreen; extern int vo_screenwidth; extern int vo_screenheight; @@ -22,12 +25,14 @@ int vo_hidecursor ( Display* , Window ); void vo_x11_decoration( Display * vo_Display,Window w,int d ); void vo_x11_classhint( Display * display,Window window,char *name ); +void vo_x11_sizehint( int x, int y, int width, int height ); int vo_x11_check_events(Display *mydisplay); void vo_x11_fullscreen( void ); #endif -extern Window vo_window; -extern GC vo_gc; +extern Window vo_window; +extern GC vo_gc; +extern XSizeHints vo_hint; #ifdef HAVE_NEW_GUI extern void vo_setwindow( Window w,GC g );