[Mplayer-cvslog] CVS: main/libvo vo_xmga.c,1.47,1.48 vo_xv.c,1.56,1.57 x11_common.c,1.49,1.50 x11_common.h,1.14,1.15

Zoltan Ponekker pontscho at mplayer.dev.hu
Thu Feb 21 22:11:08 CET 2002


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

Modified Files:
	vo_xmga.c vo_xv.c x11_common.c x11_common.h 
Log Message:
small changes

Index: vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- vo_xmga.c	21 Feb 2002 13:28:39 -0000	1.47
+++ vo_xmga.c	21 Feb 2002 21:11:01 -0000	1.48
@@ -68,8 +68,6 @@
 };
 
 //static Display              * mDisplay;
-static Window                 mWindow;
-static GC                     mGC;
 static XGCValues              wGCV;
 
 static XImage               * myximage;
@@ -102,11 +100,10 @@
 
 static void mDrawColorKey( void )
 {
- XSetBackground( mDisplay,mGC,0 );
-// XFillRectangle( mDisplay,mWindow,mGC,0,0,drwWidth,drwHeight );
- XClearWindow( mDisplay,mWindow );
- XSetForeground( mDisplay,mGC,fgColor );
- XFillRectangle( mDisplay,mWindow,mGC,drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight) );
+ XSetBackground( mDisplay,vo_gc,0 );
+ XClearWindow( mDisplay,vo_window );
+ XSetForeground( mDisplay,vo_gc,fgColor );
+ XFillRectangle( mDisplay,vo_window,vo_gc,drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight) );
  XFlush( mDisplay );
 }
 
@@ -126,9 +123,9 @@
            }
          #endif
 
-         XGetGeometry( mDisplay,mWindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
+         XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
          drwX=0; drwY=0; // drwWidth=wndWidth; drwHeight=wndHeight;
-         XTranslateCoordinates( mDisplay,mWindow,mRoot,0,0,&drwcX,&drwcY,&mRoot );
+         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 );
 
          aspect(&dwidth,&dheight,A_NOZOOM);
@@ -265,10 +262,6 @@
 
  wndX=0; wndY=0;
  wndWidth=d_width; wndHeight=d_height;
- #ifdef HAVE_NEW_GUI
-//  mdwidth=d_width; mdheight=d_height;
-  mdwidth=width; mdheight=height;
- #endif
  mFullscreen=fullscreen&1;
 
  switch ( vo_depthonscreen )
@@ -282,6 +275,7 @@
 
   aspect(&d_width,&d_height,A_NOZOOM);
 #ifdef HAVE_NEW_GUI
+ mdwidth=width; mdheight=height;
  if ( vo_window == None )
   {
 #endif
@@ -306,49 +300,37 @@
    xswamask=CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
 
     if ( WinID>=0 ){
-      mWindow = WinID ? ((Window)WinID) : RootWindow(mDisplay,mScreen);
-      XUnmapWindow( mDisplay,mWindow );
-      XChangeWindowAttributes( mDisplay,mWindow,xswamask,&xWAttribs);
+      vo_window = WinID ? ((Window)WinID) : RootWindow(mDisplay,mScreen);
+      XUnmapWindow( mDisplay,vo_window );
+      XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xWAttribs);
     } else 
-   mWindow=XCreateWindow( mDisplay,RootWindow( mDisplay,mScreen ),
+   vo_window=XCreateWindow( mDisplay,RootWindow( mDisplay,mScreen ),
      wndX,wndY,
      wndWidth,wndHeight,
      xWAttribs.border_pixel,
      mDepth,
      InputOutput,
      vinfo.visual,xswamask,&xWAttribs );
-   vo_x11_classhint( mDisplay,mWindow,"xmga" );
-   vo_hidecursor(mDisplay,mWindow);
+   vo_x11_classhint( mDisplay,vo_window,"xmga" );
+   vo_hidecursor(mDisplay,vo_window);
 
-   if ( mFullscreen ) vo_x11_decoration( mDisplay,mWindow,0 );
+   if ( mFullscreen ) vo_x11_decoration( mDisplay,vo_window,0 );
 
-   XGetNormalHints( mDisplay,mWindow,&hint );
+   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,mWindow,&hint );
-   XStoreName( mDisplay,mWindow,mTitle );
-   XMapWindow( mDisplay,mWindow );
+   XSetNormalHints( mDisplay,vo_window,&hint );
+   XStoreName( mDisplay,vo_window,mTitle );
+   XMapWindow( mDisplay,vo_window );
 		   
 #ifdef HAVE_XINERAMA
