home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / windows / x / 20930 < prev    next >
Encoding:
Text File  |  1993-01-08  |  4.8 KB  |  183 lines

  1. Path: sparky!uunet!olivea!charnel!rat!usc!cs.utexas.edu!sun-barr!ames!agate!tfs.com!tfs.com!ts2!jason
  2. From: jason@peyote.tfs.com (Jason P. Venner)
  3. Newsgroups: comp.windows.x
  4. Subject: Twm & WARPTO - X11R5 pl11
  5. Message-ID: <JASON.93Jan8132227@peyote.tfs.com>
  6. Date: 8 Jan 93 21:22:27 GMT
  7. Sender: news@tfs.com (News Administrator @ts2.tfs.com)
  8. Distribution: comp
  9. Organization: /u1/jason/.organization
  10. Lines: 170
  11. Nntp-Posting-Host: peyote
  12.  
  13.  
  14. In R4, twm would look at the window name, as well as the res_class and
  15. res_name when executing the f.warpto call.
  16.  
  17. In R5, twm only looks at the res_class and res_name' and looks at
  18. res_name twice - is this a typeo/bug
  19.  
  20.     case F_WARPTO:
  21.     {
  22.         register TwmWindow *t;
  23.         int len;
  24.  
  25.         len = strlen(action);
  26.  
  27.         for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
  28.         if (!strncmp(action, t->class.res_name, len)) break;
  29.         }
  30.         if (!t) {
  31.         for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
  32.             if (!strncmp(action, t->class.res_name, len)) break;
  33.         }
  34.         if (!t) {
  35.             for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
  36.             if (!strncmp(action, t->class.res_class, len)) break;
  37.             }
  38.         }
  39.         }
  40.  
  41.  
  42.  
  43. I have modified my twm to use a function I call MatchWinName that more
  44. or less mimic's the R4 behaviour - and what I want to happen.
  45.  
  46. /*
  47.  * This function is used by the WARPTO call to match the action name
  48.  * against window names
  49.  */
  50.  
  51. int    MatchWinName( action, action_len, t )
  52. char* action;
  53. int    action_len;
  54. struct TwmWindow* t;
  55. {
  56.  
  57.     if( strncmp( action, t->full_name, action_len ) == 0 ) {
  58.         return True;
  59.     } else if( strncmp( action, t->name, action_len ) == 0 ) {
  60.         return True;
  61.     } else if( strncmp( action, t->class.res_class, action_len ) == 0 ) {
  62.         return True;
  63.     } else if( strncmp( action, t->class.res_name, action_len ) == 0 ) {
  64.         return True;
  65.     }
  66.     return False;
  67. }
  68.  
  69.         for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
  70.             if( MatchWinName( action, len, t ) ) {
  71.                 break;
  72.             }
  73.         }
  74.  
  75. diff -c /image_store1/X11R5/mit/clients/twm/menus.c menus.c
  76. *** /image_store1/X11R5/mit/clients/twm/menus.c       Wed Jul 17 10:58:47 1991
  77. --- menus.c     Fri Jan  8 10:08:56 1993
  78. ***************
  79. --- 1297,1325 ----
  80.       }
  81.   } 
  82.   
  83. + /*
  84. +  * This function is used by the WARPTO call to match the action name
  85. +  * against window names
  86. +  */
  87. + int MatchWinName( action, action_len, t )
  88. + char* action;
  89. + int       action_len;
  90. + struct TwmWindow* t;
  91. + {
  92. +         if( strncmp( action, t->full_name, action_len ) == 0 ) {
  93. +               return True;
  94. +   } else if( strncmp( action, t->name, action_len ) == 0 ) {
  95. +             return True;
  96. +   } else if( strncmp( action, t->class.res_class, action_len ) == 0 ) {
  97. +          return True;
  98. +   } else if( strncmp( action, t->class.res_name, action_len ) == 0 ) {
  99. +           return True;
  100. +   }
  101. +      return False;
  102. + }
  103.   
  104.   
  105.   /***********************************************************************
  106. ***************
  107. --- 1342,1348 ----
  108.    ***********************************************************************
  109.    */
  110.   
  111.   int
  112.   ExecuteFunction(func, action, w, tmp_win, eventp, context, pulldown)
  113.       int func;
  114. ***************
  115.   
  116.       case F_WARPTO:
  117.          {
  118. !          register TwmWindow *t;
  119. !         int len;
  120.   
  121. !             len = strlen(action);
  122.   
  123. -        for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
  124. -              if (!strncmp(action, t->class.res_name, len)) break;
  125. -       }
  126. -      if (!t) {
  127.            for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
  128. !              if (!strncmp(action, t->class.res_name, len)) break;
  129.                 }
  130. !              if (!t) {
  131. !                  for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
  132. !                      if (!strncmp(action, t->class.res_class, len)) break;
  133. !              }
  134.            }
  135. -          }
  136. -            if (t) {
  137. -           if (Scr->WarpUnmapped || t->mapped) {
  138. -              if (!t->mapped) DeIconify (t);
  139. -                 if (!Scr->NoRaiseWarp) XRaiseWindow (dpy, t->frame);
  140. -                   WarpToWindow (t);
  141. -          }
  142. -          } else {
  143. -           XBell (dpy, 0);
  144. -            }
  145.    }
  146.        break;
  147.   
  148. --- 2112,2136 ----
  149.   
  150.       case F_WARPTO:
  151.         {
  152. !              register TwmWindow *t;
  153. !                 int len;
  154.   
  155. !             len = strlen(action);
  156.   
  157.                  for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
  158. !                  if( MatchWinName( action, len, t ) ) {
  159. !                                 break;
  160. !                         }
  161.                }
  162. !              if (t) {
  163. !                       if (Scr->WarpUnmapped || t->mapped) {
  164. !                          if (!t->mapped) DeIconify (t);
  165. !                                 if (!Scr->NoRaiseWarp) XRaiseWindow (dpy, t->frame);
  166. !                           WarpToWindow (t);
  167. !                      }
  168. !              } else {
  169. !                       XBell (dpy, 0);
  170.                  }
  171.        }
  172.        break;
  173.   
  174.  
  175. --
  176. Jason P. Venner
  177. jason@tfs.com
  178.