Mercurial > mplayer.hg
comparison Gui/wm/ws.c @ 6009:bb1f3552f118
wm detection -- round two
author | pontscho |
---|---|
date | Tue, 07 May 2002 13:31:29 +0000 |
parents | b5fb9a927bf3 |
children | 7f6e02a16ac4 |
comparison
equal
deleted
inserted
replaced
6008:c0b50929b2cd | 6009:bb1f3552f118 |
---|---|
148 Atom type; | 148 Atom type; |
149 int format; | 149 int format; |
150 unsigned long nitems, bytesafter; | 150 unsigned long nitems, bytesafter; |
151 unsigned char * args = NULL; | 151 unsigned char * args = NULL; |
152 | 152 |
153 mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is " ); | 153 Window win; |
154 // --- icewm | 154 XEvent xev; |
155 // type=XInternAtom( wsDisplay,"_ICEWM_TRAY",False ); | 155 int c = 0; |
156 // if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) | 156 int wm = wsWMUnknown; |
157 // { | |
158 // mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"IceWM\n" ); | |
159 // XFree( args ); | |
160 // return wsWMIceWM; | |
161 // } | |
162 | 157 |
163 // --- gnome | 158 // --- gnome |
164 // type=XInternAtom( wsDisplay,"_WIN_SUPPORTING_WM_CHECK",False ); | 159 type=XInternAtom( wsDisplay,"_WIN_SUPPORTING_WM_CHECK",False ); |
165 // if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) | 160 if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) |
166 // { | 161 { |
167 // mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"Gnome\n" ); | 162 mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is Gnome\n" ); |
168 // XFree( args ); | 163 XFree( args ); |
169 // return wsWMGnome; | 164 return wsWMGnome; |
170 // } | 165 } |
171 | |
172 // --- kde | |
173 // type=XInternAtom( wsDisplay,"_KDE_NET_WM_FRAME_STRUT",False ); | |
174 //// type=XInternAtom( wsDisplay,"_KDE_NET_USER_TIME",False ); | |
175 // if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) | |
176 // { | |
177 // mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"KDE\n" ); | |
178 // XFree( args ); | |
179 // return wsWMKDE; | |
180 // } | |
181 | 166 |
182 // --- net wm | 167 // --- net wm |
183 type=XInternAtom( wsDisplay,"_NET_SUPPORTED",False ); | 168 type=XInternAtom( wsDisplay,"_NET_SUPPORTED",False ); |
184 if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) | 169 if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) |
185 { | 170 { |
186 mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"NetWM\n" ); | 171 mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is NetWM\n" ); |
187 XFree( args ); | 172 XFree( args ); |
188 return wsWMNetWM; | 173 return wsWMNetWM; |
189 } | 174 } |
190 | 175 |
191 mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"Unknow\n" ); | 176 // --- other wm |
177 mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Create window for WM detect ...\n" ); | |
178 win=XCreateSimpleWindow( wsDisplay,wsRootWin,wsMaxX,wsMaxY,1,1,0,0,0 ); | |
179 XSelectInput( wsDisplay,win,PropertyChangeMask | StructureNotifyMask ); | |
180 XMapWindow( wsDisplay,win ); | |
181 XMoveWindow( wsDisplay,win,wsMaxX,wsMaxY ); | |
182 do | |
183 { | |
184 XCheckWindowEvent( wsDisplay,win,PropertyChangeMask | StructureNotifyMask,&xev ); | |
185 | |
186 if ( xev.type == PropertyNotify ) | |
187 { | |
188 char * name = XGetAtomName( wsDisplay,xev.xproperty.atom ); | |
189 if ( !name ) break; | |
190 | |
191 if ( !strncmp( name,"_ICEWM_TRAY",11 ) ) | |
192 { mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Detected wm is IceWM.\n" ); wm=wsWMIceWM; break; } | |
193 if ( !strncmp( name,"_KDE_",5 ) ) | |
194 { mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Detected wm is KDE.\n" ); wm=wsWMKDE; break; } | |
195 if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) ) | |
196 { mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Detected wm is WindowMaker style.\n" ); wm=wsWMWMaker; break; } | |
197 // fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",win,name,xev.xproperty.atom ); | |
198 XFree( name ); | |
199 } | |
200 } while( c++ < 25 ); | |
201 XDestroyWindow( wsDisplay,win ); | |
202 #ifdef MP_DEBUG | |
203 if ( wm == wsWMUnknown ) mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Unknown wm type...\n" ); | |
204 #endif | |
192 return wsWMUnknown; | 205 return wsWMUnknown; |
193 } | 206 } |
194 | 207 |
195 void wsXInit( void* mDisplay ) | 208 void wsXInit( void* mDisplay ) |
196 { | 209 { |