Hi J-S, Looking at the even code in the GraphicsWindowWX it does look like the key press and key release should produce the same character key. The intent on the OSG side is that the keys should include by ascii characters that include the appropriate capitalization so it's the responsibility of the likes of GraphicsWindowWX to ensure this.
I do wonder if this issue isn't a bug in WxWidgets itself, or perhaps GraphicsWindowWX interpretation of how WxWidgets should be used. Either way we need to fix it and get it checked in. I'll wait for such a submission before I merge your other change to the osgviewerWX example. The crash that happens when you change threading model itself needs to be looked into, and shouldn't hold us back from fixing the key issue. Robert. On Thu, Sep 25, 2008 at 4:58 PM, Jean-Sébastien Guay <[EMAIL PROTECTED]> wrote: > Hi Alberto, > >> it seems a matter of capitalization: M=77 ASCII while m=109ASCII Maybe a >> toupper or a tolower can help. > > First, I am not crazy, I did *not* have the shift key pressed, nor caps lock > on :-) > > I just investigated a bit more. When I press 'm', the key Wx reports (int > key = event.getKeyCode()) is 109 in the OnChar(event) handler, but it's 77 > in the OnKeyUp(event) handler. So my guess is that in OnChar we get the > actual character while in OnKeyUp it considers the m key the same whether > shift is pressed or not. > > It makes sense, considering that the StatsHandler checks keys in the > osgGA::GUIEventAdapter::KEYDOWN event, but the ThreadingHandler checks them > in the osgGA::GUIEventAdapter::KEYUP handler. So the StatsHandler gets the > right key code while the ThreadingHandler doesn't. > > I changed the code to get the keycode from this: > > int key = event.GetKeyCode(); > > to this: > > int key = event.GetKeyCode(); > if ((event.GetModifiers() & wxMOD_SHIFT) != 0) > key = toupper(key); > else > key = tolower(key); > > (not sure if there's a better way to do this, I'm not a WX expert...) > > And that works. Unfortunately, changing threading modes at run time leads to > a crash (which I don't get in osgviewer) so it's not that useful unless I > have the time to debug the crash too... Not now though. > > So, do I submit the changed file that fixes the OnKeyUp() issue (might be > hackish) but crashes when switching threading models anyway? > > J-S > -- > ______________________________________________________ > Jean-Sebastien Guay [EMAIL PROTECTED] > http://www.cm-labs.com/ > http://whitestar02.webhop.org/ > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
