Attached is a fix for remaining problems in capslock handling: It sets osgGA's keymask when restoring keys on FocusIn, according to the state values of XKeyEvent and XCrossingEvent. (These are the only source for X11's current capslock state that avoids pulling in the XKB extension.)
Files included in the archive: ./src/osgViewer/GraphicsWindowX11.cpp ./include/osgViewer/api/X11/GraphicsWindowX11 I hope you don't find yet another problem, but I won't hold my breath. Worked here at least in all my tests. :-) m.
Index: include/osgViewer/api/X11/GraphicsWindowX11
===================================================================
--- include/osgViewer/api/X11/GraphicsWindowX11 (revision 7947)
+++ include/osgViewer/api/X11/GraphicsWindowX11 (working copy)
@@ -166,6 +166,7 @@
void forceKey(int key, double time, bool state);
void getModifierMap(char* keymap) const;
int getModifierMask() const;
+ void syncCapsLock();
bool _valid;
Display* _display;
Index: src/osgViewer/GraphicsWindowX11.cpp
===================================================================
--- src/osgViewer/GraphicsWindowX11.cpp (revision 7943)
+++ src/osgViewer/GraphicsWindowX11.cpp (working copy)
@@ -1018,6 +1018,7 @@
case EnterNotify :
osg::notify(osg::INFO)<<"EnterNotify event received"<<std::endl;
_lockMask = ev.xcrossing.state & LockMask;
+ syncCapsLock();
break;
case KeymapNotify :
@@ -1030,6 +1031,7 @@
char modMap[32];
getModifierMap(modMap);
+ syncCapsLock();
// release normal (non-modifier) keys
for (unsigned int key = 8; key < 256; key++)
@@ -1340,6 +1342,20 @@
}
}
+void GraphicsWindowX11::syncCapsLock()
+{
+ unsigned int mask = getEventQueue()->getCurrentEventState()->getModKeyMask();
+ if (_lockMask)
+ {
+ mask |= osgGA::GUIEventAdapter::MODKEY_CAPS_LOCK;
+ }
+ else
+ {
+ mask &= ~osgGA::GUIEventAdapter::MODKEY_CAPS_LOCK;
+ }
+ getEventQueue()->getCurrentEventState()->setModKeyMask(mask);
+}
+
// Returns char[32] keymap with bits for every modifier key set.
void GraphicsWindowX11::getModifierMap(char* keymap) const
{
x11-capslockII.tar.gz
Description: application/tgz
_______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
