Subject: FVWM: Switching desktops with cursor keys problematic

From: "Felix E. Klee" <[email-masked]>
Date: Tue, 20 May 2003 16:49:13 +0200

Hi,

some time ago I set up keyboard shortcuts for switching desktops with the 
cursor keys. For example the left key calls the function

AddToFunc GotoDeskLeft
+ I . GotoDesk %{ ($[desk.n]%$f::hdesks >= 1) ? -1 : 0; }%

This function checks if the current desktop is in a certain range and calls 
GotoDesk accordingly. The problem however is that when I hit the left key 
very fast a couple of times, GotoDesk isn't finished between successive 
calls to GotoDeskLeft. Therefore $[desk.n] might not be up to date in 
certain calls to GotoDeskLeft and I end up on a desktop out of range.

Any ideas how to solve that problem?

Felix

-- 
To contact me in private don't reply but send email to 
  felix DOT klee AT inka DOT de
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
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: Mikhael Goikhman <[email-masked]>
Date: Tue, 20 May 2003 20:20:06 +0000

> Any ideas how to solve that problem?

Please always specify which version do you run.
Please always provide enough of the configuration to be understandable,
one may only guess how exactly you defined the "." function.

Anyway, I think that you use 2.5.6 instead of a later snapshot, this is
why it does not synchronized for you. Works for me.

Another solution (not sure why you don't use it anyway) is to use
GotoDesk with the first zero parameter:

  . %{ $[desk.n] > 0 ? "" : "#" }% GotoDesk 0 %{ $[desk.n] - 1 }%

Then you don't need any synchronization between fvwm and FvwmPerl and it
may work in 2.5.6 too.

Regards,
Mikhael.

---

From: "Felix E. Klee" <[email-masked]>
Date: Wed, 21 May 2003 11:07:51 +0200

> one may only guess how exactly you defined the "." function.

Sorry, I forgot to mention:
1. I'm using 2.5.6.
2. AddToFunc .
   + I SendToModule FvwmPerl eval preprocess({ 'command' => 1 } , q~$*~)

> why it does not synchronized for you. Works for me.

Interesting. I'll check out a later version when a new snapshot is 
available.

> Then you don't need any synchronization between fvwm and FvwmPerl and it

Hm, I don't see much of a difference to my solution. But the above code 
indeed seems to work better. Thank you.

BTW, now that you are back to the list, could you please take a look at my 
still unanswered questions in the thread "Getting Layer of current 
window?"?

Felix

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 21 May 2003 14:06:56 +0000

> Interesting. I'll check out a later version when a new snapshot is 

Any May snapshot should be good. Please redefine your "." function
to use "SendToModule FvwmPerl preprocess -c -- $*" if you upgrade.

> indeed seems to work better. Thank you.

"Go to desk number 1" does not need synchronization in that you may send
2 such commands and you will always be in range. "Go to +1 desk" requires
synchronization, because if you send 2 such commands before the first is
finished you may be out of range.

> still unanswered questions in the thread "Getting Layer of current 

I can reproduce this bug, but have no time to debug it.

Regards,
Mikhael.