-   vo_x11_xinerama_move(mDisplay,mWindow);
+   vo_x11_xinerama_move(mDisplay,vo_window);
 #endif
-   mGC=XCreateGC( mDisplay,mWindow,GCForeground,&wGCV );
+   vo_gc=XCreateGC( mDisplay,vo_window,GCForeground,&wGCV );
 #ifdef HAVE_NEW_GUI
   }
-  else
-    {
-     mWindow=vo_window;
-//     fprintf( stderr,"[xmga] width: %d height: %d d_width: %d d_height: %d\n",width,height,d_width,d_height );
-//     if ( vo_screenwidth != d_width )
-//      {
-//       XMoveWindow( mDisplay,mWindow,( vo_screenwidth - d_width ) / 2,( vo_screenheight - d_height ) / 2 );
-//       XResizeWindow( mDisplay,mWindow,d_width,d_height );
-//      }
-//      else mFullscreen=1;
-      mGC=vo_gc; //XCreateGC( mDisplay,mWindow,GCForeground,&wGCV );
-    }
 #endif
 
  set_window();
@@ -365,13 +347,8 @@
  
  set_window();
 
-#ifdef HAVE_NEW_GUI
- if ( vo_window == None )
-#endif
- {
-   XFlush( mDisplay );
-   XSync( mDisplay,False );
- }
+ XFlush( mDisplay );
+ XSync( mDisplay,False );
 
  saver_off(mDisplay);
 
@@ -390,7 +367,7 @@
  if ( vo_window == None )
 #endif
  {
-  XDestroyWindow( mDisplay,mWindow );
+  XDestroyWindow( mDisplay,vo_window );
  }
  mga_uninit();
  printf("vo: uninit!\n");

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- vo_xv.c	17 Feb 2002 08:24:43 -0000	1.56
+++ vo_xv.c	21 Feb 2002 21:11:01 -0000	1.57
@@ -57,9 +57,6 @@
 static unsigned char *ImageData;
 
 /* X11 related variables */
-//static Display *mydisplay;
-static Window mywindow;
-static GC mygc;
 static XImage *myximage;
 static int depth, bpp, mode;
 static XWindowAttributes attribs;
@@ -404,50 +401,44 @@
    xswamask = CWBackPixel | CWBorderPixel;
 
     if ( WinID>=0 ){
-      mywindow = WinID ? ((Window)WinID) : RootWindow(mDisplay,mScreen);
-      XUnmapWindow( mDisplay,mywindow );
-      XChangeWindowAttributes( mDisplay,mywindow,xswamask,&xswa );
+      vo_window = WinID ? ((Window)WinID) : RootWindow(mDisplay,mScreen);
+      XUnmapWindow( mDisplay,vo_window );
+      XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa );
     } else 
 
-   mywindow = XCreateWindow(mDisplay, RootWindow(mDisplay,mScreen),
+   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,mywindow,"xv" );
-   vo_hidecursor(mDisplay,mywindow);
+   vo_x11_classhint( mDisplay,vo_window,"xv" );
+   vo_hidecursor(mDisplay,vo_window);
 
-   XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask 
+   XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask 
 #ifdef HAVE_NEW_INPUT
 		| ButtonPressMask | ButtonReleaseMask
 #endif
    );
-   XSetStandardProperties(mDisplay, mywindow, hello, hello, None, NULL, 0, &hint);
-   if ( mFullscreen ) vo_x11_decoration( mDisplay,mywindow,0 );
-   XMapWindow(mDisplay, mywindow);
+   XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint);
+   if ( mFullscreen ) vo_x11_decoration( mDisplay,vo_window,0 );
+   XMapWindow(mDisplay, vo_window);
 #ifdef HAVE_XINERAMA
