[Mplayer-cvslog] CVS: main/libvo vo_x11.c,1.102,1.103 vo_xmga.c,1.66,1.67 vo_xv.c,1.85,1.86 vo_xvidix.c,1.35,1.36 x11_common.c,1.77,1.78

Zoltan Ponekker pontscho at mplayerhq.hu
Sat May 11 16:57:44 CEST 2002


Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv9550/libvo

Modified Files:
	vo_x11.c vo_xmga.c vo_xv.c vo_xvidix.c x11_common.c 
Log Message:
fix some small bug and -rootwin

Index: vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -r1.102 -r1.103
--- vo_x11.c	9 May 2002 00:45:36 -0000	1.102
+++ vo_x11.c	11 May 2002 14:57:41 -0000	1.103
@@ -249,7 +249,6 @@
  static uint32_t vm_height;
 #endif
 
-
  vo_mouse_autohide=1;
  old_vo_dwidth=-1;
  old_vo_dheight=-1;
@@ -261,6 +260,7 @@
  if(in_format==IMGFMT_I420 || in_format==IMGFMT_IYUV) in_format=IMGFMT_YV12;
  srcW= width;
  srcH= height;
+ vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;
  vo_dwidth=width; vo_dheight=height;
  
  if( flags&0x03 ) fullscreen = 1;
@@ -290,15 +290,10 @@
   else
 #endif   
    {
-    hint.x=0;
-    hint.y=0;
-//    if(zoomFlag){
-//	hint.width=d_width;
-//	hint.height=d_height;
-//    }else{
-	hint.width=width;
-	hint.height=height;
-//    }
+    hint.x=vo_dx;
+    hint.y=vo_dy;
+    hint.width=width;
+    hint.height=height;
  
 #ifdef HAVE_XF86VM
     if ( vm )
@@ -313,13 +308,7 @@
 	hint.width=modeline_width;
 	hint.height=modeline_height;
    }
-//    else
 #endif
-//    if ( fullscreen )
-//     {
-//      hint.width=vo_screenwidth;
-//      hint.height=vo_screenheight;
-//     }
     hint.flags=PPosition | PSize;
 
     bg=WhitePixel( mDisplay,mScreen );
@@ -344,24 +333,36 @@
 #endif
  
     if ( WinID>=0 ){
-      vo_window = WinID ? ((Window)WinID) : RootWindow( mDisplay,mScreen );
-      XUnmapWindow( mDisplay,vo_window );
-      XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa );
+      vo_window = WinID ? ((Window)WinID) : mRootWin;
+      if ( WinID )
+       {
+        XUnmapWindow( mDisplay,vo_window );
+        XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa );
+	XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
+       } else XSelectInput( mDisplay,vo_window,ExposureMask );
     }
     else
