Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 7, 2010, 8:21:33 PM (14 years ago)
Author:
rgrieder
Message:

Updated OIS source files to its current SVN trunk (r26).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ois_update/src/external/ois/linux/LinuxKeyboard.cpp

    r5781 r7506  
    3333#include <iostream>
    3434//-------------------------------------------------------------------//
    35 LinuxKeyboard::LinuxKeyboard(InputManager* creator, bool buffered, bool grab, bool useXRepeat)
     35LinuxKeyboard::LinuxKeyboard(InputManager* creator, bool buffered, bool grab)
    3636        : Keyboard(creator->inputSystemName(), buffered, 0, creator)
    3737{
     
    4343        grabKeyboard = grab;
    4444        keyFocusLost = false;
    45 
    46         xAutoRepeat = useXRepeat;
    47         oldXAutoRepeat = false;
    4845
    4946        //X Key Map to KeyCode
     
    213210
    214211        keyFocusLost = false;
    215 
    216         if( xAutoRepeat == false )
    217         {
    218                 //We do not want to blindly turn on autorepeat later when quiting if
    219                 //it was not on to begin with.. So, let us check and see first
    220                 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         }
    229212}
    230213
     
    234217        if( display )
    235218        {
    236                 if( oldXAutoRepeat )
    237                         XAutoRepeatOn(display);
    238 
    239219                if( grabKeyboard )
    240220                        XUngrabKeyboard(display, CurrentTime);
     
    303283
    304284        while( XPending(display) > 0 )
    305         {               XNextEvent(display, &event);            if( KeyPress == event.type )
     285        {
     286                XNextEvent(display, &event);            if(KeyPress == event.type)
    306287                {
    307288                        unsigned int character = 0;
    308289
    309                         if( mTextMode != Off )
     290                        if(mTextMode != Off)
    310291                        {
    311292                                unsigned char buffer[6] = {0,0,0,0,0,0};
     
    332313                        if( event.xkey.state & Mod1Mask && key == XK_Tab )
    333314                                linMan->_setGrabState(false);
    334                 }               else if( KeyRelease == event.type )
     315                }
     316                else if(KeyRelease == event.type)
    335317                {
    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);              }
     318                        if(!_isKeyRepeat(event))
     319                        {
     320                                //Mask out the modifier states X sets.. or we will get improper values
     321                                event.xkey.state &= ~ShiftMask;
     322                                event.xkey.state &= ~LockMask;
     323
     324                                XLookupString(&event.xkey,NULL,0,&key,NULL);
     325                                _injectKeyUp(key);
     326                        }
     327                }
    343328        }
    344329
Note: See TracChangeset for help on using the changeset viewer.