changeset 1746:6e7da6f362ab

add half gui support
author pontscho
date Wed, 29 Aug 2001 15:09:19 +0000
parents 64247d7d0076
children e955ee46d3e0
files libvo/vo_x11.c libvo/x11_common.c libvo/x11_common.h
diffstat 3 files changed, 67 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_x11.c	Wed Aug 29 15:08:43 2001 +0000
+++ b/libvo/vo_x11.c	Wed Aug 29 15:09:19 2001 +0000
@@ -154,32 +154,44 @@
  image_width=width;
  image_format=format;
 
- if ( X_already_started ) return -1;
- if( !vo_init() ) return 0; // Can't open X11
-
- hint.x=0;
- hint.y=0;
- hint.width=image_width;
- hint.height=image_height;
- 
  if( flags&0x03 ) fullscreen = 1;
  if( flags&0x02 ) vm = 1;
  if( flags&0x08 ) Flip_Flag = 1;
 
-#ifdef HAVE_XF86VM
- if (vm) {
-    unsigned int modeline_width, modeline_height, vm_event, vm_error;
-    unsigned int vm_ver, vm_rev;
-    int i,j,have_vm=0,X,Y;
+printf( "w: %d h: %d\n\n",vo_dwidth,vo_dheight );
+
+ XGetWindowAttributes( mDisplay,DefaultRootWindow( mDisplay ),&attribs );
+ depth=attribs.depth;
+
+ if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) depth=24;
+ XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo );
+
+ if ( vo_window != None ) { mywindow=vo_window; mygc=vo_gc; }
+  else
+   {
+    if ( X_already_started ) return -1;
+    if( !vo_init() ) return 0; // Can't open X11
 
-    int modecount;
+    hint.x=0;
+    hint.y=0;
+    hint.width=image_width;
+    hint.height=image_height;
+ 
 
-    if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) {
-        XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev);
-        printf("XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev);
-        have_vm=1;
-    } else
-        printf("XF86VidMode Extenstion not available.\n");
+#ifdef HAVE_XF86VM
+    if (vm) {
+        unsigned int modeline_width, modeline_height, vm_event, vm_error;
+	unsigned int vm_ver, vm_rev;
+        int i,j,have_vm=0,X,Y;
+
+        int modecount;
+
+        if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) {
+            XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev);
+            printf("XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev);
+            have_vm=1;
+        } else
+            printf("XF86VidMode Extenstion not available.\n");
 
     if (have_vm) {
       if (vidmodes==NULL)
@@ -213,51 +225,44 @@
 #endif
 
 
- if ( fullscreen )
-  {
-   hint.width=vo_screenwidth;
-   hint.height=vo_screenheight;
-  }
- vo_dwidth=hint.width;
- vo_dheight=hint.height;
- hint.flags=PPosition | PSize;
-
- bg=WhitePixel( mDisplay,mScreen );
- fg=BlackPixel( mDisplay,mScreen );
+    if ( fullscreen )
+     {
+      hint.width=vo_screenwidth;
+      hint.height=vo_screenheight;
+     }
+    hint.flags=PPosition | PSize;
 
- XGetWindowAttributes( mDisplay,DefaultRootWindow( mDisplay ),&attribs );
- depth=attribs.depth;
-
- if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) depth=24;
- XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo );
+    bg=WhitePixel( mDisplay,mScreen );
+    fg=BlackPixel( mDisplay,mScreen );
+    vo_dwidth=hint.width;
+    vo_dheight=hint.height;
 
- theCmap  =XCreateColormap( mDisplay,RootWindow( mDisplay,mScreen ),
- vinfo.visual,AllocNone );
+    theCmap  =XCreateColormap( mDisplay,RootWindow( mDisplay,mScreen ),
+    vinfo.visual,AllocNone );
 
- xswa.background_pixel=0;
- xswa.border_pixel=1;
- xswa.colormap=theCmap;
- xswamask=CWBackPixel | CWBorderPixel |CWColormap;
+    xswa.background_pixel=0;
+    xswa.border_pixel=1;
+    xswa.colormap=theCmap;
+    xswamask=CWBackPixel | CWBorderPixel |CWColormap;
 
- mywindow=XCreateWindow( mDisplay,RootWindow( mDisplay,mScreen ),
+    mywindow=XCreateWindow( mDisplay,RootWindow( mDisplay,mScreen ),
                          hint.x,hint.y,
                          hint.width,hint.height,
                          xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa );
- vo_x11_classhint( mDisplay,mywindow,"x11" );
- vo_hidecursor(mDisplay,mywindow);
+    vo_x11_classhint( mDisplay,mywindow,"x11" );
+    vo_hidecursor(mDisplay,mywindow);
+    if ( fullscreen ) vo_x11_decoration( mDisplay,mywindow,0 );
+    XSelectInput( mDisplay,mywindow,StructureNotifyMask );
+    XSetStandardProperties( mDisplay,mywindow,hello,hello,None,NULL,0,&hint );
+    XMapWindow( mDisplay,mywindow );
+    do { XNextEvent( mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != mywindow );
+    XSelectInput( mDisplay,mywindow,NoEventMask );
 
- if ( fullscreen ) vo_x11_decoration( mDisplay,mywindow,0 );
- XSelectInput( mDisplay,mywindow,StructureNotifyMask );
- XSetStandardProperties( mDisplay,mywindow,hello,hello,None,NULL,0,&hint );
- XMapWindow( mDisplay,mywindow );
- do { XNextEvent( mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != mywindow );
+    XFlush( mDisplay );
+    XSync( mDisplay,False );
 
- XSelectInput( mDisplay,mywindow,NoEventMask );
-
- XFlush( mDisplay );
- XSync( mDisplay,False );
-
- mygc=XCreateGC( mDisplay,mywindow,0L,&xgcv );
+    mygc=XCreateGC( mDisplay,mywindow,0L,&xgcv );
+   }
 
 #ifdef SH_MEM
  if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag=1;
@@ -272,7 +277,7 @@
 
  if ( Shmem_Flag )
   {
-   myximage=XShmCreateImage( mDisplay,vinfo.visual,depth,ZPixmap,NULL,&Shminfo[0],width,image_height );
+   myximage=XShmCreateImage( mDisplay,vinfo.visual,depth,ZPixmap,NULL,&Shminfo[0],image_width,image_height );
    if ( myximage == NULL )
     {
      if ( myximage != NULL ) XDestroyImage( myximage );
@@ -365,7 +370,7 @@
 
  if( format==IMGFMT_YV12 ) yuv2rgb_init( ( depth == 24 ) ? bpp : depth,mode );
    
- XSelectInput( mDisplay,mywindow,StructureNotifyMask | KeyPressMask );
+ if ( vo_window == None ) XSelectInput( mDisplay,mywindow,StructureNotifyMask | KeyPressMask );
    
  X_already_started++;
 
--- a/libvo/x11_common.c	Wed Aug 29 15:08:43 2001 +0000
+++ b/libvo/x11_common.c	Wed Aug 29 15:09:19 2001 +0000
@@ -328,6 +328,9 @@
    vo_window=w; vo_gc=g;
    vo_xeventhandling=0;
  }
+ void vo_setwindowsize( int w,int h ) {
+    vo_dwidth=w; vo_dheight=h;
+ }
 #endif
 
 int vo_x11_check_events(Display *mydisplay){
--- a/libvo/x11_common.h	Wed Aug 29 15:08:43 2001 +0000
+++ b/libvo/x11_common.h	Wed Aug 29 15:09:19 2001 +0000
@@ -24,6 +24,7 @@
  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;