[MPlayer-dev-eng] [(new)PATCH] Proposed full screen solution for latest CVS

Svante Signell svante.signell at telia.com
Wed Nov 20 23:24:19 CET 2002


Anyone interested to at least consider taking a look at my patch?

Svante Signell writes:
 > Hi,
 > 
 > I found some information about the _NET_SUPPORTED and _WIN_SUPPORTING
 > at developer.gnome.org. Changed the code according to the "Extended
 > Window Manager Hints" and the older "GNOME Window Manager
 > Compliance". Successful tested cases are non-/fullscreen on
 > Gnome1,2/Sawfish (NetWM supported) and windowmaker (0.80.1, Gnome
 > style support) with and without the gnome-panel.
 > 
 > Have not tested with other windomanagers though, eg KDE or IceWM. If
 > someone is running these WM's and is interested to test, please
 > let me know if it works. The patch follows last, against latest CVS (1.113)
 > 
 > Jindrich Makovicka writes:
 >  > [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
 >  > Arpi wrote:
 >  > 
 >  > >[Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
 >  > >Hi,
 >  > >
 >  > >then go and find which part of that patch broke it.
-------------- next part --------------
Index: libvo/x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.113
diff -u -r1.113 x11_common.c
--- libvo/x11_common.c	16 Nov 2002 16:08:36 -0000	1.113
+++ libvo/x11_common.c	17 Nov 2002 17:23:37 -0000
@@ -1,4 +1,9 @@
 
+/* Window manager references:
+ * http://www.freedesktop.org/standards/wm-spec.html
+ * http://developer.gnome.org/standards/wm/book1.html
+ */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
@@ -130,9 +135,8 @@
   { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is IceWM.\n" ); return vo_wm_IceWM; }
  if ( !strncmp( name,"_KDE_",5 ) )
   { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is KDE.\n" ); return vo_wm_KDE; }
- if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) )
-  { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is WindowMaker style.\n" ); return vo_wm_WMakerStyle; }
-// fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",win,name,xev.xproperty.atom );
+ if ( !strncmp( name,"KWM_WIN",7 ) )
+   { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is WindowMaker style.\n" ); return vo_wm_WMakerStyle;}
  return vo_wm_Unknown;
 }
 
@@ -155,13 +159,15 @@
  type=XInternAtom( mDisplay,"_NET_SUPPORTED",False );
  if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,16384,False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 )
   {
-   mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is of class NetWM.\n" );
+    //mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is of class NetWM.\n" );
+   mp_msg( MSGT_VO,MSGL_V,"VO: Detected wm is of class NetWM.\n" );
    XFree( args );
    return vo_wm_NetWM;
   }
 #endif
 // --- other wm
- mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Create window for WM detect ...\n" );
+ //mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Create window for WM detect ...\n" );
+ mp_msg( MSGT_VO,MSGL_V,"VO: Detected wm is not of class NetWM.\n" );
  win=XCreateSimpleWindow( mDisplay,mRootWin,vo_screenwidth,vo_screenheight,1,1,0,0,0 );
  XSelectInput( mDisplay,win,PropertyChangeMask | StructureNotifyMask );
  XMapWindow( mDisplay,win );
@@ -218,7 +224,7 @@
  mDisplay=XOpenDisplay(dispName);
  if ( !mDisplay )
   {
-   mp_msg(MSGT_VO,MSGL_ERR,"vo: couldn't open the X11 display (%s)!\n",dispName );
+   mp_msg(MSGT_VO,MSGL_ERR,"VO: couldn't open the X11 display (%s)!\n",dispName );
    return 0;
   }
  mScreen=DefaultScreen( mDisplay );     // Screen ID.
@@ -288,7 +294,7 @@
    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;
-   mp_msg(MSGT_VO,MSGL_V,"vo: X11 color mask:  %X  (R:%lX G:%lX B:%lX)\n",
+   mp_msg(MSGT_VO,MSGL_V,"VO: X11 color mask:  %X  (R:%lX G:%lX B:%lX)\n",
 	    mask,mXImage->red_mask,mXImage->green_mask,mXImage->blue_mask);
    XDestroyImage( mXImage );
  }
@@ -303,12 +309,13 @@
  else if ( strncmp(dispName, "localhost:", 10) == 0)
 		dispName += 9;
  if (*dispName==':' && atoi(dispName+1)<10) mLocalDisplay=1; else mLocalDisplay=0;
- mp_msg(MSGT_VO,MSGL_INFO,"vo: X11 running at %dx%d with depth %d and %d bpp (\"%s\" => %s display)\n",
+ mp_msg(MSGT_VO,MSGL_INFO,"VO: X11 running at %dx%d with depth %d and %d bpp (\"%s\" => %s display)\n",
 	vo_screenwidth,vo_screenheight,
 	depth, vo_depthonscreen,
 	dispName,mLocalDisplay?"local":"remote");
 
  vo_wm_type=vo_wm_detect();
+ // fprintf(stderr,"[x11] Running vo_wm_detect: %d\n",vo_wm_type);
 
  saver_off(mDisplay);
  return 1;
@@ -318,11 +325,11 @@
 {
  if (!mDisplay)
  {
-    mp_msg(MSGT_VO, MSGL_V, "vo: x11 uninit called but X11 not inited..\n");
+    mp_msg(MSGT_VO, MSGL_V, "VO: x11 uninit called but X11 not inited..\n");
     return;
  }
 // if( !vo_depthonscreen ) return;
- mp_msg(MSGT_VO,MSGL_V,"vo: uninit ...\n" );
+ mp_msg(MSGT_VO,MSGL_V,"VO: uninit ...\n" );
  XSetErrorHandler(NULL);
  XCloseDisplay( mDisplay );
  vo_depthonscreen = 0;
@@ -609,8 +616,6 @@
 	    wm=vo_wm_string_test(name);
 	    if ( wm != vo_wm_Unknown ) vo_wm_type=wm;
 
-//          fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",vo_window,name,Event.xproperty.atom );
-	      
 	    XFree( name );
 	   }
 	   break;
@@ -634,7 +639,8 @@
 
 #define WIN_LAYER_ONBOTTOM               2
 #define WIN_LAYER_NORMAL                 4
-#define WIN_LAYER_ONTOP                  10
+#define WIN_LAYER_ONTOP                  6
+#define WIN_LAYER_ABOVE_DOCK             10
 
 void vo_x11_setlayer( int layer )
 {
@@ -660,12 +666,33 @@
    return;
   }
 
+ type=XInternAtom( mDisplay,"_NET_SUPPORTED",False );
+ if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,16384,False,AnyPropertyType,&type,&format,&nitems,&bytesafter,(unsigned char**)(&args) ) && nitems > 0 )
+  {
+   XClientMessageEvent  xev;
+   
+   mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] NET style stay on top ( layer %d ).\n",layer );
+   memset( &xev,0,sizeof( xev ) );
+   xev.type=ClientMessage;
+   xev.message_type=XInternAtom( mDisplay,"_NET_WM_STATE",False );
+   xev.display=mDisplay;
+   xev.window=vo_window;
+   xev.format=32;
+   xev.data.l[0]=layer;
+
+   xev.data.l[1]=XInternAtom( mDisplay,"_NET_WM_STATE_ABOVE",False );
+   XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,(XEvent*)&xev );
+   XFree( args );
+   return;
+  }
+
  type=XInternAtom( mDisplay,"_WIN_SUPPORTING_WM_CHECK",False );
  if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,16384,False,AnyPropertyType,&type,&format,&nitems,&bytesafter,(unsigned char**)(&args) ) && nitems > 0 )
   {
    XClientMessageEvent  xev;
    
    mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Gnome style stay on top ( layer %d ).\n",layer );
+
    memset( &xev,0,sizeof( xev ) );
    xev.type=ClientMessage;
    xev.window=vo_window;
@@ -675,40 +702,14 @@
     {
      case -1: xev.data.l[0] = WIN_LAYER_ONBOTTOM; break;
      case  0: xev.data.l[0] = WIN_LAYER_NORMAL;   break;
-     case  1: xev.data.l[0] = WIN_LAYER_ONTOP;    break;
+     case  1: xev.data.l[0] = WIN_LAYER_ABOVE_DOCK;    break;
     }
-   
-   if ( layer ) XRaiseWindow( mDisplay,vo_window );
    XSendEvent( mDisplay,mRootWin,False,SubstructureNotifyMask,(XEvent*)&xev );
+   if ( layer ) XRaiseWindow( mDisplay,vo_window );
 								              
    XFree( args );
    return;
   }
