diff options
author | Stijn Buys <ingar@osirion.org> | 2010-10-17 22:28:18 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-10-17 22:28:18 +0000 |
commit | 7af0f889a4296ad465f829ab6609b3e6efced997 (patch) | |
tree | ce51717de31bb72197dd99f28d0c9eb9954614f5 /src/ui | |
parent | f406891947a175f3309db0facd7882afe5471508 (diff) |
add input_grab variable
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/console.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/ui/console.cc b/src/ui/console.cc index 7bd308e..67d5054 100644 --- a/src/ui/console.cc +++ b/src/ui/console.cc @@ -88,11 +88,18 @@ void Console::show() } void Console::hide() -{ +{ ui::Window::hide(); - SDL_WM_GrabInput(SDL_GRAB_ON); - SDL_ShowCursor(SDL_DISABLE); - + + core::Cvar *input_grab = core::Cvar::find("input_grab"); + if (!input_grab || input_grab->value()) { + SDL_WM_GrabInput(SDL_GRAB_ON); + SDL_ShowCursor(SDL_DISABLE); + } else { + SDL_WM_GrabInput(SDL_GRAB_OFF); + SDL_ShowCursor(SDL_ENABLE); + } + audio::play("ui/console"); } |