changeset 120:93ea0c6aae7f

common window setup code moved to set_window()
author arpi_esp
date Sat, 17 Mar 2001 19:19:18 +0000
parents e5d07da09f9b
children 94a1a9f52050
files libvo/vo_xmga.c
diffstat 1 files changed, 30 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_xmga.c	Fri Mar 16 23:05:01 2001 +0000
+++ b/libvo/vo_xmga.c	Sat Mar 17 19:19:18 2001 +0000
@@ -100,32 +100,39 @@
  XFlush( mDisplay );
 }
 
+static void set_window(){
+
+         XGetGeometry( mDisplay,mWindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
+         drwX=0; drwY=0; // drwWidth=wndWidth; drwHeight=wndHeight;
+         XTranslateCoordinates( mDisplay,mWindow,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 ( mFullscreen )
+          {
+           drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2;
+           drwcX+=drwX;
+           drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2;
+           drwcY+=drwY;
+           drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth);
+           drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight);
+           fprintf( stderr,"[xmga-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
+          }
+
+         mDrawColorKey();
+
+         mga_vid_config.x_org=drwcX;
+         mga_vid_config.y_org=drwcY;
+         mga_vid_config.dest_width=drwWidth;
+         mga_vid_config.dest_height=drwHeight;
+
+}
+
 static void check_events(void)
 {
     int e=vo_x11_check_events(mDisplay);
 
     if(e&VO_EVENT_RESIZE){
-         XGetGeometry( mDisplay,mWindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
-         drwX=0; drwY=0;
-         XTranslateCoordinates( mDisplay,mWindow,mRoot,0,0,&drwcX,&drwcY,&mRoot );
-         if ( mFullscreen )
-          {
-           drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2;
-           drwcX=drwX;
-           drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2;
-           drwcY=drwY;
-           drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth);
-           drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight);
-          }
-
-         mDrawColorKey();
-         mga_vid_config.x_org=drwcX;
-         mga_vid_config.y_org=drwcY;
-         mga_vid_config.dest_width=drwWidth;
-         mga_vid_config.dest_height=drwHeight;
-
-         fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
-
+         set_window();
          if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) )
           {
            fprintf( stderr,"Error in mga_vid_config ioctl" );
@@ -251,31 +258,11 @@
  mGC=XCreateGC( mDisplay,mWindow,GCForeground,&wGCV );
 
  XMapWindow( mDisplay,mWindow );
-
- XGetGeometry( mDisplay,mWindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
- drwX=0; drwY=0; drwWidth=wndWidth; drwHeight=wndHeight;
- XTranslateCoordinates( mDisplay,mWindow,mRoot,0,0,&drwcX,&drwcY,&mRoot );
-
- if ( fullscreen )
-  {
-   drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2;
-   drwcX=drwX;
-   drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2;
-   drwcY=drwY;
-   drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth);
-   drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight);
-  }
-
- mDrawColorKey();
+ 
+ set_window();
 
  mga_vid_config.src_width=width;
  mga_vid_config.src_height=height;
- mga_vid_config.dest_width=drwWidth;
- mga_vid_config.dest_height=drwHeight;
- mga_vid_config.x_org=drwcX;
- mga_vid_config.y_org=drwcY;
-
- fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
 
  mga_vid_config.colkey_on=1;
  mga_vid_config.colkey_red=255;