keyboard events on Linux

Hi, I’m having some strange issues with keyboard events in my Linux box, on Gnome.

I have registered the spacebar key to perform an action, then I start the application with the messenger in verbose mode. The problem is as follows:

  1. When I press the space, the messenger shows the event in the terminal, and the space-up event as well, everything works fine.

  2. I press Alt-Tab to switch the window, then I press Alt-Tab to get back again to my panda window. Now if
    I press space, the messenger is not showing anymore its event, but it’s showing an “alt-space” event and its corresponding “alt-space-up”. The application is still thinking that the “alt” modifier key is still pressed.

I couldn’t reproduce the problem in Windows 7.

Solution, or just my current workaround, press and release alt key to fix the state of it.

I would like to know if I can detect in Panda when the application losses or gain focus and fix this alt-key state
sending the event (alt-up) programmatically.

thanks in advance,
francholi

when pressing alt, panda still catches the alt-down. but when you alt-tab , gnome moves the focus away from panda. so panda never gets the alt-up. you already figured out the fix to press alt again, so panda catches the necessary alt-up event. it’s a known phenomena.

about how to fix it programatically , i dunno. maybe someone else can help here.

you could watch for the window focus event and send the up events for all modifier keys explicitly.

You can disable the modifier buttons in Panda, if you don’t need them:

base.mouseWatcherNode.setModifierButtons(ModifierButtons()) 
base.buttonThrowers[0].node().setModifierButtons(ModifierButtons())

I’m running in to the same problem. Is there a way to poll the state of each key when focus returns to the window, or do you have to guess?

We have code to do this in the Windows and Mac implementations, but no one has done it yet for the Linux implementation. If you’d like to offer that patch, we’ll be happy to accept it.

In the meantime, the best workaround is as suggested by rdb, above.

David