diff options
author | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-05-07 13:31:29 +0000 |
---|---|---|
committer | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-05-07 13:31:29 +0000 |
commit | 916a1d5dea518a04805cf18bc45c4efaadbea22a (patch) | |
tree | dd5c4d0da635a6870a5c64f8344ead1a5804599d /libvo/x11_common.c | |
parent | 68330a49a6c2f169dd91381a818382572d94a585 (diff) | |
download | mpv-916a1d5dea518a04805cf18bc45c4efaadbea22a.tar.bz2 mpv-916a1d5dea518a04805cf18bc45c4efaadbea22a.tar.xz |
wm detection -- round two
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6010 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/x11_common.c')
-rw-r--r-- | libvo/x11_common.c | 74 |
1 files changed, 60 insertions, 14 deletions
diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 2a9b9a6c95..c6eb590331 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -174,6 +174,59 @@ static void x11_errorhandler(Display *display, XErrorEvent *event) #undef MSGLEN } +int vo_wm_detect( void ) +{ + Atom type; + Window win; + XEvent xev; + int c = 0; + int wm = vo_wm_Unknown; + int format; + unsigned long nitems, bytesafter; + unsigned char * args = NULL; +#if 1 +// --- netwm + 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_VO,MSGL_STATUS,"[x11] Detected wm is NetWM.\n" ); + XFree( args ); + return vo_wm_NetWM; + } +#endif +// --- other wm + mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Create window for WM detect ...\n" ); + win=XCreateSimpleWindow( mDisplay,mRootWin,vo_screenwidth,vo_screenheight,1,1,0,0,0 ); + XSelectInput( mDisplay,win,PropertyChangeMask | StructureNotifyMask ); + XMapWindow( mDisplay,win ); + XMoveWindow( mDisplay,win,vo_screenwidth,vo_screenheight ); + do + { + XCheckWindowEvent( mDisplay,win,PropertyChangeMask | StructureNotifyMask,&xev ); + + if ( xev.type == PropertyNotify ) + { + char * name = XGetAtomName( mDisplay,xev.xproperty.atom ); + if ( !name ) break; + + if ( !strncmp( name,"_ICEWM_TRAY",11 ) ) + { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is IceWM.\n" ); wm=vo_wm_IceWM; break; } + if ( !strncmp( name,"_KDE_",5 ) ) + { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is KDE.\n" ); wm=vo_wm_KDE; break; } + if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) ) + { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is WindowMaker style.\n" ); wm=vo_wm_WMakerStyle; break; } +// fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",win,name,xev.xproperty.atom ); + + XFree( name ); + } + } while( c++ < 25 ); + XDestroyWindow( mDisplay,win ); +#ifdef MP_DEBUG + if ( wm == vo_wm_Unknown ) mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Unknown wm type...\n" ); +#endif + return wm; +} + int vo_init( void ) { // int mScreen; @@ -297,19 +350,7 @@ int vo_init( void ) 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_VO,MSGL_STATUS,"[x11] Detected wm is NetWM.\n" ); - XFree( args ); - vo_wm_type=vo_wm_NetWM; - } - } + vo_wm_type=vo_wm_detect(); return 1; } @@ -564,6 +605,7 @@ int vo_x11_check_events(Display *mydisplay){ mplayer_put_key(MOUSE_BTN0+Event.xbutton.button-1); break; #endif +#if 1 case PropertyNotify: { char * name = XGetAtomName( mydisplay,Event.xproperty.atom ); @@ -590,9 +632,9 @@ int vo_x11_check_events(Display *mydisplay){ XFree( name ); } break; +#endif } } - return ret; } @@ -675,7 +717,11 @@ void vo_x11_fullscreen( void ) switch ( vo_wm_type ) { +// case vo_wm_WMakerStyle: +// vo_x11_decoration( mDisplay,vo_window,(vo_fs) ? 1 : 0 ); + break; case vo_wm_Unknown: + vo_x11_decoration( mDisplay,vo_window,(vo_fs) ? 1 : 0 ); XUnmapWindow( mDisplay,vo_window ); break; case vo_wm_IceWM: |