From Melchoir Franz, "osgViewer toggled the NumLock state correctly when pressing the NumLock
key, but it didn't pick up the initial state. So, if NumLock was on for the OS at startup (LED on), it was still off for OSG. And the first keypress turned the LED off, and NumLock on for OSG. The attached fix picks up the state on every FocusIn, just like it was done in the last commits for CapsLock. The difference is, that the NumLock mask isn't standardized (e.g. 0x10 for Linux, and 0x80 for AIX), so we have to do a reverse lookup (::rescanModifierMapping()). Note that I could not reproduce the problem on my system, but someone else confirmed it twice on his, and the patch fixed it for him. Changed files: ./include/osgViewer/api/X11/GraphicsWindowX11 ./src/osgViewer/GraphicsWindowX11.cpp "
This commit is contained in:
@@ -47,7 +47,8 @@ class OSGVIEWER_EXPORT GraphicsWindowX11 : public osgViewer::GraphicsWindow
|
||||
_realized(false),
|
||||
_timeOfLastCheckEvents(-1.0),
|
||||
_lastEventType(0),
|
||||
_lockMask(0)
|
||||
_modifierState(0),
|
||||
_numLockMask(0)
|
||||
{
|
||||
_traits = traits;
|
||||
memset(_keyMap, 0, 32);
|
||||
@@ -164,9 +165,10 @@ class OSGVIEWER_EXPORT GraphicsWindowX11 : public osgViewer::GraphicsWindow
|
||||
void transformMouseXY(float& x, float& y);
|
||||
void adaptKey(XKeyEvent& keyevent, int& keySymbol);
|
||||
void forceKey(int key, double time, bool state);
|
||||
void rescanModifierMapping();
|
||||
void getModifierMap(char* keymap) const;
|
||||
int getModifierMask() const;
|
||||
void syncCapsLock();
|
||||
void syncLocks();
|
||||
|
||||
bool _valid;
|
||||
Display* _display;
|
||||
@@ -186,7 +188,8 @@ class OSGVIEWER_EXPORT GraphicsWindowX11 : public osgViewer::GraphicsWindow
|
||||
|
||||
double _timeOfLastCheckEvents;
|
||||
int _lastEventType;
|
||||
int _lockMask;
|
||||
int _modifierState;
|
||||
int _numLockMask;
|
||||
|
||||
char _keyMap[32];
|
||||
std::map<MouseCursor,Cursor> _mouseCursorMap;
|
||||
|
||||
Reference in New Issue
Block a user