changeset 1137:4c7b219e126c

patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
author arpi_esp
date Sun, 17 Jun 2001 01:22:09 +0000
parents 025cb2d303b8
children ccdc809e8849
files libvo/vo_3dfx.c libvo/vo_gl.c libvo/vo_x11.c libvo/vo_xmga.c libvo/vo_xv.c libvo/x11_common.c libvo/x11_common.h
diffstat 7 files changed, 40 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_3dfx.c	Sat Jun 16 18:10:32 2001 +0000
+++ b/libvo/vo_3dfx.c	Sun Jun 17 01:22:09 2001 +0000
@@ -188,6 +188,7 @@
 
 	mywindow = XCreateWindow(display, RootWindow(display,screen),
 				 hint.x, hint.y, hint.width, hint.height, 4, bpp,CopyFromParent,vinfo.visual,xswamask,&xswa);
+	vo_x11_classhint( display,mywindow,"3dfx" );
 
 	XSelectInput(display, mywindow, StructureNotifyMask);
 
--- a/libvo/vo_gl.c	Sat Jun 16 18:10:32 2001 +0000
+++ b/libvo/vo_gl.c	Sun Jun 17 01:22:09 2001 +0000
@@ -183,6 +183,8 @@
 
   mywindow = XCreateWindow(mydisplay, RootWindow(mydisplay,screen),
     hint.x, hint.y, hint.width, hint.height, 4, vinfo->depth,CopyFromParent,vinfo->visual,xswamask,&xswa);
+
+  vo_x11_classhint( mydisplay,mywindow,"gl" );
   vo_hidecursor(mydisplay,mywindow);
 
   wsGLXContext=glXCreateContext( mydisplay,vinfo,NULL,True );
--- a/libvo/vo_x11.c	Sat Jun 16 18:10:32 2001 +0000
+++ b/libvo/vo_x11.c	Sun Jun 17 01:22:09 2001 +0000
@@ -117,6 +117,7 @@
 {
 // int screen;
  int fullscreen=0;
+ int vm=0;
 // int interval, prefer_blank, allow_exp, nothing;
  unsigned int fg,bg;
  char *hello=( title == NULL ) ? "X11 render" : title;
@@ -141,11 +142,12 @@
  hint.width=image_width;
  hint.height=image_height;
  
- if( flags&0x01 ) fullscreen = 1;
+ if( flags&0x03 ) fullscreen = 1;
+ if( flags&0x02 ) vm = 1;
  if( flags&0x08 ) Flip_Flag = 1;
 
 #ifdef HAVE_XF86VM
- if (fullscreen) {
+ 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;
@@ -221,6 +223,7 @@
                          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);
 
  if ( fullscreen ) vo_x11_decoration( mDisplay,mywindow,0 );
@@ -315,7 +318,7 @@
 
   bpp=myximage->bits_per_pixel;
 
-  printf( "X11 color mask:  R:%lX  G:%lX  B:%lX\n",myximage->red_mask,myximage->green_mask,myximage->blue_mask );
+//  printf( "X11 color mask:  R:%lX  G:%lX  B:%lX\n",myximage->red_mask,myximage->green_mask,myximage->blue_mask );
 
   // If we have blue in the lowest bit then obviously RGB
   mode=( ( myximage->blue_mask & 0x01 ) != 0 ) ? MODE_RGB : MODE_BGR;
@@ -325,8 +328,9 @@
   if ( myximage->byte_order != LSBFirst )
 #endif
   {
-   printf( "No support fon non-native XImage byte order!\n" );
-   return -1;
+    mode=( ( myximage->blue_mask & 0x01 ) != 0 ) ? MODE_BGR : MODE_RGB;
+//   printf( "No support fon non-native XImage byte order!\n" );
+//   return -1;
   }
 
  if( format==IMGFMT_YV12 ) yuv2rgb_init( ( depth == 24 ) ? bpp : depth,mode );
--- a/libvo/vo_xmga.c	Sat Jun 16 18:10:32 2001 +0000
+++ b/libvo/vo_xmga.c	Sun Jun 17 01:22:09 2001 +0000
@@ -273,6 +273,7 @@
      mDepth,
      InputOutput,
      vinfo.visual,xswamask,&xWAttribs );
