Hi Leif & Robert, This is the same problem that was reported this summer on the Win32 platform. A fix for it was prepared and submitted, but it required equivalent changes on the X11 and OSX graphics windows class implementations since changes to the core OSG libraries were made. It would be great if somebody could volunteer on the X11 and OSX sides to make these.
André -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Leif Delgass Sent: September-27-07 5:12 PM To: OpenSceneGraph Users Subject: Re: [osg-users] MODKEY_CTRL problem On 9/27/07, Robert Osfield <[EMAIL PROTECTED]> wrote: > On 9/27/07, Panagiotis Papadakos <[EMAIL PROTECTED]> wrote: > > Hi Robert. Linux/KDE. > > OK. I've reproduce the problem in osgkeyboard, it looks like the alt > tab is prevent GraphicsWindowX11 from getting any events, and if it > isn't getting any events then there is no way for it to know that > anything has changed. Pressing 'alt' on its own in the osgkeyboard > window fixes the problem. > > As to a solution? I don't know. One might need to dynamically query > the modifier state rather than relying on events. This would require > substantial changes though, and is not something I have time to go > chasing after right now. Others are welcome to investigate. > > Robert. Since I've been trying to learn more Xlib, I took a look at this and it seems that OSG is using KeyPress/Release events on the modifier keys themselves to set the GUIEventAdapter modifier mask rather than using the modifier state contained in the X key, button, motion and border crossing events (the 'state' member of those events). I used xev to trace the events, and I think what happens is: Alt is pressed, the EventQueue's modifier state is set, and then the window loses keyboard focus when the window manager sees Alt-Tab. If the Alt key is released while switched away (or the user Alt-Tabs back to the OSG window), the window never gets a KeyRelease event for Alt because the event happens while it has lost keyboard focus. The Alt state in the EventQueue is then "stuck" on until it is pressed and released again. One solution would be to ignore KeyPress/Release events for modifier keys and use the modifier state masks in the other keyboard and pointer events. This also honors the current modifier mapping (MappingNotify would also need to be handled) as reported by xmodmap. Howver, another option is to select for KeymapNotify events to get the current modifier state when the keyboard/pointer focus comes back (KeymapNotify follows EnterNotify and FocusIn events). The KeymapNotify event includes state for all keys (a 256 bit vector indexed by keycode). EnterNotify also includes the modifier state in the event, but FocusIn does not. Leif Delgass _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org