Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use TextInputType when showing software keyboard #93

Merged
merged 1 commit into from
May 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
bbrto21 marked this conversation as resolved.
Show resolved Hide resolved
} 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