summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx13
-rw-r--r--src/Fl_Input_.cxx1
-rw-r--r--src/Fl_Text_Editor.cxx1
3 files changed, 13 insertions, 2 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 7aa0a3bfd..3c0c92654 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -863,9 +863,18 @@ Fl_Widget* fl_oldfocus; // kludge for Fl_Group...
\see Fl_Widget::take_focus()
*/
-void Fl::focus(Fl_Widget *o) {
- if (o && !o->visible_focus()) return;
+void Fl::focus(Fl_Widget *o)
+{
if (grab()) return; // don't do anything while grab is on
+
+ // request an on-screen keyboard on touch screen devices if needed
+ Fl_Widget *prevFocus = Fl::focus();
+ if ( prevFocus && (prevFocus->flags()&Fl_Widget::NEEDS_KEYBOARD) )
+ Fl::screen_driver()->release_keyboard();
+ if (o && (o->flags()&Fl_Widget::NEEDS_KEYBOARD))
+ Fl::screen_driver()->request_keyboard( /*o->type()*/ );
+
+ if (o && !o->visible_focus()) return;
Fl_Widget *p = focus_;
if (o != p) {
Fl::compose_reset();
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx
index a7f6a9196..68feb4e55 100644
--- a/src/Fl_Input_.cxx
+++ b/src/Fl_Input_.cxx
@@ -1128,6 +1128,7 @@ Fl_Input_::Fl_Input_(int X, int Y, int W, int H, const char* l)
shortcut_ = 0;
set_flag(SHORTCUT_LABEL);
set_flag(MAC_USE_ACCENTS_MENU);
+ set_flag(NEEDS_KEYBOARD);
tab_nav(1);
}
diff --git a/src/Fl_Text_Editor.cxx b/src/Fl_Text_Editor.cxx
index ab2f30c51..5c03b4282 100644
--- a/src/Fl_Text_Editor.cxx
+++ b/src/Fl_Text_Editor.cxx
@@ -75,6 +75,7 @@ Fl_Text_Editor::Fl_Text_Editor(int X, int Y, int W, int H, const char* l)
insert_mode_ = 1;
key_bindings = 0;
set_flag(MAC_USE_ACCENTS_MENU);
+ set_flag(NEEDS_KEYBOARD);
// handle the default key bindings
add_default_key_bindings(&key_bindings);