changeset 8835:664b0612f950

Fixed metacity + xv behavior (something broke it lately). Fixed sawfish bahavior in gmplayer: use ABOVE, FULLSCREEN is last choice. Now mplayer window is visible over the video window.
author filon
date Tue, 07 Jan 2003 20:58:25 +0000
parents ff9e47fdf740
children 7f9229174016
files libvo/x11_common.c
diffstat 1 files changed, 21 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/x11_common.c	Tue Jan 07 19:02:24 2003 +0000
+++ b/libvo/x11_common.c	Tue Jan 07 20:58:25 2003 +0000
@@ -69,6 +69,9 @@
 int vo_mouse_autohide = 0;
 int vo_wm_type = -1;
 
+/* if equal to 1 means that WM is a metacity (broken as hell) */
+int metacity_hack = 0;
+
 #define SUPPORT_NONE 0
 #define SUPPORT_FULLSCREEN 1
 #define SUPPORT_ABOVE 2
@@ -176,7 +179,6 @@
  int             wm = vo_wm_Unknown;
  unsigned long   nitems;
  Atom          * args = NULL;
- int             metacity_hack = 0;
  
  if ( WinID >= 0 ) return vo_wm_Unknown;
  
@@ -186,18 +188,23 @@
    mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm supports layers.\n" );
    for (i = 0; i < nitems; i++)
    {
-     if ( args[i] == XA_WIN_LAYER)
+     if ( args[i] == XA_WIN_LAYER) {
        wm = vo_wm_Layered;
+       metacity_hack |= 1;
+     }
      if ( args[i] == XA_WIN_HINTS)
        // metacity is the only manager which supports _WIN_LAYER but not _WIN_HINTS
        // what's more is has broken _WIN_LAYER support
-       metacity_hack = 1;
+       metacity_hack |= 2;
    }
    XFree( args );
-   if (wm && metacity_hack)
+   if (wm && metacity_hack == 3)
      return wm;
   }
 
+  if (metacity_hack == 1)
+   mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Using workaround for Metacity bugs.\n" );
+  
 // --- netwm 
   if (x11_get_property(XA_NET_SUPPORTED, &args, &nitems))
   {
@@ -717,7 +724,7 @@
   case vo_wm_NetWM:
   {
    XClientMessageEvent  xev;
-   mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] NET style stay on top ( layer %d ).\n",layer );
+   char *state;
 
    memset( &xev,0,sizeof( xev ) );
    xev.type=ClientMessage;
@@ -727,9 +734,9 @@
    xev.format=32;
    xev.data.l[0]=layer;
    
-   if (net_wm_support & SUPPORT_FULLSCREEN)
+   if (net_wm_support & SUPPORT_ABOVE)
    {
-     xev.data.l[1]=XA_NET_WM_STATE_FULLSCREEN;
+     xev.data.l[1]=XA_NET_WM_STATE_ABOVE;
      XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,(XEvent*)&xev );
    } else
    if (net_wm_support & SUPPORT_STAYS_ON_TOP)
@@ -737,11 +744,14 @@
      xev.data.l[1]=XA_NET_WM_STATE_STAYS_ON_TOP;
      XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,(XEvent*)&xev );
    } else
-   if (net_wm_support & SUPPORT_ABOVE)
+   if (net_wm_support & SUPPORT_FULLSCREEN)
    {
-     xev.data.l[1]=XA_NET_WM_STATE_ABOVE;
+     xev.data.l[1]=XA_NET_WM_STATE_FULLSCREEN;
      XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,(XEvent*)&xev );
    }
+   state = XGetAtomName (mDisplay, xev.data.l[1]);
+   mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] NET style stay on top ( layer %d ). Using state %s.\n",layer,state );
+   XFree (state);
   }
  }
 }
@@ -769,13 +779,13 @@
    vo_old_x=vo_dx; vo_old_y=vo_dy; vo_old_width=vo_dwidth; vo_old_height=vo_dheight;
    x=0; y=0; w=vo_screenwidth; h=vo_screenheight;
  }
- if (! (net_wm_support & SUPPORT_FULLSCREEN))
+ if (net_wm_support!=SUPPORT_FULLSCREEN || metacity_hack==1)
  {
    vo_x11_decoration( mDisplay,vo_window,(vo_fs) ? 0 : 1 );
    vo_x11_sizehint( x,y,w,h,0 );
  }
  vo_x11_setlayer( vo_fs );
- if (! (net_wm_support & SUPPORT_FULLSCREEN))
+ if (net_wm_support!=SUPPORT_FULLSCREEN || metacity_hack==1)
  {
    if(vo_wm_type==vo_wm_Unknown && !(vo_fsmode&16))
   //     XUnmapWindow( mDisplay,vo_window );  // required for MWM