-   vo_x11_xinerama_move(mDisplay,mywindow);
+   vo_x11_xinerama_move(mDisplay,vo_window);
 #endif
-   mygc = XCreateGC(mDisplay, mywindow, 0L, &xgcv);
+   vo_gc = XCreateGC(mDisplay, vo_window, 0L, &xgcv);
    XFlush(mDisplay);
    XSync(mDisplay, False);
 #ifdef HAVE_XF86VM
     if ( vm )
      {
       /* Grab the mouse pointer in our window */
-      XGrabPointer(mDisplay, mywindow, True, 0,
+      XGrabPointer(mDisplay, vo_window, True, 0,
                    GrabModeAsync, GrabModeAsync,
-                   mywindow, None, CurrentTime);
-      XSetInputFocus(mDisplay, mywindow, RevertToNone, CurrentTime);
+                   vo_window, None, CurrentTime);
+      XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime);
      }
 #endif
-
 #ifdef HAVE_NEW_GUI
   }
-  else
-    {
-     mywindow=vo_window;
-     mygc=vo_gc;
-    }
 #endif
 
  xv_port = 0;
@@ -518,9 +509,9 @@
 #endif
      set_gamma_correction();
 
-     XGetGeometry( mDisplay,mywindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
+     XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
      drwX=0; drwY=0;
-     XTranslateCoordinates( mDisplay,mywindow,mRoot,0,0,&drwcX,&drwcY,&mRoot );
+     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 );
 
      aspect(&dwidth,&dheight,A_NOZOOM);
@@ -582,9 +573,9 @@
  int e=vo_x11_check_events(mDisplay);
  if(e&VO_EVENT_RESIZE)
   {
-   XGetGeometry( mDisplay,mywindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
+   XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
    drwX=0; drwY=0;
-   XTranslateCoordinates( mDisplay,mywindow,mRoot,0,0,&drwcX,&drwcY,&mRoot );
+   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
@@ -616,8 +607,8 @@
   }
  if ( e & VO_EVENT_EXPOSE )
   {
-   XvShmPutImage(mDisplay, xv_port, mywindow, mygc, xvimage[current_buf], 0, 0,  image_width, image_height, drwX, drwY, 1, 1, False);
-   XvShmPutImage(mDisplay, xv_port, mywindow, mygc, xvimage[current_buf], 0, 0,  image_width, image_height, drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight), False);
+   XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf], 0, 0,  image_width, image_height, drwX, drwY, 1, 1, False);
+   XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf], 0, 0,  image_width, image_height, drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight), False);
   }
 }
 
@@ -626,7 +617,7 @@
 
 static void flip_page(void)
 {
- XvShmPutImage(mDisplay, xv_port, mywindow, mygc, xvimage[current_buf],
+ XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf],
          0, 0,  image_width, image_height,
          drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight),
          False);
@@ -777,7 +768,7 @@
  if ( vo_window == None )
 #endif
  {
-  XDestroyWindow( mDisplay,mywindow );
+  XDestroyWindow( mDisplay,vo_window );
  }
  for( i=0;i<num_buffers;i++ ) deallocate_xvimage( i );
 #ifdef HAVE_XF86VM

Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- x11_common.c	17 Feb 2002 12:34:29 -0000	1.49
+++ x11_common.c	21 Feb 2002 21:11:01 -0000	1.50
@@ -392,19 +392,12 @@
 	    XSetClassHint(display,window,&wmClass);
 }
 
-#ifdef HAVE_NEW_GUI
- Window    vo_window = None;
- GC        vo_gc;
- int       vo_xeventhandling = 1;
- int       vo_resize = 0;
- int       vo_expose = 0;
+Window    vo_window = None;
+GC        vo_gc;
 
+#ifdef HAVE_NEW_GUI
  void vo_setwindow( Window w,GC g ) {
    vo_window=w; vo_gc=g;
-   vo_xeventhandling=0;
- }
- void vo_setwindowsize( int w,int h ) {
-    vo_dwidth=w; vo_dheight=h;
  }
 #endif
 
