changeset 8388:45eb2d4d633c

The detection of a NetWM class window manager hints is tested before the test of a gnome class windomanager hints, since the gnome hints are outdated and replaced by the newer NetWM specification. Newer versions of Gnome support this standard, and therefore the test should be placed before the Gnome test. Windowmaker does not support NetWM and is checked after the NetWM test. In fact the new code should be placed also before the test for IceWM. Regarding other WMs such as KDE, IceWM the change is not tested. patch by Svante Signell <svante.signell@telia.com>
author arpi
date Sat, 07 Dec 2002 01:25:30 +0000
parents 17938f68e2e0
children e8c51ec86340
files libvo/x11_common.c
diffstat 1 files changed, 24 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/x11_common.c	Sat Dec 07 01:07:11 2002 +0000
+++ b/libvo/x11_common.c	Sat Dec 07 01:25:30 2002 +0000
@@ -131,7 +131,7 @@
   { 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 ) )
+ if ( !strncmp( name,"KWM_WIN",7 ) )
   { 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 );
  return vo_wm_Unknown;
@@ -635,7 +635,9 @@
 
 #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 )
 {
@@ -651,6 +653,7 @@
     XClientMessageEvent xev;
     memset(&xev, 0, sizeof(xev));
     xev.type = ClientMessage;
+    xev.display= mDisplay;
     xev.window = vo_window;
     xev.message_type = XInternAtom(mDisplay, "_WIN_LAYER", False);
     xev.format = 32;
@@ -661,11 +664,28 @@
    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;
@@ -676,37 +696,11 @@
     {
      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 );
-								              
-   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;
   }