Hi JS,

I would say that it makes sense to release the keys when the window loses
focus or is deactivated.  This would help avoid the issues like Melchior was
talking about where an action key is left down when the window loses focus.
http://msdn.microsoft.com/en-us/library/ms646274(VS.85).aspx has information
about the WM_ACTIVATE event and
http://msdn.microsoft.com/en-us/library/ms646282(VS.85).aspx has info about
the WM_KILLFOCUS event which I think is where it would be most appropriate.

Thanks!

Jason

On Thu, Jul 31, 2008 at 8:35 AM, Jean-Sébastien Guay <
[EMAIL PROTECTED]> wrote:

> Hello Franz,
>
>  When you start the example on a machine with two monitors,
>>>
>>
>> I'll try if you send me some.  ;-)
>>
>
> Hehehe :-)
>
>  Yes, but I'm "unpressing" the key when the mouse leaves the first
>> window, so I don't think it can get stuck on X11. In my naivety
>> I'd expect that the X11 version doesn't have problems with multiple
>> windows. Now, multiple keyboards are a different matter. But I
>> might be missing something ...
>>
>
> Ah yes, the X11 code checks when focus leaves the window whereas mine
> checks when focus comes back to the window.
>
> But how does that work with Alt-Tab for example? When the focus leaves the
> app, the alt key is still pressed (physically)...
>
> I also considered whether it was right to release keys when focus leaves
> the app or when it comes back. If I'm driving a vehicle forward, pressing
> the up-arrow key, and some other app steals focus (as apps like to do on
> Windows... :-( ), do I want the vehicle to continue moving forward or to
> stop? I'm not sure there's one general answer... So I might just do it like
> you did (when focus leaves) if I can find out how to make it work.
>
>  Yes, but I'm only releasing the keys that are still considered in
>> pressed state, but reportedly aren't. I'm not force-releasing
>> every key. But you said that you can't do that on Win32, so
>> that's indeed a problem.
>>
>
> Well, yes I can and I do, but since my handler is called when focus comes
> back to the window, it doesn't necessarily come back to the same window if
> the app has multiple windows.
>
> Anyways, I think the fix is still valid as it fixes it in all but a few
> special cases. I can continue trying to get something that works in all
> cases, but that could take some time.
>
> I considered another possibility:
>
> I found out that when focus comes back to the app, I don't need to send
> keyPress events for keys that are pressed in reality but which the app
> doesn't think are (presumably because of keyboard repeat or something like
> that). So what I could do is that when focus leaves the app, I could just
> release all keys. When focus comes back, the keys that are pressed in
> reality would send events and all would be well, no keys would be stuck.
>
> What do you think? Thanks,
>
> 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

Reply via email to