[MPlayer-dev-eng] WM detection streamline patch

Nilmoni Deb ndeb at ece.cmu.edu
Sat May 11 18:07:18 CEST 2002


Hi,
	This patch is just to reuse the WM keyword detection code.
This is w.r.t x11_common.c cvs version 1.78.

--- libvo/x11_common.c	Sat May 11 11:14:57 2002
+++ libvo/x11_common.c.new	Sat May 11 12:03:05 2002
@@ -175,6 +175,18 @@
 #undef MSGLEN
 }
 
+int  vo_wm_string_test(char  *name)
+{
+  if ( !strncmp( name,"_ICEWM_TRAY",11 ) )
+    { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is IceWM.\n" ); return vo_wm_IceWM; }
+  if ( !strncmp( name,"_KDE_",5 ) )
+    { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is KDE.\n" ); return vo_wm_KDE; }
+  if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) )
+    { mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is WindowMaker style.\n" ); return vo_wm_WMakerStyle; }
+
+  return vo_wm_Unknown;
+}
+
 int vo_wm_detect( void )
 {
  Atom            type;
@@ -214,12 +226,8 @@
      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; }
+     wm = vo_wm_string_test(name);
+     if( wm != vo_wm_Unknown) break;
 //     fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",win,name,xev.xproperty.atom );
 
      XFree( name ); name=NULL;
@@ -623,24 +631,12 @@
 #if 1
       case PropertyNotify: 
     	   {
+	    int    wm = vo_wm_Unknown;
 	    char * name = XGetAtomName( mydisplay,Event.xproperty.atom );
 	    if ( !name ) break;
 	    
-            if ( !strncmp( name,"_ICEWM_TRAY",11 ) )
-	      {
-	       mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is IceWM.\n" );
-	       vo_wm_type=vo_wm_IceWM;
-	      }
-	    if ( !strncmp( name,"_KDE_",5 ) )
-	      {
-	       mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is KDE.\n" );
-	       vo_wm_type=vo_wm_KDE;
-	      }
-	    if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) )
-	      {
-	       mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Detected wm is WindowMaker style.\n" );
-	       vo_wm_type=vo_wm_WMakerStyle;
-	     }
+	    wm = vo_wm_string_test(name);
+	    if( wm != vo_wm_Unknown) vo_wm_type=wm;
 
 // 	     fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",vo_window,name,Event.xproperty.atom );
 	      


thanks
- Nil




More information about the MPlayer-dev-eng mailing list