Subject: incompatible change in "next" command?

From: Dominik Vogt <[email-masked]>
Date: Wed, 6 Nov 2002 11:09:18 +0100

I am thinking about an incompatible change in the Next and Prev
commands.  The other conditional commands that start looking for a
new window from the currently focused window already work this
way:

 - When the conditional command is run without a context window,
   it takes the focus window as a reference point.
 - If it is run with a context window, that is used instead of
   the focus window.

This allows many wonderful things, for example:

  Next Next Focus
  WindowId ... Next Focus

but breaks certain setups.  It might affect actions bound to a
window menu item (although I can't think of anything that would
require running Next or Prev) and nested complex functions:

  AddToFunc foo
  + I Next bar

  AddToFunc bar
  + I echo $w
  + I Next echo $w

I need this especially in FvwmProxy to to keep its own idea of a
selected window and to run some conditional commands on it.  This
is a hypothetical FvwmProxy setup I have in mind:

  Key Tab A M circulate_proxy_window Next
  Key Tab A SM circulate_proxy_window Prev

  AddToFunc circulate_proxy_window
  + I SendToModule FvwmProxy $0 (CurrentPage) select_proxy_window

  AddToFunc select_proxy_window
  + I SendToModule FvwmProxy Select $w

It should work like this:

 - User presses Alt-Tab.
 - Fvwm sends "Next (CurrentPage) select_proxy_window" to
   FvwmProxy.
 - FvwmProxy sets the context window and passes the string back
   to fvwm.
 - Fvwm runs the command and replies with "Select <new window id>"
 - FvwmProxy selects the given window.
  
Bye

Dominik ^_^  ^_^
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Mikhael Goikhman <[email-masked]>
Date: Thu, 7 Nov 2002 10:47:06 +0000

> require running Next or Prev) and nested complex functions:

I don't know. Maybe practically such change will be almost invisible.
But then Next can't be used for anything relable. I.e. to have something
relable one should use either one or another form instead of "Next":

  NoWindow Next    # relatively to the focussed window (the current Next)
  ThisWindow Next  # relatively to the context window if any
  Current Next     # just as unrelable as the proposed Next

Maybe just to have 2 Next commands, so that a single command would be
needed instead of a prefixed command? I.e. introduce ThisNext (or maybe
NextWindow) that like ThisWindow does nothing if there is no context.
I don't say "no", I just try to think.

>   + I Next echo $w

A simplier example would be any Next in root menu and that root menu bound
to WTSF contexts. Such menu would work a bit differently that it is now.
With NeverFocus or ClickToFocus windows. In the end I don't much care if
there is a way to force one or another meaning (using prefixes).

Regards,
Mikhael.

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 7 Nov 2002 13:08:38 +0100

On Thu, Nov 07, 2002 at 10:47:06AM +0000, Mikhael Goikhman wrote:
> But then Next can't be used for anything relable.

Did you ever notice that "Direction" already works this way?  It
*is* reliable because nobody ever thinks of using it outside a
window context.  I am hoping for the same with Next/Prev.

> I.e. to have something

I thought about that too, but on one hand it looks like a silly
thing to do as other commands have proven to work well with the
new logic.  And on the other hand it duplicated code and
maintenance work for no good reason.  Of course it is a dangerous
thing to do.

> With NeverFocus or ClickToFocus windows.

I still can not think of a reason why one should have this in a
root or window menu (or any other menu).

> In the end I don't much care if

Bye

Dominik ^_^  ^_^

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 7 Nov 2002 14:19:25 +0100

[snip]

Well, it's all just theory unless we try it out.  I will commit a
patch.

One related thing I do not understand from the top of my head.
The following commands generate the following output:

  next echo $w
  next next echo $w
  next next echo $$w
  next next echo $$$$$w

    [FVWM][Echo]: 0x1a00020

  next next echo $$$w
  next next echo $$$$w
  next next echo $$$$$$w

    [FVWM][Echo]: 0xa00002

  next next echo $$$$$$$w

    [FVWM][Echo]: $w

This is what I would have expected:

  fid = first window id
  sid = second window id
  -> = "expands/evaluates to"

  next echo $w -> 0xfid
  next next echo $w -> next echo 0xfid -> 0xfid
  next next echo $$w -> next echo $w -> 0xsid
  next next echo $$$w -> next echo $0xfid -> 0xfid
  next next echo $$$$w -> next echo $$w -> $w
  next next echo $$$$$w -> next echo $$0xfid -> $0xfid
  next next echo $$$$$$w -> next echo $$$w -> $0xsid
  next next echo $$$$$$$w -> next echo $$$0xfid -> $0xfid

Sigh, the mysteries of parameter expansion.

Bye

Dominik ^_^  ^_^