-      vo_window=XCreateWindow( mDisplay,RootWindow( mDisplay,mScreen ),
+     {
+      vo_window=XCreateWindow( mDisplay,mRootWin,
                          hint.x,hint.y,
                          hint.width,hint.height,
                          xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa );
 
-    vo_x11_classhint( mDisplay,vo_window,"x11" );
-    vo_hidecursor(mDisplay,vo_window);
-    XSelectInput( mDisplay,vo_window,StructureNotifyMask );
-    XSetStandardProperties( mDisplay,vo_window,title,title,None,NULL,0,&hint );
-    XMapWindow( mDisplay,vo_window );
-    if(WinID!=0)
-    do { XNextEvent( mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != vo_window );
-    XSelectInput( mDisplay,vo_window,NoEventMask );
+      vo_x11_classhint( mDisplay,vo_window,"x11" );
+      vo_hidecursor(mDisplay,vo_window);
+      XSelectInput( mDisplay,vo_window,StructureNotifyMask );
+      XSetStandardProperties( mDisplay,vo_window,title,title,None,NULL,0,&hint );
+      XMapWindow( mDisplay,vo_window );
+      if(WinID!=0)
+         do { XNextEvent( mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != vo_window );
+      XSelectInput( mDisplay,vo_window,NoEventMask );
+
+      if ( fullscreen ) vo_x11_fullscreen();
+#ifdef HAVE_XINERAMA
+      vo_x11_xinerama_move(mDisplay,vo_window);
+#endif
+     }
+
     XFlush( mDisplay );
     XSync( mDisplay,False );
 
@@ -381,13 +382,11 @@
 #endif
    }
 
-   if ( fullscreen ) vo_x11_fullscreen();
-#ifdef HAVE_XINERAMA
-   vo_x11_xinerama_move(mDisplay,vo_window);
-#endif
-
-   vo_gc=XCreateGC( mDisplay,vo_window,0L,&xgcv );
-   getMyXImage();
+  vo_gc=XCreateGC( mDisplay,vo_window,0L,&xgcv );
+  getMyXImage();
+  
+  if ( !WinID )
+   { vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; }
 
   switch ((bpp=myximage->bits_per_pixel)){
          case 24: draw_alpha_fnc=draw_alpha_24; 

Index: vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- vo_xmga.c	8 May 2002 20:24:35 -0000	1.66
+++ vo_xmga.c	11 May 2002 14:57:41 -0000	1.67
@@ -79,9 +79,6 @@
 static XWindowAttributes      attribs;
 static uint32_t               X_already_started=0;
 
-static uint32_t               wndX;
-static uint32_t               wndY;
-
 static uint32_t               fgColor;
 
 static uint32_t               mvHeight;
@@ -108,11 +105,15 @@
 
 static void set_window(){
 
-         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;
-         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 );
+	 if ( WinID )
+	  {
+           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;
+           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 );
+	  }
+	  else { drwX=drwcX=vo_dx; drwY=drwcY=vo_dy; drwWidth=vo_dwidth; drwHeight=vo_dheight; }
 
          aspect(&dwidth,&dheight,A_NOZOOM);
          if ( vo_fs )
@@ -166,9 +167,8 @@
  int e=vo_x11_check_events(mDisplay);
  if ( !(e&VO_EVENT_RESIZE) && !(e&VO_EVENT_EXPOSE) ) return;
  set_window();
- if(e&VO_EVENT_EXPOSE) mDrawColorKey();
- if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) )
-   printf( "Error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
+ mDrawColorKey();
+ if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) printf( "Error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
 }
 
 static void draw_osd(void)
@@ -188,7 +188,7 @@
 
 static int inited=0;
 
-static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t* info)
+static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format,const vo_tune_info_t* info)
 {
  char                 * mTitle=(title == NULL) ? "XMGA render" : title;
  XVisualInfo            vinfo;
@@ -230,7 +230,7 @@
 
  mvWidth=width; mvHeight=height;
 
- wndX=0; wndY=0;
+ vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;
  vo_dwidth=d_width; vo_dheight=d_height;
  vo_mouse_autohide=1;
 
@@ -254,46 +254,58 @@
 #endif
   {
 #ifdef X11_FULLSCREEN
-   if ( fullscreen&1 ) aspect(&dwidth,&dheight,A_ZOOM);
+   if ( flags&1 ) aspect(&dwidth,&dheight,A_ZOOM);
 #endif
 
-   XGetWindowAttributes( mDisplay,DefaultRootWindow( mDisplay ),&attribs );
+   XGetWindowAttributes( mDisplay,mRootWin,&attribs );
    mDepth=attribs.depth;
    if ( mDepth != 15 && mDepth != 16 && mDepth != 24 && mDepth != 32 ) mDepth=24;
    XMatchVisualInfo( mDisplay,mScreen,mDepth,TrueColor,&vinfo );
-   xWAttribs.colormap=XCreateColormap( mDisplay,RootWindow( mDisplay,mScreen ),vinfo.visual,AllocNone );
+   xWAttribs.colormap=XCreateColormap( mDisplay,mRootWin,vinfo.visual,AllocNone );
    xWAttribs.background_pixel=0;
    xWAttribs.border_pixel=0;
-   xWAttribs.event_mask=StructureNotifyMask | ExposureMask | KeyPressMask | PropertyChangeMask |
-       ((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask));
+   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) : RootWindow(mDisplay,mScreen);
-      XUnmapWindow( mDisplay,vo_window );
-      XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xWAttribs);
+    
+      vo_window = WinID ? ((Window)WinID) : mRootWin;
+      if ( WinID )
+       {
+        XUnmapWindow( mDisplay,vo_window );
+        XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xWAttribs);
+        XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
+       } else XSelectInput( mDisplay,vo_window,ExposureMask );
+       
     } else 