+   vo_x11_classhint( mDisplay,mWindow,"xmga" );
    vo_hidecursor(mDisplay,mWindow);
 
    if ( mFullscreen ) vo_x11_decoration( mDisplay,mWindow,0 );
--- a/libvo/vo_xv.c	Sat Jun 16 18:10:32 2001 +0000
+++ b/libvo/vo_xv.c	Sun Jun 17 01:22:09 2001 +0000
@@ -141,6 +141,7 @@
    mywindow = 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);
 
    XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask );
--- a/libvo/x11_common.c	Sat Jun 16 18:10:32 2001 +0000
+++ b/libvo/x11_common.c	Sun Jun 17 01:22:09 2001 +0000
@@ -49,6 +49,7 @@
 {
 // int       mScreen;
  int bpp;
+ unsigned int mask;
 // char    * DisplayName = ":0.0";
 // Display * mDisplay;
  XImage  * mXImage;
@@ -78,12 +79,19 @@
  // get bits/pixel:
    mXImage=XGetImage( mDisplay,mRootWin,0,0,1,1,AllPlanes,ZPixmap );
    bpp=mXImage->bits_per_pixel;
+   if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi
+   mask=mXImage->red_mask|mXImage->green_mask|mXImage->blue_mask;
+   printf("vo: X11 color mask:  %X  (R:%lX G:%lX B:%lX)\n",
+     mask,mXImage->red_mask,mXImage->green_mask,mXImage->blue_mask);
+   if(((vo_depthonscreen+7)/8)==2){
+     if(mask==0x7FFF) vo_depthonscreen=15; else
+     if(mask==0xFFFF) vo_depthonscreen=16;
+   }
    XDestroyImage( mXImage );
- if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi
 // XCloseDisplay( mDisplay );
 #warning Better local display detection method is needed. 
  if (*mDisplayName==':') mLocalDisplay=1; else mLocalDisplay=0;
- printf("X11 running at %dx%d depth: %d (\"%s\" => %s display)\n",vo_screenwidth,vo_screenheight,vo_depthonscreen,mDisplayName,mLocalDisplay?"local":"remote");
+ printf("vo: X11 running at %dx%d depth: %d (\"%s\" => %s display)\n",vo_screenwidth,vo_screenheight,vo_depthonscreen,mDisplayName,mLocalDisplay?"local":"remote");
  return 1;
 }
 
@@ -149,6 +157,14 @@
 
 void vo_x11_decoration( Display * vo_Display,Window w,int d )
 {
+
+#if 1
+    XSetWindowAttributes attr;
+    attr.override_redirect = True;
+    XChangeWindowAttributes(vo_Display, w, CWOverrideRedirect, &attr);
+//    XMapWindow(vo_Display], w);
+#endif
+
  vo_MotifHints=XInternAtom( vo_Display,"_MOTIF_WM_HINTS",0 );
  if ( vo_MotifHints != None )
   {
@@ -159,6 +175,13 @@
   }
 }
 
+void vo_x11_classhint( Display * display,Window window,char *name ){
+	    XClassHint wmClass;
+	    wmClass.res_name = name;
+	    wmClass.res_class = "MPlayer";
+	    XSetClassHint(display,window,&wmClass);
+}
+
 #ifdef HAVE_GUI
  Window    vo_window = None;
  GC        vo_gc;
--- a/libvo/x11_common.h	Sat Jun 16 18:10:32 2001 +0000
+++ b/libvo/x11_common.h	Sun Jun 17 01:22:09 2001 +0000
@@ -16,6 +16,7 @@
 int vo_init( void );
 int vo_hidecursor ( Display* , Window );
 void vo_x11_decoration( Display * vo_Display,Window w,int d );
+void vo_x11_classhint( Display * display,Window window,char *name );
 int vo_x11_check_events(Display *mydisplay);
 #endif