Control: retitle -1 osg+xfce: Shift key release event unrecognized
Control: reassign -1 src:openscenegraph src:xfce4-settings
Control: tags -1 patch

In Ubuntu 14.04, the Xfce desktop has this bug but the default Unity desktop doesn't; I have not tested the other desktops.

The key release event _is_ reaching openscenegraph, but with a changed key code that causes it to not be recognised; as unmodifiedKey is not affected, the immediate fix would be the attached (untested), but I'm not sure if this should be considered an openscenegraph bug or an Xfce bug.

(gdb) dprintf osgGA/EventQueue.cpp:383,"release %i %i, modstate %i",key,unmodifiedKey,_accumulateEventState._ptr->_modKeyMask (gdb) dprintf osgGA/EventQueue.cpp:339,"press %i %i, modstate %i",key,unmodifiedKey,_accumulateEventState._ptr->_modKeyMask
[...]
press 115 115, modstate 0release 115 115, modstate 0press 99 99, modstate 0release 99 99, modstate 0press 99 99, modstate 0release 99 99, modstate 0press 65507 65507, modstate 0press 19 115, modstate 4release 19 115, modstate 4release 65507 65507, modstate 4press 65505 65505, modstate 0press 83 115, modstate 1release 83 115, modstate 1release 65034 65505, modstate 1press 100 100, modstate 1release 100 100, modstate 1press 65505 65505, modstate 1release 65034 65505, modstate 1press 65506 65506, modstate 1release 65032 65506, modstate 3press 98 98, modstate 3release 98 98, modstate 3press 65507 65507, modstate 3release 65507 65507, modstate 7press 65515 65515, modstate 3release 65515 65515, modstate 259press 65505 65505, modstate 3press 65515 65515, modstate 3release 65515 65515, modstate 259release 65034 65505, modstate 3press 65507 65507, modstate 3press 65505 65505, modstate 7release 65034 65505, modstate 7release 65507 65507, modstate 7press 65505 65505, modstate 3press 65032 65506, modstate 3release 65034 65505, modstate 3release 65032 65506, modstate 3press 65505 65505, modstate 3release 65034 65505, modstate 3press 65506 65506, modstate 3release 65032 65506, modstate 3cpress 99 99, modstate 3release 99 99, modstate 3press 65505 65505, modstate 3press 67 99, modstate 3release 67 99, modstate 3release 65034 65505, modstate 3

(65505(1),65506(2),65507(4)=OpenSceneGraph key codes (modkey masks) for left Shift, right Shift, left Ctrl: see include/osgGA/GUIEventAdapter. The conversion from X key codes is in src/osgViewer/GraphicsWindowX11.cpp)
Description: Fix "stuck" shift key

Some settings of the Xfce keyboard layout switcher change the key code of
shift key release events, causing OSG to not recognise them.
Work around this by using the unmodifiedKey code instead.

Author: Rebecca Palmer
Bug-Debian: http://bugs.debian.org/687332
Forwarded: no
--- openscenegraph-3.2.0~rc1.orig/OpenSceneGraph/src/osgGA/EventQueue.cpp
+++ openscenegraph-3.2.0~rc1/OpenSceneGraph/src/osgGA/EventQueue.cpp
@@ -337,7 +337,7 @@ void EventQueue::mouseButtonRelease(floa
 
 void EventQueue::keyPress(int key, double time, int unmodifiedKey)
 {
-    switch(key)
+    switch(unmodifiedKey)
     {
         case(GUIEventAdapter::KEY_Shift_L):      _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_LEFT_SHIFT | _accumulateEventState->getModKeyMask()); break;
         case(GUIEventAdapter::KEY_Shift_R):      _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_RIGHT_SHIFT | _accumulateEventState->getModKeyMask()); break;
@@ -381,7 +381,7 @@ void EventQueue::keyPress(int key, doubl
 
 void EventQueue::keyRelease(int key, double time, int unmodifiedKey)
 {
-    switch(key)
+    switch(unmodifiedKey)
     {
         case(GUIEventAdapter::KEY_Shift_L):      _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_LEFT_SHIFT & _accumulateEventState->getModKeyMask()); break;
         case(GUIEventAdapter::KEY_Shift_R):      _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_RIGHT_SHIFT & _accumulateEventState->getModKeyMask()); break;

Reply via email to