Hi Franz,
I've reproduce the modified state problems with osgkeyboard, merged
your changes and confirmed that they fix the issue for the modified
keys, although caps lock is currently getting out of sync. I haven't
investigated the caps lock issue beyond a quick review of your changes
and GraphicsWindowX11.cpp, in this quick review I didn't spot anything
obvious out of place, so it might just be a case of adding further
detection/handling of this case.
One other item that needs resolving is the warning:
/home/robert/OpenSceneGraph/src/osgViewer/GraphicsWindowX11.cpp:1310:
warning: converting to 'Time' from 'double'
Which relates to:
event.time = time;
Where event.time is Time, and time is a double being passed into the
forceKey methods parameter. Here we see a clash between the OSG that
manages time in seconds, and X11 events which are in milliseconds.
The is a compatibility issue here where both and offset and scale is
required, X11 itself making it a bit awkward - I've had this problem
before, which is why there is crude code in
GraphicWindowX11::checkEvents() that tries to estimate the X11 Time
values since the last time of checking events to get a relative offset
that can be used when compute the seconds time of an event. Does this
make sense?
Robert.
On Tue, Feb 19, 2008 at 5:36 PM, Melchior FRANZ
<[EMAIL PROTECTED]> wrote:
> When switching virtual desktops or minimizing a window, keys
> remain in pressed state after revealing, even if they are no
> longer pressed on the keyboard. This can have bad effects,
> especially if the stuck keys are modifier keys. One has to
> press and release the stuck keys again to reset the wrong state.
>
> The fix keeps track of all key presses and releases. On FocusOut
> and UnmapNotify it releases all keys that are in pressed state,
> and on KeymapNotify (following a FocusIn), it sets the currently
> pressed keys again. To avoid confusion in the OSG-using application
> normal keys are always reported released /before/ and pressed
> /after/ modifier keys.
>
> As current key states are returned as char[32] keymap by
> XQueryKeymap and XKeymapEvent, this format is also used to
> recognize modifier keys and for maintaining the current
> internal key state. Functions to set/clear/query bits in
> such a keymap are added.
>
> The patch was extensively tested with osgkeyboard and
> FlightGear under KDE and fvwm2. It was not tested on a
> Xinerama setup or with multiple windows, but as _eventDisplay
> is used throughout, there should be no problems. The patch also
> makes the following changes:
>
> - removes old and obsolete handling of modifier keys in ::adaptKey().
> This wasn't only unused, but also wrong (and for that reason commented
> out in revision 7066). The modifier states are actually handled
> in ./src/osgGA/EventQueue.cpp (EventQueue::keyPress/keyRelease).
> - fixes some spelling
>
>
> The attached files are:
>
> ./src/osgViewer/GraphicsWindowX11.cpp
> ./include/osgViewer/api/X11/GraphicsWindowX11
>
> m.
>
> _______________________________________________
> 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