@@ -57,6 +57,37 @@ static bool IsASCIIPrintableKey(char c) {
57
57
return false ;
58
58
}
59
59
60
+ static bool TextInputTypeToEcoreIMFInputPanelLayout (
61
+ std::string text_input_type,
62
+ Ecore_IMF_Input_Panel_Layout& panel_layout) {
63
+ if (text_input_type == " TextInputType.text" ||
64
+ text_input_type == " TextInputType.multiline" ) {
65
+ panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;
66
+ } else if (text_input_type == " TextInputType.number" ) {
67
+ panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER;
68
+ } else if (text_input_type == " TextInputType.phone" ) {
69
+ panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER;
70
+ } else if (text_input_type == " TextInputType.datetime" ) {
71
+ panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_DATETIME;
72
+ } else if (text_input_type == " TextInputType.emailAddress" ) {
73
+ panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL;
74
+ } else if (text_input_type == " TextInputType.url" ) {
75
+ panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_URL;
76
+ } else if (text_input_type == " TextInputType.visiblePassword" ) {
77
+ panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD;
78
+ } else if (text_input_type == " TextInputType.name" ||
79
+ text_input_type == " TextInputType.address" ) {
80
+ FT_LOGW (
81
+ " Actual requested text input type is [%s], but select "
82
+ " TextInputType.text as fallback type" ,
83
+ text_input_type.c_str ());
84
+ panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;
85
+ } else {
86
+ return false ;
87
+ }
88
+ return true ;
89
+ }
90
+
60
91
void TextInputChannel::CommitCallback (void * data,
61
92
Ecore_IMF_Context* ctx,
62
93
void * event_info) {
@@ -586,6 +617,10 @@ void TextInputChannel::ShowSoftwareKeyboard() {
586
617
FT_LOGD (" Show input panel" );
587
618
if (imf_context_ && !is_software_keyboard_showing_) {
588
619
is_software_keyboard_showing_ = true ;
620
+ Ecore_IMF_Input_Panel_Layout panel_layout;
621
+ if (TextInputTypeToEcoreIMFInputPanelLayout (input_type_, panel_layout)) {
622
+ ecore_imf_context_input_panel_layout_set (imf_context_, panel_layout);
623
+ }
589
624
ecore_imf_context_input_panel_show (imf_context_);
590
625
ecore_imf_context_focus_in (imf_context_);
591
626
}
0 commit comments