-   vo_window=XCreateWindow( mDisplay,mRootWin,
-     wndX,wndY,
-     vo_dwidth,vo_dheight,
-     xWAttribs.border_pixel,
-     mDepth,
-     InputOutput,
-     vinfo.visual,xswamask,&xWAttribs );
-   vo_x11_classhint( mDisplay,vo_window,"xmga" );
-   vo_hidecursor(mDisplay,vo_window);
+     {
+      vo_window=XCreateWindow( mDisplay,mRootWin,
+         vo_dx,vo_dy,
+         vo_dwidth,vo_dheight,
+         xWAttribs.border_pixel,
+         mDepth,
+         InputOutput,
+         vinfo.visual,xswamask,&xWAttribs );
+     
+      vo_x11_classhint( mDisplay,vo_window,"xmga" );
+      vo_hidecursor(mDisplay,vo_window);
+      vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 );
 
-   XStoreName( mDisplay,vo_window,mTitle );
-   XMapWindow( mDisplay,vo_window );
+      XStoreName( mDisplay,vo_window,mTitle );
+      XMapWindow( mDisplay,vo_window );
+ 
+      if ( flags&1 ) vo_x11_fullscreen();
 
-   if ( fullscreen&1 ) vo_x11_fullscreen();
-		   
 #ifdef HAVE_XINERAMA
-   vo_x11_xinerama_move(mDisplay,vo_window);
+      vo_x11_xinerama_move(mDisplay,vo_window);
 #endif
-   vo_gc=XCreateGC( mDisplay,vo_window,GCForeground,&wGCV );
+     }
+    vo_gc=XCreateGC( mDisplay,vo_window,GCForeground,&wGCV );
   }
 
