From 37b46ec8dc03e090a6bec4a753233329a8335d41 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 31 Aug 2016 12:56:06 +0300 Subject: [PATCH] Don't pass events to an invisible root widget --- source/systemkeyboardinput.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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 -- 2.43.0