diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2018-03-26 15:42:08 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2018-03-26 15:42:08 +0000 |
| commit | 4df5c6d0b0feb94d09966d62113746c2094028df (patch) | |
| tree | ee13dc85a335d27fda9672df179dd85cf8a0df30 /src/Fl.cxx | |
| parent | e8818e968cea0d05cd7aa27553a964c16813e422 (diff) | |
Android: Avoids hiding and showing keyboard when focus changes from text input to text input
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12805 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl.cxx')
| -rw-r--r-- | src/Fl.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx index 3c0c92654..011e978e0 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -861,6 +861,11 @@ Fl_Widget* fl_oldfocus; // kludge for Fl_Group... \e test if the widget wants the focus (by it returning non-zero from handle()). + Widgets can set the NEEDS_KEYBOARD flag to indicate that a keyboard is + essential for the widget to function. Touchscreen devices will be sent a + request to show and on-screen keyboard if no hardware keyboard is + connected. + \see Fl_Widget::take_focus() */ void Fl::focus(Fl_Widget *o) @@ -869,10 +874,12 @@ void Fl::focus(Fl_Widget *o) // request an on-screen keyboard on touch screen devices if needed Fl_Widget *prevFocus = Fl::focus(); - if ( prevFocus && (prevFocus->flags()&Fl_Widget::NEEDS_KEYBOARD) ) + char hideKeyboard = ( prevFocus && (prevFocus->flags()&Fl_Widget::NEEDS_KEYBOARD) ); + char showKeyboard = (o && (o->flags()&Fl_Widget::NEEDS_KEYBOARD)); + if (hideKeyboard && !showKeyboard) Fl::screen_driver()->release_keyboard(); - if (o && (o->flags()&Fl_Widget::NEEDS_KEYBOARD)) - Fl::screen_driver()->request_keyboard( /*o->type()*/ ); + if (showKeyboard && !hideKeyboard) + Fl::screen_driver()->request_keyboard(); if (o && !o->visible_focus()) return; Fl_Widget *p = focus_; |
