Skip to content

Commit

Permalink
Added a cmake option to disable keyboard grabbing on linux. Enabled b…
Browse files Browse the repository at this point in the history
…y default.

Fixes OpenDungeons#293
  • Loading branch information
Yohann Ferreira committed Nov 13, 2014
1 parent 718529b commit 9706d42
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ if(OD_BUILD_TESTING)
include(CTest)
endif()

# Linux option - Do not grab the keyboard when using OIS
# This is breking the game's input on certain linux distributions and thus, must stay an option for now...
option(OD_LINUX_NO_KEYBOARD_GRAB "Do not grab keyboard input when using OIS under Linux. Permits input in other applications." ON)

# Defines the value for the preprocessor.
if(OD_LINUX_NO_KEYBOARD_GRAB)
set(OD_NO_KEYBOARD_GRAB)
message(STATUS "Linux (OIS): x11_keyboard_grab = false")
else()
message(STATUS "Linux (OIS): x11_keyboard_grab = true")
endif()

##################################
#### Useful variables ############
##################################
Expand Down
4 changes: 4 additions & 0 deletions source/modes/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ InputManager::InputManager(Ogre::RenderWindow* renderWindow):
#elif defined OIS_LINUX_PLATFORM
paramList.insert(std::make_pair(std::string("x11_mouse_grab"), std::string("false")));
paramList.insert(std::make_pair(std::string("x11_mouse_hide"), std::string("false")));
#if defined OD_NO_KEYBOARD_GRAB
paramList.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("false")));
#else
paramList.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("true")));
#endif
paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
#endif

Expand Down

0 comments on commit 9706d42

Please sign in to comment.