Vivien, JS, A couple of thoughts- My app is an MFC based concoction. As such the osg window is a dialog and not a control. Apparently dialogs do not (and cannot) receive WM_CHAR messages. One work around for me is to only use keyup and not to use keydown. However I think this doesn't address a general problem as outlined below.
My understanding is that WM_KEYDOWN is generated instantly when a key is pressed. It tells you that a key was pressed. It does not really tell you if that key was an 'a' or 'A' or 'á'. WM_CHAR does the necessary translations and tells you which a was meant. Now the problem is that both mechanisms seem very necessary that's why Windows generates WM_KEYDOWN AND WM_CHAR and not just one or the other. Often times in game programming you want to know when the a button or the tilde button was pressed. You don't want the computer to do dead keys and turn it into something else. I guess what I'm saying is that I would argue that the mapping should be WM_KEYDOWN -> osgGA::GUIEventAdapter::KEYDOWN and WM_KEYUP -> osgGA::GUIEventAdapter::KEYUP. There might need to be a separate mechanism for handling WM_CHAR. An example from the game side would be if you are playing DOOM and using 'a','w','s','d' for straffing, you want those buttons to work regardless of if someone hit the ~ or ^ previously or had the caps lock on, etc. Now if you are putting text into an edit box, then you want the ~ or ^... PS I'm no expert so what I'm saying could be misguided :) Thoughts? -Brad -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Jean-Sébastien Guay Sent: Thursday, September 16, 2010 11:35 AM To: [email protected] Subject: Re: [osg-users] Keypress broken since rev 11749 Hi Vivien, Thanks for replying, it's good to know why the change was needed. > I did it in order to fix an issue with dead keys that were not handled > correctly. Dead keys are used for key combination. For example in French > keyboard pressing '^' key then after that 'u' key should result in the > character 'û'. This was not working properly with osg. I didn't know that, I'm a native French speaker but I rarely use French when I use my computer (just how I've always done it) and I've never tried to use accented characters in an OSG app. I guess with osgWidget::Input now it becomes possible and desirable for some apps, so I understand the need for your change. If you were to make an OSG-based e-mail or IM client I would probably need to use accented characters in it too :-) > Now the real question is why you do not receive the event WM_CHAR on your > application. Any idea on that? Brad, how are you using the osgViewer::GraphicsWindowWin32? Is it in a normal osgViewer window? Is it in a Qt or other GUI toolkit window? If that's the case then perhaps the GUI toolkit is not redirecting all its Windows messages to the GraphicsWindow correctly? J-S -- ______________________________________________________ Jean-Sebastien Guay [email protected] http://www.cm-labs.com/ http://whitestar02.webhop.org/ _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