- type=XInternAtom( mDisplay,"_NET_SUPPORTED",False );
- if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,16384,False,AnyPropertyType,&type,&format,&nitems,&bytesafter,(unsigned char**)(&args) ) && nitems > 0 )
-  {
-   XEvent e;
-   int    i;
-   
-   mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] NET style stay on top ( layer %d ).\n",layer );
-   memset( &e,0,sizeof( e ) );
-   e.xclient.type=ClientMessage;
-   e.xclient.message_type=XInternAtom( mDisplay,"_NET_WM_STATE",False );
-   e.xclient.display=mDisplay;
-   e.xclient.window=vo_window;
-   e.xclient.format=32;
-   e.xclient.data.l[0]=layer;
-
-   e.xclient.data.l[1]=XInternAtom( mDisplay,"_NET_WM_STATE_STAYS_ON_TOP",False );
-   type=XInternAtom( mDisplay,"_NET_WM_STATE_FULLSCREEN",False );
-   for ( i=0;i < nitems;i++ )
-     if ( args[i] == type ) { e.xclient.data.l[1]=XInternAtom( mDisplay,"_NET_WM_STATE_FULLSCREEN",False ); break; }
-
-   XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,&e );
-								   
-   XFree( args );
-   return;
-  }
 }
 
 void vo_x11_fullscreen( void )
@@ -954,7 +955,7 @@
 			   &nvisuals);
   if (visuals != NULL) {
     for (i = 0; i < nvisuals; i++) {
-      mp_msg(MSGT_VO,MSGL_V,"vo: X11 truecolor visual %#x, depth %d, R:%lX G:%lX B:%lX\n",
+      mp_msg(MSGT_VO,MSGL_V,"VO: X11 truecolor visual %#x, depth %d, R:%lX G:%lX B:%lX\n",
 	       visuals[i].visualid, visuals[i].depth,
 	       visuals[i].red_mask, visuals[i].green_mask,
 	       visuals[i].blue_mask);


More information about the MPlayer-dev-eng mailing list