From 7af0f889a4296ad465f829ab6609b3e6efced997 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 17 Oct 2010 22:28:18 +0000 Subject: add input_grab variable --- src/ui/console.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/ui/console.cc') 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"); } -- cgit v1.2.3