From: Mikko Rasa Date: Fri, 2 Sep 2016 22:08:37 +0000 (+0300) Subject: Only pass key and navigation events to enabled widgets X-Git-Url: http://git.tdb.fi/?p=libs%2Fgltk.git;a=commitdiff_plain;h=7a479bd688449ec150196f033855af7713fddc0e 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. --- 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;