From 7a479bd688449ec150196f033855af7713fddc0e Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 3 Sep 2016 01:08:37 +0300 Subject: [PATCH] Only pass key and navigation events to enabled widgets It would be even better to not allow them to be focused in the first place, but that raises issues such as where to put the focus if the focused widget gets disabled. So this will have to do. --- source/container.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/container.cpp b/source/container.cpp index c38509f..91fa487 100644 --- a/source/container.cpp +++ b/source/container.cpp @@ -274,7 +274,7 @@ void Container::touch_motion(int x, int y, unsigned finger) bool Container::key_press(unsigned key, unsigned mod) { - if(input_focus) + if(input_focus && input_focus->is_enabled()) return input_focus->key_press(key, mod); else return false; @@ -282,7 +282,7 @@ bool Container::key_press(unsigned key, unsigned mod) bool Container::key_release(unsigned key, unsigned mod) { - if(input_focus) + if(input_focus && input_focus->is_enabled()) return input_focus->key_release(key, mod); else return false; @@ -290,7 +290,7 @@ bool Container::key_release(unsigned key, unsigned mod) bool Container::character(wchar_t ch) { - if(input_focus) + if(input_focus && input_focus->is_enabled()) return input_focus->character(ch); else return false; @@ -304,7 +304,7 @@ void Container::focus_out() bool Container::navigate(Navigation nav) { - if(input_focus) + if(input_focus && input_focus->is_enabled()) return input_focus->navigate(nav); else return false; -- 2.45.2