Created
November 24, 2013 16:18
-
-
Save javiercantero/7628876 to your computer and use it in GitHub Desktop.
These are the differences between the 1.3.0 source tree from http://packages.debian.org/source/jessie/ois and https://github.com/freeorion/freeorion/tree/master/FreeOrion/OIS (the non-linux stuff is deleted from debian sources, so this diff only applies to linux differences). Note the use of -b to avoid including blank diffs, but still some chan…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -rub --strip-trailing-cr ois-v1-3/src/linux/LinuxInputManager.cpp ois-freeorion-0.4.3/src/linux/LinuxInputManager.cpp | |
--- ois-v1-3/src/linux/LinuxInputManager.cpp 2010-08-16 00:51:34.000000000 +0200 | |
+++ ois-freeorion-0.4.3/src/linux/LinuxInputManager.cpp 2013-11-21 16:09:53.000000000 +0100 | |
@@ -26,6 +26,7 @@ | |
#include "linux/LinuxMouse.h" | |
#include "OISException.h" | |
#include <cstdlib> | |
+#include <stdio.h> | |
using namespace OIS; | |
@@ -66,10 +67,12 @@ | |
{ | |
ParamList::iterator i = paramList.find("WINDOW"); | |
if( i == paramList.end() ) | |
- OIS_EXCEPT( E_InvalidParam, "LinuxInputManager >> No WINDOW!" ); | |
+ { | |
+ printf("OIS: No Window specified... Not using x11 keyboard/mouse\n"); | |
+ return; | |
+ } | |
- //TODO 64 bit proof this little conversion xxx wip | |
- window = strtoul(i->second.c_str(), 0, 10); | |
+ window = strtoull(i->second.c_str(), 0, 10); | |
//--------- Keyboard Settings ------------// | |
i = paramList.find("x11_keyboard_grab"); | |
@@ -102,11 +105,14 @@ | |
{ | |
DeviceList ret; | |
- if( keyboardUsed == false ) | |
+ if(window) | |
+ { | |
+ if(keyboardUsed == false) | |
ret.insert(std::make_pair(OISKeyboard, mInputSystemName)); | |
- if( mouseUsed == false ) | |
+ if(mouseUsed == false) | |
ret.insert(std::make_pair(OISMouse, mInputSystemName)); | |
+ } | |
for(JoyStickInfoList::iterator i = unusedJoyStickList.begin(); i != unusedJoyStickList.end(); ++i) | |
ret.insert(std::make_pair(OISJoyStick, i->vendor)); | |
@@ -119,8 +125,8 @@ | |
{ | |
switch(iType) | |
{ | |
- case OISKeyboard: return 1; | |
- case OISMouse: return 1; | |
+ case OISKeyboard: return window ? 1 : 0; | |
+ case OISMouse: return window ? 1 : 0; | |
case OISJoyStick: return joySticks; | |
default: return 0; | |
} | |
@@ -131,8 +137,8 @@ | |
{ | |
switch(iType) | |
{ | |
- case OISKeyboard: return keyboardUsed ? 0 : 1; | |
- case OISMouse: return mouseUsed ? 0 : 1; | |
+ case OISKeyboard: return window ? (keyboardUsed ? 0 : 1) : 0; | |
+ case OISMouse: return window ? (mouseUsed ? 0 : 1) : 0; | |
case OISJoyStick: return (int)unusedJoyStickList.size(); | |
default: return 0; | |
} | |
@@ -141,9 +147,9 @@ | |
//----------------------------------------------------------------------------// | |
bool LinuxInputManager::vendorExist(Type iType, const std::string & vendor) | |
{ | |
- if( (iType == OISKeyboard || iType == OISMouse) && vendor == mInputSystemName ) | |
+ if((iType == OISKeyboard || iType == OISMouse) && vendor == mInputSystemName) | |
{ | |
- return true; | |
+ return window ? true : false; | |
} | |
else if( iType == OISJoyStick ) | |
{ | |
@@ -164,14 +170,16 @@ | |
{ | |
case OISKeyboard: | |
{ | |
- if( keyboardUsed == false ) | |
+ if(window && keyboardUsed == false) | |
obj = new LinuxKeyboard(this, bufferMode, grabKeyboard); | |
+ | |
break; | |
} | |
case OISMouse: | |
{ | |
- if( mouseUsed == false ) | |
+ if(window && mouseUsed == false) | |
obj = new LinuxMouse(this, bufferMode, grabMouse, hideMouse); | |
+ | |
break; | |
} | |
case OISJoyStick: | |
@@ -191,7 +199,7 @@ | |
break; | |
} | |
- if( obj == 0 ) | |
+ if(obj == 0) | |
OIS_EXCEPT(E_InputDeviceNonExistant, "No devices match requested type."); | |
return obj; | |
@@ -200,9 +208,9 @@ | |
//----------------------------------------------------------------------------// | |
void LinuxInputManager::destroyObject( Object* obj ) | |
{ | |
- if( obj ) | |
+ if(obj) | |
{ | |
- if( obj->type() == OISJoyStick ) | |
+ if(obj->type() == OISJoyStick) | |
{ | |
unusedJoyStickList.push_back( ((LinuxJoyStick*)obj)->_getJoyInfo() ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment