changeset 4813:15e95b9cf191

using vo_dx, vo_dy
author alex
date Fri, 22 Feb 2002 19:52:09 +0000
parents bad436339b03
children 23abc0e262e3
files libvo/vo_x11.c
diffstat 1 files changed, 16 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_x11.c	Fri Feb 22 19:36:21 2002 +0000
+++ b/libvo/vo_x11.c	Fri Feb 22 19:52:09 2002 +0000
@@ -57,51 +57,30 @@
 static void Display_Image ( XImage * myximage,unsigned char *ImageData );
 static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride);
 
-/* since it doesn't seem to be defined on some platforms */
-int XShmGetEventBase( Display* );
-
 /* local data */
 static unsigned char *ImageData;
 
 /* X11 related variables */
-//static Display *mDisplay;
 static XImage *myximage;
 static int depth,bpp,mode;
 static XWindowAttributes attribs;
 
-//static int vo_dwidth,vo_dheight;
-
 static int Flip_Flag;
 static int zoomFlag;
 
 #ifdef HAVE_SHM
-
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #include <X11/extensions/XShm.h>
 
-//static int HandleXError _ANSI_ARGS_( ( Display * dpy,XErrorEvent * event ) );
-static void InstallXErrorHandler ( void );
-static void DeInstallXErrorHandler ( void );
-
 static int Shmem_Flag;
 static int Quiet_Flag;
 static XShmSegmentInfo Shminfo[1];
 static int gXErrorFlag;
 static int CompletionType=-1;
 
-static void InstallXErrorHandler()
-{
-        //XSetErrorHandler( HandleXError );
-        XFlush( mDisplay );
-}
-
-static void DeInstallXErrorHandler()
-{
-        XSetErrorHandler( NULL );
-        XFlush( mDisplay );
-}
-
+/* since it doesn't seem to be defined on some platforms */
+int XShmGetEventBase( Display* );
 #endif
 
 static uint32_t image_width;
@@ -158,8 +137,6 @@
    }
  if ( Shmem_Flag ) CompletionType=XShmGetEventBase( mDisplay ) + ShmCompletion;
 
- InstallXErrorHandler();
-
  if ( Shmem_Flag )
   {
    myximage=XShmCreateImage( mDisplay,vinfo.visual,depth,ZPixmap,NULL,&Shminfo[0],image_width,image_height );
@@ -228,8 +205,6 @@
    ImageData=myximage->data;
 #ifdef HAVE_SHM
   }
-
-  DeInstallXErrorHandler();
 #endif
 }
 
@@ -256,8 +231,6 @@
  int vm=0;
 // int interval, prefer_blank, allow_exp, nothing;
  unsigned int fg,bg;
- char *hello=( title == NULL ) ? "X11 render" : title;
-// char *name=":0.0";
  XSizeHints hint;
  XEvent xev;
  XGCValues xgcv;
@@ -270,6 +243,9 @@
  static uint32_t vm_height;
 #endif
 
+ if (!title)
+    title = strdup("MPlayer X11 (XImage/Shm) render");
+
  in_format=format;
  srcW= width;
  srcH= height;
@@ -370,7 +346,7 @@
     vo_hidecursor(mDisplay,vo_window);
     if ( fullscreen ) vo_x11_decoration( mDisplay,vo_window,0 );
     XSelectInput( mDisplay,vo_window,StructureNotifyMask );
-    XSetStandardProperties( mDisplay,vo_window,hello,hello,None,NULL,0,&hint );
+    XSetStandardProperties( mDisplay,vo_window,title,title,None,NULL,0,&hint );
     XMapWindow( mDisplay,vo_window );
 #ifdef HAVE_XINERAMA
    vo_x11_xinerama_move(mDisplay,vo_window);
@@ -382,7 +358,7 @@
     XSync( mDisplay,False );
     vo_gc=XCreateGC( mDisplay,vo_window,0L,&xgcv );
 
-    XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask );
+    XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask);
 
 #ifdef HAVE_XF86VM
     if ( vm )
@@ -610,11 +586,18 @@
 	Window root;
 
         vo_x11_decoration( mDisplay,vo_window,0 );
+#ifdef LOCAL_LOOKUP
 	XGetGeometry(mDisplay, vo_window, &root, &foo, &foo,
 		     &vo_fs_oldwidth, &vo_fs_oldheight, &foo, &foo);
 	    
         XTranslateCoordinates(mDisplay, vo_window, root, 0, 0,
 				  &vo_fs_oldx, &vo_fs_oldy,(Window *) &foo);
+#else
+	vo_fs_oldwidth = vo_dwidth;
+	vo_fs_oldheight = vo_dheight;
+	vo_fs_oldx = vo_dx;
+	vo_fs_oldy = vo_dy;
+#endif
 
 	mp_msg(MSGT_VO,MSGL_V,"X11 Fullscreen: saved old place: %dx%d-%dx%d\n",
 	    vo_fs_oldx, vo_fs_oldy, vo_fs_oldwidth, vo_fs_oldheight);
@@ -632,9 +615,11 @@
 	    vo_fs_oldwidth, vo_fs_oldheight);
 	vo_x11_decoration( mDisplay,vo_window,1 );
 
+#ifdef LOCAL_LOOKUP
 	/* restore */
 	vo_dwidth = vo_fs_oldwidth;
 	vo_dheight = vo_fs_oldheight;
+#endif
 	
 	/* clean */
 	vo_fs_oldwidth = -1;