+ if ( ( flags&1 )&&( !WinID ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
+ 
  set_window();
 
  mga_vid_config.src_width=width;
@@ -306,8 +318,6 @@
 
  if(mga_init()) return -1;
  
- set_window();
-
  XFlush( mDisplay );
  XSync( mDisplay,False );
 

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- vo_xv.c	8 May 2002 20:24:35 -0000	1.85
+++ vo_xv.c	11 May 2002 14:57:41 -0000	1.86
@@ -336,10 +336,8 @@
  
  vo_mouse_autohide=1;
 
+ vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;
  vo_dwidth=d_width; vo_dheight=d_height;
-// vo_fs=flags&1;
-// if ( vo_fs )
-//  { vo_old_width=d_width; vo_old_height=d_height; }
      
 #ifdef HAVE_XF86VM
  if( flags&0x02 ) vm = 1;
@@ -365,8 +363,8 @@
   else
 #endif
   {
-   hint.x = 0;
-   hint.y = 0;
+   hint.x = vo_dx;
+   hint.y = vo_dy;
    hint.width = d_width;
    hint.height = d_height;
    aspect(&d_width,&d_height,A_NOZOOM);
@@ -387,8 +385,6 @@
 #endif
    if ( vo_fs )
     {
-//     hint.width=vo_screenwidth;
-//     hint.height=vo_screenheight;
 #ifdef X11_FULLSCREEN
      /* this code replaces X11_FULLSCREEN hack in mplayer.c
       * aspect() is available through aspect.h for all vos.
@@ -415,35 +411,39 @@
    xswamask = CWBackPixel | CWBorderPixel;
 
     if ( WinID>=0 ){
-      vo_window = WinID ? ((Window)WinID) : RootWindow(mDisplay,mScreen);
-      XUnmapWindow( mDisplay,vo_window );
-      XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa );
+      vo_window = WinID ? ((Window)WinID) : mRootWin;
+      if ( WinID ) 
+       {
+        XUnmapWindow( mDisplay,vo_window );
+        XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa );
+	XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
+       } else { drwX=vo_dx; drwY=vo_dy; }
     } else 
+       {
+        vo_window = XCreateWindow(mDisplay, mRootWin,
+          hint.x, hint.y, hint.width, hint.height,
+          0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa);
 
-   vo_window = XCreateWindow(mDisplay, RootWindow(mDisplay,mScreen),
-       hint.x, hint.y, hint.width, hint.height,
-       0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa);
+        vo_x11_classhint( mDisplay,vo_window,"xv" );
+        vo_hidecursor(mDisplay,vo_window);
 
-   vo_x11_classhint( mDisplay,vo_window,"xv" );
-   vo_hidecursor(mDisplay,vo_window);
-
-   XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PropertyChangeMask |
+        XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PropertyChangeMask |
 	((WinID==0) ? 0 : (PointerMotionMask
 #ifdef HAVE_NEW_INPUT
 		| ButtonPressMask | ButtonReleaseMask
 #endif
-	))
-   );
-   XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint);
-   XSetWMNormalHints( mDisplay,vo_window,&hint );
-   XMapWindow(mDisplay, vo_window);
-   if ( flags&1 ) vo_x11_fullscreen();
+	  )));
+        XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint);
+        XSetWMNormalHints( mDisplay,vo_window,&hint );
+	XMapWindow(mDisplay, vo_window);
+	if ( flags&1 ) vo_x11_fullscreen();
 #ifdef HAVE_XINERAMA
-   vo_x11_xinerama_move(mDisplay,vo_window);
+	vo_x11_xinerama_move(mDisplay,vo_window);
 #endif
-   vo_gc = XCreateGC(mDisplay, vo_window, 0L, &xgcv);
-   XFlush(mDisplay);
-   XSync(mDisplay, False);
+       }
+    vo_gc = XCreateGC(mDisplay, vo_window, 0L, &xgcv);
+    XFlush(mDisplay);
+    XSync(mDisplay, False);
 #ifdef HAVE_XF86VM
     if ( vm )
      {
@@ -476,7 +476,7 @@
      set_gamma_correction();
 
      aspect(&vo_dwidth,&vo_dheight,A_NOZOOM);
-     if ( vo_fs )
+     if ( ( flags&1 )&&( !WinID ) )
       {
        aspect(&vo_dwidth,&vo_dheight,A_ZOOM);
        drwX=( vo_screenwidth - (vo_dwidth > vo_screenwidth?vo_screenwidth:vo_dwidth) ) / 2;
@@ -485,7 +485,7 @@
        vo_dheight=(vo_dheight > vo_screenheight?vo_screenheight:vo_dheight);
        mp_msg(MSGT_VO,MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight );
       }
-
+     
      mp_msg(MSGT_VO,MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight );
 
      saver_off(mDisplay);  // turning off screen saver

Index: vo_xvidix.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xvidix.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- vo_xvidix.c	8 May 2002 20:53:00 -0000	1.35
+++ vo_xvidix.c	11 May 2002 14:57:41 -0000	1.36
@@ -69,7 +69,6 @@
 static uint32_t image_depth;
 
 /* Window parameters */
-static uint32_t window_x, window_y;
 static uint32_t window_width, window_height;
 
 /* used by XGetGeometry & XTranslateCoordinates for moving/resizing window */
@@ -79,26 +78,35 @@
 
 static void set_window(int force_update,const vo_tune_info_t *info)
 {
-    XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &drwWidth,
-	&drwHeight, &drwBorderWidth, &drwDepth);
-    drwX = drwY = 0;
-    XTranslateCoordinates(mDisplay, vo_window, mRoot, 0, 0,
-	&drwcX, &drwcY, &mRoot);
-
-    aspect(&dwidth,&dheight,A_NOZOOM);
-    if (!vo_fs)
-	mp_msg(MSGT_VO, MSGL_V, "[xvidix] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
-	    drwcX, drwcY, drwX, drwY, drwWidth, drwHeight);
+    if ( WinID )
+     {
+      XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &drwWidth,
+	  &drwHeight, &drwBorderWidth, &drwDepth);
+      drwX = drwY = 0;
+      XTranslateCoordinates(mDisplay, vo_window, mRoot, 0, 0,
+	  &drwcX, &drwcY, &mRoot);
+
+      aspect(&dwidth,&dheight,A_NOZOOM);
+      if (!vo_fs)
+	  mp_msg(MSGT_VO, MSGL_V, "[xvidix] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
+	      drwcX, drwcY, drwX, drwY, drwWidth, drwHeight);
 
     /* following stuff copied from vo_xmga.c */
+     } 
+     else 
+      { 
+       aspect(&dwidth,&dheight,A_NOZOOM);
+       drwcX=drwX=vo_dx; drwcY=drwY=vo_dy; drwWidth=vo_dwidth; drwHeight=vo_dheight; 
+      }
+
 #if X11_FULLSCREEN
     if (vo_fs)
     {
         aspect(&dwidth,&dheight,A_ZOOM);
 	drwX = (vo_screenwidth - (dwidth > vo_screenwidth ? vo_screenwidth : dwidth)) / 2;
-	drwcX += drwX;
+	drwcX = drwX;
 	drwY = (vo_screenheight - (dheight > vo_screenheight ? vo_screenheight : dheight)) / 2;
-	drwcY += drwY;
+	drwcY = drwY;
 	drwWidth = (dwidth > vo_screenwidth ? vo_screenwidth : dwidth);
 	drwHeight = (dheight > vo_screenheight ? vo_screenheight : dheight);
 	mp_msg(MSGT_VO, MSGL_V, "[xvidix-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
@@ -129,17 +137,17 @@
 #endif
 
     /* set new values in VIDIX */
-    if (force_update || (window_x != drwcX) || (window_y != drwcY) ||
+    if (force_update || (vo_dx != drwcX) || (vo_dy != drwcY) ||
 	(window_width != drwWidth) || (window_height != drwHeight))
     {
-	window_x = drwcX;
-	window_y = drwcY;
+	vo_dx = drwcX;
+	vo_dy = drwcY;
 	window_width = drwWidth;
 	window_height = drwHeight;
 
 	/* FIXME: implement runtime resize/move if possible, this way is very ugly! */
 	vidix_stop();
-	if (vidix_init(image_width, image_height, window_x, window_y,
+	if (vidix_init(image_width, image_height, vo_dx, vo_dy,
 	    window_width, window_height, image_format, vo_depthonscreen,
 	    vo_screenwidth, vo_screenheight,info) != 0)
         {
@@ -153,7 +161,7 @@
     }
     
     mp_msg(MSGT_VO, MSGL_INFO, "[xvidix] window properties: pos: %dx%d, size: %dx%d\n",
-	window_x, window_y, window_width, window_height);
+	vo_dx, vo_dy, window_width, window_height);
 
     /* mDrawColorKey: */
 
@@ -189,6 +197,7 @@
     image_height = height;
     image_width = width;
     image_format = format;
+    vo_mouse_autohide=1;
 
     if (IMGFMT_IS_RGB(format))
     {
@@ -225,8 +234,8 @@
     aspect_save_prescale(d_width, d_height);
     aspect_save_screenres(vo_screenwidth, vo_screenheight);
 
-    window_x = 0;
-    window_y = 0;
+    vo_dx = 0;
+    vo_dy = 0;
     window_width = d_width;
     window_height = d_height;
 
@@ -254,7 +263,8 @@
     }
 
     aspect(&d_width, &d_height, A_NOZOOM);
-    
+
+    vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;    
     vo_dwidth=d_width; vo_dheight=d_height;
 
 #ifdef HAVE_NEW_GUI
@@ -264,20 +274,7 @@
 #endif
 
 #ifdef X11_FULLSCREEN
-    if ( flags&1 ) /* fullscreen */
-    {
-        if (flags & 0x04)
-        {
-    	    aspect(&d_width, &d_height, A_ZOOM);
-        }
-//    	else
-//    	{
-//	    d_width = vo_screenwidth;
-//	    d_height = vo_screenheight;
-//    	}
-//	window_width = vo_screenwidth;
-//	window_height = vo_screenheight;
-    }
+    if ( ( flags&1 )||(flags & 0x04) ) aspect(&d_width, &d_height, A_ZOOM);
 #endif
     dwidth = d_width;
     dheight = d_height;
@@ -295,57 +292,49 @@
     xswa.border_pixel     = 0;
     xswa.colormap         = XCreateColormap(mDisplay, RootWindow(mDisplay, mScreen),
 					    vinfo.visual, AllocNone);
-    xswa.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask | 
+    xswa.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask | PropertyChangeMask |
        ((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask));
     xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
 
     if (WinID >= 0)
     {
 	vo_window = WinID ? ((Window)WinID) : RootWindow(mDisplay, mScreen);
-	XUnmapWindow(mDisplay, vo_window);
-	XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
+	if ( WinID )
+	 {
+	  XUnmapWindow(mDisplay, vo_window);
+	  XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
+	  XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
+	 } else XSelectInput( mDisplay,vo_window,ExposureMask );
     }
     else
-	vo_window = XCreateWindow(mDisplay, RootWindow(mDisplay, mScreen),
-	    window_x, window_y, window_width, window_height, xswa.border_pixel,
+     {
+      vo_window = XCreateWindow(mDisplay, RootWindow(mDisplay, mScreen),
+	    vo_dx, vo_dy, window_width, window_height, xswa.border_pixel,
 	    vinfo.depth, InputOutput, vinfo.visual, xswamask, &xswa);
 
-    vo_x11_classhint(mDisplay, vo_window, "xvidix");
-    vo_hidecursor(mDisplay, vo_window);
-
-//#ifdef X11_FULLSCREEN
-//    if (vo_fs && vo_wm_type == 0) /* fullscreen */
-//	vo_x11_decoration(mDisplay, vo_window, 0);
-//#endif
-
-    XGetNormalHints(mDisplay, vo_window, &hint);
-    hint.x = window_x;
-    hint.y = window_y;
-    hint.base_width = hint.width = window_width;
-    hint.base_height = hint.height = window_height;
-    hint.flags = USPosition | USSize;
-    XSetNormalHints(mDisplay, vo_window, &hint);
-
-    XStoreName(mDisplay, vo_window, title);
-    /* Map window. */
+      vo_x11_classhint(mDisplay, vo_window, "xvidix");
+      vo_hidecursor(mDisplay, vo_window);
+      vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 );
 
-    XMapWindow(mDisplay, vo_window);
+      XStoreName(mDisplay, vo_window, title);
+      XMapWindow(mDisplay, vo_window);
     
-    if ( flags&1 ) vo_x11_fullscreen();
+      if ( flags&1 ) vo_x11_fullscreen();
     
 #ifdef HAVE_XINERAMA
-    vo_x11_xinerama_move(mDisplay, vo_window);
+      vo_x11_xinerama_move(mDisplay, vo_window);
 #endif
 
+     }
     vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &mGCV);
-
-//    XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask );
 #ifdef HAVE_NEW_GUI
 }
 #endif
 
     mp_msg(MSGT_VO, MSGL_INFO, "[xvidix] image properties: %dx%d depth: %d\n",
 	image_width, image_height, image_depth);
+	
+    if ( ( !WinID )&&( flags&1 ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
 
     if (vidix_grkey_support())
     {

Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- x11_common.c	9 May 2002 17:28:09 -0000	1.77
+++ x11_common.c	11 May 2002 14:57:41 -0000	1.78
@@ -185,12 +185,16 @@
  int             format;
  unsigned long   nitems, bytesafter;
  unsigned char * args = NULL;
+ char          * name = NULL;
+ 
+ if ( WinID >= 0 ) return vo_wm_Unknown;
+ 
 #if 1
 // --- netwm 
  type=XInternAtom( mDisplay,"_NET_SUPPORTED",False );
  if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 )
   {
-   mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is NetWM.\n" );
+   mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is of class NetWM.\n" );
    XFree( args );
    return vo_wm_NetWM;
   }
@@ -207,7 +211,7 @@
 
    if ( xev.type == PropertyNotify )
     {
-     char * name = XGetAtomName( mDisplay,xev.xproperty.atom );
+     name=XGetAtomName( mDisplay,xev.xproperty.atom );
      if ( !name ) break;
 
      if ( !strncmp( name,"_ICEWM_TRAY",11 ) )
@@ -218,9 +222,10 @@
       { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is WindowMaker style.\n" ); wm=vo_wm_WMakerStyle; break; }
 //     fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",win,name,xev.xproperty.atom );
 
-     XFree( name );
+     XFree( name ); name=NULL;
     }
  } while( c++ < 25 );
+ if ( name ) XFree( name );
  XDestroyWindow( mDisplay,win );
 #ifdef MP_DEBUG
  if ( wm == vo_wm_Unknown ) mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Unknown wm type...\n" );
@@ -677,6 +682,7 @@
  
  if ( vo_wm_type == vo_wm_IceWM )
   {
+   mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] IceWM style stay on top ( layer %d ).\n",layer );
    switch ( layer )
     {
      case -1: layer=2; break; // WinLayerBelow
@@ -684,7 +690,7 @@
      case  1: layer=8; break; // WinLayerOnTop
     }
    XChangeProperty( mDisplay,vo_window,
-   XInternAtom( mDisplay,"_WIN_LAYER",False ),XA_CARDINAL,32,PropModeReplace,(unsigned char *)&layer,1 );
+     XInternAtom( mDisplay,"_WIN_LAYER",False ),XA_CARDINAL,32,PropModeReplace,(unsigned char *)&layer,1 );
    return;
   }
 
@@ -750,8 +756,8 @@
   { vo_fs=VO_FALSE; x=vo_old_x; y=vo_old_y; w=vo_old_width; h=vo_old_height; }
    else { vo_fs=VO_TRUE; vo_old_x=vo_dx; vo_old_y=vo_dy; vo_old_width=vo_dwidth;   vo_old_height=vo_dheight; }
 
- vo_x11_sizehint( x,y,w,h,0 );
  vo_x11_decoration( mDisplay,vo_window,(vo_fs) ? 0 : 1 );
+ vo_x11_sizehint( x,y,w,h,0 );
  vo_x11_setlayer( vo_fs );
  XMoveResizeWindow( mDisplay,vo_window,x,y,w,h );
  XMapRaised( mDisplay,vo_window );




More information about the MPlayer-cvslog mailing list