Reloading keybindings slow


I have a setup with two computers which I control from my laptop. I want to have my X desktop on each of these, and therefore I’ve setup Fvwm to allow for convenient switching between the three desktops.

I do this by running Xnest on a special desk (invisible from my normal desks), which I can get to through a keybinding. When I do this, I remove all current keybindings so that Fvwm will just pass the keypresses on to the Xnest (where fvwm on my other computer runs).

All this works fine, and it would suit me very well except for one thing: When I switch back, I reload the keybindings again, and this is for some reason very slow. The two functions look like:

DestroyFunc SwitchToWorkShortcuts
AddToFunc SwitchToWorkShortcuts
+ "I" Key Left          A	CM	-
+ "I" Key Right	       A	CM	-
+ "I" Key Up	        A	CM	-
+ "I" Key Down	      A	CM	-
+ "I" Key M	        A	CM	-
+ "I" Key V	        A	CM	-
+ "I" Key H	        A	CM	-


DestroyFunc SwitchToNormalShortcuts
AddToFunc SwitchToNormalShortcuts
+ "I" Key Left		A	CM	GotoPageDir LEFT
+ "I" Key Right		A	CM	GotoPageDir RIGHT
+ "I" Key Up		A	CM	GotoPageDir UP
+ "I" Key Down		A	CM	GotoPageDir DOWN
+ "I" Key M	        A	CM	Maximize 100 96
+ "I" Key V	        A	CM	Maximize 0 96      # Only vertically
+ "I" Key H	        A	CM	Maximize 100 0     # Only horizontally

To switch to the normal shortcuts take several seconds, during which Fvwm runs at 100% CPU. I think that seems unreasonably high, does anyone see if I’ve done something obvious wrong?

// Simon[/code]

[color=red]Edited by theBlackDragon:
–> Moved from Basic questions[/color]

Some more input on this: if I restart fvwm, the reloading of the keys is much faster to start with. It almost seems like there is some list of keybindings growing for each switch I make…

// Simon

Sorry about the delay on this. I suspect the issue here is with Xnest more than anything else. If you close Xnest and simulate changing your key bindings, I am assuming it does so at the “normal” speed?

– Thomas Adam

I tried killing the Xnest and just switching to the empty desks, but the speed is the same. Switching between the two Xnests is fast (only the “remove keybindings” is run then), but switching back to the normal desk is slow.

Thanks for replying!

// Simon

It sounds as though there’s some sort of network latency. Do you have IgnoreModifiers in use?

– Thomas Adam

Yes, I have IgnoreModifiers L25 for numlock. I removed it and the funny thing is that it actually seems to make a difference. There’s still a delay, but less.

How did you know and what difference should it make? :slight_smile:

// Simon

Because of the way modifiers work within X11. Whenever a key is pressed, an event is generated from the Xserver that is the keycode. Without going into too much detail, the XClient ultimately receiving that key event has to translate the keycode into a keysym.

Before the key is processed on the sever, the Xserver checks to see if it is a modifier or not. That’s fine of course. Now imagine FVWM sat in the middle having to filter the key events, to determine whether the modifier event is for it (the WM) or the application, and to then have to send repeated information back to the Xserver and then onto the XClient below it. (This is just so the WM itself doesn’t have to deal with modifiers).

That’s why it can be a little slow. I must admit, the only speed decrease I’d expect to see is if you were running FVWM over a remote X display (i.e. the XServer was not on the local box you were sat at).

– Thomas Adam