🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #24732

Twm & WARPTO - X11R5 pl11

#24732
From: Jason P. Venner
Date: Fri, 08 Jan 1993 21:22
170 lines
5116 bytes
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
Technical Details
Message-ID: <JASON.93Jan8132227@peyote.tfs.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!charnel!rat!usc!cs.utexas.edu!sun-barr!ames!agate!tfs.com!tfs.com!ts2!jason

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!charnel!rat!usc!cs.utexas.edu!sun-barr!ames!agate!tfs.com!tfs.com!ts2!jason
From: jason@peyote.tfs.com (Jason P. Venner)
Newsgroups: comp.windows.x
Subject: Twm & WARPTO - X11R5 pl11
Message-ID: <JASON.93Jan8132227@peyote.tfs.com>
Date: 8 Jan 93 21:22:27 GMT
Sender: news@tfs.com (News Administrator @ts2.tfs.com)
Distribution: comp
Organization: /u1/jason/.organization
Lines: 170
Nntp-Posting-Host: peyote