From: jason@peyote.tfs.com (Jason P. Venner)
Newsgroups: fj.mail-lists.x-window
Subject: Twm & WARPTO - X11R5 pl11
Date: 8 Jan 93 23:24:14 GMT
Distribution: fj
Organization: /u1/jason/.organization

Date: Fri, 8 Jan 1993 21:22:27 GMT
Message-Id: <JASON.93Jan8132227@peyote.tfs.com>
Newsgroups: comp.windows.x


In R4, twm would look at the window name, as well as the res_class and
res_name when executing the f.warpto call.

In R5, twm only looks at the res_class and res_name' and looks at
res_name twice - is this a typeo/bug

    case F_WARPTO:
	{
	    register TwmWindow *t;
	    int len;

	    len = strlen(action);

	    for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
		if (!strncmp(action, t->class.res_name, len)) break;
	    }
	    if (!t) {
		for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
		    if (!strncmp(action, t->class.res_name, len)) break;
		}
		if (!t) {
		    for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
			if (!strncmp(action, t->class.res_class, len)) break;
		    }
		}
	    }



I have modified my twm to use a function I call MatchWinName that more
or less mimic's the R4 behaviour - and what I want to happen.

/*
 * This function is used by the WARPTO call to match the action name
 * against window names
 */

int	MatchWinName( action, action_len, t )
char* action;
int	action_len;
struct TwmWindow* t;
{

	if( strncmp( action, t->full_name, action_len ) == 0 ) {
		return True;
	} else if( strncmp( action, t->name, action_len ) == 0 ) {
		return True;
	} else if( strncmp( action, t->class.res_class, action_len ) == 0 ) {
		return True;
	} else if( strncmp( action, t->class.res_name, action_len ) == 0 ) {
		return True;
	}
	return False;
}

		for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
			if( MatchWinName( action, len, t ) ) {
				break;
			}
		}

diff -c /image_store1/X11R5/mit/clients/twm/menus.c menus.c
*** /image_store1/X11R5/mit/clients/twm/menus.c       Wed Jul 17 10:58:47 1991
--- menus.c     Fri Jan  8 10:08:56 1993
***************
--- 1297,1325 ----
      }
  } 
  
+ /*
+  * This function is used by the WARPTO call to match the action name
+  * against window names
+  */
+ 
+ int MatchWinName( action, action_len, t )
+ char* action;
+ int       action_len;
+ struct TwmWindow* t;
+ {
+ 
+         if( strncmp( action, t->full_name, action_len ) == 0 ) {
+               return True;
+   } else if( strncmp( action, t->name, action_len ) == 0 ) {
+             return True;
+   } else if( strncmp( action, t->class.res_class, action_len ) == 0 ) {
+          return True;
+   } else if( strncmp( action, t->class.res_name, action_len ) == 0 ) {
+           return True;
+   }
+      return False;
+ }
+ 
  
  
  /***********************************************************************
***************
--- 1342,1348 ----
   ***********************************************************************
   */
  
+ 
  int
  ExecuteFunction(func, action, w, tmp_win, eventp, context, pulldown)
      int func;
***************
  
      case F_WARPTO:
         {
!          register TwmWindow *t;
!         int len;
  
!             len = strlen(action);
  
-        for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
-              if (!strncmp(action, t->class.res_name, len)) break;
-       }
-      if (!t) {
           for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
!              if (!strncmp(action, t->class.res_name, len)) break;
                }
!              if (!t) {
!                  for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
!                      if (!strncmp(action, t->class.res_class, len)) break;
!              }
           }
-          }
- 
-            if (t) {
-           if (Scr->WarpUnmapped || t->mapped) {
-              if (!t->mapped) DeIconify (t);
-                 if (!Scr->NoRaiseWarp) XRaiseWindow (dpy, t->frame);
-                   WarpToWindow (t);
-          }
-          } else {
-           XBell (dpy, 0);
-            }
   }
       break;
  
--- 2112,2136 ----
  
      case F_WARPTO:
        {
!              register TwmWindow *t;
!                 int len;
  
!             len = strlen(action);
  
                 for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
!                  if( MatchWinName( action, len, t ) ) {
!                                 break;
!                         }
               }
!              if (t) {
!                       if (Scr->WarpUnmapped || t->mapped) {
!                          if (!t->mapped) DeIconify (t);
!                                 if (!Scr->NoRaiseWarp) XRaiseWindow (dpy, t->frame);
!                           WarpToWindow (t);
!                      }
!              } else {
!                       XBell (dpy, 0);
                 }
       }
       break;
  

--
Jason P. Venner
jason@tfs.com