[osg-users] Win32 keyboard bug

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Wed Jul 30 06:06:02 PDT 2008

Hello Robert, all,

> As for fixing this in an osg application one idea for Win32 could be
> to add a WM_ACTIVATE handler in
> GraphicWindowWin32::handleNativeWindowingEvent. Note that this method
> is virtual so the message can be handled by just deriving a class from
> GraphicWindowWin32 so you do not have to modify any code inside the
> osg library for this fix.
> When the application get focus some calls to GetAsyncKeyState can be
> made to check the status of the modifier keys and calls can be made to
> EventQueue::keyPress/keyRelease to update the osg modifier key mask
> accordingly. If you need to keep track of other keys that might have
> been released or pressed when your application did not have focus you
> have to call GetAsyncKeyState for them as well.

I am currently testing out a pretty small patch to 
osgViewer::GraphicsWindowWin32 that will fix this issue. I decided to 
fix it in the core, because otherwise I'd have to construct all my 
GraphicsWindow objects myself (using a derived class) instead of using 
the factory methods (which create a GraphicsWindowWin32 directly). And 
fixing the problem at the root just seems like the right thing to do.

I'll submit the fix to osg-submissions once I'm done, hopefully this 
will be considered a bug fix and will be integrated into 2.6.

Just a heads up.

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list