comparison libvo/x11_common.c @ 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 8a0b6e083280
children 9efd0c6e6307
comparison
equal deleted inserted replaced
8387:17938f68e2e0 8388:45eb2d4d633c
129 { 129 {
130 if ( !strncmp( name,"_ICEWM_TRAY",11 ) ) 130 if ( !strncmp( name,"_ICEWM_TRAY",11 ) )
131 { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is IceWM.\n" ); return vo_wm_IceWM; } 131 { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is IceWM.\n" ); return vo_wm_IceWM; }
132 if ( !strncmp( name,"_KDE_",5 ) ) 132 if ( !strncmp( name,"_KDE_",5 ) )
133 { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is KDE.\n" ); return vo_wm_KDE; } 133 { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is KDE.\n" ); return vo_wm_KDE; }
134 if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) ) 134 if ( !strncmp( name,"KWM_WIN",7 ) )
135 { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is WindowMaker style.\n" ); return vo_wm_WMakerStyle; } 135 { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is WindowMaker style.\n" ); return vo_wm_WMakerStyle; }
136 // fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",win,name,xev.xproperty.atom ); 136 // fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",win,name,xev.xproperty.atom );
137 return vo_wm_Unknown; 137 return vo_wm_Unknown;
138 } 138 }
139 139
633 XSetWMNormalHints( mDisplay,vo_window,&vo_hint ); 633 XSetWMNormalHints( mDisplay,vo_window,&vo_hint );
634 } 634 }
635 635
636 #define WIN_LAYER_ONBOTTOM 2 636 #define WIN_LAYER_ONBOTTOM 2
637 #define WIN_LAYER_NORMAL 4 637 #define WIN_LAYER_NORMAL 4
638 #define WIN_LAYER_ONTOP 10 638 #define WIN_LAYER_ONTOP 6
639 #define WIN_LAYER_ABOVE_DOCK 10
640
639 641
640 void vo_x11_setlayer( int layer ) 642 void vo_x11_setlayer( int layer )
641 { 643 {
642 Atom type; 644 Atom type;
643 int format; 645 int format;
649 if ( vo_wm_type == vo_wm_IceWM ) 651 if ( vo_wm_type == vo_wm_IceWM )
650 { 652 {
651 XClientMessageEvent xev; 653 XClientMessageEvent xev;
652 memset(&xev, 0, sizeof(xev)); 654 memset(&xev, 0, sizeof(xev));
653 xev.type = ClientMessage; 655 xev.type = ClientMessage;
656 xev.display= mDisplay;
654 xev.window = vo_window; 657 xev.window = vo_window;
655 xev.message_type = XInternAtom(mDisplay, "_WIN_LAYER", False); 658 xev.message_type = XInternAtom(mDisplay, "_WIN_LAYER", False);
656 xev.format = 32; 659 xev.format = 32;
657 xev.data.l[0] = layer?ice_layer:4; // if not fullscreen, stay on layer "Normal" 660 xev.data.l[0] = layer?ice_layer:4; // if not fullscreen, stay on layer "Normal"
658 xev.data.l[1] = CurrentTime; 661 xev.data.l[1] = CurrentTime;
659 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] IceWM style stay on top ( layer %d ).\n",xev.data.l[0] ); 662 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] IceWM style stay on top ( layer %d ).\n",xev.data.l[0] );
660 XSendEvent(mDisplay, mRootWin, False, SubstructureNotifyMask, (XEvent *) &xev); 663 XSendEvent(mDisplay, mRootWin, False, SubstructureNotifyMask, (XEvent *) &xev);
661 return; 664 return;
662 } 665 }
663 666
667 type=XInternAtom( mDisplay,"_NET_SUPPORTED",False );
668 if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,16384,False,AnyPropertyType,&type,&format,&nitems,&bytesafter,(unsigned char**)(&args) ) && nitems > 0 )
669 {
670 XClientMessageEvent xev;
671 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] NET style stay on top ( layer %d ).\n",layer );
672 memset( &xev,0,sizeof( xev ) );
673 xev.type=ClientMessage;
674 xev.message_type=XInternAtom( mDisplay,"_NET_WM_STATE",False );
675 xev.display=mDisplay;
676 xev.window=vo_window;
677 xev.format=32;
678 xev.data.l[0]=layer;
679 xev.data.l[1]=XInternAtom( mDisplay,"_NET_WM_STATE_ABOVE",False );
680 XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,(XEvent*)&xev );
681 XFree( args );
682 return;
683 }
684
664 type=XInternAtom( mDisplay,"_WIN_SUPPORTING_WM_CHECK",False ); 685 type=XInternAtom( mDisplay,"_WIN_SUPPORTING_WM_CHECK",False );
665 if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,16384,False,AnyPropertyType,&type,&format,&nitems,&bytesafter,(unsigned char**)(&args) ) && nitems > 0 ) 686 if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,16384,False,AnyPropertyType,&type,&format,&nitems,&bytesafter,(unsigned char**)(&args) ) && nitems > 0 )
666 { 687 {
667 XClientMessageEvent xev; 688 XClientMessageEvent xev;
668
669 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Gnome style stay on top ( layer %d ).\n",layer ); 689 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Gnome style stay on top ( layer %d ).\n",layer );
670 memset( &xev,0,sizeof( xev ) ); 690 memset( &xev,0,sizeof( xev ) );
671 xev.type=ClientMessage; 691 xev.type=ClientMessage;
672 xev.window=vo_window; 692 xev.window=vo_window;
673 xev.message_type=XInternAtom( mDisplay,"_WIN_LAYER",False ); 693 xev.message_type=XInternAtom( mDisplay,"_WIN_LAYER",False );
674 xev.format=32; 694 xev.format=32;
675 switch ( layer ) 695 switch ( layer )
676 { 696 {
677 case -1: xev.data.l[0] = WIN_LAYER_ONBOTTOM; break; 697 case -1: xev.data.l[0] = WIN_LAYER_ONBOTTOM; break;
678 case 0: xev.data.l[0] = WIN_LAYER_NORMAL; break; 698 case 0: xev.data.l[0] = WIN_LAYER_NORMAL; break;
679 case 1: xev.data.l[0] = WIN_LAYER_ONTOP; break; 699 case 1: xev.data.l[0] = WIN_LAYER_ABOVE_DOCK; break;
680 } 700 }
681 701
682 if ( layer ) XRaiseWindow( mDisplay,vo_window ); 702 if ( layer ) XRaiseWindow( mDisplay,vo_window );
683 XSendEvent( mDisplay,mRootWin,False,SubstructureNotifyMask,(XEvent*)&xev ); 703 XSendEvent( mDisplay,mRootWin,False,SubstructureNotifyMask,(XEvent*)&xev );
684
685 XFree( args );
686 return;
687 }
688 type=XInternAtom( mDisplay,"_NET_SUPPORTED",False );
689 if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,16384,False,AnyPropertyType,&type,&format,&nitems,&bytesafter,(unsigned char**)(&args) ) && nitems > 0 )
690 {
691 XEvent e;
692 int i;
693
694 mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] NET style stay on top ( layer %d ).\n",layer );
695 memset( &e,0,sizeof( e ) );
696 e.xclient.type=ClientMessage;
697 e.xclient.message_type=XInternAtom( mDisplay,"_NET_WM_STATE",False );
698 e.xclient.display=mDisplay;
699 e.xclient.window=vo_window;
700 e.xclient.format=32;
701 e.xclient.data.l[0]=layer;
702
703 e.xclient.data.l[1]=XInternAtom( mDisplay,"_NET_WM_STATE_STAYS_ON_TOP",False );
704 type=XInternAtom( mDisplay,"_NET_WM_STATE_FULLSCREEN",False );
705 for ( i=0;i < nitems;i++ )
706 if ( args[i] == type ) { e.xclient.data.l[1]=XInternAtom( mDisplay,"_NET_WM_STATE_FULLSCREEN",False ); break; }
707
708 XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,&e );
709
710 XFree( args ); 704 XFree( args );
711 return; 705 return;
712 } 706 }
713 } 707 }
714 708