Mercurial > mplayer.hg
comparison libvo/x11_common.c @ 6043:421781c5b128
fix some small bug and -rootwin
author | pontscho |
---|---|
date | Sat, 11 May 2002 14:57:41 +0000 |
parents | 7570f4666c15 |
children | b1a30f8d9955 |
comparison
equal
deleted
inserted
replaced
6042:c0fb4f38c8a7 | 6043:421781c5b128 |
---|---|
183 int c = 0; | 183 int c = 0; |
184 int wm = vo_wm_Unknown; | 184 int wm = vo_wm_Unknown; |
185 int format; | 185 int format; |
186 unsigned long nitems, bytesafter; | 186 unsigned long nitems, bytesafter; |
187 unsigned char * args = NULL; | 187 unsigned char * args = NULL; |
188 char * name = NULL; | |
189 | |
190 if ( WinID >= 0 ) return vo_wm_Unknown; | |
191 | |
188 #if 1 | 192 #if 1 |
189 // --- netwm | 193 // --- netwm |
190 type=XInternAtom( mDisplay,"_NET_SUPPORTED",False ); | 194 type=XInternAtom( mDisplay,"_NET_SUPPORTED",False ); |
191 if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) | 195 if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) |
192 { | 196 { |
193 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is NetWM.\n" ); | 197 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is of class NetWM.\n" ); |
194 XFree( args ); | 198 XFree( args ); |
195 return vo_wm_NetWM; | 199 return vo_wm_NetWM; |
196 } | 200 } |
197 #endif | 201 #endif |
198 // --- other wm | 202 // --- other wm |
205 { | 209 { |
206 XCheckWindowEvent( mDisplay,win,PropertyChangeMask | StructureNotifyMask,&xev ); | 210 XCheckWindowEvent( mDisplay,win,PropertyChangeMask | StructureNotifyMask,&xev ); |
207 | 211 |
208 if ( xev.type == PropertyNotify ) | 212 if ( xev.type == PropertyNotify ) |
209 { | 213 { |
210 char * name = XGetAtomName( mDisplay,xev.xproperty.atom ); | 214 name=XGetAtomName( mDisplay,xev.xproperty.atom ); |
211 if ( !name ) break; | 215 if ( !name ) break; |
212 | 216 |
213 if ( !strncmp( name,"_ICEWM_TRAY",11 ) ) | 217 if ( !strncmp( name,"_ICEWM_TRAY",11 ) ) |
214 { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is IceWM.\n" ); wm=vo_wm_IceWM; break; } | 218 { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is IceWM.\n" ); wm=vo_wm_IceWM; break; } |
215 if ( !strncmp( name,"_KDE_",5 ) ) | 219 if ( !strncmp( name,"_KDE_",5 ) ) |
216 { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is KDE.\n" ); wm=vo_wm_KDE; break; } | 220 { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is KDE.\n" ); wm=vo_wm_KDE; break; } |
217 if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) ) | 221 if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) ) |
218 { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is WindowMaker style.\n" ); wm=vo_wm_WMakerStyle; break; } | 222 { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is WindowMaker style.\n" ); wm=vo_wm_WMakerStyle; break; } |
219 // fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",win,name,xev.xproperty.atom ); | 223 // fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",win,name,xev.xproperty.atom ); |
220 | 224 |
221 XFree( name ); | 225 XFree( name ); name=NULL; |
222 } | 226 } |
223 } while( c++ < 25 ); | 227 } while( c++ < 25 ); |
228 if ( name ) XFree( name ); | |
224 XDestroyWindow( mDisplay,win ); | 229 XDestroyWindow( mDisplay,win ); |
225 #ifdef MP_DEBUG | 230 #ifdef MP_DEBUG |
226 if ( wm == vo_wm_Unknown ) mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Unknown wm type...\n" ); | 231 if ( wm == vo_wm_Unknown ) mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Unknown wm type...\n" ); |
227 #endif | 232 #endif |
228 return wm; | 233 return wm; |
675 | 680 |
676 if ( WinID >= 0 ) return; | 681 if ( WinID >= 0 ) return; |
677 | 682 |
678 if ( vo_wm_type == vo_wm_IceWM ) | 683 if ( vo_wm_type == vo_wm_IceWM ) |
679 { | 684 { |
685 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] IceWM style stay on top ( layer %d ).\n",layer ); | |
680 switch ( layer ) | 686 switch ( layer ) |
681 { | 687 { |
682 case -1: layer=2; break; // WinLayerBelow | 688 case -1: layer=2; break; // WinLayerBelow |
683 case 0: layer=4; break; // WinLayerNormal | 689 case 0: layer=4; break; // WinLayerNormal |
684 case 1: layer=8; break; // WinLayerOnTop | 690 case 1: layer=8; break; // WinLayerOnTop |
685 } | 691 } |
686 XChangeProperty( mDisplay,vo_window, | 692 XChangeProperty( mDisplay,vo_window, |
687 XInternAtom( mDisplay,"_WIN_LAYER",False ),XA_CARDINAL,32,PropModeReplace,(unsigned char *)&layer,1 ); | 693 XInternAtom( mDisplay,"_WIN_LAYER",False ),XA_CARDINAL,32,PropModeReplace,(unsigned char *)&layer,1 ); |
688 return; | 694 return; |
689 } | 695 } |
690 | 696 |
691 type=XInternAtom( mDisplay,"_NET_SUPPORTED",False ); | 697 type=XInternAtom( mDisplay,"_NET_SUPPORTED",False ); |
692 if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) | 698 if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) |
748 | 754 |
749 if ( vo_fs ) | 755 if ( vo_fs ) |
750 { vo_fs=VO_FALSE; x=vo_old_x; y=vo_old_y; w=vo_old_width; h=vo_old_height; } | 756 { vo_fs=VO_FALSE; x=vo_old_x; y=vo_old_y; w=vo_old_width; h=vo_old_height; } |
751 else { vo_fs=VO_TRUE; vo_old_x=vo_dx; vo_old_y=vo_dy; vo_old_width=vo_dwidth; vo_old_height=vo_dheight; } | 757 else { vo_fs=VO_TRUE; vo_old_x=vo_dx; vo_old_y=vo_dy; vo_old_width=vo_dwidth; vo_old_height=vo_dheight; } |
752 | 758 |
759 vo_x11_decoration( mDisplay,vo_window,(vo_fs) ? 0 : 1 ); | |
753 vo_x11_sizehint( x,y,w,h,0 ); | 760 vo_x11_sizehint( x,y,w,h,0 ); |
754 vo_x11_decoration( mDisplay,vo_window,(vo_fs) ? 0 : 1 ); | |
755 vo_x11_setlayer( vo_fs ); | 761 vo_x11_setlayer( vo_fs ); |
756 XMoveResizeWindow( mDisplay,vo_window,x,y,w,h ); | 762 XMoveResizeWindow( mDisplay,vo_window,x,y,w,h ); |
757 XMapRaised( mDisplay,vo_window ); | 763 XMapRaised( mDisplay,vo_window ); |
758 XRaiseWindow( mDisplay,vo_window ); | 764 XRaiseWindow( mDisplay,vo_window ); |
759 XFlush( mDisplay ); | 765 XFlush( mDisplay ); |