Xserver and the FVWM

Hi:

I apologize if this question is inappropriate to the forum, but I have to ask:

How does the Xserver interact with FVWM?

My understanding was that FVWM ran ‘on top of’ the Xserver. When a key was pressed, the Xserver interpreted the key press (Thanks Thomas Adam) and then passed the keycode onto the FVWM - which looked at the keycode, compared it against the Xmodmapping to check if that keycode had any special value to FVWM (again, thanks Thomas and tBD), if so, FVWM handled it, if not, that key press was passed onto the application currenty in focus - so, is this not how it works?

I ask because I have a third party app that is listening for XEvents, and for some reason, not all XEvents are visible - I can ‘see’ only focus change XEvents but not key presses and key releases - is it possible that keypresses that are bound using my defined XModMap file that I wrote don’t actually ‘go outside of fvwm’ and therefore are not visible to any application other than fvwm? I would have thought that when a message was passed from the Xserver to the FVWM, that an XEvent listener (all it does is listen for events, looks at them, prints up what they are, but doesn’t use them) would see ALL XEvents, including keypresses and keyreleases, currently, all I can see with this third party app are focus changes…

Is there a trusted third-party app that someone could recommend that I could use to display XEvents when key’s are pressed and released? the one I am using is proprietary to my company, and I am not sure how ‘good’ it actually is (the engineer who wrote is long gone form the company for… interesting reasons).

so, I guess my question is two fold: SHOULD all events from the keyboard be visible to applications outside of FVWM if they are listening for them (before or during the time that FVWM deals with those events on its own)? And does anyone know of a good third party app that I could use to listen for these events as well? I just want to know that FVWM is registering the keypress and keyrelease commands so that I can use them.

If my post could possibly be more confusing, please let me know and I’ll do my best. (I need more caffiene).

Thanks in advance,
skender

No, it involves FVWM (just), so it stays.

In more ways than one, that’s for sure.

More or less, yes. Remember that the Xserver knows about key presses and mappings thereof. It is always the job of the Xserver to know how to handle key-press events. The thing to remember though, is that any key-bindings made are greedy with respect to the WM (FVWM). If FVWM can’t deal with it, then the key is passed down the chain to the application (whether the application in question has focus or not is irrelevant.)

Unlikely. Note that “xmodmap” just tells the Xserver that keys (keysyms, whatever) have been updated. Other than that, the Xserver never looks at Xmodmap again unless a user or program uses it. In the case of your application, what I suspect is happening is that these events are not being propogated – that is, they’re being passed down to your application, but your application hasn’t yet dealt with them. There could be any number of reasons for this – most likely the events are synthetic. You do know you can bind “xev” to listen to a window, right? Might be interesting to see what events the application receives.

Indeed, consider using ‘ddd’ or ‘gdb’, if things get out of hand. The other thing to check is to see within your code, how it is handling Xevents – something I can help with, if need be.

Which third-party app would that be? Remember that events are generated, propogated, and then acted upon accordingly.

See above – ‘xev’ (first choice), ‘ddd’, and/or ‘gdb’, will all suffice.

Oh, FVWM will be, but if they key presses are not ‘registered’ with FVWM (that is, no keys have been bound to it), FVWM will just pass them right along.

Sounds to me like this ‘third-party’ app sucks. :stuck_out_tongue:

– Thomas Adam

Thomas:

Thanks for responding.

Your post made think about somethings, so let me ramble and tell me if anything I say makes sense (e.g., it is in th realm of reality and therefore you can probably help me).

In events.c of the fvwm src there is a function called ‘old_execute_function’ which calls execute_function in functions.c – this function, according to the comments, should 'execute a fvwm built in function). <-- it seems to be parsing the function in .fvwm2rc (parses syntax, igores whitespace and lines started with #, etc). The reason I bring this up is because, and please correct me if I’m wrong, but the 'HandleKeyPress( ) function in events.c, that calls old_execute_function in functions.c, that calls execute_function( ), that is called by the Xserver, correct?

if the above is true, then the XEvent should be visible to my thirdparty app (which does, in so many ways, suck), correct? Are the XEvents captured by X, and then shipped to the WM (whichever one is currently active)? Or is something more ‘primitive’ acknowledged by the Xserver and then the XEvents are actually built by the WM?

I know these questions might be lame, but I need to understand HOW things work if I am to fix the bloody code here that doesn’t work.

thanks –
Skender

PS-> I think that I am going to put xev onto the application and see what is going on. Any thoughts would be appreciate. thanks again.

Thomas –

One more thing, and here is what is confusing me: The key presses can’t be seen by this lame third-party app, but the function in my .fvwm2rc file that switches focus between applications that uses the following line

+ I Focus

is visible to the third party app for app’s gaining focus and losing focus…

Could that ‘possibly’ mean that only those functions specified by the fvwm get packaged into XEvents? Or are all ‘activities’ that come from the keyboard (key presses, key releases) treated as XEvents as well by FVWM (and I currently just don’t know how to see them/access them)?

– Skender

Thomas –

Ok, so, to get the key press to be made visible as an XEvent, I had to add

+ I FakeKeypress press F4

to make the XEvent ‘visible’.

I guess that if you map a keypress to a function, that it must never be made available outside, and you have to explicitly state what you want that keypress to do for you…

kind of wierd…

Anyway, thought I’d share my findings and ask what you thought,
thanks,
Skender

Visible to what? FakeKeyPress just sends a synthetic Xevent to the application in question (invoked within the function context, in this case.)

Not true – currently, it is not possible in FVWM to have window-specific key-bindings. You can certainly use:

+I Key foo A A foo

Within a function just fine – the result is that the key-binding is global. With “FakeKeyPress” though, you’re just sending a synthetic event, which is not the same thing as an actual binding. It’s fake. It’s also not guaranteed to work properly. So be very careful in using it. It’s certainly nowhere near a solution to your problem.

– Thomas Adam