From: Mikko Rasa Date: Wed, 31 Aug 2016 09:56:06 +0000 (+0300) Subject: Don't pass events to an invisible root widget X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=37b46ec8dc03e090a6bec4a753233329a8335d41;p=libs%2Fgltk.git Don't pass events to an invisible root widget --- diff --git a/source/systemkeyboardinput.cpp b/source/systemkeyboardinput.cpp index fe803a6..f5657bd 100644 --- a/source/systemkeyboardinput.cpp +++ b/source/systemkeyboardinput.cpp @@ -16,6 +16,9 @@ SystemKeyboardInput::SystemKeyboardInput(Root &r, Input::Keyboard &k): bool SystemKeyboardInput::key_press(unsigned key) { + if(!root.is_visible()) + return false; + // TODO modifiers if(root.key_press(key, 0)) return true; @@ -37,12 +40,18 @@ bool SystemKeyboardInput::key_press(unsigned key) bool SystemKeyboardInput::key_release(unsigned key) { - return root.key_release(key, 0); + if(root.is_visible()) + return root.key_release(key, 0); + else + return false; } bool SystemKeyboardInput::character(StringCodec::unichar ch) { - return root.character(ch); + if(root.is_visible()) + return root.character(ch); + else + return false; } } // namespace GLtk