@@ -433,57 +426,41 @@
  static XComposeStatus stat;
 // unsigned long  vo_KeyTable[512];
 
-#ifdef HAVE_NEW_GUI
- if ( vo_xeventhandling )
-   {
-#endif
-    while ( XPending( mydisplay ) )
-      {
-       XNextEvent( mydisplay,&Event );
-       switch( Event.type )
-         {
-          case Expose:
-               ret|=VO_EVENT_EXPOSE;
-               break;
-          case ConfigureNotify:
-               vo_dwidth=Event.xconfigure.width;
-               vo_dheight=Event.xconfigure.height;
-	       ret|=VO_EVENT_RESIZE;
-               break;
-          case KeyPress:
-               XLookupString( &Event.xkey,buf,sizeof(buf),&keySym,&stat );
-               vo_x11_putkey( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) );
-	       ret|=VO_EVENT_KEYPRESS;
-               break;
+ while ( XPending( mydisplay ) )
+  {
+   XNextEvent( mydisplay,&Event );
+//   #ifdef HAVE_NEW_GUI
+//    if ( use_gui ) gEvent( 0,(char*)&Event );
+//   #endif
+   if ( vo_window == Event.xany.window )
+    switch( Event.type )
+     {
+      case Expose:
+           ret|=VO_EVENT_EXPOSE;
+           break;
+      case ConfigureNotify:
+           vo_dwidth=Event.xconfigure.width;
+           vo_dheight=Event.xconfigure.height;
+           ret|=VO_EVENT_RESIZE;
+           break;
+      case KeyPress:
+           XLookupString( &Event.xkey,buf,sizeof(buf),&keySym,&stat );
+           vo_x11_putkey( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) );
+           ret|=VO_EVENT_KEYPRESS;
+           break;
 #ifdef HAVE_NEW_INPUT
-          case ButtonPress:
-               // Ignore mouse whell press event
-               if(Event.xbutton.button == 4 || Event.xbutton.button == 5)
-                    break;
-               mplayer_put_key((MOUSE_BTN0+Event.xbutton.button-1)|MP_KEY_DOWN);
-               break;
-          case ButtonRelease:
-               mplayer_put_key(MOUSE_BTN0+Event.xbutton.button-1);
-               break;
+      case ButtonPress:
+           // Ignore mouse whell press event
+           if(Event.xbutton.button == 4 || Event.xbutton.button == 5)
+            break;
+           mplayer_put_key((MOUSE_BTN0+Event.xbutton.button-1)|MP_KEY_DOWN);
+           break;
+      case ButtonRelease:
+           mplayer_put_key(MOUSE_BTN0+Event.xbutton.button-1);
+           break;
 #endif
-         }
-      }
-#ifdef HAVE_NEW_GUI
-    }
-    else
-     {
-      if ( vo_resize )
-       {
-        vo_resize=0;
-        ret|=VO_EVENT_RESIZE;
-       }
-      if ( vo_expose )
-       {
-        vo_expose=0;
-        ret|=VO_EVENT_EXPOSE;
-       }
      }
-#endif
+  }
 
   return ret;
 }

Index: x11_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- x11_common.h	31 Jan 2002 00:37:27 -0000	1.14
+++ x11_common.h	21 Feb 2002 21:11:01 -0000	1.15
@@ -21,14 +21,11 @@
 int vo_x11_check_events(Display *mydisplay);
 #endif
 
+extern Window    vo_window;
+extern GC        vo_gc;
+
 #ifdef HAVE_NEW_GUI
- extern Window    vo_window;
- extern GC        vo_gc;
  extern void vo_setwindow( Window w,GC g );
- extern void vo_setwindowsize( int w,int h );
- extern int       vo_xeventhandling;
- extern int       vo_expose;
- extern int       vo_resize;
  extern void vo_x11_putkey(int key);
 #endif
 #ifdef HAVE_GUI




More information about the MPlayer-cvslog mailing list