Changeset 12125
- Timestamp:
- 01/27/11 17:23:48 (2 years ago)
- Location:
- OpenSceneGraph/trunk
- Files:
-
- 9 modified
-
examples/osgkeyboard/osgkeyboard.cpp (modified) (8 diffs)
-
include/osgGA/EventQueue (modified) (1 diff)
-
include/osgGA/GUIEventAdapter (modified) (3 diffs)
-
include/osgViewer/api/Win32/GraphicsWindowWin32 (modified) (2 diffs)
-
include/osgViewer/api/X11/GraphicsWindowX11 (modified) (1 diff)
-
src/osgGA/EventQueue.cpp (modified) (3 diffs)
-
src/osgGA/GUIEventAdapter.cpp (modified) (2 diffs)
-
src/osgViewer/GraphicsWindowWin32.cpp (modified) (6 diffs)
-
src/osgViewer/GraphicsWindowX11.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgkeyboard/osgkeyboard.cpp
r8079 r12125 43 43 osg::Group* getScene() { return _scene.get(); } 44 44 45 void keyChange(int key, int value);45 void keyChange(int key, int virtualKey, int value); 46 46 47 47 protected: … … 50 50 51 51 osg::Switch* addKey(osg::Vec3& pos, int key,const std::string& text,float width, float height); 52 osg::Switch* addKey(int key,osg::Switch* sw);53 52 54 53 void createKeyboard(); … … 62 61 }; 63 62 64 void KeyboardModel::keyChange(int key, int value)63 void KeyboardModel::keyChange(int key, int virtualKey, int value) 65 64 { 66 65 osg::notify(osg::INFO) << "key value change, code="<<std::hex << key << "\t value="<< value << std::dec << std::endl; 67 66 68 67 // toggle the keys graphical representation on or off via osg::Swithc 69 KeyModelMap::iterator itr = _keyModelMap.find( key);68 KeyModelMap::iterator itr = _keyModelMap.find(virtualKey); 70 69 if (itr!=_keyModelMap.end()) 71 70 { … … 148 147 } 149 148 150 osg::Switch* KeyboardModel::addKey(int key,osg::Switch* sw)151 {152 _keyModelMap[key] = sw;153 return sw;154 }155 156 149 void KeyboardModel::createKeyboard() 157 150 { … … 176 169 177 170 addKey(pos,osgGA::GUIEventAdapter::KEY_Shift_L,"Shift",2.0f,0.5f); 178 addKey(pos, '\\',"\\",1.0f,1.0f);179 addKey( 'Z',addKey(pos,'z',"Z",1.0f,1.0f));180 addKey( 'X',addKey(pos,'x',"X",1.0f,1.0f));181 addKey( 'C',addKey(pos,'c',"C",1.0f,1.0f));182 addKey( 'V',addKey(pos,'v',"V",1.0f,1.0f));183 addKey( 'B',addKey(pos,'b',"B",1.0f,1.0f));184 addKey( 'N',addKey(pos,'n',"N",1.0f,1.0f));185 addKey( 'M',addKey(pos,'m',"M",1.0f,1.0f));186 addKey( '<',addKey(pos,',',",",1.0f,1.0f));187 addKey( '>',addKey(pos,'.',".",1.0f,1.0f));188 addKey( '?',addKey(pos,'/',"/",1.0f,1.0f));171 addKey(pos,osgGA::GUIEventAdapter::KEY_Backslash,"\\",1.0f,1.0f); 172 addKey(pos,osgGA::GUIEventAdapter::KEY_Z,"Z",1.0f,1.0f); 173 addKey(pos,osgGA::GUIEventAdapter::KEY_X,"X",1.0f,1.0f); 174 addKey(pos,osgGA::GUIEventAdapter::KEY_C,"C",1.0f,1.0f); 175 addKey(pos,osgGA::GUIEventAdapter::KEY_V,"V",1.0f,1.0f); 176 addKey(pos,osgGA::GUIEventAdapter::KEY_B,"B",1.0f,1.0f); 177 addKey(pos,osgGA::GUIEventAdapter::KEY_N,"N",1.0f,1.0f); 178 addKey(pos,osgGA::GUIEventAdapter::KEY_M,"M",1.0f,1.0f); 179 addKey(pos,osgGA::GUIEventAdapter::KEY_Comma,",",1.0f,1.0f); 180 addKey(pos,osgGA::GUIEventAdapter::KEY_Period,".",1.0f,1.0f); 181 addKey(pos,osgGA::GUIEventAdapter::KEY_Slash,"/",1.0f,1.0f); 189 182 addKey(pos,osgGA::GUIEventAdapter::KEY_Shift_R,"Shift",2.0f,0.5f); 190 183 … … 193 186 194 187 addKey(pos,osgGA::GUIEventAdapter::KEY_Caps_Lock,"Caps",2.0f,0.5f); 195 addKey( 'A',addKey(pos,'a',"A",1.0f,1.0f));196 addKey( 'S',addKey(pos,'s',"S",1.0f,1.0f));197 addKey( 'D',addKey(pos,'d',"D",1.0f,1.0f));198 addKey( 'F',addKey(pos,'f',"F",1.0f,1.0f));199 addKey( 'G',addKey(pos,'g',"G",1.0f,1.0f));200 addKey( 'H',addKey(pos,'h',"H",1.0f,1.0f));201 addKey( 'J',addKey(pos,'j',"J",1.0f,1.0f));202 addKey( 'K',addKey(pos,'k',"K",1.0f,1.0f));203 addKey( 'L',addKey(pos,'l',"L",1.0f,1.0f));204 addKey( ':',addKey(pos,';',";",1.0f,1.0f));205 addKey( '@',addKey(pos,'\'',"'",1.0f,1.0f));206 addKey( '~',addKey(pos,'#',"#",1.0f,1.0f));188 addKey(pos,osgGA::GUIEventAdapter::KEY_A,"A",1.0f,1.0f); 189 addKey(pos,osgGA::GUIEventAdapter::KEY_S,"S",1.0f,1.0f); 190 addKey(pos,osgGA::GUIEventAdapter::KEY_D,"D",1.0f,1.0f); 191 addKey(pos,osgGA::GUIEventAdapter::KEY_F,"F",1.0f,1.0f); 192 addKey(pos,osgGA::GUIEventAdapter::KEY_G,"G",1.0f,1.0f); 193 addKey(pos,osgGA::GUIEventAdapter::KEY_H,"H",1.0f,1.0f); 194 addKey(pos,osgGA::GUIEventAdapter::KEY_J,"J",1.0f,1.0f); 195 addKey(pos,osgGA::GUIEventAdapter::KEY_K,"K",1.0f,1.0f); 196 addKey(pos,osgGA::GUIEventAdapter::KEY_L,"L",1.0f,1.0f); 197 addKey(pos,osgGA::GUIEventAdapter::KEY_Semicolon,";",1.0f,1.0f); 198 addKey(pos,osgGA::GUIEventAdapter::KEY_Quote,"'",1.0f,1.0f); 199 addKey(pos,osgGA::GUIEventAdapter::KEY_Hash,"#",1.0f,1.0f); 207 200 addKey(pos,osgGA::GUIEventAdapter::KEY_Return,"Return",4.0f,0.5f); 208 201 … … 211 204 212 205 addKey(pos,osgGA::GUIEventAdapter::KEY_Tab,"Tab",2.0f,0.5f); 213 addKey( 'Q',addKey(pos,'q',"Q",1.0f,1.0f));214 addKey( 'W',addKey(pos,'w',"W",1.0f,1.0f));215 addKey( 'E',addKey(pos,'e',"E",1.0f,1.0f));216 addKey( 'R',addKey(pos,'r',"R",1.0f,1.0f));217 addKey( 'T',addKey(pos,'t',"T",1.0f,1.0f));218 addKey( 'Y',addKey(pos,'y',"Y",1.0f,1.0f));219 addKey( 'U',addKey(pos,'u',"U",1.0f,1.0f));220 addKey( 'I',addKey(pos,'i',"I",1.0f,1.0f));221 addKey( 'O',addKey(pos,'o',"O",1.0f,1.0f));222 addKey( 'P',addKey(pos,'p',"P",1.0f,1.0f));223 addKey( '{',addKey(pos,'[',"[",1.0f,1.0f));224 addKey( '}',addKey(pos,']',"]",1.0f,1.0f));206 addKey(pos,osgGA::GUIEventAdapter::KEY_Q,"Q",1.0f,1.0f); 207 addKey(pos,osgGA::GUIEventAdapter::KEY_W,"W",1.0f,1.0f); 208 addKey(pos,osgGA::GUIEventAdapter::KEY_E,"E",1.0f,1.0f); 209 addKey(pos,osgGA::GUIEventAdapter::KEY_R,"R",1.0f,1.0f); 210 addKey(pos,osgGA::GUIEventAdapter::KEY_T,"T",1.0f,1.0f); 211 addKey(pos,osgGA::GUIEventAdapter::KEY_Y,"Y",1.0f,1.0f); 212 addKey(pos,osgGA::GUIEventAdapter::KEY_U,"U",1.0f,1.0f); 213 addKey(pos,osgGA::GUIEventAdapter::KEY_I,"I",1.0f,1.0f); 214 addKey(pos,osgGA::GUIEventAdapter::KEY_O,"O",1.0f,1.0f); 215 addKey(pos,osgGA::GUIEventAdapter::KEY_P,"P",1.0f,1.0f); 216 addKey(pos,osgGA::GUIEventAdapter::KEY_Leftbracket,"[",1.0f,1.0f); 217 addKey(pos,osgGA::GUIEventAdapter::KEY_Rightbracket,"]",1.0f,1.0f); 225 218 226 219 pos.x() = 0.0f; 227 220 pos.z() += 1.0f; 228 221 229 addKey(pos, '`',"`",1.0f,1.0f);230 addKey(pos, '1',"1",1.0f,1.0f);231 addKey(pos, '2',"2",1.0f,1.0f);232 addKey(pos, '3',"3",1.0f,1.0f);233 addKey(pos, '4',"4",1.0f,1.0f);234 addKey(pos, '5',"5",1.0f,1.0f);235 addKey(pos, '6',"6",1.0f,1.0f);236 addKey(pos, '7',"7",1.0f,1.0f);237 addKey(pos, '8',"8",1.0f,1.0f);238 addKey(pos, '9',"9",1.0f,1.0f);239 addKey(pos, '0',"0",1.0f,1.0f);240 addKey(pos, '-',"-",1.0f,1.0f);241 addKey(pos, '=',"=",1.0f,1.0f);222 addKey(pos,osgGA::GUIEventAdapter::KEY_Backquote,"`",1.0f,1.0f); 223 addKey(pos,osgGA::GUIEventAdapter::KEY_1,"1",1.0f,1.0f); 224 addKey(pos,osgGA::GUIEventAdapter::KEY_2,"2",1.0f,1.0f); 225 addKey(pos,osgGA::GUIEventAdapter::KEY_3,"3",1.0f,1.0f); 226 addKey(pos,osgGA::GUIEventAdapter::KEY_4,"4",1.0f,1.0f); 227 addKey(pos,osgGA::GUIEventAdapter::KEY_5,"5",1.0f,1.0f); 228 addKey(pos,osgGA::GUIEventAdapter::KEY_6,"6",1.0f,1.0f); 229 addKey(pos,osgGA::GUIEventAdapter::KEY_7,"7",1.0f,1.0f); 230 addKey(pos,osgGA::GUIEventAdapter::KEY_8,"8",1.0f,1.0f); 231 addKey(pos,osgGA::GUIEventAdapter::KEY_9,"9",1.0f,1.0f); 232 addKey(pos,osgGA::GUIEventAdapter::KEY_0,"0",1.0f,1.0f); 233 addKey(pos,osgGA::GUIEventAdapter::KEY_Minus,"-",1.0f,1.0f); 234 addKey(pos,osgGA::GUIEventAdapter::KEY_Equals,"=",1.0f,1.0f); 242 235 addKey(pos,osgGA::GUIEventAdapter::KEY_BackSpace,"Backspace",3.0f,0.5f); 243 236 … … 406 399 case(osgGA::GUIEventAdapter::KEYDOWN): 407 400 { 408 _keyboardModel->keyChange(ea.getKey(), 1);401 _keyboardModel->keyChange(ea.getKey(), ea.getUnmodifiedKey(),1); 409 402 return true; 410 403 } 411 404 case(osgGA::GUIEventAdapter::KEYUP): 412 405 { 413 _keyboardModel->keyChange(ea.getKey(), 0);406 _keyboardModel->keyChange(ea.getKey(), ea.getUnmodifiedKey(),0); 414 407 return true; 415 408 } -
OpenSceneGraph/trunk/include/osgGA/EventQueue
r11934 r12125 147 147 148 148 /** Method for adapting keyboard press events. Note, special keys such as Ctrl/Function keys should be adapted to GUIEventAdapter::KeySymbol mappings.*/ 149 void keyPress(int key ) { keyPress(key, getTime()); }149 void keyPress(int key, int unmodifiedKey = 0) { keyPress(key, getTime(), unmodifiedKey); } 150 150 151 151 /** Method for adapting keyboard press events. Note, special keys such as Ctrl/Function keys should be adapted to GUIEventAdapter::KeySymbol mappings, with specified time.*/ 152 void keyPress(int key, double time );152 void keyPress(int key, double time, int unmodifiedKey = 0); 153 153 154 154 155 155 /** Method for adapting keyboard press events. Note, special keys such as Ctrl/Function keys should be adapted to GUIEventAdapter::KeySymbol mappings.*/ 156 void keyRelease(int key ) { keyRelease(key, getTime()); }156 void keyRelease(int key, int unmodifiedKey = 0) { keyRelease(key, getTime(), unmodifiedKey); } 157 157 158 158 /** Method for adapting keyboard press events. Note, special keys such as Ctrl/Function keys should be adapted to GUIEventAdapter::KeySymbol mappings, with specified time.*/ 159 void keyRelease(int key, double time );159 void keyRelease(int key, double time, int unmodifiedKey = 0); 160 160 161 161 GUIEventAdapter* touchBegan(unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, double time); -
OpenSceneGraph/trunk/include/osgGA/GUIEventAdapter
r11938 r12125 59 59 { 60 60 KEY_Space = 0x20, 61 61 62 KEY_0 = '0', 63 KEY_1 = '1', 64 KEY_2 = '2', 65 KEY_3 = '3', 66 KEY_4 = '4', 67 KEY_5 = '5', 68 KEY_6 = '6', 69 KEY_7 = '7', 70 KEY_8 = '8', 71 KEY_9 = '9', 72 KEY_A = 'a', 73 KEY_B = 'b', 74 KEY_C = 'c', 75 KEY_D = 'd', 76 KEY_E = 'e', 77 KEY_F = 'f', 78 KEY_G = 'g', 79 KEY_H = 'h', 80 KEY_I = 'i', 81 KEY_J = 'j', 82 KEY_K = 'k', 83 KEY_L = 'l', 84 KEY_M = 'm', 85 KEY_N = 'n', 86 KEY_O = 'o', 87 KEY_P = 'p', 88 KEY_Q = 'q', 89 KEY_R = 'r', 90 KEY_S = 's', 91 KEY_T = 't', 92 KEY_U = 'u', 93 KEY_V = 'v', 94 KEY_W = 'w', 95 KEY_X = 'x', 96 KEY_Y = 'y', 97 KEY_Z = 'z', 98 99 KEY_Exclaim = 0x21, 100 KEY_Quotedbl = 0x22, 101 KEY_Hash = 0x23, 102 KEY_Dollar = 0x24, 103 KEY_Ampersand = 0x26, 104 KEY_Quote = 0x27, 105 KEY_Leftparen = 0x28, 106 KEY_Rightparen = 0x29, 107 KEY_Asterisk = 0x2A, 108 KEY_Plus = 0x2B, 109 KEY_Comma = 0x2C, 110 KEY_Minus = 0x2D, 111 KEY_Period = 0x2E, 112 KEY_Slash = 0x2F, 113 KEY_Colon = 0x3A, 114 KEY_Semicolon = 0x3B, 115 KEY_Less = 0x3C, 116 KEY_Equals = 0x3D, 117 KEY_Greater = 0x3E, 118 KEY_Question = 0x3F, 119 KEY_At = 0x40, 120 KEY_Leftbracket = 0x5B, 121 KEY_Backslash = 0x5C, 122 KEY_Rightbracket = 0x5D, 123 KEY_Caret = 0x5E, 124 KEY_Underscore = 0x5F, 125 KEY_Backquote = 0x60, 126 62 127 KEY_BackSpace = 0xFF08, /* back space, back char */ 63 128 KEY_Tab = 0xFF09, … … 375 440 virtual int getKey() const { return _key; } 376 441 442 /** set virtual key pressed. */ 443 void setUnmodifiedKey(int key) { _unmodifiedKey = key; } 444 445 /** get virtual key pressed. */ 446 int getUnmodifiedKey() const { return _unmodifiedKey; } 447 377 448 /** set button pressed/released.*/ 378 449 void setButton(int button) { _button = button; } … … 520 591 int _windowHeight; 521 592 int _key; 593 int _unmodifiedKey; 522 594 int _button; 523 595 float _Xmin,_Xmax; -
OpenSceneGraph/trunk/include/osgViewer/api/Win32/GraphicsWindowWin32
r11773 r12125 136 136 bool setPixelFormat(); 137 137 138 void adaptKey( WPARAM wParam, LPARAM lParam, int& keySymbol, unsigned int& modifierMask );138 void adaptKey( WPARAM wParam, LPARAM lParam, int& keySymbol, unsigned int& modifierMask, int& unmodifiedKeySymbol ); 139 139 140 140 void transformMouseXY(float& x, float& y); … … 179 179 std::map<MouseCursor,HCURSOR> _mouseCursorMap; 180 180 181 std::map< int, bool> _keyMap;181 std::map<std::pair<int, int>, bool> _keyMap; 182 182 183 183 bool _applyWorkaroundForMultimonitorMultithreadNVidiaWin32Issues; -
OpenSceneGraph/trunk/include/osgViewer/api/X11/GraphicsWindowX11
r12079 r12125 164 164 165 165 void transformMouseXY(float& x, float& y); 166 void adaptKey(XKeyEvent& keyevent, int& keySymbol );166 void adaptKey(XKeyEvent& keyevent, int& keySymbol, int& unmodifiedKeySymbol); 167 167 void forceKey(int key, double time, bool state); 168 168 void rescanModifierMapping(); -
OpenSceneGraph/trunk/src/osgGA/EventQueue.cpp
r11934 r12125 275 275 } 276 276 277 void EventQueue::keyPress(int key, double time )277 void EventQueue::keyPress(int key, double time, int unmodifiedKey) 278 278 { 279 279 switch(key) … … 313 313 event->setEventType(GUIEventAdapter::KEYDOWN); 314 314 event->setKey(key); 315 event->setTime(time); 316 317 addEvent(event); 318 } 319 320 void EventQueue::keyRelease(int key, double time) 315 event->setUnmodifiedKey(unmodifiedKey); 316 event->setTime(time); 317 318 addEvent(event); 319 } 320 321 void EventQueue::keyRelease(int key, double time, int unmodifiedKey) 321 322 { 322 323 switch(key) … … 340 341 event->setEventType(GUIEventAdapter::KEYUP); 341 342 event->setKey(key); 343 event->setUnmodifiedKey(unmodifiedKey); 342 344 event->setTime(time); 343 345 -
OpenSceneGraph/trunk/src/osgGA/GUIEventAdapter.cpp
r11934 r12125 32 32 _windowHeight(1024), 33 33 _key(0), 34 _unmodifiedKey(0), 34 35 _button(0), 35 36 _Xmin(-1.0), … … 58 59 _windowHeight(rhs._windowHeight), 59 60 _key(rhs._key), 61 _unmodifiedKey(rhs._unmodifiedKey), 60 62 _button(rhs._button), 61 63 _Xmin(rhs._Xmin), -
OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowWin32.cpp
r11812 r12125 402 402 _keymap[VK_F11 ] = osgGA::GUIEventAdapter::KEY_F11; 403 403 _keymap[VK_F12 ] = osgGA::GUIEventAdapter::KEY_F12; 404 _keymap[0xc0 ] = '`';405 _keymap['0' ] = '0';406 _keymap['1' ] = '1';407 _keymap['2' ] = '2';408 _keymap['3' ] = '3';409 _keymap['4' ] = '4';410 _keymap['5' ] = '5';411 _keymap['6' ] = '6';412 _keymap['7' ] = '7';413 _keymap['8' ] = '8';414 _keymap['9' ] = '9';415 _keymap[0xbd ] = '-';416 _keymap[0xbb ] = '=';404 _keymap[0xc0 ] = osgGA::GUIEventAdapter::KEY_Backquote; 405 _keymap['0' ] = osgGA::GUIEventAdapter::KEY_0; 406 _keymap['1' ] = osgGA::GUIEventAdapter::KEY_1; 407 _keymap['2' ] = osgGA::GUIEventAdapter::KEY_2; 408 _keymap['3' ] = osgGA::GUIEventAdapter::KEY_3; 409 _keymap['4' ] = osgGA::GUIEventAdapter::KEY_4; 410 _keymap['5' ] = osgGA::GUIEventAdapter::KEY_5; 411 _keymap['6' ] = osgGA::GUIEventAdapter::KEY_6; 412 _keymap['7' ] = osgGA::GUIEventAdapter::KEY_7; 413 _keymap['8' ] = osgGA::GUIEventAdapter::KEY_8; 414 _keymap['9' ] = osgGA::GUIEventAdapter::KEY_9; 415 _keymap[0xbd ] = osgGA::GUIEventAdapter::KEY_Minus; 416 _keymap[0xbb ] = osgGA::GUIEventAdapter::KEY_Equals; 417 417 _keymap[VK_BACK ] = osgGA::GUIEventAdapter::KEY_BackSpace; 418 418 _keymap[VK_TAB ] = osgGA::GUIEventAdapter::KEY_Tab; 419 _keymap['A' ] = 'A';420 _keymap['B' ] = 'B';421 _keymap['C' ] = 'C';422 _keymap['D' ] = 'D';423 _keymap['E' ] = 'E';424 _keymap['F' ] = 'F';425 _keymap['G' ] = 'G';426 _keymap['H' ] = 'H';427 _keymap['I' ] = 'I';428 _keymap['J' ] = 'J';429 _keymap['K' ] = 'K';430 _keymap['L' ] = 'L';431 _keymap['M' ] = 'M';432 _keymap['N' ] = 'N';433 _keymap['O' ] = 'O';434 _keymap['P' ] = 'P';435 _keymap['Q' ] = 'Q';436 _keymap['R' ] = 'R';437 _keymap['S' ] = 'S';438 _keymap['T' ] = 'T';439 _keymap['U' ] = 'U';440 _keymap['V' ] = 'V';441 _keymap['W' ] = 'W';442 _keymap['X' ] = 'X';443 _keymap['Y' ] = 'Y';444 _keymap['Z' ] = 'Z';445 _keymap[0xdb ] = '[';446 _keymap[0xdd ] = ']';447 _keymap[0xdc ] = '\\';419 _keymap['A' ] = osgGA::GUIEventAdapter::KEY_A; 420 _keymap['B' ] = osgGA::GUIEventAdapter::KEY_B; 421 _keymap['C' ] = osgGA::GUIEventAdapter::KEY_C; 422 _keymap['D' ] = osgGA::GUIEventAdapter::KEY_D; 423 _keymap['E' ] = osgGA::GUIEventAdapter::KEY_E; 424 _keymap['F' ] = osgGA::GUIEventAdapter::KEY_F; 425 _keymap['G' ] = osgGA::GUIEventAdapter::KEY_G; 426 _keymap['H' ] = osgGA::GUIEventAdapter::KEY_H; 427 _keymap['I' ] = osgGA::GUIEventAdapter::KEY_I; 428 _keymap['J' ] = osgGA::GUIEventAdapter::KEY_J; 429 _keymap['K' ] = osgGA::GUIEventAdapter::KEY_K; 430 _keymap['L' ] = osgGA::GUIEventAdapter::KEY_L; 431 _keymap['M' ] = osgGA::GUIEventAdapter::KEY_M; 432 _keymap['N' ] = osgGA::GUIEventAdapter::KEY_N; 433 _keymap['O' ] = osgGA::GUIEventAdapter::KEY_O; 434 _keymap['P' ] = osgGA::GUIEventAdapter::KEY_P; 435 _keymap['Q' ] = osgGA::GUIEventAdapter::KEY_Q; 436 _keymap['R' ] = osgGA::GUIEventAdapter::KEY_R; 437 _keymap['S' ] = osgGA::GUIEventAdapter::KEY_S; 438 _keymap['T' ] = osgGA::GUIEventAdapter::KEY_T; 439 _keymap['U' ] = osgGA::GUIEventAdapter::KEY_U; 440 _keymap['V' ] = osgGA::GUIEventAdapter::KEY_V; 441 _keymap['W' ] = osgGA::GUIEventAdapter::KEY_W; 442 _keymap['X' ] = osgGA::GUIEventAdapter::KEY_X; 443 _keymap['Y' ] = osgGA::GUIEventAdapter::KEY_Y; 444 _keymap['Z' ] = osgGA::GUIEventAdapter::KEY_Z; 445 _keymap[0xdb ] = osgGA::GUIEventAdapter::KEY_Leftbracket; 446 _keymap[0xdd ] = osgGA::GUIEventAdapter::KEY_Rightbracket; 447 _keymap[0xdc ] = osgGA::GUIEventAdapter::KEY_Backslash; 448 448 _keymap[VK_CAPITAL ] = osgGA::GUIEventAdapter::KEY_Caps_Lock; 449 _keymap[0xba ] = ';';450 _keymap[0xde ] = '\'';449 _keymap[0xba ] = osgGA::GUIEventAdapter::KEY_Semicolon; 450 _keymap[0xde ] = osgGA::GUIEventAdapter::KEY_Quote; 451 451 _keymap[VK_RETURN ] = osgGA::GUIEventAdapter::KEY_Return; 452 452 _keymap[VK_LSHIFT ] = osgGA::GUIEventAdapter::KEY_Shift_L; 453 _keymap[0xbc ] = ',';454 _keymap[0xbe ] = '.';455 _keymap[0xbf ] = '/';453 _keymap[0xbc ] = osgGA::GUIEventAdapter::KEY_Comma; 454 _keymap[0xbe ] = osgGA::GUIEventAdapter::KEY_Period; 455 _keymap[0xbf ] = osgGA::GUIEventAdapter::KEY_Slash; 456 456 _keymap[VK_RSHIFT ] = osgGA::GUIEventAdapter::KEY_Shift_R; 457 457 _keymap[VK_LCONTROL ] = osgGA::GUIEventAdapter::KEY_Control_L; 458 458 _keymap[VK_LWIN ] = osgGA::GUIEventAdapter::KEY_Super_L; 459 _keymap[VK_SPACE ] = ' ';459 _keymap[VK_SPACE ] = osgGA::GUIEventAdapter::KEY_Space; 460 460 _keymap[VK_LMENU ] = osgGA::GUIEventAdapter::KEY_Alt_L; 461 461 _keymap[VK_RMENU ] = osgGA::GUIEventAdapter::KEY_Alt_R; … … 2238 2238 } 2239 2239 2240 void GraphicsWindowWin32::adaptKey( WPARAM wParam, LPARAM lParam, int& keySymbol, unsigned int& modifierMask )2240 void GraphicsWindowWin32::adaptKey( WPARAM wParam, LPARAM lParam, int& keySymbol, unsigned int& modifierMask, int& unmodifiedKeySymbol) 2241 2241 { 2242 2242 modifierMask = 0; … … 2304 2304 keySymbol = osgGA::GUIEventAdapter::KEY_KP_Enter; 2305 2305 } 2306 else if ((keySymbol & 0xff00)==0) 2306 2307 unmodifiedKeySymbol = keySymbol; 2308 2309 if ((keySymbol & 0xff00)==0) 2307 2310 { 2308 2311 char asciiKey[2]; … … 2480 2483 { 2481 2484 int keySymbol = 0; 2485 int unmodifiedKeySymbol = 0; 2482 2486 unsigned int modifierMask = 0; 2483 adaptKey(wParam, lParam, keySymbol, modifierMask );2484 _keyMap[ keySymbol] = true;2487 adaptKey(wParam, lParam, keySymbol, modifierMask, unmodifiedKeySymbol); 2488 _keyMap[std::make_pair(keySymbol,unmodifiedKeySymbol)] = true; 2485 2489 //getEventQueue()->getCurrentEventState()->setModKeyMask(modifierMask); 2486 getEventQueue()->keyPress(keySymbol, eventTime );2490 getEventQueue()->keyPress(keySymbol, eventTime, unmodifiedKeySymbol); 2487 2491 } 2488 2492 break; … … 2495 2499 { 2496 2500 int keySymbol = 0; 2501 int unmodifiedKeySymbol = 0; 2497 2502 unsigned int modifierMask = 0; 2498 adaptKey(wParam, lParam, keySymbol, modifierMask );2499 _keyMap[ keySymbol] = false;2503 adaptKey(wParam, lParam, keySymbol, modifierMask, unmodifiedKeySymbol); 2504 _keyMap[std::make_pair(keySymbol, unmodifiedKeySymbol)] = false; 2500 2505 //getEventQueue()->getCurrentEventState()->setModKeyMask(modifierMask); 2501 getEventQueue()->keyRelease(keySymbol, eventTime );2506 getEventQueue()->keyRelease(keySymbol, eventTime, unmodifiedKeySymbol); 2502 2507 } 2503 2508 break; … … 2539 2544 2540 2545 // Release all keys that were pressed when the window lost focus. 2541 for (std::map< int, bool>::iterator key = _keyMap.begin();2546 for (std::map<std::pair<int, int>, bool>::iterator key = _keyMap.begin(); 2542 2547 key != _keyMap.end(); ++key) 2543 2548 { 2544 2549 if (key->second) 2545 2550 { 2546 getEventQueue()->keyRelease(key->first );2551 getEventQueue()->keyRelease(key->first.first, key->first.second); 2547 2552 key->second = false; 2548 2553 } -
OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowX11.cpp
r12003 r12125 1415 1415 keyMapSetKey(_keyMap, ev.xkey.keycode); 1416 1416 int keySymbol = 0; 1417 adaptKey(ev.xkey, keySymbol); 1418 1419 getEventQueue()->keyPress(keySymbol, eventTime); 1417 int unmodifiedKeySymbol = 0; 1418 adaptKey(ev.xkey, keySymbol, unmodifiedKeySymbol); 1419 1420 getEventQueue()->keyPress(keySymbol, eventTime, unmodifiedKeySymbol); 1420 1421 break; 1421 1422 } … … 1446 1447 keyMapClearKey(_keyMap, ev.xkey.keycode); 1447 1448 int keySymbol = 0; 1448 adaptKey(ev.xkey, keySymbol); 1449 int unmodifiedKeySymbol = 0; 1450 adaptKey(ev.xkey, keySymbol, unmodifiedKeySymbol); 1449 1451 1450 getEventQueue()->keyRelease(keySymbol, eventTime );1452 getEventQueue()->keyRelease(keySymbol, eventTime, unmodifiedKeySymbol); 1451 1453 break; 1452 1454 } … … 1519 1521 } 1520 1522 1521 void GraphicsWindowX11::adaptKey(XKeyEvent& keyevent, int& keySymbol )1523 void GraphicsWindowX11::adaptKey(XKeyEvent& keyevent, int& keySymbol, int& unmodifiedKeySymbol) 1522 1524 { 1523 1525 unsigned char buffer_return[32]; … … 1531 1533 keySymbol = buffer_return[0]; 1532 1534 } 1535 1536 unmodifiedKeySymbol = XKeycodeToKeysym(keyevent.display, keyevent.keycode, 0); 1533 1537 } 1534 1538 … … 1554 1558 1555 1559 int keySymbol = 0; 1560 int unmodifiedKeySymbol = 0; 1556 1561 if (state) 1557 1562 { 1558 1563 event.type = KeyPress; 1559 adaptKey(event, keySymbol );1560 getEventQueue()->keyPress(keySymbol, time );1564 adaptKey(event, keySymbol, unmodifiedKeySymbol); 1565 getEventQueue()->keyPress(keySymbol, time, unmodifiedKeySymbol); 1561 1566 keyMapSetKey(_keyMap, key); 1562 1567 } … … 1564 1569 { 1565 1570 event.type = KeyRelease; 1566 adaptKey(event, keySymbol );1567 getEventQueue()->keyRelease(keySymbol, time );1571 adaptKey(event, keySymbol, unmodifiedKeySymbol); 1572 getEventQueue()->keyRelease(keySymbol, time, unmodifiedKeySymbol); 1568 1573 keyMapClearKey(_keyMap, key); 1569 1574 }
