From af8f68a7ff8daa6fc262f1ee5773cbf220f6de71 Mon Sep 17 00:00:00 2001 From: Seoyeon Kim Date: Thu, 18 Apr 2019 13:55:37 +0900 Subject: [PATCH] Add to set and get Input Panel language - Be able to set IME Language as English using SetInputPanelLanguage(). The default is automatic depending on the system display. Change-Id: I57b56c5aa6e48955ba4b0c67aa7f14aedb56a566 Signed-off-by: Seoyeon Kim --- .../adaptor-framework/input-method-context.cpp | 11 ++++++ .../adaptor-framework/input-method-context.h | 24 ++++++++++- .../input/common/input-method-context-impl.h | 11 ++++++ .../input-method-context-impl-ecore-wl.cpp | 46 ++++++++++++++++++++++ .../input-method-context-impl-ecore-wl.h | 11 ++++++ .../ubuntu-x11/input-method-context-impl-x.cpp | 46 ++++++++++++++++++++++ .../input/ubuntu-x11/input-method-context-impl-x.h | 11 ++++++ .../windows/input-method-context-impl-win.cpp | 11 ++++++ .../input/windows/input-method-context-impl-win.h | 10 +++++ 9 files changed, 180 insertions(+), 1 deletion(-) diff --git a/dali/devel-api/adaptor-framework/input-method-context.cpp b/dali/devel-api/adaptor-framework/input-method-context.cpp index 427ae6c..a63c3e2 100755 --- a/dali/devel-api/adaptor-framework/input-method-context.cpp +++ b/dali/devel-api/adaptor-framework/input-method-context.cpp @@ -196,6 +196,17 @@ bool InputMethodContext::IsTextPredictionAllowed() const return Internal::Adaptor::InputMethodContext::GetImplementation(*this).IsTextPredictionAllowed(); } +void InputMethodContext::SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) +{ + Internal::Adaptor::InputMethodContext::GetImplementation(*this).SetInputPanelLanguage( language ); +} + +Dali::InputMethodContext::InputPanelLanguage InputMethodContext::GetInputPanelLanguage() const +{ + return Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetInputPanelLanguage(); +} + +// Signals InputMethodContext::ActivatedSignalType& InputMethodContext::ActivatedSignal() { return Internal::Adaptor::InputMethodContext::GetImplementation(*this).ActivatedSignal(); diff --git a/dali/devel-api/adaptor-framework/input-method-context.h b/dali/devel-api/adaptor-framework/input-method-context.h index be9c81e..15666ff 100755 --- a/dali/devel-api/adaptor-framework/input-method-context.h +++ b/dali/devel-api/adaptor-framework/input-method-context.h @@ -2,7 +2,7 @@ #define __DALI_INPUT_METHOD_CONTEXT_H__ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,6 +88,12 @@ public: HARDWARE_KEYBOARD ///< Hardware keyboard }; + enum class InputPanelLanguage + { + AUTOMATIC, ///< IME Language automatically set depending on the system display + ALPHABET ///< Latin alphabet at all times + }; + /** * @brief This structure is used to pass on data from the InputMethodContext regarding predictive text. */ @@ -411,6 +417,22 @@ public: * @return Whether the IM allow text prediction or not. */ bool IsTextPredictionAllowed() const; + + /** + * @brief Sets the language of the input panel. + * + * This method can be used when you want to show the English keyboard. + * @param[in] language The language to be set to the input panel + */ + void SetInputPanelLanguage( InputPanelLanguage language ); + + /** + * @brief Gets the language of the input panel. + * + * @return The language of the input panel + */ + InputPanelLanguage GetInputPanelLanguage() const; + public: // Signals diff --git a/dali/internal/input/common/input-method-context-impl.h b/dali/internal/input/common/input-method-context-impl.h index a46cdb5..7890b1c 100755 --- a/dali/internal/input/common/input-method-context-impl.h +++ b/dali/internal/input/common/input-method-context-impl.h @@ -245,6 +245,17 @@ public: * @copydoc Dali::InputMethodContext::IsTextPredictionAllowed() */ virtual bool IsTextPredictionAllowed() const { return false; } + + /** + * @copydoc Dali::InputMethodContext::SetInputPanelLanguage() + */ + virtual void SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) {} + + /** + * @copydoc Dali::InputMethodContext::GetInputPanelLanguage() + */ + virtual Dali::InputMethodContext::InputPanelLanguage GetInputPanelLanguage() const { return Dali::InputMethodContext::InputPanelLanguage(); } + public: // Signals /** diff --git a/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp b/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp index 13f8c0a..bc74eec 100755 --- a/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp +++ b/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp @@ -937,6 +937,52 @@ bool InputMethodContextEcoreWl::IsTextPredictionAllowed() const return prediction; } +void InputMethodContextEcoreWl::SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::SetInputPanelLanguage\n" ); + if( mIMFContext ) + { + switch (language) + { + case Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC: + { + ecore_imf_context_input_panel_language_set( mIMFContext, ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC ); + break; + } + case Dali::InputMethodContext::InputPanelLanguage::ALPHABET: + { + ecore_imf_context_input_panel_language_set( mIMFContext, ECORE_IMF_INPUT_PANEL_LANG_ALPHABET ); + break; + } + } + } +} + +Dali::InputMethodContext::InputPanelLanguage InputMethodContextEcoreWl::GetInputPanelLanguage() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetInputPanelLanguage\n" ); + if( mIMFContext ) + { + int value; + value = ecore_imf_context_input_panel_language_get( mIMFContext ); + + switch (value) + { + case ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC: + { + return Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC; + break; + } + case ECORE_IMF_INPUT_PANEL_LANG_ALPHABET: + { + return Dali::InputMethodContext::InputPanelLanguage::ALPHABET; + break; + } + } + } + return Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC; +} + bool InputMethodContextEcoreWl::ProcessEventKeyDown( const KeyEvent& keyEvent ) { bool eventHandled( false ); diff --git a/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.h b/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.h index eca83cd..ad7117c 100755 --- a/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.h +++ b/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.h @@ -235,6 +235,17 @@ public: * @copydoc Dali::InputMethodContext::IsTextPredictionAllowed() */ bool IsTextPredictionAllowed() const override; + + /** + * @copydoc Dali::InputMethodContext::SetInputPanelLanguage() + */ + void SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) override; + + /** + * @copydoc Dali::InputMethodContext::GetInputPanelLanguage() + */ + Dali::InputMethodContext::InputPanelLanguage GetInputPanelLanguage() const override; + private: /** * Context created the first time and kept until deleted. diff --git a/dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp b/dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp index add026d..d398555 100755 --- a/dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp +++ b/dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp @@ -745,6 +745,52 @@ bool InputMethodContextX::IsTextPredictionAllowed() const return prediction; } +void InputMethodContextX::SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::SetInputPanelLanguage\n" ); + if( mIMFContext ) + { + switch (language) + { + case Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC: + { + ecore_imf_context_input_panel_language_set( mIMFContext, ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC ); + break; + } + case Dali::InputMethodContext::InputPanelLanguage::ALPHABET: + { + ecore_imf_context_input_panel_language_set( mIMFContext, ECORE_IMF_INPUT_PANEL_LANG_ALPHABET ); + break; + } + } + } +} + +Dali::InputMethodContext::InputPanelLanguage InputMethodContextX::GetInputPanelLanguage() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::GetInputPanelLanguage\n" ); + if( mIMFContext ) + { + int value; + value = ecore_imf_context_input_panel_language_get( mIMFContext ); + + switch (value) + { + case ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC: + { + return Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC; + break; + } + case ECORE_IMF_INPUT_PANEL_LANG_ALPHABET: + { + return Dali::InputMethodContext::InputPanelLanguage::ALPHABET; + break; + } + } + } + return Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC; +} + bool InputMethodContextX::ProcessEventKeyDown( const KeyEvent& keyEvent ) { bool eventHandled( false ); diff --git a/dali/internal/input/ubuntu-x11/input-method-context-impl-x.h b/dali/internal/input/ubuntu-x11/input-method-context-impl-x.h index c12d777..4c2b1b5 100755 --- a/dali/internal/input/ubuntu-x11/input-method-context-impl-x.h +++ b/dali/internal/input/ubuntu-x11/input-method-context-impl-x.h @@ -240,6 +240,17 @@ public: * @copydoc Dali::InputMethodContext::IsTextPredictionAllowed() */ bool IsTextPredictionAllowed() const override; + + /** + * @copydoc Dali::InputMethodContext::SetInputPanelLanguage() + */ + void SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) override; + + /** + * @copydoc Dali::InputMethodContext::GetInputPanelLanguage() + */ + Dali::InputMethodContext::InputPanelLanguage GetInputPanelLanguage() const override; + private: /** * Context created the first time and kept until deleted. diff --git a/dali/internal/input/windows/input-method-context-impl-win.cpp b/dali/internal/input/windows/input-method-context-impl-win.cpp index 16df1a5..6bbfac1 100755 --- a/dali/internal/input/windows/input-method-context-impl-win.cpp +++ b/dali/internal/input/windows/input-method-context-impl-win.cpp @@ -355,6 +355,17 @@ bool InputMethodContextWin::FilterEventKey( const Dali::KeyEvent& keyEvent ) return eventHandled; } +void InputMethodContextWin::SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::SetInputPanelLanguage\n" ); +} + +Dali::InputMethodContext::InputPanelLanguage InputMethodContextWin::GetInputPanelLanguage() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::GetInputPanelLanguage\n" ); + return Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC; +} + bool InputMethodContextWin::ProcessEventKeyDown( const KeyEvent& keyEvent ) { bool eventHandled( false ); diff --git a/dali/internal/input/windows/input-method-context-impl-win.h b/dali/internal/input/windows/input-method-context-impl-win.h index a2f71f3..d2a03fc 100755 --- a/dali/internal/input/windows/input-method-context-impl-win.h +++ b/dali/internal/input/windows/input-method-context-impl-win.h @@ -229,6 +229,16 @@ public: */ bool FilterEventKey( const Dali::KeyEvent& keyEvent ) override; + /** + * @copydoc Dali::InputMethodContext::SetInputPanelLanguage() + */ + void SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) override; + + /** + * @copydoc Dali::InputMethodContext::GetInputPanelLanguage() + */ + Dali::InputMethodContext::InputPanelLanguage GetInputPanelLanguage() const override; + private: /** * Context created the first time and kept until deleted. -- 2.7.4