comparison libvo/x11_common.c @ 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 9fefdd9064b5
children b8c271750450
comparison
equal deleted inserted replaced
8834:ff9e47fdf740 8835:664b0612f950
66 66
67 /* output window id */ 67 /* output window id */
68 int WinID=-1; 68 int WinID=-1;
69 int vo_mouse_autohide = 0; 69 int vo_mouse_autohide = 0;
70 int vo_wm_type = -1; 70 int vo_wm_type = -1;
71
72 /* if equal to 1 means that WM is a metacity (broken as hell) */
73 int metacity_hack = 0;
71 74
72 #define SUPPORT_NONE 0 75 #define SUPPORT_NONE 0
73 #define SUPPORT_FULLSCREEN 1 76 #define SUPPORT_FULLSCREEN 1
74 #define SUPPORT_ABOVE 2 77 #define SUPPORT_ABOVE 2
75 #define SUPPORT_STAYS_ON_TOP 4 78 #define SUPPORT_STAYS_ON_TOP 4
174 { 177 {
175 int i; 178 int i;
176 int wm = vo_wm_Unknown; 179 int wm = vo_wm_Unknown;
177 unsigned long nitems; 180 unsigned long nitems;
178 Atom * args = NULL; 181 Atom * args = NULL;
179 int metacity_hack = 0;
180 182
181 if ( WinID >= 0 ) return vo_wm_Unknown; 183 if ( WinID >= 0 ) return vo_wm_Unknown;
182 184
183 // -- supports layers 185 // -- supports layers
184 if (x11_get_property(XA_WIN_PROTOCOLS, &args, &nitems)) 186 if (x11_get_property(XA_WIN_PROTOCOLS, &args, &nitems))
185 { 187 {
186 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm supports layers.\n" ); 188 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm supports layers.\n" );
187 for (i = 0; i < nitems; i++) 189 for (i = 0; i < nitems; i++)
188 { 190 {
189 if ( args[i] == XA_WIN_LAYER) 191 if ( args[i] == XA_WIN_LAYER) {
190 wm = vo_wm_Layered; 192 wm = vo_wm_Layered;
193 metacity_hack |= 1;
194 }
191 if ( args[i] == XA_WIN_HINTS) 195 if ( args[i] == XA_WIN_HINTS)
192 // metacity is the only manager which supports _WIN_LAYER but not _WIN_HINTS 196 // metacity is the only manager which supports _WIN_LAYER but not _WIN_HINTS
193 // what's more is has broken _WIN_LAYER support 197 // what's more is has broken _WIN_LAYER support
194 metacity_hack = 1; 198 metacity_hack |= 2;
195 } 199 }
196 XFree( args ); 200 XFree( args );
197 if (wm && metacity_hack) 201 if (wm && metacity_hack == 3)
198 return wm; 202 return wm;
199 } 203 }
200 204
205 if (metacity_hack == 1)
206 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Using workaround for Metacity bugs.\n" );
207
201 // --- netwm 208 // --- netwm
202 if (x11_get_property(XA_NET_SUPPORTED, &args, &nitems)) 209 if (x11_get_property(XA_NET_SUPPORTED, &args, &nitems))
203 { 210 {
204 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is of class NetWM.\n" ); 211 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is of class NetWM.\n" );
205 net_wm_support = 0; 212 net_wm_support = 0;
715 break; 722 break;
716 } 723 }
717 case vo_wm_NetWM: 724 case vo_wm_NetWM:
718 { 725 {
719 XClientMessageEvent xev; 726 XClientMessageEvent xev;
720 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] NET style stay on top ( layer %d ).\n",layer ); 727 char *state;
721 728
722 memset( &xev,0,sizeof( xev ) ); 729 memset( &xev,0,sizeof( xev ) );
723 xev.type=ClientMessage; 730 xev.type=ClientMessage;
724 xev.message_type=XA_NET_WM_STATE; 731 xev.message_type=XA_NET_WM_STATE;
725 xev.display=mDisplay; 732 xev.display=mDisplay;
726 xev.window=vo_window; 733 xev.window=vo_window;
727 xev.format=32; 734 xev.format=32;
728 xev.data.l[0]=layer; 735 xev.data.l[0]=layer;
729 736
730 if (net_wm_support & SUPPORT_FULLSCREEN) 737 if (net_wm_support & SUPPORT_ABOVE)
731 { 738 {
732 xev.data.l[1]=XA_NET_WM_STATE_FULLSCREEN; 739 xev.data.l[1]=XA_NET_WM_STATE_ABOVE;
733 XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,(XEvent*)&xev ); 740 XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,(XEvent*)&xev );
734 } else 741 } else
735 if (net_wm_support & SUPPORT_STAYS_ON_TOP) 742 if (net_wm_support & SUPPORT_STAYS_ON_TOP)
736 { 743 {
737 xev.data.l[1]=XA_NET_WM_STATE_STAYS_ON_TOP; 744 xev.data.l[1]=XA_NET_WM_STATE_STAYS_ON_TOP;
738 XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,(XEvent*)&xev ); 745 XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,(XEvent*)&xev );
739 } else 746 } else
740 if (net_wm_support & SUPPORT_ABOVE) 747 if (net_wm_support & SUPPORT_FULLSCREEN)
741 { 748 {
742 xev.data.l[1]=XA_NET_WM_STATE_ABOVE; 749 xev.data.l[1]=XA_NET_WM_STATE_FULLSCREEN;
743 XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,(XEvent*)&xev ); 750 XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,(XEvent*)&xev );
744 } 751 }
752 state = XGetAtomName (mDisplay, xev.data.l[1]);
753 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] NET style stay on top ( layer %d ). Using state %s.\n",layer,state );
754 XFree (state);
745 } 755 }
746 } 756 }
747 } 757 }
748 758
749 void vo_x11_fullscreen( void ) 759 void vo_x11_fullscreen( void )
767 (vo_dheight==vo_screenheight && vo_dheight!=vo_old_height) ) return; 777 (vo_dheight==vo_screenheight && vo_dheight!=vo_old_height) ) return;
768 vo_fs=VO_TRUE; 778 vo_fs=VO_TRUE;
769 vo_old_x=vo_dx; vo_old_y=vo_dy; vo_old_width=vo_dwidth; vo_old_height=vo_dheight; 779 vo_old_x=vo_dx; vo_old_y=vo_dy; vo_old_width=vo_dwidth; vo_old_height=vo_dheight;
770 x=0; y=0; w=vo_screenwidth; h=vo_screenheight; 780 x=0; y=0; w=vo_screenwidth; h=vo_screenheight;
771 } 781 }
772 if (! (net_wm_support & SUPPORT_FULLSCREEN)) 782 if (net_wm_support!=SUPPORT_FULLSCREEN || metacity_hack==1)
773 { 783 {
774 vo_x11_decoration( mDisplay,vo_window,(vo_fs) ? 0 : 1 ); 784 vo_x11_decoration( mDisplay,vo_window,(vo_fs) ? 0 : 1 );
775 vo_x11_sizehint( x,y,w,h,0 ); 785 vo_x11_sizehint( x,y,w,h,0 );
776 } 786 }
777 vo_x11_setlayer( vo_fs ); 787 vo_x11_setlayer( vo_fs );
778 if (! (net_wm_support & SUPPORT_FULLSCREEN)) 788 if (net_wm_support!=SUPPORT_FULLSCREEN || metacity_hack==1)
779 { 789 {
780 if(vo_wm_type==vo_wm_Unknown && !(vo_fsmode&16)) 790 if(vo_wm_type==vo_wm_Unknown && !(vo_fsmode&16))
781 // XUnmapWindow( mDisplay,vo_window ); // required for MWM 791 // XUnmapWindow( mDisplay,vo_window ); // required for MWM
782 XWithdrawWindow(mDisplay,vo_window,mScreen); 792 XWithdrawWindow(mDisplay,vo_window,mScreen);
783 XMoveResizeWindow( mDisplay,vo_window,x,y,w,h ); 793 XMoveResizeWindow( mDisplay,vo_window,x,y,w,h );