[Mplayer-cvslog] CVS: main/libvo vo_xmga.c,1.18,1.19 vo_xv.c,1.18,1.19 x11_common.c,1.17,1.18 x11_common.h,1.4,1.5

Zoltan Ponekker pontscho at users.sourceforge.net
Tue May 8 14:17:05 CEST 2001


Update of /cvsroot/mplayer/main/libvo
In directory usw-pr-cvs1:/tmp/cvs-serv2829/libvo

Modified Files:
	vo_xmga.c vo_xv.c x11_common.c x11_common.h 
Log Message:
add gui support

Index: vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** vo_xmga.c	2001/04/24 11:42:04	1.18
--- vo_xmga.c	2001/05/08 12:17:02	1.19
***************
*** 88,91 ****
--- 88,95 ----
  static uint32_t               drwcX,drwcY,dwidth,dheight,mFullscreen;
  
+ #ifdef HAVE_GUI
+  static uint32_t               mdwidth,mdheight;
+ #endif
+ 
  static XSetWindowAttributes   xWAttribs;
  
***************
*** 107,110 ****
--- 111,128 ----
           //fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
  
+          #ifdef HAVE_GUI
+           if ( vo_window != None )
+            {
+             mFullscreen=0;
+             dwidth=mdwidth; dheight=mdheight;
+             if ( ( drwWidth == vo_screenwidth )&&( drwHeight == vo_screenheight ) )
+              {
+               mFullscreen=1;
+               dwidth=vo_screenwidth;
+               dheight=vo_screenwidth * mdheight / mdwidth;
+              }
+            }
+          #endif
+ 
           if ( mFullscreen )
            {
***************
*** 225,241 ****
   wndWidth=d_width; wndHeight=d_height;
   dwidth=d_width; dheight=d_height;
   mFullscreen=fullscreen;
  
-  if ( fullscreen )
-   {
-    wndWidth=vo_screenwidth;
-    wndHeight=vo_screenheight;
-   }
- 
-  XGetWindowAttributes( mDisplay,DefaultRootWindow( mDisplay ),&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 );
   switch ( vo_depthonscreen )
    {
--- 243,251 ----
   wndWidth=d_width; wndHeight=d_height;
   dwidth=d_width; dheight=d_height;
+  #ifdef HAVE_GUI
+   mdwidth=d_width; mdheight=d_height;
+  #endif
   mFullscreen=fullscreen;
  
   switch ( vo_depthonscreen )
    {
***************
*** 246,277 ****
     default: printf( "Sorry, this (%d) color depth not supported.\n",vo_depthonscreen ); return -1;
    }
-  xWAttribs.background_pixel=0;
-  xWAttribs.border_pixel=0;
-  xWAttribs.event_mask=StructureNotifyMask | ExposureMask | KeyPressMask;
-  xswamask=CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- 
-  mWindow=XCreateWindow( mDisplay,RootWindow( mDisplay,mScreen ),
-    wndX,wndY,
-    wndWidth,wndHeight,
-    xWAttribs.border_pixel,
-    mDepth,
-    InputOutput,
-    vinfo.visual,xswamask,&xWAttribs );
-  vo_hidecursor(mDisplay,mWindow);
- 
-  if ( fullscreen ) vo_x11_decoration( mDisplay,mWindow,0 );
- 
-  XGetNormalHints( mDisplay,mWindow,&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 );
  
   mGC=XCreateGC( mDisplay,mWindow,GCForeground,&wGCV );
  
-  XMapWindow( mDisplay,mWindow );
- 
   set_window();
  
--- 256,315 ----
     default: printf( "Sorry, this (%d) color depth not supported.\n",vo_depthonscreen ); return -1;
    }
  
+ #ifdef HAVE_GUI
+  if ( vo_window == None )
+   {
+ #endif
+    if ( fullscreen )
+     {
+      wndWidth=vo_screenwidth;
+      wndHeight=vo_screenheight;
+     }
+ 
+    XGetWindowAttributes( mDisplay,DefaultRootWindow( mDisplay ),&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.background_pixel=0;
+    xWAttribs.border_pixel=0;
+    xWAttribs.event_mask=StructureNotifyMask | ExposureMask | KeyPressMask;
+    xswamask=CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+ 
+    mWindow=XCreateWindow( mDisplay,RootWindow( mDisplay,mScreen ),
+      wndX,wndY,
+      wndWidth,wndHeight,
+      xWAttribs.border_pixel,
+      mDepth,
+      InputOutput,
+      vinfo.visual,xswamask,&xWAttribs );
+    vo_hidecursor(mDisplay,mWindow);
+ 
+    if ( fullscreen ) vo_x11_decoration( mDisplay,mWindow,0 );
+ 
+    XGetNormalHints( mDisplay,mWindow,&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 );
+ #ifdef HAVE_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;
+     }
+ #endif
   mGC=XCreateGC( mDisplay,mWindow,GCForeground,&wGCV );
  
   set_window();
  
***************
*** 286,291 ****
   if(mga_init()) return -1;
  
!  XFlush( mDisplay );
!  XSync( mDisplay,False );
  
   saver_off(mDisplay);
--- 324,336 ----
   if(mga_init()) return -1;
  
! #ifdef HAVE_GUI
!  if ( vo_window == None )
!   {
! #endif
!    XFlush( mDisplay );
!    XSync( mDisplay,False );
! #ifdef HAVE_GUI
!   }
! #endif
  
   saver_off(mDisplay);

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** vo_xv.c	2001/05/01 01:32:59	1.18
--- vo_xv.c	2001/05/08 12:17:02	1.19
***************
*** 86,89 ****
--- 86,93 ----
  static uint32_t               drwcX,drwcY,dwidth,dheight,mFullscreen;
  
+ #ifdef HAVE_GUI
+  static uint32_t               mdwidth,mdheight;
+ #endif
+ 
  /*
   * connect to server, create and map window,
***************
*** 122,155 ****
   screen = DefaultScreen(mydisplay);
  
!  hint.x = 0;
!  hint.y = 0;
!  hint.width = d_width;
!  hint.height = d_height;
!  if ( fullscreen )
    {
!    hint.width=vo_screenwidth;
!    hint.height=vo_screenheight;
    }
!  hint.flags = PPosition | PSize;
!  XGetWindowAttributes(mydisplay, DefaultRootWindow(mydisplay), &attribs);
!  depth=attribs.depth;
!  if (depth != 15 && depth != 16 && depth != 24 && depth != 32) depth = 24;
!  XMatchVisualInfo(mydisplay, screen, depth, TrueColor, &vinfo);
! 
!  xswa.background_pixel = 0;
!  xswa.border_pixel     = 0;
!  xswamask = CWBackPixel | CWBorderPixel;
! 
!  mywindow = XCreateWindow(mydisplay, RootWindow(mydisplay,screen),
!  hint.x, hint.y, hint.width, hint.height,
!  0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa);
!  vo_hidecursor(mydisplay,mywindow);
! 
!  XSelectInput(mydisplay, mywindow, StructureNotifyMask | KeyPressMask );
!  XSetStandardProperties(mydisplay, mywindow, hello, hello, None, NULL, 0, &hint);
!  if ( fullscreen ) vo_x11_decoration( mydisplay,mywindow,0 );
!  XMapWindow(mydisplay, mywindow);
!  XFlush(mydisplay);
!  XSync(mydisplay, False);
  
   mygc = XCreateGC(mydisplay, mywindow, 0L, &xgcv);
--- 126,177 ----
   screen = DefaultScreen(mydisplay);
  
! #ifdef HAVE_GUI
!  if ( vo_window == None )
    {
! #endif
!    hint.x = 0;
!    hint.y = 0;
!    hint.width = d_width;
!    hint.height = d_height;
!    if ( fullscreen )
!     {
!      hint.width=vo_screenwidth;
!      hint.height=vo_screenheight;
!     }
!    hint.flags = PPosition | PSize;
!    XGetWindowAttributes(mydisplay, DefaultRootWindow(mydisplay), &attribs);
!    depth=attribs.depth;
!    if (depth != 15 && depth != 16 && depth != 24 && depth != 32) depth = 24;
!    XMatchVisualInfo(mydisplay, screen, depth, TrueColor, &vinfo);
! 
!    xswa.background_pixel = 0;
!    xswa.border_pixel     = 0;
!    xswamask = CWBackPixel | CWBorderPixel;
! 
!    mywindow = XCreateWindow(mydisplay, RootWindow(mydisplay,screen),
!    hint.x, hint.y, hint.width, hint.height,
!    0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa);
!    vo_hidecursor(mydisplay,mywindow);
! 
!    XSelectInput(mydisplay, mywindow, StructureNotifyMask | KeyPressMask );
!    XSetStandardProperties(mydisplay, mywindow, hello, hello, None, NULL, 0, &hint);
!    if ( fullscreen ) vo_x11_decoration( mydisplay,mywindow,0 );
!    XMapWindow(mydisplay, mywindow);
!    XFlush(mydisplay);
!    XSync(mydisplay, False);
! #ifdef HAVE_GUI
    }
!   else
!     {
!      mywindow=vo_window;
!      mygc=vo_gc;
!      if ( vo_screenwidth != d_width )
!       {
!        XMoveWindow( mydisplay,mywindow,( vo_screenwidth - d_width ) / 2,( vo_screenheight - d_height ) / 2 );
!        XResizeWindow( mydisplay,mywindow,d_width,d_height );
!       }
!       else mFullscreen=1;
!     }
! #endif
  
   mygc = XCreateGC(mydisplay, mywindow, 0L, &xgcv);
***************
*** 253,256 ****
--- 275,292 ----
     XTranslateCoordinates( mydisplay,mywindow,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_GUI
+     if ( vo_window != None )
+      {
+       mFullscreen=0;
+       dwidth=mdwidth; dheight=mdheight;
+       if ( ( drwWidth == vo_screenwidth )&&( drwHeight == vo_screenheight ) )
+        {
+         mFullscreen=1;
+         dwidth=vo_screenwidth;
+         dheight=vo_screenwidth * mdheight / mdwidth;
+        }
+      }
+    #endif
  
     if ( mFullscreen )

Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** x11_common.c	2001/04/27 15:41:39	1.17
--- x11_common.c	2001/05/08 12:17:03	1.18
***************
*** 150,153 ****
--- 150,164 ----
  }
  
+ #ifdef HAVE_GUI
+  Window    vo_window = None;
+  GC        vo_gc;
+  int       vo_xeventhandling = 1;
+  int       vo_resize = 0;
+  int       vo_expose = 0;
+ 
+  void vo_setwindow( Window w,GC g )
+  { vo_window=w; vo_gc=g; }
+ #endif
+ 
  int vo_x11_check_events(Display *mydisplay){
   int ret=0;
***************
*** 158,181 ****
  // unsigned long  vo_KeyTable[512];
  
!  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;
      }
!   }
  
    return ret;
--- 169,212 ----
  // unsigned long  vo_KeyTable[512];
  
! #ifdef HAVE_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;
!          }
!       }
! #ifdef HAVE_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.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** x11_common.h	2001/04/14 15:45:38	1.4
--- x11_common.h	2001/05/08 12:17:03	1.5
***************
*** 14,17 ****
--- 14,28 ----
  #endif
  
+ #ifdef HAVE_GUI
+  extern Window    vo_window;
+  extern Display * vo_display;
+  extern GC        vo_gc;
+  extern int       vo_xeventhandling;
+  extern int       vo_expose;
+  extern int       vo_resize;
+ 
+  extern void vo_setwindow( Window w,GC g );
+ #endif
+ 
  void saver_off( Display * );
  void saver_on( Display * );


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list