Skip to content

Commit

Permalink
Use TextInputType when showing software keyboard
Browse files Browse the repository at this point in the history
Signed-off-by: Boram Bae <[email protected]>
  • Loading branch information
bbrto21 committed May 26, 2021
1 parent 9f408ef commit 333655a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions shell/platform/tizen/channels/text_input_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,37 @@ static bool IsASCIIPrintableKey(char c) {
return false;
}

static bool TextInputTypeToEcoreIMFInputPanelLayout(
std::string text_input_type,
Ecore_IMF_Input_Panel_Layout& panel_layout) {
if (text_input_type == "TextInputType.text" ||
text_input_type == "TextInputType.multiline") {
panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;
} else if (text_input_type == "TextInputType.number") {
panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER;
} else if (text_input_type == "TextInputType.phone") {
panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER;
} else if (text_input_type == "TextInputType.datetime") {
panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_DATETIME;
} else if (text_input_type == "TextInputType.emailAddress") {
panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL;
} else if (text_input_type == "TextInputType.url") {
panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_URL;
} else if (text_input_type == "TextInputType.visiblePassword") {
panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD;
} else if (text_input_type == "TextInputType.name" ||
text_input_type == "TextInputType.address") {
FT_LOGW(
"Actual requested text input type is [%s], but select "
"TextInputType.text as fallback type",
text_input_type.c_str());
panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;
} else {
return false;
}
return true;
}

void TextInputChannel::CommitCallback(void* data,
Ecore_IMF_Context* ctx,
void* event_info) {
Expand Down Expand Up @@ -586,6 +617,10 @@ void TextInputChannel::ShowSoftwareKeyboard() {
FT_LOGD("Show input panel");
if (imf_context_ && !is_software_keyboard_showing_) {
is_software_keyboard_showing_ = true;
Ecore_IMF_Input_Panel_Layout panel_layout;
if (TextInputTypeToEcoreIMFInputPanelLayout(input_type_, panel_layout)) {
ecore_imf_context_input_panel_layout_set(imf_context_, panel_layout);
}
ecore_imf_context_input_panel_show(imf_context_);
ecore_imf_context_focus_in(imf_context_);
}
Expand Down

0 comments on commit 333655a

Please sign in to comment.