Changeset 8351 for code/trunk/src/external/ois/linux/LinuxKeyboard.cpp
- Timestamp:
- Apr 28, 2011, 7:15:14 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/external/ois/linux/LinuxKeyboard.cpp
r5781 r8351 33 33 #include <iostream> 34 34 //-------------------------------------------------------------------// 35 LinuxKeyboard::LinuxKeyboard(InputManager* creator, bool buffered, bool grab , bool useXRepeat)35 LinuxKeyboard::LinuxKeyboard(InputManager* creator, bool buffered, bool grab) 36 36 : Keyboard(creator->inputSystemName(), buffered, 0, creator) 37 37 { … … 43 43 grabKeyboard = grab; 44 44 keyFocusLost = false; 45 46 xAutoRepeat = useXRepeat;47 oldXAutoRepeat = false;48 45 49 46 //X Key Map to KeyCode … … 213 210 214 211 keyFocusLost = false; 215 216 if( xAutoRepeat == false )217 {218 //We do not want to blindly turn on autorepeat later when quiting if219 //it was not on to begin with.. So, let us check and see first220 XKeyboardState old;221 XGetKeyboardControl( display, &old );222 oldXAutoRepeat = false;223 224 if( old.global_auto_repeat == AutoRepeatModeOn )225 oldXAutoRepeat = true;226 227 XAutoRepeatOff( display );228 }229 212 } 230 213 … … 234 217 if( display ) 235 218 { 236 if( oldXAutoRepeat )237 XAutoRepeatOn(display);238 239 219 if( grabKeyboard ) 240 220 XUngrabKeyboard(display, CurrentTime); … … 303 283 304 284 while( XPending(display) > 0 ) 305 { XNextEvent(display, &event); if( KeyPress == event.type ) 285 { 286 XNextEvent(display, &event); 287 288 if(KeyPress == event.type) 306 289 { 307 290 unsigned int character = 0; 308 291 309 if( mTextMode != Off)292 if(mTextMode != Off) 310 293 { 311 294 unsigned char buffer[6] = {0,0,0,0,0,0}; … … 332 315 if( event.xkey.state & Mod1Mask && key == XK_Tab ) 333 316 linMan->_setGrabState(false); 334 } else if( KeyRelease == event.type ) 317 } 318 else if(KeyRelease == event.type) 335 319 { 336 //Mask out the modifier states X sets.. or we will get improper values 337 event.xkey.state &= ~ShiftMask; 338 event.xkey.state &= ~LockMask; 339 340 //Else, it is a valid key release 341 XLookupString(&event.xkey,NULL,0,&key,NULL); 342 _injectKeyUp(key); } 320 if(!_isKeyRepeat(event)) 321 { 322 //Mask out the modifier states X sets.. or we will get improper values 323 event.xkey.state &= ~ShiftMask; 324 event.xkey.state &= ~LockMask; 325 326 XLookupString(&event.xkey,NULL,0,&key,NULL); 327 _injectKeyUp(key); 328 } 329 } 343 330 } 344 331
Note: See TracChangeset
for help on using the changeset viewer.