Index: code/branches/ois_update/src/external/ois/linux/LinuxInputManager.cpp
===================================================================
--- code/branches/ois_update/src/external/ois/linux/LinuxInputManager.cpp	(revision 7505)
+++ code/branches/ois_update/src/external/ois/linux/LinuxInputManager.cpp	(revision 7506)
@@ -40,5 +40,4 @@
 	hideMouse = true;
 	mGrabs = true;
-	useXRepeat = false;
 	keyboardUsed = mouseUsed = false;
 
@@ -74,9 +73,4 @@
 
 	//--------- Keyboard Settings ------------//
-	i = paramList.find("XAutoRepeatOn");
-	if( i != paramList.end() )
-		if( i->second == "true" )
-			useXRepeat = true;
-
 	i = paramList.find("x11_keyboard_grab");
 	if( i != paramList.end() )
@@ -172,5 +166,5 @@
 	{
 		if( keyboardUsed == false )
-			obj = new LinuxKeyboard(this, bufferMode, grabKeyboard, useXRepeat);
+			obj = new LinuxKeyboard(this, bufferMode, grabKeyboard);
 		break;
 	}
Index: code/branches/ois_update/src/external/ois/linux/LinuxInputManager.h
===================================================================
--- code/branches/ois_update/src/external/ois/linux/LinuxInputManager.h	(revision 7505)
+++ code/branches/ois_update/src/external/ois/linux/LinuxInputManager.h	(revision 7506)
@@ -101,7 +101,4 @@
 		bool mGrabs;
 		bool hideMouse;
-
-		//! By default, keyboard disables XRepeatRate
-		bool useXRepeat;
 	};
 }
Index: code/branches/ois_update/src/external/ois/linux/LinuxJoyStickEvents.cpp
===================================================================
--- code/branches/ois_update/src/external/ois/linux/LinuxJoyStickEvents.cpp	(revision 7505)
+++ code/branches/ois_update/src/external/ois/linux/LinuxJoyStickEvents.cpp	(revision 7506)
@@ -96,104 +96,107 @@
 	//We are in non blocking mode - we just read once, and try to fill up buffer
 	input_event js[JOY_BUFFERSIZE];
