diff options
-rw-r--r-- | src/client.cpp | 8 | ||||
-rw-r--r-- | src/client.h | 2 | ||||
-rw-r--r-- | src/gui/setup_visual.cpp | 4 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp index e6aeb22e2..949dbacd2 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -562,6 +562,8 @@ void Client::gameInit() } } + applyGrabMode(); + // Initialize for drawing mainGraphics->_beginDraw(); @@ -2429,3 +2431,9 @@ void Client::resizeVideo(int width, int height, bool always) config.setValue("screenheight", height); } } + +void Client::applyGrabMode() +{ + SDL_WM_GrabInput(config.getBoolValue("grabinput") + ? SDL_GRAB_ON : SDL_GRAB_OFF); +} diff --git a/src/client.h b/src/client.h index 6c93adbdf..ba6fde480 100644 --- a/src/client.h +++ b/src/client.h @@ -273,6 +273,8 @@ public: static bool isTmw(); + static void applyGrabMode(); + void optionChanged(const std::string &name); void action(const gcn::ActionEvent &event); diff --git a/src/gui/setup_visual.cpp b/src/gui/setup_visual.cpp index 6df2dbf82..22894e267 100644 --- a/src/gui/setup_visual.cpp +++ b/src/gui/setup_visual.cpp @@ -55,10 +55,14 @@ Setup_Visual::Setup_Visual() new SetupItemCheckBox(_("Show pickup notifications as particle effects"), "", "showpickupparticle", this, "showpickupparticleEvent"); + new SetupItemCheckBox(_("Grab mouse and keyboard input"), + "", "grabinput", this, "grabinputEvent"); + setDimension(gcn::Rectangle(0, 0, 550, 350)); } void Setup_Visual::apply() { SetupTabScroll::apply(); + Client::applyGrabMode(); } |