Mercurial > mplayer.hg
changeset 5997:b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
author | pontscho |
---|---|
date | Mon, 06 May 2002 15:05:07 +0000 |
parents | 73e5c3b80d8c |
children | 79977d64bb99 |
files | Gui/interface.c Gui/mplayer/play.c Gui/mplayer/sw.h Gui/mplayer/widgets.c Gui/wm/ws.c Gui/wm/ws.h libvo/x11_common.c libvo/x11_common.h |
diffstat | 8 files changed, 344 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui/interface.c Mon May 06 13:04:36 2002 +0000 +++ b/Gui/interface.c Mon May 06 15:05:07 2002 +0000 @@ -104,7 +104,7 @@ wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); } guiIntfStruct.MovieWidth=vo_dwidth; - guiIntfStruct.MovieHeight=vo_dwidth; + guiIntfStruct.MovieHeight=vo_dheight; } break; #ifdef USE_DVDREAD
--- a/Gui/mplayer/play.c Mon May 06 13:04:36 2002 +0000 +++ b/Gui/mplayer/play.c Mon May 06 15:05:07 2002 +0000 @@ -54,9 +54,26 @@ wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); }// else { vo_x11_fullscreen(); appMPlayer.subWindow.isFullScreen=vo_fs; } #else + if ( ( guiIntfStruct.Playing )&&( appMPlayer.subWindow.isFullScreen ) ) + { + appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight; + switch ( appMPlayer.sub.x ) + { + case -1: appMPlayer.subWindow.OldX=( wsMaxX / 2 ) - ( appMPlayer.subWindow.OldWidth / 2 ); break; + case -2: appMPlayer.subWindow.OldX=wsMaxX - appMPlayer.subWindow.OldWidth; break; + default: appMPlayer.subWindow.OldX=appMPlayer.sub.x; break; + } + switch ( appMPlayer.sub.y ) + { + case -1: appMPlayer.subWindow.OldY=( wsMaxY / 2 ) - ( appMPlayer.subWindow.OldHeight / 2 ); break; + case -2: appMPlayer.subWindow.OldY=wsMaxY - appMPlayer.subWindow.OldHeight; break; + default: appMPlayer.subWindow.OldY=appMPlayer.sub.y; break; + } + } wsFullScreen( &appMPlayer.subWindow ); - vo_fs=0; - if ( appMPlayer.subWindow.isFullScreen ) vo_fs=1; + vo_fs=appMPlayer.subWindow.isFullScreen; + wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen ); + wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen ); #endif fullscreen=appMPlayer.subWindow.isFullScreen;
--- a/Gui/mplayer/sw.h Mon May 06 13:04:36 2002 +0000 +++ b/Gui/mplayer/sw.h Mon May 06 15:05:07 2002 +0000 @@ -44,13 +44,6 @@ break; // --- case wsPLMouseButton: - if ( appMPlayer.subWindow.isFullScreen ) - { - if( ++SubVisible%2 ) wsMoveTopWindow( &appMPlayer.mainWindow ); - else wsMoveTopWindow( &appMPlayer.subWindow ); - mplSubMoved=1; - break; - } gtkShow( evHidePopUpMenu,NULL ); sx=X; sy=Y; msButton=wsPLMouseButton; @@ -69,32 +62,11 @@ } break; case wsRLMouseButton: - if ( !mplSubMoved ) + if ( ( !mplSubMoved )&&( appMPlayer.subWindow.isFullScreen ) ) { -#if 0 - if( SubVisible++%2 ) - { - wsMoveTopWindow( &appMPlayer.mainWindow ); - fprintf( stderr,"[sw] MAIN TOP\n" ); - } - else - { - wsMoveTopWindow( &appMPlayer.subWindow ); - fprintf( stderr,"[sw] SUB TOP\n" ); - } -#else - if ( appMPlayer.subWindow.Focused == 2 ) - { - wsMoveTopWindow( &appMPlayer.mainWindow ); - fprintf( stderr,"[sw] MAIN TOP\n" ); - } - else - { - wsMoveTopWindow( &appMPlayer.subWindow ); - fprintf( stderr,"[sw] SUB TOP\n" ); - } -#endif - } + if( SubVisible++%2 ) wsMoveTopWindow( &appMPlayer.mainWindow ); + else wsMoveTopWindow( &appMPlayer.subWindow ); + } msButton=0; mplSubMoved=0; break;
--- a/Gui/mplayer/widgets.c Mon May 06 13:04:36 2002 +0000 +++ b/Gui/mplayer/widgets.c Mon May 06 15:05:07 2002 +0000 @@ -18,6 +18,7 @@ #include "./mplayer.h" #include "../events.h" +#include "../app.h" #include "gtk/menu.h" #include "play.h" @@ -128,6 +129,12 @@ gtk_widget_show( MessageBox ); } +void gtkSetLayer( GtkWidget * wdg ) +{ + GdkWindowPrivate * win = wdg->window; + wsSetLayer( gdk_display,win->xwindow,appMPlayer.subWindow.isFullScreen ); +} + void gtkShow( int type,char * param ) { switch( type ) @@ -140,27 +147,34 @@ gtkSetDefaultToCList( SkinList,param ); gtk_widget_show( SkinBrowser ); } + gtkSetLayer( SkinBrowser ); break; case evPreferences: gtk_widget_hide( Options ); gtk_widget_show( Options ); + gtkSetLayer( Options ); break; case evPlayList: gtk_widget_hide( PlayList ); gtk_widget_show( PlayList ); + gtkSetLayer( PlayList ); break; case evLoad: ShowFileSelect( fsVideoSelector ); + gtkSetLayer( FileSelect ); break; case evFirstLoad: ShowFileSelect( fsVideoSelector ); + gtkSetLayer( FileSelect ); break; case evLoadSubtitle: ShowFileSelect( fsSubtitleSelector ); + gtkSetLayer( FileSelect ); break; case evAbout: gtk_widget_hide( AboutBox ); gtk_widget_show( AboutBox ); + gtkSetLayer( AboutBox ); break; case evShowPopUpMenu: gtkPopupMenu=evNone; @@ -174,3 +188,5 @@ break; } } + +
--- a/Gui/wm/ws.c Mon May 06 13:04:36 2002 +0000 +++ b/Gui/wm/ws.c Mon May 06 15:05:07 2002 +0000 @@ -23,6 +23,7 @@ #include "wsconv.h" #include "../../postproc/rgb2rgb.h" #include "../../mp_msg.h" +#include "../../mplayer.h" #include <X11/extensions/XShm.h> #ifdef HAVE_XSHAPE @@ -51,11 +52,11 @@ Window wsRootWin; XEvent wsEvent; int wsWindowDepth; -int wsWMType = 1; -int wsIsKDE = 0; +int wsWMType = wsWMUnknown; GC wsHGC; MotifWmHints wsMotifWmHints; Atom wsTextProperlyAtom = None; +int wsLayer = 0; int wsDepthOnScreen = 0; int wsRedMask = 0; @@ -138,9 +139,59 @@ fprintf(stderr,"[ws] Error code: %d ( %s )\n",Event->error_code,type ); fprintf(stderr,"[ws] Request code: %d\n",Event->request_code ); fprintf(stderr,"[ws] Minor code: %d\n",Event->minor_code ); + fprintf(stderr,"[ws] Modules: %s\n",current_module ); exit( 0 ); } +int wsWindowManagerType( void ) +{ + Atom type; + int format; + unsigned long nitems, bytesafter; + unsigned char * args = NULL; + + mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is " ); +// --- icewm +// type=XInternAtom( wsDisplay,"_ICEWM_TRAY",False ); +// if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) +// { +// mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"IceWM\n" ); +// XFree( args ); +// return wsWMIceWM; +// } + +// --- gnome +// type=XInternAtom( wsDisplay,"_WIN_SUPPORTING_WM_CHECK",False ); +// if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) +// { +// mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"Gnome\n" ); +// XFree( args ); +// return wsWMGnome; +// } + +// --- kde +// type=XInternAtom( wsDisplay,"_KDE_NET_WM_FRAME_STRUT",False ); +//// type=XInternAtom( wsDisplay,"_KDE_NET_USER_TIME",False ); +// if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) +// { +// mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"KDE\n" ); +// XFree( args ); +// return wsWMKDE; +// } + +// --- net wm + type=XInternAtom( wsDisplay,"_NET_SUPPORTED",False ); + if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) + { + mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"NetWM\n" ); + XFree( args ); + return wsWMNetWM; + } + + mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"Unknow\n" ); + return wsWMUnknown; +} + void wsXInit( void* mDisplay ) { int eventbase; @@ -192,6 +243,8 @@ wsMaxX=DisplayWidth( wsDisplay,wsScreen ); wsMaxY=DisplayHeight( wsDisplay,wsScreen ); + wsWMType=wsWindowManagerType(); + wsGetDepthOnScreen(); #ifdef DEBUG { @@ -253,6 +306,7 @@ wsConvFunc=BGR8880_to_BGR555_c; break; } + XSetErrorHandler( wsErrorHandler ); } // ---------------------------------------------------------------------------------------------- @@ -356,7 +410,7 @@ wsClassHint.res_class="MPlayer"; XSetClassHint( wsDisplay,win->WindowID,&wsClassHint ); - win->SizeHint.flags=PPosition | PSize | PResizeInc | PWinGravity | PBaseSize; + win->SizeHint.flags=PPosition | PSize | PResizeInc | PWinGravity;// | PBaseSize; win->SizeHint.x=win->X; win->SizeHint.y=win->Y; win->SizeHint.width=win->Width; @@ -571,16 +625,25 @@ char * name = XGetAtomName( wsDisplay,Event->xproperty.atom ); if ( !name ) break; - if ( !strncmp( name,"_ICEWM_TRAY",11 ) || - !strncmp( name,"_KDE_",5 ) || - !strncmp( name,"KWM_WIN_DESKTOP",15 ) ) wsWMType=0; + if ( !strncmp( name,"_ICEWM_TRAY",11 ) ) + { + wsWMType=wsWMIceWM; + mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is IceWM.\n" ); + } + if ( !strncmp( name,"_KDE_",5 ) ) + { + mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is KDE.\n" ); + wsWMType=wsWMKDE; + } + if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) ) + { + mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is WindowMaker style.\n" ); + wsWMType=wsWMWMaker; + } - if ( !strncmp( name,"_KDE_",5 ) ) wsIsKDE=1; - // fprintf(stderr,"[ws] PropertyNotify %s ( 0x%x )\n",name,Event->xproperty.atom ); XFree( name ); - break; } break; @@ -639,12 +702,82 @@ } // ---------------------------------------------------------------------------------------------- +// Move window to selected layer +// ---------------------------------------------------------------------------------------------- + +#define WIN_LAYER_ONBOTTOM 2 +#define WIN_LAYER_NORMAL 4 +#define WIN_LAYER_ONTOP 6 + +void wsSetLayer( Display * wsDisplay, Window win, int layer ) +{ + Atom type; + int format; + unsigned long nitems, bytesafter; + unsigned char * args = NULL; + + type=XInternAtom( wsDisplay,"_NET_SUPPORTED",False ); + if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) + { + XEvent e; + e.xclient.type=ClientMessage; + e.xclient.message_type=XInternAtom( wsDisplay,"_NET_WM_STATE",False ); + e.xclient.display=wsDisplay; + e.xclient.window=win; + e.xclient.format=32; + e.xclient.data.l[0]=layer; + e.xclient.data.l[1]=XInternAtom( wsDisplay,"_NET_WM_STATE_STAYS_ON_TOP",False ); + e.xclient.data.l[2]=0l; + e.xclient.data.l[3]=0l; + e.xclient.data.l[4]=0l; + XSendEvent( wsDisplay,wsRootWin,False,SubstructureRedirectMask,&e ); + + XFree( args ); + return; + } + type=XInternAtom( wsDisplay,"_WIN_SUPPORTING_WM_CHECK",False ); + if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) + { + XClientMessageEvent xev; + + memset( &xev,0,sizeof( xev ) ); + xev.type=ClientMessage; + xev.window=win; + xev.message_type=XInternAtom( wsDisplay,"_WIN_LAYER",False ); + xev.format=32; + switch ( layer ) + { + 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; + } + XSendEvent( wsDisplay,wsRootWin,False,SubstructureNotifyMask,(XEvent*)&xev ); + if ( layer ) XRaiseWindow( wsDisplay,win ); + + XFree( args ); + return; + } +} + +// ---------------------------------------------------------------------------------------------- // Switch to fullscreen. // ---------------------------------------------------------------------------------------------- void wsFullScreen( wsTWindow * win ) { int decoration = 0; - if ( wsWMType ) XUnmapWindow( wsDisplay,win->WindowID ); + + if ( wsWMType == wsWMUnknown ) XUnmapWindow( wsDisplay,win->WindowID ); + + switch ( wsWMType ) + { + case wsWMUnknown: + XUnmapWindow( wsDisplay,win->WindowID ); + break; + case wsWMIceWM: + if ( !win->isFullScreen ) XUnmapWindow( wsDisplay,win->WindowID ); + break; + } + if ( win->isFullScreen ) { win->X=win->OldX; @@ -665,10 +798,11 @@ wsScreenSaverOff( wsDisplay ); } - win->SizeHint.flags=PPosition | PSize | PWinGravity | PBaseSize; + win->SizeHint.flags=PPosition | PSize | PWinGravity;// | PBaseSize; win->SizeHint.x=win->X; win->SizeHint.y=win->Y; win->SizeHint.width=win->Width; win->SizeHint.height=win->Height; win->SizeHint.base_width=win->Width; win->SizeHint.base_height=win->Height; + win->SizeHint.win_gravity=StaticGravity; if ( win->Property & wsMaxSize ) { @@ -684,6 +818,7 @@ } XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint ); + wsSetLayer( wsDisplay,win->WindowID,win->isFullScreen ); XMoveResizeWindow( wsDisplay,win->WindowID,win->X,win->Y,win->Width,win->Height ); wsWindowDecoration( win,decoration ); XMapRaised( wsDisplay,win->WindowID ); @@ -772,12 +907,12 @@ win->Width=sx; win->Height=sy; - win->SizeHint.flags=PPosition | PSize | PWinGravity | PBaseSize; + win->SizeHint.flags=PPosition | PSize | PWinGravity;// | PBaseSize; win->SizeHint.x=win->X; win->SizeHint.y=win->Y; win->SizeHint.width=win->Width; win->SizeHint.height=win->Height; -/* + if ( win->Property & wsMinSize ) { win->SizeHint.flags|=PMinSize; @@ -790,10 +925,12 @@ win->SizeHint.max_width=win->Width; win->SizeHint.max_height=win->Height; } -*/ + win->SizeHint.win_gravity=StaticGravity; win->SizeHint.base_width=sx; win->SizeHint.base_height=sy; - if ( !wsIsKDE ) XUnmapWindow( wsDisplay,win->WindowID ); + + if ( wsWMType == wsWMUnknown ) XUnmapWindow( wsDisplay,win->WindowID ); + XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint ); XResizeWindow( wsDisplay,win->WindowID,sx,sy ); XMapRaised( wsDisplay,win->WindowID ); @@ -811,9 +948,30 @@ // ---------------------------------------------------------------------------------------------- void wsMoveTopWindow( wsTWindow * win ) { - if ( wsIsKDE ) return; - XMapRaised( wsDisplay,win->WindowID ); - XRaiseWindow( wsDisplay,win->WindowID ); + if ( wsWMType == wsWMIceWM ) + { + XUnmapWindow( wsDisplay,win->WindowID ); + XMapWindow( wsDisplay,win->WindowID ); + return; + } +/* + if ( XInternAtom( wsDisplay,"_NET_ACTIVE_WINDOW",False ) != None ) + { + XEvent e; + + e.xclient.type=ClientMessage; + e.xclient.message_type=XInternAtom( wsDisplay,"_NET_ACTIVE_WINDOW",False ); + e.xclient.display=wsDisplay; + e.xclient.window=win->WindowID; + e.xclient.format=32; + e.xclient.data.l[0]=0; + XSendEvent( wsDisplay,wsRootWin,False,SubstructureRedirectMask,&e ); + } + else */ + { + XMapRaised( wsDisplay,win->WindowID ); + XRaiseWindow( wsDisplay,win->WindowID ); + } } // ---------------------------------------------------------------------------------------------- @@ -929,7 +1087,7 @@ { switch( show ) { - case wsShowWindow: XMapWindow( wsDisplay,win->WindowID ); break; + case wsShowWindow: XMapRaised( wsDisplay,win->WindowID ); break; case wsHideWindow: XUnmapWindow( wsDisplay,win->WindowID ); break; } XFlush( wsDisplay );
--- a/Gui/wm/ws.h Mon May 06 13:04:36 2002 +0000 +++ b/Gui/wm/ws.h Mon May 06 15:05:07 2002 +0000 @@ -87,6 +87,15 @@ #define wsPVisible 5 #define wsRolled 6 +#define wsWMWMW 0 +#define wsWMUnknown 1 +#define wsWMNetWM 2 +#define wsWMKDE 3 +#define wsWMIceWM 4 +#define wsWMBlackBox 5 +#define wsWMGnome 6 +#define wsWMWMaker 7 + #define wsParamDisplay Display *dpy,Window w typedef void (*wsTReDraw)( wsParamDisplay ); @@ -167,9 +176,12 @@ extern int wsMaxX; extern int wsMaxY; +extern int wsWMType; + extern Display * wsDisplay; extern int wsScreen; extern Window wsRootWin; +extern int wsLayer; extern unsigned char * wsImageData; @@ -219,6 +231,7 @@ extern void wsSetTitle( wsTWindow * win,char * name ); extern void wsVisibleWindow( wsTWindow * win,int show ); extern void wsWindowDecoration( wsTWindow * win,long d ); +extern void wsSetLayer( Display * wsDisplay,Window win, int layer ); extern void wsFullScreen( wsTWindow * win ); extern void wsPostRedisplay( wsTWindow * win ); extern void wsSetShape( wsTWindow * win,char * data );
--- a/libvo/x11_common.c Mon May 06 13:04:36 2002 +0000 +++ b/libvo/x11_common.c Mon May 06 15:05:07 2002 +0000 @@ -46,6 +46,11 @@ */ #define SCAN_VISUALS +#define vo_wm_Unknown 0 +#define vo_wm_NetWM 1 +#define vo_wm_KDE 2 +#define vo_wm_IceWM 3 +#define vo_wm_WMakerStyle 4 extern int verbose; @@ -61,6 +66,7 @@ /* output window id */ int WinID=-1; int vo_mouse_autohide = 0; +int vo_wm_type = vo_wm_Unknown; #ifdef HAVE_XINERAMA int xinerama_screen = 0; @@ -289,7 +295,21 @@ vo_screenwidth,vo_screenheight, depth, vo_depthonscreen, dispName,mLocalDisplay?"local":"remote"); - + + { + Atom type; + int format; + unsigned long nitems, bytesafter; + unsigned char * args = NULL; + type=XInternAtom( mDisplay,"_NET_SUPPORTED",False ); + if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) + { + mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[x11] Detected wm is NetWM.\n" ); + XFree( args ); + vo_wm_type=vo_wm_NetWM; + } + } + return 1; } @@ -459,7 +479,6 @@ int vo_mouse_timer_const = 30; static int vo_mouse_counter = 30; - int vo_wm_type = 1; int vo_x11_check_events(Display *mydisplay){ int ret=0; @@ -548,10 +567,23 @@ { char * name = XGetAtomName( mydisplay,Event.xproperty.atom ); if ( !name ) break; - if ( !strncmp( name,"_ICEWM_TRAY",11 ) || - !strncmp( name,"_KDE_",5 ) || - !strncmp( name,"KWM_WIN_DESKTOP",15 ) ) vo_wm_type=0; - + + if ( !strncmp( name,"_ICEWM_TRAY",11 ) ) + { + mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[x11] Detected wm is IceWM.\n" ); + vo_wm_type=vo_wm_IceWM; + } + if ( !strncmp( name,"_KDE_",5 ) ) + { + mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[x11] Detected wm is KDE.\n" ); + vo_wm_type=vo_wm_KDE; + } + if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) ) + { + mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[x11] Detected wm is WindowMaker style.\n" ); + vo_wm_type=vo_wm_WMakerStyle; + } + // fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",vo_window,name,Event.xproperty.atom ); XFree( name ); @@ -577,26 +609,88 @@ XSetWMNormalHints( mDisplay,vo_window,&vo_hint ); } +#define WIN_LAYER_ONBOTTOM 2 +#define WIN_LAYER_NORMAL 4 +#define WIN_LAYER_ONTOP 6 + +void vo_x11_setlayer( int layer ) +{ + Atom type; + int format; + unsigned long nitems, bytesafter; + unsigned char * args = NULL; + + if ( vo_wm_type == vo_wm_IceWM ) return; + + type=XInternAtom( mDisplay,"_NET_SUPPORTED",False ); + if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) + { + XEvent e; + + mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] NET style stay on top ( layer %d ).\n",layer ); + 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 ); + e.xclient.data.l[2]=0l; + e.xclient.data.l[3]=0l; + e.xclient.data.l[4]=0l; + XSendEvent( mDisplay,mRootWin,False,SubstructureRedirectMask,&e ); + + XFree( args ); + return; + } + type=XInternAtom( mDisplay,"_WIN_SUPPORTING_WM_CHECK",False ); + if ( Success == XGetWindowProperty( mDisplay,mRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&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; + xev.window=vo_window; + xev.message_type=XInternAtom( mDisplay,"_WIN_LAYER",False ); + xev.format=32; + switch ( layer ) + { + 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; + } + XSendEvent( mDisplay,mRootWin,False,SubstructureNotifyMask,(XEvent*)&xev ); + if ( layer ) XRaiseWindow( mDisplay,vo_window ); + + XFree( args ); + return; + } +} + void vo_x11_fullscreen( void ) { - if ( vo_wm_type ) XUnmapWindow( mDisplay,vo_window ); + int x=0,y=0,w=vo_screenwidth,h=vo_screenheight; - if ( !vo_fs ) + switch ( vo_wm_type ) { - vo_fs=VO_TRUE; - vo_old_x=vo_dx; vo_old_y=vo_dy; vo_old_width=vo_dwidth; vo_old_height=vo_dheight; - vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; + case vo_wm_Unknown: + XUnmapWindow( mDisplay,vo_window ); + break; + case vo_wm_IceWM: + if ( !vo_fs ) XUnmapWindow( mDisplay,vo_window ); + break; } - else - { - vo_fs=VO_FALSE; - vo_dx=vo_old_x; vo_dy=vo_old_y; vo_dwidth=vo_old_width; vo_dheight=vo_old_height; - } - vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 ); - XMoveResizeWindow( mDisplay,vo_window,vo_dx,vo_dy,vo_dwidth,vo_dheight ); + + if ( vo_fs ) + { vo_fs=VO_FALSE; x=vo_old_x; y=vo_old_y; w=vo_old_width; h=vo_old_height; } + 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; } + + vo_x11_sizehint( x,y,w,h,0 ); vo_x11_decoration( mDisplay,vo_window,(vo_fs) ? 0 : 1 ); + vo_x11_setlayer( vo_fs ); + XMoveResizeWindow( mDisplay,vo_window,x,y,w,h ); XMapRaised( mDisplay,vo_window ); - XRaiseWindow( mDisplay,vo_window ); XFlush( mDisplay ); }