Subject: FVWM: Negative conditions for Next & Prev

From: "Douglas K. Rand" <[email-masked]>
Date: Mon, 15 Jul 1996 16:05:38 -0500 (CDT)

I've patched fvwm-2.0.43 to handle negative conditions with a leading
'!' character. I use 

  Next [!Iconic CurrentDesk CurrentScreen !Fvwm*] Focus

in my .fvwmrc to move to cycle through the windows on the current
screen. The "!Fvwm*" part is what ignores all windows with a name,
class, or resource matching "Fvwm*". I'd rather use the "go to the
next window ignoring these windows" style instead of "go to the next
window with a name like ____."

I managed to resist the temptation to put in complete regular
expressions, as that would break the documented behavior of Next and
Prev. Instead, I simply expanded the already existing '!' convention
to window names.

The patch isn't the prettiest. Perhaps I should have included misc.h
which would have gotten me the NoClass and NoResource variables to use
instead of the literal strings. 

I hope others will enjoy this patch.

*** wild.c      Fri Jul 12 10:55:14 1996
--- wild.c-orig Tue Sep 13 14:11:47 1994
***************
*** 12,36 ****
   *
   *      This code donated by  Paul Hudson <[email-masked]>    
   *      It is public domain, no strings attached. No guarantees either.
-  * 
-  *      Simple code to understand patterns that begin with '!' to reverse
-  *      the bias of the search. (I use it with commands like
-  *         Next [!Iconic CurrentDesk CurrentScreen !Fvwm*] Focus
-  *      Mods by Douglas Rand <[email-masked]>
   *
   *****************************************************************************/
  int matchWildcards(char *pattern, char *string)
  {
!   if (pattern == NULL)
!     return TRUE;
!   else if (*pattern == '!')
      {
-       if(strcmp(string, "NoClass") == 0 || strcmp(string, "NoResource") == 0)
-       return FALSE;
-       else return !matchWildcards(pattern + 1, string);
-     }
-   else if (string == NULL)
-     {
        if(pattern == NULL)
        return TRUE;
        else if(strcmp(pattern,"*")==0)
--- 12,23 ----
   *
   *      This code donated by  Paul Hudson <[email-masked]>    
   *      It is public domain, no strings attached. No guarantees either.
   *
   *****************************************************************************/
  int matchWildcards(char *pattern, char *string)
  {
!   if(string == NULL)
      {
        if(pattern == NULL)
        return TRUE;
        else if(strcmp(pattern,"*")==0)

--
Douglas K. Rand                                              [email-masked]
System/Network Administrator      Scientific Computing Center -- UND Aerospace
Office: +1 701 777 2801                             University of North Dakota
FAX:    +1 701 777 2940                   Box 9022, Grand Forks ND  58202-9022
 echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq'|dc
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: "Charles Hines" <[email-masked]>
Date: Tue, 16 Jul 1996 09:11:51 -0400

>>>>> "Douglas" == Douglas K Rand <[email-masked]> writes:

Douglas> I've patched fvwm-2.0.43 to handle negative conditions with a
Douglas> leading '!' character. I use

Douglas>   Next [!Iconic CurrentDesk CurrentScreen !Fvwm*] Focus

Douglas> in my .fvwmrc to move to cycle through the windows on the
Douglas> current screen. The "!Fvwm*" part is what ignores all windows
Douglas> with a name, class, or resource matching "Fvwm*". I'd rather
Douglas> use the "go to the next window ignoring these windows" style
Douglas> instead of "go to the next window with a name like ____."

Makes sense.

Douglas> I managed to resist the temptation to put in complete regular
Douglas> expressions, as that would break the documented behavior of
Douglas> Next and Prev. Instead, I simply expanded the already
Douglas> existing '!' convention to window names.

Good idea (for the time being at least).

Douglas> The patch isn't the prettiest. Perhaps I should have included
Douglas> misc.h which would have gotten me the NoClass and NoResource
Douglas> variables to use instead of the literal strings.

That would have been better, yes.

Douglas> I hope others will enjoy this patch.

A variant of this might make it into 2.1.0, since it should be
relatively harmless and rather useful.

Chuck

---

From: "Charles Hines" <[email-masked]>
Date: Tue, 16 Jul 1996 14:32:55 -0400

>>>>> "Me" == Charles Hines <[email-masked]> writes:

Me> That would have been better, yes.

Opps - spoke too soon!  Actually, you can't do that because those vars
are in fvwm itself and that would mean that modules using libfvwm2.a
wouldn't be able to link due to those being unresolved!  I should make
those strings available as defines instead perhaps...

Chuck

---

From: "Douglas K. Rand" <[email-masked]>
Date: Tue, 16 Jul 1996 14:29:04 -0500 (CDT)

>>>>>> "Charles" == Charles Hines <[email-masked]> writes:

Charles> That would have been better, yes.

Charles> Opps - spoke too soon!  Actually, you can't do that because
Charles> those vars are in fvwm itself and that would mean that
Charles> modules using libfvwm2.a wouldn't be able to link due to
Charles> those being unresolved!  I should make those strings
Charles> available as defines instead perhaps...

Not terribly polite to say, but good.  ;^)

I had remembered taking a brief look at misc.h, and had a vague
recollection that it wouldn't be easy or good. I feel better now that
it isn't as simple as adding "#include "misc.h" to the top. 

I also remembered that just below my patch is yet another check for

if (pattern == NULL)
  return TRUE

which can be deleted as thats the first thing I check for. But then
you probably already spotted that.

Thanks for picking up the patch.