-	int ret = read(mJoyStick, &js, sizeof(struct input_event) * JOY_BUFFERSIZE);
-	if( ret <= 0 )
-		return;
-
-	//Determine how many whole events re read up
-	ret /= sizeof(struct input_event);
-	for(int i = 0; i < ret; ++i)
+	while(true)
 	{
-		switch(js[i].type)
+		int ret = read(mJoyStick, &js, sizeof(struct input_event) * JOY_BUFFERSIZE);
+        if( ret < 0 )
+			break;
+
+		//Determine how many whole events re read up
+		ret /= sizeof(struct input_event);
+		for(int i = 0; i < ret; ++i)
 		{
-		case EV_KEY:  //Button
-		{
-			int button = mButtonMap[js[i].code];
-
-			#ifdef OIS_LINUX_JOY_DEBUG
-			  cout << "\nButton Code: " << js[i].code << ", OIS Value: " << button << endl;
-			#endif
-
-			//Check to see whether push or released event...
-			if(js[i].value)
-			{
-				mState.mButtons[button] = true;
-				if( mBuffered && mListener )
-					if(!mListener->buttonPressed(JoyStickEvent(this,mState), button)) return;
-			}
-			else
-			{
-				mState.mButtons[button] = false;
-				if( mBuffered && mListener )
-					if(!mListener->buttonReleased(JoyStickEvent(this,mState), button)) return;
-			}
-			break;
-		}
-
-		case EV_ABS:  //Absolute Axis
-		{
-			//A Stick (BrakeDefine is the highest possible Axis)
-			if( js[i].code <= ABS_BRAKE )
-			{
-				int axis = mAxisMap[js[i].code];
-				assert( axis < 32 && "Too many axes (Max supported is 32). Report this to OIS forums!" );
-
-				axisMoved[axis] = true;
-
-				//check for rescaling:
-				if( mRanges[axis].min == JoyStick::MIN_AXIS && mRanges[axis].max != JoyStick::MAX_AXIS )
-				{	//Scale is perfect
-					mState.mAxes[axis].abs = js[i].value;
+			switch(js[i].type)
+			{
+			case EV_KEY:  //Button
+			{
+				int button = mButtonMap[js[i].code];
+
+				#ifdef OIS_LINUX_JOY_DEBUG
+				  cout << "\nButton Code: " << js[i].code << ", OIS Value: " << button << endl;
+				#endif
+
+				//Check to see whether push or released event...
+				if(js[i].value)
+				{
+					mState.mButtons[button] = true;
+					if( mBuffered && mListener )
+						if(!mListener->buttonPressed(JoyStickEvent(this,mState), button)) return;
 				}
 				else
-				{	//Rescale
-					float proportion = (float)(js[i].value-mRanges[axis].max)/(float)(mRanges[axis].min-mRanges[axis].max);
-					mState.mAxes[axis].abs = (int)(32767.0f - (65535.0f * proportion));
+				{
+					mState.mButtons[button] = false;
+					if( mBuffered && mListener )
+						if(!mListener->buttonReleased(JoyStickEvent(this,mState), button)) return;
 				}
-			}
-			else if( js[i].code <= ABS_HAT3Y ) //A POV - Max four POVs allowed
-			{
-				//Normalise the POV to between 0-7
-				//Even is X Axis, Odd is Y Axis
-				unsigned char LinuxPovNumber = js[i].code - 16;
-				short OIS_POVIndex = POV_MASK[LinuxPovNumber];
-
-				//Handle X Axis first (Even) (left right)
-				if((LinuxPovNumber & 0x0001) == 0)
+				break;
+			}
+
+			case EV_ABS:  //Absolute Axis
+			{
+				//A Stick (BrakeDefine is the highest possible Axis)
+				if( js[i].code <= ABS_BRAKE )
 				{
-					//Why do this? Because, we use a bit field, and when this axis is east,
-					//it can't possibly be west too. So clear out the two X axes, then refil
-					//it in with the new direction bit.
-					//Clear the East/West Bit Flags first
-					mState.mPOV[OIS_POVIndex].direction &= 0x11110011;
-					if( js[i].value == -1 )	//Left
-						mState.mPOV[OIS_POVIndex].direction |= Pov::West;
-					else if( js[i].value == 1 ) //Right
-						mState.mPOV[OIS_POVIndex].direction |= Pov::East;
+					int axis = mAxisMap[js[i].code];
+					assert( axis < 32 && "Too many axes (Max supported is 32). Report this to OIS forums!" );
+
+					axisMoved[axis] = true;
+
+					//check for rescaling:
+					if( mRanges[axis].min == JoyStick::MIN_AXIS && mRanges[axis].max != JoyStick::MAX_AXIS )
+					{	//Scale is perfect
+						mState.mAxes[axis].abs = js[i].value;
+					}
+					else
+					{	//Rescale
+						float proportion = (float)(js[i].value-mRanges[axis].max)/(float)(mRanges[axis].min-mRanges[axis].max);
+						mState.mAxes[axis].abs = (int)(32767.0f - (65535.0f * proportion));
+					}
 				}
-				//Handle Y Axis (Odd) (up down)
-				else
+				else if( js[i].code <= ABS_HAT3Y ) //A POV - Max four POVs allowed
 				{
-					//Clear the North/South Bit Flags first
-					mState.mPOV[OIS_POVIndex].direction &= 0x11111100;
-					if( js[i].value == -1 )	//Up
-						mState.mPOV[OIS_POVIndex].direction |= Pov::North;
-					else if( js[i].value == 1 ) //Down
-						mState.mPOV[OIS_POVIndex].direction |= Pov::South;
+					//Normalise the POV to between 0-7
+					//Even is X Axis, Odd is Y Axis
+					unsigned char LinuxPovNumber = js[i].code - 16;
+					short OIS_POVIndex = POV_MASK[LinuxPovNumber];
+
+					//Handle X Axis first (Even) (left right)
+					if((LinuxPovNumber & 0x0001) == 0)
+					{
+						//Why do this? Because, we use a bit field, and when this axis is east,
+						//it can't possibly be west too. So clear out the two X axes, then refil
+						//it in with the new direction bit.
+						//Clear the East/West Bit Flags first
+						mState.mPOV[OIS_POVIndex].direction &= 0x11110011;
+						if( js[i].value == -1 )	//Left
+							mState.mPOV[OIS_POVIndex].direction |= Pov::West;
+						else if( js[i].value == 1 ) //Right
+							mState.mPOV[OIS_POVIndex].direction |= Pov::East;
+					}
+					//Handle Y Axis (Odd) (up down)
+					else
+					{
+						//Clear the North/South Bit Flags first
+						mState.mPOV[OIS_POVIndex].direction &= 0x11111100;
+						if( js[i].value == -1 )	//Up
+							mState.mPOV[OIS_POVIndex].direction |= Pov::North;
+						else if( js[i].value == 1 ) //Down
+							mState.mPOV[OIS_POVIndex].direction |= Pov::South;
+					}
+
+					if( mBuffered && mListener )
+						if( mListener->povMoved( JoyStickEvent(this,mState), OIS_POVIndex) == false )
+							return;
 				}
-
-				if( mBuffered && mListener )
-					if( mListener->povMoved( JoyStickEvent(this,mState), OIS_POVIndex) == false )
-						return;
-			}
-			break;
-		}
-
-		
-		case EV_REL: //Relative Axes (Do any joystick actually have a relative axis?)
-#ifdef OIS_LINUX_JOY_DEBUG
-		    cout << "\nWarning: Relatives axes not supported yet" << endl;
-#endif
-			break;
-		default: break;
+				break;
+			}
+
+			
+			case EV_REL: //Relative Axes (Do any joystick actually have a relative axis?)
+	#ifdef OIS_LINUX_JOY_DEBUG
+				cout << "\nWarning: Relatives axes not supported yet" << endl;
+	#endif
+				break;
+			default: break;
+			}
 		}
 	}
Index: code/branches/ois_update/src/external/ois/linux/LinuxKeyboard.cpp
===================================================================
--- code/branches/ois_update/src/external/ois/linux/LinuxKeyboard.cpp	(revision 7505)
+++ code/branches/ois_update/src/external/ois/linux/LinuxKeyboard.cpp	(revision 7506)
@@ -33,5 +33,5 @@
 #include <iostream>
 //-------------------------------------------------------------------//
-LinuxKeyboard::LinuxKeyboard(InputManager* creator, bool buffered, bool grab, bool useXRepeat)
+LinuxKeyboard::LinuxKeyboard(InputManager* creator, bool buffered, bool grab)
 	: Keyboard(creator->inputSystemName(), buffered, 0, creator)
 {
@@ -43,7 +43,4 @@
 	grabKeyboard = grab;
 	keyFocusLost = false;
-
-	xAutoRepeat = useXRepeat;
-	oldXAutoRepeat = false;
 
 	//X Key Map to KeyCode
@@ -213,18 +210,4 @@
 
 	keyFocusLost = false;
-
-	if( xAutoRepeat == false )
-	{
-		//We do not want to blindly turn on autorepeat later when quiting if
-		//it was not on to begin with.. So, let us check and see first
-		XKeyboardState old;
-		XGetKeyboardControl( display, &old );
-		oldXAutoRepeat = false;
-
-		if( old.global_auto_repeat == AutoRepeatModeOn )
-			oldXAutoRepeat = true;
-
-		XAutoRepeatOff( display );
-	}
 }
 
@@ -234,7 +217,4 @@
 	if( display )
 	{
-		if( oldXAutoRepeat )
-			XAutoRepeatOn(display);
-
 		if( grabKeyboard )
 			XUngrabKeyboard(display, CurrentTime);
@@ -303,9 +283,10 @@
 
 	while( XPending(display) > 0 )
-	{ 		XNextEvent(display, &event);  		if( KeyPress == event.type )
+	{
+		XNextEvent(display, &event); 		if(KeyPress == event.type)
 		{
 			unsigned int character = 0;
 
-			if( mTextMode != Off )
+			if(mTextMode != Off)
 			{
 				unsigned char buffer[6] = {0,0,0,0,0,0};
@@ -332,13 +313,17 @@
 			if( event.xkey.state & Mod1Mask && key == XK_Tab )
 				linMan->_setGrabState(false);
-		} 		else if( KeyRelease == event.type )
+		}
+		else if(KeyRelease == event.type)
 		{
-			//Mask out the modifier states X sets.. or we will get improper values
-			event.xkey.state &= ~ShiftMask;
-			event.xkey.state &= ~LockMask;
-
-			//Else, it is a valid key release
-			XLookupString(&event.xkey,NULL,0,&key,NULL);
-			_injectKeyUp(key); 		}
+			if(!_isKeyRepeat(event))
+			{
+				//Mask out the modifier states X sets.. or we will get improper values
+				event.xkey.state &= ~ShiftMask;
+				event.xkey.state &= ~LockMask;
+
+				XLookupString(&event.xkey,NULL,0,&key,NULL);
+				_injectKeyUp(key);
+			}
+		}
 	}
 
Index: code/branches/ois_update/src/external/ois/linux/LinuxKeyboard.h
===================================================================
--- code/branches/ois_update/src/external/ois/linux/LinuxKeyboard.h	(revision 7505)
+++ code/branches/ois_update/src/external/ois/linux/LinuxKeyboard.h	(revision 7506)
@@ -34,5 +34,5 @@
 	{
 	public:
-		LinuxKeyboard(InputManager* creator, bool buffered, bool grab, bool useXRepeat );
+		LinuxKeyboard(InputManager* creator, bool buffered, bool grab);
 		virtual ~LinuxKeyboard();
 
@@ -59,4 +59,21 @@
 
 	protected:
+		inline bool _isKeyRepeat(XEvent &event)
+		{
+			//When a key is repeated, there will be two events: released, followed by another immediate pressed. So check to see if another pressed is present	
+			if(!XPending(display))
+				return false;
+
+			XEvent e;
+			XPeekEvent(display, &e);
+			if(e.type == KeyPress && e.xkey.keycode == event.xkey.keycode && (e.xkey.time - event.xkey.time) < 2)
+			{
+				XNextEvent(display, &e);
+				return true;
+			}
+
+			return false;
+		}
+
 		bool _injectKeyDown( KeySym key, int text );
 		bool _injectKeyUp( KeySym key );
@@ -75,7 +92,4 @@
 		bool keyFocusLost;
 
-		bool xAutoRepeat;
-		bool oldXAutoRepeat;
-
 		std::string mGetString;
 	};
Index: code/branches/ois_update/src/external/ois/linux/LinuxMouse.cpp
===================================================================
--- code/branches/ois_update/src/external/ois/linux/LinuxMouse.cpp	(revision 7505)
+++ code/branches/ois_update/src/external/ois/linux/LinuxMouse.cpp	(revision 7506)
@@ -173,6 +173,6 @@
 
 			//Compute this frames Relative X & Y motion
-			mState.X.rel = event.xmotion.x - oldXMouseX;
-			mState.Y.rel = event.xmotion.y - oldXMouseY;
+			int dx = event.xmotion.x - oldXMouseX;
+			int dy = event.xmotion.y - oldXMouseY;
 		
 			//Store old values for next time to compute relative motion
@@ -180,6 +180,8 @@
 			oldXMouseY = event.xmotion.y;
 
-			mState.X.abs += mState.X.rel;
-			mState.Y.abs += mState.Y.rel;
+			mState.X.abs += dx;
+			mState.Y.abs += dy;
+			mState.X.rel += dx;
+			mState.Y.rel += dy;
 
 			//Check to see if we are grabbing the mouse to the window (requires clipping and warping)
Index: code/branches/ois_update/src/external/ois/linux/LinuxPrereqs.h
===================================================================
--- code/branches/ois_update/src/external/ois/linux/LinuxPrereqs.h	(revision 7505)
+++ code/branches/ois_update/src/external/ois/linux/LinuxPrereqs.h	(revision 7506)
@@ -32,5 +32,5 @@
 
 //! Max number of elements to collect from buffered input
-#define JOY_BUFFERSIZE 10
+#define JOY_BUFFERSIZE 64
 
 namespace OIS
