merge with master
authorJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:16:51 +0000 (01:16 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:16:51 +0000 (01:16 +0900)
34 files changed:
CMakeLists.txt
inc/FUiIme.h
inc/FUiImeIInputMethodListener.h [moved from src/FUiImeIInputMethodListener.h with 93% similarity]
inc/FUiImeIInputMethodProvider.h [moved from src/FUiImeIInputMethodProvider.h with 88% similarity]
inc/FUiImeInputMethod.h [moved from src/FUiImeInputMethod.h with 91% similarity]
inc/FUiImeInputMethodInfo.h [changed mode: 0755->0644]
inc/FUiImeInputMethodManager.h [changed mode: 0755->0644]
packaging/osp-ime.spec
src/FUiImeInputMethod.cpp
src/FUiImeInputMethodInfo.cpp
src/FUiImeInputMethodManager.cpp
src/FUiIme_EcoreEventHandler.cpp [new file with mode: 0644]
src/FUiIme_EcoreEventHandler.h [new file with mode: 0644]
src/FUiIme_EcoreFdHandler.cpp
src/FUiIme_EcoreFdHandler.h
src/FUiIme_ImeInfo.cpp
src/FUiIme_ImeInfo.h
src/FUiIme_InputMethodImpl.cpp
src/FUiIme_InputMethodImpl.h
src/FUiIme_InputMethodInfoImpl.cpp
src/FUiIme_InputMethodInfoImpl.h
src/FUiIme_InputMethodManagerImpl.cpp
src/FUiIme_InputMethodManagerImpl.h
src/FUiIme_InputServiceBinder.cpp
src/FUiIme_InputServiceBinder.h
src/FUiIme_InputServiceSignalListener.cpp
src/FUiIme_InputServiceSignalListener.h
src/FUiIme_Key.cpp [new file with mode: 0644]
src/FUiIme_Key.h
src/FUiIme_ScimDataConverter.cpp
src/FUiIme_ScimDataConverter.h
src/FUiIme_TargetWindowAgent.cpp [new file with mode: 0644]
src/FUiIme_TargetWindowAgent.h [new file with mode: 0644]
src/app/FApp_ImeEntry.cpp

index 725f825..8b66515 100644 (file)
@@ -11,6 +11,8 @@ INCLUDE_DIRECTORIES(
   /usr/include/dlog
   /usr/include/dbus-1.0
   /usr/lib/dbus-1.0/include
+  /usr/include/glib-2.0
+  /usr/lib/glib-2.0/include
   /usr/include/e_dbus-1
   /usr/include/elementary-1
   /usr/include/efreet-1
@@ -24,11 +26,12 @@ INCLUDE_DIRECTORIES(
   /usr/include/libxml2
   /usr/include/media
        /usr/include/osp
-       /usr/include/osp/base
        /usr/include/osp/app
+       /usr/include/osp/base
+       /usr/include/osp/graphics
+       /usr/include/osp/io
        /usr/include/osp/net
        /usr/include/osp/security
-       /usr/include/osp/io
        /usr/include/osp/ui
        /usr/include/scim-1.0
        )
@@ -38,6 +41,7 @@ SET (${this_target}_SOURCE_FILES
        src/FUiImeInputMethod.cpp
        src/FUiImeInputMethodInfo.cpp
        src/FUiImeInputMethodManager.cpp
+       src/FUiIme_EcoreEventHandler.cpp
        src/FUiIme_EcoreFdHandler.cpp
        src/FUiIme_ImeInfo.cpp
        src/FUiIme_InputMethodImpl.cpp
@@ -45,7 +49,9 @@ SET (${this_target}_SOURCE_FILES
        src/FUiIme_InputMethodManagerImpl.cpp
        src/FUiIme_InputServiceBinder.cpp
        src/FUiIme_InputServiceSignalListener.cpp
+       src/FUiIme_Key.cpp
        src/FUiIme_ScimDataConverter.cpp
+       src/FUiIme_TargetWindowAgent.cpp
 )
 
 ## Definitions
@@ -71,10 +77,12 @@ TARGET_LINK_LIBRARIES(${this_target} "-ldl")
 TARGET_LINK_LIBRARIES(${this_target} "-lecore")
 TARGET_LINK_LIBRARIES(${this_target} "-lecore_x")
 TARGET_LINK_LIBRARIES(${this_target} "-lelementary")
-TARGET_LINK_LIBRARIES(${this_target} "-levas" )
-TARGET_LINK_LIBRARIES(${this_target} "-lpkgmgr-info" )
+TARGET_LINK_LIBRARIES(${this_target} "-levas")
+TARGET_LINK_LIBRARIES(${this_target} "-lglib-2.0")
+TARGET_LINK_LIBRARIES(${this_target} "-lpkgmgr-info")
 TARGET_LINK_LIBRARIES(${this_target} "-lscim-1.0")
-TARGET_LINK_LIBRARIES(${this_target} "-lxml2" )
+TARGET_LINK_LIBRARIES(${this_target} "-lxml2")
+TARGET_LINK_LIBRARIES(${this_target} "-lX11")
 
 SET_TARGET_PROPERTIES(${this_target} 
        PROPERTIES 
index dd28508..d12ec64 100644 (file)
 #ifndef _FUI_IME_H_\r
 #define _FUI_IME_H_\r
 \r
+#include <FUiImeIInputMethodListener.h>\r
+#include <FUiImeIInputMethodProvider.h>\r
+#include <FUiImeInputMethod.h>\r
 #include <FUiImeInputMethodInfo.h>\r
 #include <FUiImeInputMethodManager.h>\r
 \r
 /**\r
  * @namespace Tizen::Ui::Ime\r
  * @brief This namespace contains the classes and interfaces for an input method.\r
- * @since 2.0\r
+ * @since 2.1\r
  *\r
  * @remarks @b Header @b %file: @b \#include @b <FUiIme.h> @n\r
  * @b Library : @b osp-ime\r
@@ -43,6 +46,7 @@
  * The following diagram illustrates the relationships between the classes belonging to the %Ime namespace.\r
  *\r
  * @image html ui_ime_namespace_classdiagram.png\r
+ *\r
  */\r
 namespace Tizen { namespace Ui { namespace Ime {\r
 \r
similarity index 93%
rename from src/FUiImeIInputMethodListener.h
rename to inc/FUiImeIInputMethodListener.h
index 3b6e3de..06381c2 100644 (file)
 namespace Tizen { namespace Ui { namespace Ime {
 
 /**
- * @if VISPARTNER
  * @interface  IInputMethodListener
  * @brief      This interface provides a listener for the InputMethod class to receive asynchronous callbacks from the input service.
- * @since      2.0
+ * @since      2.1
  *
  * @remarks IME application developers can implement a class that is derived from %IInputMethodListener and use it to receive asynchronous callbacks
  * from the input service.
  *
- * @visibility partner
+ * @privlevel partner
  * @privilege http://tizen.org/privilege/ime
  *
  * The %IInputMethodListener provides a listener for the %InputMethod class to receive asynchronous callbacks from the input service.
@@ -60,50 +59,43 @@ namespace Tizen { namespace Ui { namespace Ime {
  * };
  * @endcode
  *
- * @endif
  */
 class _OSP_EXPORT_ IInputMethodListener
        : virtual public Tizen::Base::Runtime::IEventListener
 {
 public:
        /** 
-       * @if VISPARTNER
        * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this
        * interface is called.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
-       * @endif
        */
        virtual ~IInputMethodListener(void) {}
 
        /** 
-       * @if VISPARTNER
        * Called when the position of the cursor in an associated text input UI control changes.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @param[in]    position The position of the cursor
-       * @endif
        */
        virtual void OnCursorPositionChanged(int position) {}
 
        /** 
-       * @if VISPARTNER
        * Called when an associated text input UI control responds to a request with the surrounding text.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @param[in] text The surrounding text
        * @param[in] cursorPosition The position of the cursor
        * @remarks The surrounding text can be requested by the Tizen::Ui::Ime::InputMethod::RequestSurroundingText() method. The length of the
        * surrounding text can be less than that requested by the user.
-       * @endif
        */
        virtual void OnSurroundingTextReceived(const Tizen::Base::String& text, int cursorPosition) {}
 
@@ -115,7 +107,7 @@ protected:
        // Following method is reserved and may change its name at any time without
        // prior notice.
        //
-       // @since 2.0
+       // @since 2.1
        //
        virtual void IInputMethodListener_Reserved1(void) {}
 
@@ -126,7 +118,7 @@ protected:
        // Following method is reserved and may change its name at any time without
        // prior notice.
        //
-       // @since 2.0
+       // @since 2.1
        //
        virtual void IInputMethodListener_Reserved2(void) {}
 
@@ -137,7 +129,7 @@ protected:
        // Following method is reserved and may change its name at any time without
        // prior notice.
        //
-       // @since 2.0
+       // @since 2.1
        //
        virtual void IInputMethodListener_Reserved3(void) {}
 
@@ -148,7 +140,7 @@ protected:
        // Following method is reserved and may change its name at any time without
        // prior notice.
        //
-       // @since 2.0
+       // @since 2.1
        //
        virtual void IInputMethodListener_Reserved4(void) {}
 
@@ -159,7 +151,7 @@ protected:
        // Following method is reserved and may change its name at any time without
        // prior notice.
        //
-       // @since 2.0
+       // @since 2.1
        //
        virtual void IInputMethodListener_Reserved5(void) {}
 };
similarity index 88%
rename from src/FUiImeIInputMethodProvider.h
rename to inc/FUiImeIInputMethodProvider.h
index b2d6ac6..36e52ec 100644 (file)
 #define _FUI_IME_IINPUT_METHOD_PROVIDER_H_
 
 #include <FGrpRectangle.h>
+#include <FLclLocale.h>
 #include <FOspConfig.h>
 #include <FUiInputConnectionTypes.h>
 
 namespace Tizen { namespace Ui { namespace Ime {
 
 /**
- * @if VISPARTNER
  * @interface  IInputMethodProvider
  * @brief      This is an interface for the InputMethod class that interacts with the associated text input UI control.
- * @since      2.0
+ * @since      2.1
  *
  * @remarks The IME application developers can implement a class derived from %IInputMethodProvider and set it as the provider of the InputMethod class.
  * The IME application can then provide attributes for the soft input panel and operate according to the commands of the associated text input UI control. For
  * example, when ShowInputPanel() or HideInputPanel() are called, the IME application's frame should either be hidden or made visible.
  *
- * @visibility partner
+ * @privlevel partner
  * @privilege http://tizen.org/privilege/ime
  *
  * The %IInputMethodProvider interface is an interface for the InputMethod class that interacts with the associated text input UI control.
@@ -60,152 +60,141 @@ namespace Tizen { namespace Ui { namespace Ime {
  * };
  * @endcode
  *
- * @endif
  */
 class _OSP_EXPORT_ IInputMethodProvider
 {
 public:
        /**
-       * @if VISPARTNER
        * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this
        * interface is called.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
-       * @endif
        */
        virtual ~IInputMethodProvider(void) {}
 
        /**
-       * @if VISPARTNER
        * Called when the associated text input UI control requests the enter key action of the input panel.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @return The enter key action of the input panel
-       * @endif
        */
        virtual Tizen::Ui::InputPanelAction GetEnterKeyAction(void) {return Tizen::Ui::INPUT_PANEL_ACTION_ENTER;}
 
        /**
-       * @if VISPARTNER
        * Called when the associated text input UI control requests the position and size of the input panel.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @return The position and size of the input panel
        * @remarks The associated text input UI control can change its position on the screen to avoid becoming positioned behind the input panel.
-       * @endif
        */
        virtual Tizen::Graphics::Rectangle GetInputPanelBounds(void) = 0;
 
        /**
-       * @if VISPARTNER
        * Called when the associated text input UI control requests the style of the input panel.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @return A style of the input panel
-       * @endif
        */
        virtual Tizen::Ui::InputPanelStyle GetInputPanelStyle(void) {return Tizen::Ui::INPUT_PANEL_STYLE_NORMAL;}
 
+       /*
+       * Called when the associated text input UI control requests the language of the input method.
+       *
+       * @since 2.1
+       * @privlevel partner
+       * @privilege http://tizen.org/privilege/ime
+       *
+       * @return A language of the input method
+       */
+       virtual Tizen::Locales::Locale GetLanguage(void) {return Tizen::Locales::Locale(Tizen::Locales::LANGUAGE_ENG,
+                                                                                                               Tizen::Locales::COUNTRY_US);}
+
        /**
-       * @if VISPARTNER
        * Called when the associated text input UI control requests the input panel to enable or disable the caps mode.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @param[in] enable The state of the caps mode
-       * @endif
        */
        virtual void SetCapsModeEnabled(bool enable) {}
 
        /**
-       * @if VISPARTNER
        * Called when the associated text input UI control requests the input panel to set the enter key action.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @param[in] action The enter key action
        * @remarks The input panel can show text on the enter button according to the enter key action.
-       * @endif
        */
        virtual void SetEnterKeyAction(Tizen::Ui::InputPanelAction action) {}
 
        /**
-       * @if VISPARTNER
        * Called when the associated text input UI control requests the input panel to enable or disable the enter key action.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @param[in] enable The state of the enter key action
-       * @endif
        */
        virtual void SetEnterKeyActionEnabled(bool enable) {}
 
        /**
-       * @if VISPARTNER
        * Called when the associated text input UI control requests the input panel to set its style.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @param[in] style The style of the input panel
-       * @endif
        */
        virtual void SetInputPanelStyle(Tizen::Ui::InputPanelStyle style) {}
 
        /**
-       * @if VISPARTNER
        * Called when the associated text input UI control requests the input panel to hide itself.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @remarks The IME application developer should implement this interface.
-       * @endif
        */
        virtual void HideInputPanel(void) = 0;
 
        /**
-       * @if VISPARTNER
        * Called when the associated text input UI control checks whether the enter key action is enabled or not.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @return The state of the enter key action
-       * @endif
        */
        virtual bool IsEnterKeyActionEnabled(void) {return false;}
 
        /**
-       * @if VISPARTNER
        * Called when the associated text input UI control requests the input panel to show itself.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @remarks The IME application developer should implement this interface.
-       * @endif
        */
        virtual void ShowInputPanel(void) = 0;
 
@@ -217,7 +206,7 @@ protected:
        // Following method is reserved and may change its name at any time without
        // prior notice.
        //
-       // @since 2.0
+       // @since 2.1
        //
        virtual void IInputMethodProvider_Reserved1(void) {}
 
@@ -228,7 +217,7 @@ protected:
        // Following method is reserved and may change its name at any time without
        // prior notice.
        //
-       // @since 2.0
+       // @since 2.1
        //
        virtual void IInputMethodProvider_Reserved2(void) {}
 
@@ -239,7 +228,7 @@ protected:
        // Following method is reserved and may change its name at any time without
        // prior notice.
        //
-       // @since 2.0
+       // @since 2.1
        //
        virtual void IInputMethodProvider_Reserved3(void) {}
 
@@ -250,7 +239,7 @@ protected:
        // Following method is reserved and may change its name at any time without
        // prior notice.
        //
-       // @since 2.0
+       // @since 2.1
        //
        virtual void IInputMethodProvider_Reserved4(void) {}
 
@@ -261,7 +250,7 @@ protected:
        // Following method is reserved and may change its name at any time without
        // prior notice.
        //
-       // @since 2.0
+       // @since 2.1
        //
        virtual void IInputMethodProvider_Reserved5(void) {}
 };
similarity index 91%
rename from src/FUiImeInputMethod.h
rename to inc/FUiImeInputMethod.h
index d9fa249..04c5fa0 100644 (file)
@@ -38,10 +38,9 @@ namespace Tizen { namespace Ui { namespace Ime {
 class _InputMethodImpl;
 
 /**
- * @if VISPARTNER
  * @class InputMethod
  * @brief This class provides a standard implementation of the %InputMethod.
- * @since      2.0
+ * @since      2.1
  *
  * @final This class is not intended for extension.
  * @remarks    IME application developers can use the %InputMethod to communicate with the associated text input UI control. First, set the provider which
@@ -49,7 +48,7 @@ class _InputMethodImpl;
  * allow the IME application to interact with the associated text input UI control properly. After that, request the %InputMethod to send a text or a key event
  * which is to be displayed in the associated text input UI control.
  *
- * @visibility partner
+ * @privlevel partner
  * @privilege http://tizen.org/privilege/ime
  *
  * The %InputMethod provides a standard implementation of the %InputMethod.
@@ -96,7 +95,6 @@ class _InputMethodImpl;
  * }
  * @endcode
  *
- * @endif
  */
 
 class _OSP_EXPORT_ InputMethod
@@ -104,11 +102,10 @@ class _OSP_EXPORT_ InputMethod
 {
 public:
        /** 
-       * @if VISPARTNER
        * Gets an instance of the %InputMethod.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @return An instance of the %InputMethod
@@ -117,16 +114,14 @@ public:
        * @exception E_SYSTEM A failure occurs from the underlying system.
        * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
        * @remarks The specific error code can be accessed using the GetLastResult() method and OOM might be thrown by this method.
-       * @endif
        */
        static InputMethod* GetInstance(void);
 
        /**
-       * @if VISPARTNER
        * Sets an instance of the IInputMethodProvider.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @param[in] pProvider An instance of the IInputMethodProvider
@@ -135,16 +130,14 @@ public:
        * @remarks The %InputMethod accepts only one provider. So users should unregister the provider by setting @c pProvider as @c null before
        * deallocating an instance of the provider.
        * @remarks The specific error code can be accessed using the GetLastResult() method.
-       * @endif
        */
        void SetInputMethodProvider(IInputMethodProvider* pProvider);
 
        /**
-       * @if VISPARTNER
        * Sets an instance of the IInputMethodListener.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @param[in] pListener An instance of the IInputMethodListener
@@ -153,16 +146,14 @@ public:
        * @remarks The %InputMethod accepts only one listener. So users should unregister the listener by setting @c pListener as @c null before
        * deallocating an instance of the listener.
        * @remarks The specific error code can be accessed using the GetLastResult() method.
-       * @endif
        */
        void SetInputMethodListener(IInputMethodListener* pListener);
 
        /**
-       * @if VISPARTNER
        * Deletes text at the position of the cursor.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @return An error code
@@ -171,32 +162,41 @@ public:
        * @exception E_SUCCESS The method is successful.
        * @exception E_INVALID_ARG The @c length is less than or equal to @c 0.
        * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
-       * @endif
        */
        result DeleteText(int cursorOffset, int length);
 
        /**
-       * @if VISPARTNER
        * Notifies the state of the input panel to the associated text input UI control when the state of an input panel changes.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @return An error code
        * @param[in] state The state of the input panel
        * @exception E_SUCCESS The method is successful.
        * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
-       * @endif
        */
        result NotifyInputPanelState(Tizen::Ui::InputPanelShowState state);
 
+       /*
+       * Notifies a point of time when the language of the input method changes.
+       *
+       * @since 2.1
+       * @privlevel partner
+       * @privilege http://tizen.org/privilege/ime
+       *
+       * @return An error code
+       * @exception E_SUCCESS The method is successful.
+       * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+       */
+       result NotifyLanguageChanged(void);
+
        /**
-        * @if VISPARTNER
         * Requests the surrounding text from the position of the cursor.
         *
-        * @since 2.0
-        * @visibility partner
+        * @since 2.1
+        * @privlevel partner
         * @privilege http://tizen.org/privilege/ime
         *
         * @return An error code
@@ -206,16 +206,14 @@ public:
         * @exception E_INVALID_ARG The arguments are less than @c 0.
         * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
         * @remarks The requested surrounding text can be received using the Tizen::Ui::Ime::IInputMethodListener::OnSurroundingTextReceived() method.
-        * @endif
         */
        result RequestSurroundingText(int lengthBeforeCursor, int lengthAfterCursor);
 
        /**
-       * @if VISPARTNER
        * Sends a composite text to the associated text input UI control.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @return An error code
@@ -223,16 +221,14 @@ public:
        * @exception E_SUCCESS The method is successful.
        * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
        * @remarks The composite text means a text which is being modified.
-       * @endif
        */
        result SendCompositeText(const Tizen::Base::String& text);
 
        /**
-       * @if VISPARTNER
        * Sends a key event directly to the associated text input UI control.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @return An error code
@@ -240,23 +236,20 @@ public:
        * @param[in] state The key state
        * @exception E_SUCCESS The method is successful.
        * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
-       * @endif
        */
        result SendKeyEvent(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState state);
 
        /**
-       * @if VISPARTNER
        * Sends text to the associated text input UI control.
        *
-       * @since 2.0
-       * @visibility partner
+       * @since 2.1
+       * @privlevel partner
        * @privilege http://tizen.org/privilege/ime
        *
        * @return An error code
        * @param[in] text The text to send
        * @exception E_SUCCESS The method is successful.
        * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
-       * @endif
        */
        result SendText(const Tizen::Base::String& text);
 
@@ -264,7 +257,7 @@ private:
        //
        // This Construct() is intentionally declared as private so that only the platform can create an instance.
        //
-       // @since 2.0
+       // @since 2.1
        //
        // @return An error code
        // @exception E_SUCCESS The method is successful.
@@ -277,32 +270,34 @@ private:
        //
        // This default constructor is intentionally declared as private to implement the Singleton semantic.
        //
-       // @since 2.0
+       // @since 2.1
        //
        InputMethod(void);
 
        //
        // This destructor is intentionally declared as private to implement the Singleton semantic.
        //
-       // @since 2.0
+       // @since 2.1
        //
        virtual ~InputMethod(void);
 
        //
        // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
        //
-       // @since 2.0
+       // @since 2.1
        //
        InputMethod(const InputMethod& rhs);
 
        //
        // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
        //
-       // @since 2.0
+       // @since 2.1
        //
        InputMethod& operator=(const InputMethod& rhs);
 
 private:
+       friend class _InputMethodImpl;
+
        _InputMethodImpl* __pInputMethodImpl;
 };
 
old mode 100755 (executable)
new mode 100644 (file)
index 0b4d013..f547ff2
@@ -36,80 +36,70 @@ namespace Tizen { namespace Ui { namespace Ime {
 class _InputMethodInfoImpl;\r
 \r
 /**\r
- * @if VISPARTNER\r
  * @class InputMethodInfo\r
  * @brief This class provides a standard implementation of the %InputMethodInfo.\r
- * @since 2.0\r
+ * @since 2.1\r
  *\r
  * @final This class is not intended for extension.\r
  * @remarks A user can get the general information of the input method.\r
  *\r
- * @visibility partner-manufacturer\r
- * @privilege %http://tizen.org/privilege/imemanager\r
+ * @privlevel platform\r
+ * @privilege http://tizen.org/privilege/imemanager\r
  *\r
  * The %InputMethodInfo class provides a standard implementation of the %InputMethodInfo.\r
  *\r
- * @endif\r
  */\r
 class _OSP_EXPORT_ InputMethodInfo\r
        : public Tizen::Base::Object\r
 {\r
 public:\r
        /**\r
-        * @if VISPARTNER\r
         * This destructor overrides Tizen::Base::Object::~Object().\r
         *\r
-        * @since 2.0\r
-        * @visibility partner-manufacturer\r
-        * @privilege %http://tizen.org/privilege/imemanager\r
-        * @endif\r
+        * @since 2.1\r
+        * @privlevel platform\r
+        * @privilege http://tizen.org/privilege/imemanager\r
         */\r
        virtual ~InputMethodInfo(void);\r
 \r
        /**\r
-        * @if VISPARTNER\r
         * Gets the application ID of an input method.\r
         *\r
-        * @since 2.0\r
-        * @visibility partner-manufacturer\r
-        * @privilege %http://tizen.org/privilege/imemanager\r
+        * @since 2.1\r
+        * @privlevel platform\r
+        * @privilege http://tizen.org/privilege/imemanager\r
         *\r
         * @return The application ID\r
         * @exception E_SUCCESS The method is successful.\r
         * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
-        * @endif\r
         */\r
        Tizen::App::AppId GetAppId(void) const;\r
 \r
        /**\r
-        * @if VISPARTNER\r
         * Gets the language list that an input method supports.\r
         *\r
-        * @since 2.0\r
-        * @visibility partner-manufacturer\r
-        * @privilege %http://tizen.org/privilege/imemanager\r
+        * @since 2.1\r
+        * @privlevel platform\r
+        * @privilege http://tizen.org/privilege/imemanager\r
         *\r
         * @return An instance of the language list that consists of the Locale instances\r
         * @exception E_SUCCESS The method is successful.\r
         * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
         * @remarks The %InputMethodInfo automatically deallocates the memory of the language list when it is destroyed. Therefore a user should not\r
         * manually deallocate the memory of the language list.\r
-        * @endif\r
         */\r
        const Tizen::Base::Collection::IList* GetLanguageList(void) const;\r
 \r
        /**\r
-        * @if VISPARTNER\r
         * Gets the name of an input method.\r
         *\r
-        * @since 2.0\r
-        * @visibility partner-manufacturer\r
-        * @privilege %http://tizen.org/privilege/imemanager\r
+        * @since 2.1\r
+        * @privlevel platform\r
+        * @privilege http://tizen.org/privilege/imemanager\r
         *\r
         * @return The name\r
         * @exception E_SUCCESS The method is successful.\r
         * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
-        * @endif\r
         */\r
        Tizen::Base::String GetName(void) const;\r
 \r
@@ -117,7 +107,7 @@ private:
        //\r
        // This Equals() is intentionally declared as private so that only the platform can compare the object received as an input parameter with this object.\r
        //\r
-       // @since 2.0\r
+       // @since 2.1\r
        //\r
        // @return @c true if the object received as an input parameter equals this object, @n\r
        // else @c false\r
@@ -128,14 +118,14 @@ private:
        //\r
        // This default constructor is intentionally declared as private so that only the platform can create an instance.\r
        //\r
-       // @since 2.0\r
+       // @since 2.1\r
        //\r
        InputMethodInfo(void);\r
 \r
        //\r
        // This copy constructor is intentionally declared as private so that only the platform can copy objects.\r
        //\r
-       // @since 2.0\r
+       // @since 2.1\r
        //\r
        // @param[in]   info A reference to the %InputMethodInfo\r
        //\r
@@ -144,7 +134,7 @@ private:
        //\r
        // This copy assignment operator is intentionally declared as private so that only the platform can copy objects.\r
        //\r
-       // @since 2.0\r
+       // @since 2.1\r
        //\r
        // @param[in]   info A reference to the %InputMethodInfo\r
        //\r
old mode 100755 (executable)
new mode 100644 (file)
index 550b59c..e59aac5
 #include <FBaseDataType.h>\r
 #include <FBaseObject.h>\r
 #include <FOspConfig.h>\r
+#include <FUiImeInputMethodInfo.h>\r
 \r
 namespace Tizen { namespace Ui { namespace Ime {\r
 \r
 class _InputMethodManagerImpl;\r
 \r
 /**\r
- * @if VISPARTNER\r
  * @class      InputMethodManager\r
  * @brief      This class provides a standard implementation of the %InputMethodManager.\r
- * @since 2.0\r
+ * @since 2.1\r
  *\r
  * @final This class is not intended for extension.\r
  * @remarks A user can manage input methods installed in the system.\r
  *\r
- * @visibility partner-manufacturer\r
- * @privilege %http://tizen.org/privilege/imemanager\r
+ * @privlevel platform\r
+ * @privilege http://tizen.org/privilege/imemanager\r
  *\r
  * The %InputMethodManager provides a standard implementation of the %InputMethodManager.\r
  *\r
- * @endif\r
  */\r
 class _OSP_EXPORT_ InputMethodManager\r
        : public Tizen::Base::Object\r
 {\r
 public:\r
        /**\r
-        * @if VISPARTNER\r
         * Gets an instance of the %InputMethodManager.\r
         *\r
-        * @since 2.0\r
-        * @visibility partner-manufacturer\r
-        * @privilege %http://tizen.org/privilege/imemanager\r
+        * @since 2.1\r
+        * @privlevel platform\r
+        * @privilege http://tizen.org/privilege/imemanager\r
         *\r
         * @return An instance of the %InputMethodManager\r
         * @exception E_SUCCESS The method is successful.\r
         * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
         * @remarks The specific error code can be accessed using the GetLastResult() method and OOM might be thrown by this method.\r
-        * @endif\r
         */\r
        static InputMethodManager* GetInstance(void);\r
 \r
+       /*\r
+        * Gets the %InputMethodInfo of the active input method.\r
+        *\r
+        * @since 2.1\r
+        * @privlevel platform\r
+        * @privilege http://tizen.org/privilege/imemanager\r
+        *\r
+        * @return An instance of the InputMethodInfo\r
+        * @exception E_SUCCESS The method is successful.\r
+        * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+        * @remarks The specific error code can be accessed using the GetLastResult() method.\r
+        */\r
+       InputMethodInfo* GetActiveInputMethodInfoN(void) const;\r
+\r
        /**\r
-        * @if VISPARTNER\r
         * Gets the list of the %InputMethodInfo of the input methods installed in the system.\r
         *\r
-        * @since 2.0\r
-        * @visibility partner-manufacturer\r
-        * @privilege %http://tizen.org/privilege/imemanager\r
+        * @since 2.1\r
+        * @privlevel platform\r
+        * @privilege http://tizen.org/privilege/imemanager\r
         *\r
         * @return An instance of the list that consists of the InputMethodInfo instances\r
         * @exception E_SUCCESS The method is successful.\r
         * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
         * @remarks The specific error code can be accessed using the GetLastResult() method.\r
-        * @endif\r
         */\r
        Tizen::Base::Collection::IList* GetInputMethodInfoListN(void) const;\r
 \r
        /**\r
-        * @if VISPARTNER\r
         * Sets an input method.\r
         *\r
-        * @since 2.0\r
-        * @visibility partner-manufacturer\r
-        * @privilege %http://tizen.org/privilege/imemanager\r
+        * @since 2.1\r
+        * @privlevel platform\r
+        * @privilege http://tizen.org/privilege/imemanager\r
         *\r
         * @return An error code\r
         * @param[in]   id An application ID\r
         * @exception   E_SUCCESS The method is successful.\r
         * @exception E_APP_NOT_INSTALLED The specified ID doesn't match with any of the application ID for the input method installed in the system.\r
         * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
-        * @endif\r
         */\r
-       result SetInputMethod(Tizen::App::AppId id);\r
+       result SetInputMethod(const Tizen::App::AppId& id);\r
+\r
+       /*\r
+        * Checks whether an input method is active or not.\r
+        *\r
+        * @since 2.1\r
+        * @privlevel platform\r
+        * @privilege http://tizen.org/privilege/imemanager\r
+        *\r
+        * @return @c true if the input method is active, @n\r
+        *             else @c false\r
+        * @param[in]   id An application ID\r
+        * @exception E_SUCCESS The method is successful.\r
+        * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+        * @remarks The specific error code can be accessed using the GetLastResult() method.\r
+        */\r
+       bool IsActiveInputMethod(const Tizen::App::AppId& id) const;\r
 \r
 private:\r
        //\r
        // This default constructor is intentionally declared as private to implement the Singleton semantic.\r
        //\r
-       // @since 2.0\r
+       // @since 2.1\r
        //\r
        InputMethodManager(void);\r
 \r
        //\r
        // This destructor is intentionally declared as private to implement the Singleton semantic.\r
        //\r
-       // @since 2.0\r
+       // @since 2.1\r
        //\r
        virtual ~InputMethodManager(void);\r
 \r
        //\r
        // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
        //\r
-       // @since 2.0\r
+       // @since 2.1\r
        //\r
        InputMethodManager(const InputMethodManager& rhs);\r
 \r
        //\r
        // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
        //\r
-       // @since 2.0\r
+       // @since 2.1\r
        //\r
        InputMethodManager& operator=(const InputMethodManager& rhs);\r
 \r
 private:\r
+       friend class _InputMethodManagerImpl;\r
+\r
        _InputMethodManagerImpl* __pInputMethodManagerImpl;\r
 };\r
 \r
index 912ac56..e8b2a0c 100644 (file)
@@ -3,7 +3,7 @@
 
 Name:       osp-ime
 Summary:    The IME library of OSP 
-Version:    1.2.0.0
+Version:    1.2.1.0
 Release:    1
 Group:      TO_BE/FILLED_IN
 License:    TO BE FILLED IN
@@ -12,6 +12,7 @@ BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(ecore)
 BuildRequires:  pkgconfig(elementary)
+BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(isf)
 BuildRequires:  pkgconfig(libwbxml2)
 BuildRequires:  pkgconfig(osp-appfw)
@@ -20,6 +21,7 @@ BuildRequires:  osp-appfw-internal-devel
 BuildRequires:  pkgconfig(osp-uifw)
 BuildRequires:  osp-uifw-internal-devel
 BuildRequires:  pkgconfig(libprivilege-control)
+BuildRequires:  pkgconfig(xv)
 
 # runtime requires
 Requires: osp-appfw
index 8d6b5e8..7a30733 100644 (file)
@@ -54,9 +54,17 @@ InputMethod::Construct(void)
 {\r
        result r = E_SUCCESS;\r
 \r
-       __pInputMethodImpl = _InputMethodImpl::GetInstance(*this);\r
-       r = GetLastResult();\r
-       SysTryReturnResult(NID_UI_IME, __pInputMethodImpl, r, "Propagating.");\r
+       __pInputMethodImpl = new(std::nothrow) _InputMethodImpl();\r
+       SysTryReturnResult(NID_UI_IME, __pInputMethodImpl, E_OUT_OF_MEMORY, "Memory allocation failed.");\r
+\r
+       r = __pInputMethodImpl->Construct();\r
+       SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "Propagating.");\r
+\r
+       return r;\r
+\r
+CATCH:\r
+       delete __pInputMethodImpl;\r
+       __pInputMethodImpl = null;\r
 \r
        return r;\r
 }\r
@@ -92,16 +100,12 @@ void
 InputMethod::SetInputMethodProvider(IInputMethodProvider* pProvider)\r
 {\r
        __pInputMethodImpl->SetInputMethodProvider(pProvider);\r
-\r
-       return;\r
 }\r
 \r
 void\r
 InputMethod::SetInputMethodListener(IInputMethodListener* pListener)\r
 {\r
        __pInputMethodImpl->SetInputMethodListener(pListener);\r
-\r
-       return;\r
 }\r
 \r
 result\r
@@ -117,6 +121,12 @@ InputMethod::NotifyInputPanelState(InputPanelShowState state)
 }\r
 \r
 result\r
+InputMethod::NotifyLanguageChanged(void)\r
+{\r
+       return __pInputMethodImpl->NotifyLanguageChanged();\r
+}\r
+\r
+result\r
 InputMethod::RequestSurroundingText(int lengthBeforeCursor, int lengthAfterCursor)\r
 {\r
        return __pInputMethodImpl->RequestSurroundingText(lengthBeforeCursor, lengthAfterCursor);\r
@@ -129,7 +139,7 @@ InputMethod::SendCompositeText(const String& text)
 }\r
 \r
 result\r
-InputMethod::SendKeyEvent(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState state)\r
+InputMethod::SendKeyEvent(KeyCode code, KeyState state)\r
 {\r
        return __pInputMethodImpl->SendKeyEvent(code, state);\r
 }\r
index e078bbc..5c6c566 100644 (file)
 #include <FSec_AccessController.h>\r
 #include "FUiIme_InputMethodInfoImpl.h"\r
 \r
+using namespace Tizen::App;\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Base::Collection;\r
 using namespace Tizen::Security;\r
 \r
 namespace Tizen { namespace Ui { namespace Ime {\r
 \r
 InputMethodInfo::InputMethodInfo(void)\r
 {\r
-       result r = E_SUCCESS;\r
-\r
-       __pInputMethodInfoImpl = _InputMethodInfoImpl::CreateInputMethodInfoImplN();\r
-       r = GetLastResult();\r
-       SysTryReturnVoidResult(NID_UI_IME, __pInputMethodInfoImpl, r, "[%s] Propagating.", GetErrorMessage(r));\r
-\r
-       return;\r
+       __pInputMethodInfoImpl = new(std::nothrow) _InputMethodInfoImpl();\r
+       SysTryReturnVoidResult(NID_UI_IME, __pInputMethodInfoImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
 }\r
 \r
 InputMethodInfo::~InputMethodInfo(void)\r
@@ -51,13 +49,8 @@ InputMethodInfo::~InputMethodInfo(void)
 \r
 InputMethodInfo::InputMethodInfo(const InputMethodInfo& info)\r
 {\r
-       result r = E_SUCCESS;\r
-\r
-       __pInputMethodInfoImpl = _InputMethodInfoImpl::CreateInputMethodInfoImplN(*(info.__pInputMethodInfoImpl));\r
-       r = GetLastResult();\r
-       SysTryReturnVoidResult(NID_UI_IME, __pInputMethodInfoImpl, r, "[%s] Propagating.", GetErrorMessage(r));\r
-\r
-       return;\r
+       __pInputMethodInfoImpl = new(std::nothrow) _InputMethodInfoImpl(*(info.__pInputMethodInfoImpl));\r
+       SysTryReturnVoidResult(NID_UI_IME, __pInputMethodInfoImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
 }\r
 \r
 InputMethodInfo&\r
@@ -77,7 +70,7 @@ InputMethodInfo::Equals(const Object& object) const
        return __pInputMethodInfoImpl->Equals(*(pInputMethodInfo->__pInputMethodInfoImpl));\r
 }\r
 \r
-Tizen::App::AppId\r
+AppId\r
 InputMethodInfo::GetAppId(void) const\r
 {\r
        result r = E_SUCCESS;\r
@@ -88,7 +81,7 @@ InputMethodInfo::GetAppId(void) const
        return __pInputMethodInfoImpl->GetAppId();\r
 }\r
 \r
-const Tizen::Base::Collection::IList*\r
+const IList*\r
 InputMethodInfo::GetLanguageList(void) const\r
 {\r
        result r = E_SUCCESS;\r
@@ -99,7 +92,7 @@ InputMethodInfo::GetLanguageList(void) const
        return __pInputMethodInfoImpl->GetLanguageList();\r
 }\r
 \r
-Tizen::Base::String\r
+String\r
 InputMethodInfo::GetName(void) const\r
 {\r
        result r = E_SUCCESS;\r
index 123526d..2d8e206 100644 (file)
@@ -30,6 +30,8 @@
 #include <FSec_AccessController.h>\r
 #include "FUiIme_InputMethodManagerImpl.h"\r
 \r
+using namespace Tizen::App;\r
+using namespace Tizen::Base::Collection;\r
 using namespace Tizen::Security;\r
 \r
 namespace Tizen { namespace Ui { namespace Ime {\r
@@ -55,14 +57,20 @@ InputMethodManager::GetInstance(void)
        r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);\r
        SysTryReturn(NID_UI_IME, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");\r
 \r
+       _InputMethodManagerImpl* pImpl = null;\r
+\r
        if (__pInputMethodManager == null)\r
        {\r
                __pInputMethodManager = new(std::nothrow) InputMethodManager();\r
                SysTryReturn(NID_UI_IME, __pInputMethodManager, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
 \r
-               __pInputMethodManager->__pInputMethodManagerImpl = _InputMethodManagerImpl::GetInstance(*__pInputMethodManager);\r
-               r = GetLastResult();\r
-               SysTryCatch(NID_UI_IME, __pInputMethodManager->__pInputMethodManagerImpl, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+               pImpl = new(std::nothrow) _InputMethodManagerImpl();\r
+               SysTryCatch(NID_UI_IME, pImpl, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+               r = pImpl->Construct();\r
+               SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+               __pInputMethodManager->__pInputMethodManagerImpl = pImpl;\r
        }\r
 \r
        return __pInputMethodManager;\r
@@ -71,12 +79,23 @@ CATCH:
        delete __pInputMethodManager;\r
        __pInputMethodManager = null;\r
 \r
-       __pInputMethodManager->__pInputMethodManagerImpl = null;\r
+       delete pImpl;\r
 \r
        return null;\r
 }\r
 \r
-Tizen::Base::Collection::IList*\r
+InputMethodInfo*\r
+InputMethodManager::GetActiveInputMethodInfoN(void) const\r
+{\r
+       result r = E_SUCCESS;\r
+\r
+       r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);\r
+       SysTryReturn(NID_UI_IME, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");\r
+\r
+       return __pInputMethodManagerImpl->GetActiveInputMethodInfoN();\r
+}\r
+\r
+IList*\r
 InputMethodManager::GetInputMethodInfoListN(void) const\r
 {\r
        result r = E_SUCCESS;\r
@@ -88,7 +107,7 @@ InputMethodManager::GetInputMethodInfoListN(void) const
 }\r
 \r
 result\r
-InputMethodManager::SetInputMethod(Tizen::App::AppId id)\r
+InputMethodManager::SetInputMethod(const AppId& id)\r
 {\r
        result r = E_SUCCESS;\r
 \r
@@ -98,4 +117,15 @@ InputMethodManager::SetInputMethod(Tizen::App::AppId id)
        return __pInputMethodManagerImpl->SetInputMethod(id);\r
 }\r
 \r
+bool\r
+InputMethodManager::IsActiveInputMethod(const AppId& id) const\r
+{\r
+       result r = E_SUCCESS;\r
+\r
+       r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);\r
+       SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");\r
+\r
+       return __pInputMethodManagerImpl->IsActiveInputMethod(id);\r
+}\r
+\r
 }}} // Tizen::Ui::Ime\r
diff --git a/src/FUiIme_EcoreEventHandler.cpp b/src/FUiIme_EcoreEventHandler.cpp
new file mode 100644 (file)
index 0000000..fc67991
--- /dev/null
@@ -0,0 +1,145 @@
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file       FUiIme_EcoreEventHandler.cpp\r
+ * @brief      This is the implementation file for the %_EcoreEventHandler class.\r
+ *\r
+ * This implementation file contains definition of the %_EcoreEventHandler class.\r
+ */\r
+\r
+#include <new>\r
+\r
+#include <Ecore_X.h>\r
+#include <Elementary.h>\r
+\r
+#include <FBaseSysLog.h>\r
+\r
+#include "FUi_EcoreEvas.h"\r
+#include "FUi_EcoreEvasMgr.h"\r
+#include "FUiIme_EcoreEventHandler.h"\r
+#include "FUiIme_TargetWindowAgent.h"\r
+\r
+using namespace Tizen::Ui;\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+_EcoreEventHandler* _EcoreEventHandler::__pEcoreEventHandler = null;\r
+\r
+_EcoreEventHandler::_EcoreEventHandler(void)\r
+       :__pClientMessageHandler(null)\r
+{\r
+}\r
+\r
+_EcoreEventHandler::~_EcoreEventHandler(void)\r
+{\r
+       __pEcoreEventHandler = null;\r
+\r
+       if (__pClientMessageHandler)\r
+       {\r
+               ecore_event_handler_del(__pClientMessageHandler);\r
+               __pClientMessageHandler = null;\r
+       }\r
+}\r
+\r
+_EcoreEventHandler*\r
+_EcoreEventHandler::GetInstance(void)\r
+{\r
+       if (__pEcoreEventHandler == null)\r
+       {\r
+               __pEcoreEventHandler = new(std::nothrow) _EcoreEventHandler();\r
+               SysTryReturn(NID_UI_IME, __pEcoreEventHandler, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+       }\r
+\r
+       return __pEcoreEventHandler;\r
+}\r
+\r
+result\r
+_EcoreEventHandler::Activate(void)\r
+{\r
+       result r = E_SUCCESS;\r
+\r
+       r = Deactivate();\r
+       SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, r, "Propagating.");\r
+\r
+       _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();\r
+       SysTryReturnResult(NID_UI_IME, pEcoreEvasMgr, E_OBJ_NOT_FOUND, "The required instance does not exist.");\r
+       _EcoreEvas* pEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();\r
+       SysTryReturnResult(NID_UI_IME, pEcoreEvas, E_OBJ_NOT_FOUND, "The required instance does not exist.");\r
+       Evas_Object* pEvasObject = pEcoreEvas->GetWindowObject();\r
+       SysTryReturnResult(NID_UI_IME, pEvasObject, E_OBJ_NOT_FOUND, "The required instance does not exist.");\r
+\r
+       __pClientMessageHandler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, ClientMessageCallback, pEvasObject);\r
+       SysTryReturnResult(NID_UI_IME, __pClientMessageHandler, E_SYSTEM, "A failure occurs from the underlying system.");\r
+\r
+       return r;\r
+}\r
+\r
+result\r
+_EcoreEventHandler::Deactivate(void)\r
+{\r
+       result r = E_SUCCESS;\r
+\r
+       if (__pClientMessageHandler)\r
+       {\r
+               void* pData = null;\r
+               pData = ecore_event_handler_del(__pClientMessageHandler);\r
+               SysTryReturnResult(NID_UI_IME, pData, E_SYSTEM, "A failure occurs from the underlying system.");\r
+\r
+               __pClientMessageHandler = null;\r
+       }\r
+\r
+       return r;\r
+}\r
+\r
+Eina_Bool\r
+_EcoreEventHandler::ClientMessageCallback(void* pData, int type, void* pEvent)\r
+{\r
+       SysLog(NID_UI_IME, "The client message callback has been called.");\r
+\r
+       result r = E_SUCCESS;\r
+\r
+       Ecore_X_Event_Client_Message* pMessage = null;\r
+       pMessage = static_cast<Ecore_X_Event_Client_Message*>(pEvent);\r
+       SysTryReturn(NID_UI_IME, pMessage, ECORE_CALLBACK_CANCEL, E_SYSTEM, "[E_SYSTEM] A failure occurs from the underlying system.");\r
+\r
+    if (pMessage->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE)\r
+       {\r
+               Evas_Object* pEvasObject = null;\r
+               pEvasObject = reinterpret_cast<Evas_Object*>(pData);\r
+               SysTryReturn(NID_UI_IME, pEvasObject, ECORE_CALLBACK_CANCEL, E_SYSTEM, "[E_SYSTEM] A failure occurs from the underlying system.");\r
+\r
+               Ecore_X_Window keyboardWindow = elm_win_xwindow_get(pEvasObject);\r
+               Ecore_X_Window activeWindow = pMessage->data.l[1];\r
+\r
+               _TargetWindowAgent* pTargetWindowAgent = _TargetWindowAgent::GetInstance();\r
+               r = GetLastResult();\r
+               SysTryReturn(NID_UI_IME, pTargetWindowAgent, ECORE_CALLBACK_CANCEL, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+               if (pTargetWindowAgent->IsActive(keyboardWindow, activeWindow))\r
+               {\r
+                       int angle = pMessage->data.l[0];\r
+\r
+                       r = pTargetWindowAgent->SetOrientation(angle);\r
+                       SysTryReturn(NID_UI_IME, r == E_SUCCESS, ECORE_CALLBACK_CANCEL, r, "[%s] Propagating.", GetErrorMessage(r));\r
+               }\r
+       }\r
+\r
+       return ECORE_CALLBACK_RENEW;\r
+}\r
+\r
+}}} // Tizen::Ui::Ime\r
diff --git a/src/FUiIme_EcoreEventHandler.h b/src/FUiIme_EcoreEventHandler.h
new file mode 100644 (file)
index 0000000..9dde4c4
--- /dev/null
@@ -0,0 +1,68 @@
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_EcoreEventHandler.h\r
+ * @brief This is the header file for the %_EcoreEventHandler class.\r
+ *\r
+ * This header file contains the declarations of the %_EcoreEventHandler class.\r
+ */\r
+\r
+#ifndef _FUI_IME_INTERNAL_ECORE_EVENT_HANDLER_H_\r
+#define _FUI_IME_INTERNAL_ECORE_EVENT_HANDLER_H_\r
+\r
+#include <Ecore.h>\r
+#include <Eina.h>\r
+\r
+#include <FBaseDataType.h>\r
+#include <FBaseObject.h>\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+/**\r
+* @class _EcoreEventHandler\r
+* @brief This class is a concrete class of the %_EcoreEventHandler class.\r
+* @since 2.1\r
+*\r
+*/\r
+class _EcoreEventHandler\r
+       : public Tizen::Base::Object\r
+{\r
+public:\r
+       static _EcoreEventHandler* GetInstance(void);\r
+\r
+       result Activate(void);\r
+       result Deactivate(void);\r
+\r
+private:\r
+       _EcoreEventHandler();\r
+       virtual ~_EcoreEventHandler(void);\r
+\r
+       _EcoreEventHandler(const _EcoreEventHandler& rhs);\r
+       _EcoreEventHandler& operator=(const _EcoreEventHandler& rhs);\r
+\r
+       static Eina_Bool ClientMessageCallback(void* pData, int type, void* pEvent);\r
+\r
+private:\r
+       static _EcoreEventHandler* __pEcoreEventHandler;\r
+\r
+       Ecore_Event_Handler* __pClientMessageHandler;\r
+};\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif // _FUI_IME_INTERNAL_ECORE_EVENT_HANDLER_H_\r
index 93f7715..c159e63 100644 (file)
@@ -41,6 +41,8 @@ _EcoreFdHandler::_EcoreFdHandler(void)
 \r
 _EcoreFdHandler::~_EcoreFdHandler(void)\r
 {\r
+       __pEcoreFdHandler = null;\r
+\r
        __fd = -1;\r
        __pHelperAgent = null;\r
 \r
@@ -71,7 +73,7 @@ _EcoreFdHandler::GetInstance(int fd, scim::HelperAgent& helperAgent)
 \r
        result r = E_SUCCESS;\r
 \r
-       if (!__pEcoreFdHandler)\r
+       if (__pEcoreFdHandler == null)\r
        {\r
                __pEcoreFdHandler = new(std::nothrow) _EcoreFdHandler();\r
                SysTryReturn(NID_UI_IME, __pEcoreFdHandler, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
@@ -126,7 +128,7 @@ _EcoreFdHandler::Deactivate(void)
 }\r
 \r
 Eina_Bool\r
-_EcoreFdHandler::FdHandler(void *data, Ecore_Fd_Handler *handler)\r
+_EcoreFdHandler::FdHandler(void* pData, Ecore_Fd_Handler* pFdHandler)\r
 {\r
        if (!__pEcoreFdHandler)\r
        {\r
@@ -155,7 +157,7 @@ _EcoreFdHandler::ProcessEvent(void)
        bool connected = false;\r
 \r
        connected = __pHelperAgent->filter_event();\r
-       SysTryReturnResult(NID_UI_IME, connected == true, E_HOST_NOT_FOUND, "The destination host is not found.");\r
+       SysTryReturnResult(NID_UI_IME, connected, E_HOST_NOT_FOUND, "The destination host is not found.");\r
 \r
        return r;\r
 }\r
index b5e56cd..f7de047 100644 (file)
@@ -42,15 +42,13 @@ namespace Tizen { namespace Ui { namespace Ime {
 /**\r
 * @class _EcoreFdHander\r
 * @brief This class is a concrete class of the %_EcoreFdHander class.\r
-* @since 2.0\r
+* @since 2.1\r
 *\r
 */\r
 class _EcoreFdHandler\r
        : public Tizen::Base::Object\r
 {\r
 public:\r
-       virtual ~_EcoreFdHandler(void);\r
-\r
        static _EcoreFdHandler* GetInstance(int fd, scim::HelperAgent& helperAgent);\r
 \r
        result Activate(void);\r
@@ -58,13 +56,14 @@ public:
 \r
 private:\r
        _EcoreFdHandler();\r
+       virtual ~_EcoreFdHandler(void);\r
 \r
        _EcoreFdHandler(const _EcoreFdHandler& rhs);\r
        _EcoreFdHandler& operator=(const _EcoreFdHandler& rhs);\r
 \r
        result Construct(int fd, scim::HelperAgent& helperAgent);\r
 \r
-       static Eina_Bool FdHandler(void *data, Ecore_Fd_Handler *fdHandler);\r
+       static Eina_Bool FdHandler(void* pData, Ecore_Fd_Handler* pFdHandler);\r
 \r
        bool HasPendingEvent(void) const;\r
        result ProcessEvent(void);\r
index 38a03c3..9b45dbd 100644 (file)
@@ -38,8 +38,6 @@ extern "C"
 \r
                r = Tizen::Ui::Ime::_ImeInfo::GetInstance()->Construct(uuid, name, language);\r
                SysTryLog(NID_UI_IME, r == E_SUCCESS, "Initializing _ImeInfo has failed.");\r
-\r
-               return;\r
        }\r
 \r
 #ifdef __cplusplus\r
index ce3cd2a..eb3cf4a 100644 (file)
@@ -37,7 +37,7 @@ namespace Tizen { namespace Ui { namespace Ime {
 /**\r
 * @class _ImeInfo\r
 * @brief This class is a concrete class of the %_ImeInfo class.\r
-* @since 2.0\r
+* @since 2.1\r
 *\r
 */\r
 class _ImeInfo\r
index f2fbda6..779bc4c 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include <new>
+#include <unique_ptr.h>
 
 #include <Ecore_IMF.h>
 #include <Ecore_X.h> // ecore_x_icccm_hints_get
@@ -34,6 +35,7 @@
 #include "FUi_EcoreEvas.h"
 #include "FUi_EcoreEvasMgr.h"
 
+#include "FUiIme_EcoreEventHandler.h"
 #include "FUiIme_EcoreFdHandler.h"
 #include "FUiIme_ImeInfo.h"
 #include "FUiIme_InputMethodImpl.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Graphics;
-using namespace Tizen::Locales;
 using namespace Tizen::Ui;
 
 namespace Tizen { namespace Ui { namespace Ime {
 
-_InputMethodImpl* _InputMethodImpl::__pInputMethodImpl = null;
-
 _InputMethodImpl::_InputMethodImpl(void)
        :__pHelperAgent(null)
-       ,__pInputMethod(null)
+       ,__pEcoreEventHandler(null)
        ,__pEcoreFdHandler(null)
        ,__pInputServiceBinder(null)
-       ,__pInputServiceSignalListener(null)
-       ,__pScimDataConverter(null)
 {
 }
 
 _InputMethodImpl::~_InputMethodImpl(void)
 {
-       __pInputMethodImpl = null;
        __pHelperAgent = null;
-       __pInputMethod = null;
+
+       if (__pEcoreEventHandler)
+       {
+               __pEcoreEventHandler->Deactivate();
+               __pEcoreEventHandler = null;
+       }
 
        if (__pEcoreFdHandler)
        {
@@ -76,16 +77,10 @@ _InputMethodImpl::~_InputMethodImpl(void)
                __pInputServiceBinder->Unbind();
                __pInputServiceBinder = null;
        }
-
-       delete __pInputServiceSignalListener;
-       __pInputServiceSignalListener = null;
-
-       delete __pScimDataConverter;
-       __pScimDataConverter = null;
 }
 
 result
-_InputMethodImpl::Construct(InputMethod& inputMethod)
+_InputMethodImpl::Construct(void)
 {
        result r = E_SUCCESS;
 
@@ -99,19 +94,19 @@ _InputMethodImpl::Construct(InputMethod& inputMethod)
        SysTryCatch(NID_UI_IME, bindingId > -1, , r, "[%s] Propagating.", GetErrorMessage(r));
 
        __pHelperAgent = __pInputServiceBinder->GetHelperAgent();
-       __pInputMethod = &inputMethod;
-
-       __pInputServiceSignalListener = new(std::nothrow) _InputServiceSignalListener();
-       SysTryCatch(NID_UI_IME, __pInputServiceSignalListener, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
-
-       __pScimDataConverter = new(std::nothrow) _ScimDataConverter();
-       SysTryCatch(NID_UI_IME, __pScimDataConverter, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
 
        SetInputServiceSignalCallback();
 
        r = SetEcoreEvasAttribute();
        SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
+       __pEcoreEventHandler = _EcoreEventHandler::GetInstance();
+       r = GetLastResult();
+       SysTryCatch(NID_UI_IME, __pEcoreEventHandler, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = __pEcoreEventHandler->Activate();
+       SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
        __pEcoreFdHandler = _EcoreFdHandler::GetInstance(bindingId, *__pHelperAgent);
        r = GetLastResult();
        SysTryCatch(NID_UI_IME, __pEcoreFdHandler, , r, "[%s] Propagating.", GetErrorMessage(r));
@@ -126,13 +121,12 @@ CATCH:
        __pInputServiceBinder = null;
 
        __pHelperAgent = null;
-       __pInputMethod = null;
-
-       delete __pInputServiceSignalListener;
-       __pInputServiceSignalListener = null;
 
-       delete __pScimDataConverter;
-       __pScimDataConverter = null;
+       if (__pEcoreEventHandler)
+       {
+               __pEcoreEventHandler->Deactivate();
+               __pEcoreEventHandler = null;
+       }
 
        if (__pEcoreFdHandler)
        {
@@ -146,40 +140,19 @@ CATCH:
 _InputMethodImpl*
 _InputMethodImpl::GetInstance(InputMethod& inputMethod)
 {
-       result r = E_SUCCESS;
-
-       if (!__pInputMethodImpl)
-       {
-               __pInputMethodImpl = new(std::nothrow) _InputMethodImpl();
-               SysTryReturn(NID_UI_IME, __pInputMethodImpl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
-               
-               r = __pInputMethodImpl->Construct(inputMethod);
-               SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-       }
-
-       return __pInputMethodImpl;
-
-CATCH:
-       delete __pInputMethodImpl;
-       __pInputMethodImpl = null;
-
-       return null;
+       return inputMethod.__pInputMethodImpl;
 }
 
 void
 _InputMethodImpl::SetInputMethodProvider(IInputMethodProvider* pProvider)
 {
-       __pInputServiceSignalListener->SetInputMethodProvider(pProvider);
-
-       return;
+       _InputServiceSignalListener::SetInputMethodProvider(pProvider);
 }
 
 void
 _InputMethodImpl::SetInputMethodListener(IInputMethodListener* pListener)
 {
-       __pInputServiceSignalListener->SetInputMethodListener(pListener);
-
-       return;
+       _InputServiceSignalListener::SetInputMethodListener(pListener);
 }
 
 result
@@ -222,6 +195,16 @@ _InputMethodImpl::NotifyInputPanelState(InputPanelShowState state)
 }
 
 result
+_InputMethodImpl::NotifyLanguageChanged(void)
+{
+       result r = E_SUCCESS;
+
+       __pHelperAgent->update_input_context(ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, 0);
+
+       return r;
+}
+
+result
 _InputMethodImpl::RequestSurroundingText(int lengthBeforeCursor, int lengthAfterCursor)
 {
        SysTryReturnResult(NID_UI_IME, (lengthBeforeCursor >= 0) && (lengthAfterCursor >= 0), E_INVALID_ARG,
@@ -238,12 +221,12 @@ _InputMethodImpl::RequestSurroundingText(int lengthBeforeCursor, int lengthAfter
 }
 
 result
-_InputMethodImpl::SendCompositeText(const Tizen::Base::String& text)
+_InputMethodImpl::SendCompositeText(const String& text)
 {
        result r = E_SUCCESS;
 
        scim::WideString compositeText;
-       r = __pScimDataConverter->ConvertString(text, compositeText);
+       r = _ScimDataConverter::ConvertString(text, compositeText);
        SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, r, "Propagating.");
 
        scim::AttributeList attributeList;
@@ -253,7 +236,7 @@ _InputMethodImpl::SendCompositeText(const Tizen::Base::String& text)
 }
 
 result
-_InputMethodImpl::SendKeyEvent(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState state)
+_InputMethodImpl::SendKeyEvent(KeyCode code, KeyState state)
 {
        SysTryReturnResult(NID_UI_IME, (code > KEY_INVALID) && (code < KEY_HARDWARE_MAX), E_INVALID_ARG,
                                        "Invalid argument(s) is used. The key code is beyond the scope.");
@@ -263,19 +246,19 @@ _InputMethodImpl::SendKeyEvent(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState stat
        result r = E_SUCCESS;
 
        scim::KeyEvent keyEvent;
-       __pScimDataConverter->ConvertKey(code, state, keyEvent);
+       _ScimDataConverter::ConvertKey(code, state, keyEvent);
        __pHelperAgent->forward_key_event(-1, "", keyEvent);
 
        return r;
 }
 
 result
-_InputMethodImpl::SendText(const Tizen::Base::String& text)
+_InputMethodImpl::SendText(const String& text)
 {
        result r = E_SUCCESS;
 
        scim::String scimText;
-       r = __pScimDataConverter->ConvertString(text, scimText);
+       r = _ScimDataConverter::ConvertString(text, scimText);
        SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, r, "Propagating.");
 
        scim::WideString wideString = scim::utf8_mbstowcs(scimText);
@@ -285,25 +268,6 @@ _InputMethodImpl::SendText(const Tizen::Base::String& text)
        return r;
 }
 
-bool
-_InputMethodImpl::HasPendingEvent(void) const
-{
-       return __pHelperAgent->has_pending_event();
-}
-
-result
-_InputMethodImpl::ProcessPendingEvent(void)
-{
-       result r = E_SUCCESS;
-
-       bool bound = false;
-
-       bound = __pHelperAgent->filter_event();
-       SysTryReturnResult(NID_UI_IME, bound == true, E_HOST_NOT_FOUND, "The destination host is not found.");
-
-       return r;
-}
-
 result
 _InputMethodImpl::SetEcoreEvasAttribute(void)
 {
@@ -341,24 +305,25 @@ _InputMethodImpl::SetEcoreEvasAttribute(void)
 void
 _InputMethodImpl::SetInputServiceSignalCallback(void)
 {
-       __pHelperAgent->signal_connect_exit(scim::slot(_InputServiceSignalListener::OnTerminate));
        __pHelperAgent->signal_connect_get_geometry(scim::slot(_InputServiceSignalListener::GetInputPanelBounds));
+       __pHelperAgent->signal_connect_get_layout(scim::slot(_InputServiceSignalListener::GetInputPanelStyle));
+       __pHelperAgent->signal_connect_get_language_locale(scim::slot(_InputServiceSignalListener::GetLanguage));
+       __pHelperAgent->signal_connect_get_return_key_disable(scim::slot(_InputServiceSignalListener::IsEnterKeyActionEnabled));
+       __pHelperAgent->signal_connect_get_return_key_type(scim::slot(_InputServiceSignalListener::GetEnterKeyAction));
+
+       __pHelperAgent->signal_connect_set_caps_mode(scim::slot(_InputServiceSignalListener::SetCapsModeEnabled));
+       __pHelperAgent->signal_connect_set_language(scim::slot(_InputServiceSignalListener::SetLanguage));
+       __pHelperAgent->signal_connect_set_layout(scim::slot(_InputServiceSignalListener::SetInputPanelStyle));
+       __pHelperAgent->signal_connect_set_return_key_disable(scim::slot(_InputServiceSignalListener::SetEnterKeyActionEnabled));
+       __pHelperAgent->signal_connect_set_return_key_type(scim::slot(_InputServiceSignalListener::SetEnterKeyAction));
+
+       __pHelperAgent->signal_connect_exit(scim::slot(_InputServiceSignalListener::OnTerminate));
        __pHelperAgent->signal_connect_ise_hide(scim::slot(_InputServiceSignalListener::HideInputPanel));
        __pHelperAgent->signal_connect_ise_show(scim::slot(_InputServiceSignalListener::ShowInputPanel));
        __pHelperAgent->signal_connect_update_cursor_position(scim::slot(_InputServiceSignalListener::OnCursorPositionChanged));
        __pHelperAgent->signal_connect_update_surrounding_text(scim::slot(_InputServiceSignalListener::OnSurroundingTextReceived));
-       __pHelperAgent->signal_connect_set_language(scim::slot(_InputServiceSignalListener::SetLanguage));
-       __pHelperAgent->signal_connect_set_return_key_type(scim::slot(_InputServiceSignalListener::SetEnterKeyAction));
-       __pHelperAgent->signal_connect_get_return_key_type(scim::slot(_InputServiceSignalListener::GetEnterKeyAction));
-       __pHelperAgent->signal_connect_set_return_key_disable(scim::slot(_InputServiceSignalListener::SetEnterKeyActionEnabled));
-       __pHelperAgent->signal_connect_get_return_key_disable(scim::slot(_InputServiceSignalListener::IsEnterKeyActionEnabled));
-       __pHelperAgent->signal_connect_get_layout(scim::slot(_InputServiceSignalListener::GetInputPanelStyle));
-       __pHelperAgent->signal_connect_set_layout(scim::slot(_InputServiceSignalListener::SetInputPanelStyle));
-       __pHelperAgent->signal_connect_set_caps_mode(scim::slot(_InputServiceSignalListener::SetCapsModeEnabled));
 
        SysLog(NID_UI_IME, "The signal callback functions of the input service have been set");
-
-       return;
 }
 
 void
@@ -380,8 +345,6 @@ _InputMethodImpl::HideInputPanel(void)
        {
                evas_object_hide(pEvasObject);
        }
-
-       return;
 }
 
 void
@@ -403,8 +366,6 @@ _InputMethodImpl::ShowInputPanel(void)
        {
                evas_object_show(pEvasObject);
        }
-
-       return;
 }
 
 }}} // Tizen::Ui::Ime
index cd5021b..0aebe15 100644 (file)
 #include <FBaseObject.h>\r
 #include <FBaseString.h>\r
 #include <FGrpRectangle.h>\r
-#include <FLclLocale.h>\r
 #include <FUiImeIInputMethodListener.h>\r
 #include <FUiImeIInputMethodProvider.h>\r
 #include <FUiImeInputMethod.h>\r
+#include <FUiKeyTypes.h>\r
 \r
-#include "FUiIme_Key.h"\r
 #include "FUiIme_InputServiceBinder.h"\r
 \r
 namespace Tizen { namespace Ui { namespace Ime {\r
 \r
+class _EcoreEventHandler;\r
 class _EcoreFdHandler;\r
-class _ScimDataConverter;\r
-class _InputServiceSignalListener;\r
 \r
 /**\r
 * @class _InputMethodImpl\r
 * @brief This class is a concrete class of the %_InputMethodImpl class.\r
-* @since 2.0\r
+* @since 2.1\r
 *\r
 */\r
 class _InputMethodImpl\r
        : public Tizen::Base::Object\r
 {\r
 public:\r
-       virtual ~_InputMethodImpl(void);\r
-\r
        static _InputMethodImpl* GetInstance(InputMethod& inputMethod);\r
 \r
        void SetInputMethodProvider(IInputMethodProvider* pProvider);\r
@@ -71,6 +67,7 @@ public:
 \r
        result DeleteText(int cursorOffset, int length);\r
        result NotifyInputPanelState(Tizen::Ui::InputPanelShowState state);\r
+       result NotifyLanguageChanged(void);\r
        result RequestSurroundingText(int lengthBeforeCursor, int lengthAfterCursor);\r
        result SendCompositeText(const Tizen::Base::String& text);\r
        result SendKeyEvent(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState state);\r
@@ -78,14 +75,13 @@ public:
 \r
 private:\r
        _InputMethodImpl(void);\r
+       virtual ~_InputMethodImpl(void);\r
 \r
        _InputMethodImpl(const _InputMethodImpl& rhs);\r
        _InputMethodImpl& operator=(const _InputMethodImpl& rhs);\r
 \r
-       result Construct(InputMethod& inputMethod);\r
+       result Construct(void);\r
 \r
-       bool HasPendingEvent(void) const;\r
-       result ProcessPendingEvent(void);\r
        result SetEcoreEvasAttribute(void);\r
        void SetInputServiceSignalCallback(void);\r
 \r
@@ -93,16 +89,13 @@ private:
        void ShowInputPanel(void);\r
 \r
 private:\r
-       static _InputMethodImpl* __pInputMethodImpl;\r
+       friend class InputMethod;\r
 \r
        scim::HelperAgent* __pHelperAgent;\r
 \r
-       InputMethod* __pInputMethod;\r
-\r
+       _EcoreEventHandler* __pEcoreEventHandler;\r
        _EcoreFdHandler* __pEcoreFdHandler;\r
        _InputServiceBinder* __pInputServiceBinder;\r
-       _InputServiceSignalListener* __pInputServiceSignalListener;\r
-       _ScimDataConverter* __pScimDataConverter;\r
 };\r
 \r
 }}} // Tizen::Ui::Ime\r
index 8e63c76..37120ff 100644 (file)
@@ -24,6 +24,7 @@
 \r
 #include <new>\r
 #include <string.h>\r
+#include <unique_ptr.h>\r
 \r
 #include <FBaseColTypes.h>\r
 #include <FBaseSysLog.h>\r
@@ -33,6 +34,7 @@
 #include "FUiIme_InputMethodInfoImpl.h"\r
 #include "FUiIme_ScimDataConverter.h"\r
 \r
+using namespace Tizen::App;\r
 using namespace Tizen::Base;\r
 using namespace Tizen::Base::Collection;\r
 using namespace Tizen::Locales;\r
@@ -44,19 +46,13 @@ _InputMethodInfoImpl::_InputMethodInfoImpl(void)
 {\r
        result r = E_SUCCESS;\r
 \r
-       __pLanguageList = new(std::nothrow) ArrayList(SingleObjectDeleter);\r
-       SysTryReturnVoidResult(NID_UI_IME, __pLanguageList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+       std::unique_ptr<ArrayList> pLanguageList(new(std::nothrow) ArrayList(SingleObjectDeleter));\r
+       SysTryReturnVoidResult(NID_UI_IME, pLanguageList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
 \r
-       r = __pLanguageList->Construct();\r
-       SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
-\r
-       return;\r
-\r
-CATCH:\r
-       delete __pLanguageList;\r
-       __pLanguageList = null;\r
+       r = pLanguageList->Construct();\r
+       SysTryReturnVoidResult(NID_UI_IME, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));\r
 \r
-       return;\r
+       __pLanguageList = pLanguageList.release();\r
 }\r
 \r
 _InputMethodInfoImpl::_InputMethodInfoImpl(const _InputMethodInfoImpl& impl)\r
@@ -66,11 +62,13 @@ _InputMethodInfoImpl::_InputMethodInfoImpl(const _InputMethodInfoImpl& impl)
        __appId = impl.__appId;\r
        __name = impl.__name;\r
 \r
-       __pLanguageList = new(std::nothrow) ArrayList(SingleObjectDeleter);\r
-       SysTryReturnVoidResult(NID_UI_IME, __pLanguageList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+       std::unique_ptr<ArrayList> pLanguageList(new(std::nothrow) ArrayList(SingleObjectDeleter));\r
+       SysTryReturnVoidResult(NID_UI_IME, pLanguageList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
 \r
-       r = __pLanguageList->Construct();\r
-       SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+       r = pLanguageList->Construct();\r
+       SysTryReturnVoidResult(NID_UI_IME, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+       __pLanguageList = pLanguageList.release();\r
 \r
        r = SetLanguageList(*(impl.__pLanguageList));\r
        SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
@@ -96,24 +94,6 @@ _InputMethodInfoImpl::~_InputMethodInfoImpl(void)
 }\r
 \r
 _InputMethodInfoImpl*\r
-_InputMethodInfoImpl::CreateInputMethodInfoImplN(void)\r
-{\r
-       _InputMethodInfoImpl* pInputMethodInfoImpl = new(std::nothrow) _InputMethodInfoImpl();\r
-       SysTryReturn(NID_UI_IME, pInputMethodInfoImpl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
-\r
-       return pInputMethodInfoImpl;\r
-}\r
-\r
-_InputMethodInfoImpl*\r
-_InputMethodInfoImpl::CreateInputMethodInfoImplN(const _InputMethodInfoImpl& impl)\r
-{\r
-       _InputMethodInfoImpl* pInputMethodInfoImpl = new(std::nothrow) _InputMethodInfoImpl(impl);\r
-       SysTryReturn(NID_UI_IME, pInputMethodInfoImpl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
-\r
-       return pInputMethodInfoImpl;\r
-}\r
-\r
-_InputMethodInfoImpl*\r
 _InputMethodInfoImpl::GetInstance(InputMethodInfo& inputMethodInfo)\r
 {\r
        return inputMethodInfo.__pInputMethodInfoImpl;\r
@@ -151,19 +131,19 @@ _InputMethodInfoImpl::Equals(const Object& object) const
        return __appId.Equals(pInputMethodInfoImpl->__appId, true);\r
 }\r
 \r
-Tizen::App::AppId\r
+AppId\r
 _InputMethodInfoImpl::GetAppId(void) const\r
 {\r
        return __appId;\r
 }\r
 \r
-const Tizen::Base::Collection::IList*\r
+const IList*\r
 _InputMethodInfoImpl::GetLanguageList(void) const\r
 {\r
        return __pLanguageList;\r
 }\r
 \r
-Tizen::Base::String\r
+String\r
 _InputMethodInfoImpl::GetName(void) const\r
 {\r
        return __name;\r
@@ -176,15 +156,13 @@ _InputMethodInfoImpl::GetUuid(void) const
 }\r
 \r
 void\r
-_InputMethodInfoImpl::SetAppId(Tizen::App::AppId id)\r
+_InputMethodInfoImpl::SetAppId(AppId id)\r
 {\r
        __appId = id;\r
-\r
-       return;\r
 }\r
 \r
 void\r
-_InputMethodInfoImpl::SetUuid(Tizen::Base::String id)\r
+_InputMethodInfoImpl::SetUuid(String id)\r
 {\r
        __uuid = id;\r
 \r
@@ -193,12 +171,10 @@ _InputMethodInfoImpl::SetUuid(Tizen::Base::String id)
                delete[] __pUuid;\r
        }\r
        __pUuid = _StringConverter::CopyToCharArrayN(id);\r
-\r
-       return;\r
 }\r
 \r
 result\r
-_InputMethodInfoImpl::SetLanguageList(const Tizen::Base::Collection::IList& list)\r
+_InputMethodInfoImpl::SetLanguageList(const IList& list)\r
 {\r
        result r = E_SUCCESS;\r
 \r
@@ -215,7 +191,7 @@ _InputMethodInfoImpl::SetLanguageList(const Tizen::Base::Collection::IList& list
        {\r
                const Locale* pLanguage = static_cast<const Locale*>(pLanguageList->GetAt(i));\r
                r = GetLastResult();\r
-               SysTryReturnResult(NID_UI_IME, pLanguage, r, "Propagating.");\r
+               SysTryCatch(NID_UI_IME, pLanguage, , r, "[%s] Propagating.", GetErrorMessage(r));\r
 \r
                pDestLanguage = new(std::nothrow) Locale(*pLanguage);\r
                SysTryCatch(NID_UI_IME, pDestLanguage, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
@@ -235,20 +211,15 @@ CATCH:
 }\r
 \r
 void\r
-_InputMethodInfoImpl::SetName(const Tizen::Base::String& name)\r
+_InputMethodInfoImpl::SetName(const String& name)\r
 {\r
        __name = name;\r
-\r
-       return;\r
 }\r
 \r
 void\r
 _InputMethodInfoImpl::SetName(const scim::String& name)\r
 {\r
-       _ScimDataConverter converter;\r
-       converter.ConvertString(name, __name);\r
-\r
-       return;\r
+       _ScimDataConverter::ConvertString(name, __name);\r
 }\r
 \r
 result\r
@@ -257,30 +228,30 @@ _InputMethodInfoImpl::AddLanguage(const char* language)
        result r = E_SUCCESS;\r
 \r
        // verify the input parameter\r
-       const int ISO_639_2_LENGTH = 6;\r
-       const int ISO_639_2_LANGUAGE_CODE_LENGTH = 3;\r
-       const int COUNTRY_CODE_LENGTH = 2;\r
+       const int _ISO_639_2_LENGTH = 6;\r
+       const int _ISO_639_2_LANGUAGE_CODE_LENGTH = 3;\r
+       const int _COUNTRY_CODE_LENGTH = 2;\r
 \r
        int length = strlen(language);\r
-       SysTryReturnResult(NID_UI_IME, (length == ISO_639_2_LENGTH), E_INVALID_ARG,\r
+       SysTryReturnResult(NID_UI_IME, (length == _ISO_639_2_LENGTH), E_INVALID_ARG,\r
                                        "Invalid argument(s) is used. The language is not a type of ISO 639-2 and is %s.", language);\r
 \r
        LanguageCode languageCode = LANGUAGE_INVALID;\r
        CountryCode countryCode = COUNTRY_INVALID;\r
 \r
        // LanguageCode\r
-       char srcLanguage[ISO_639_2_LANGUAGE_CODE_LENGTH + 1];\r
-       strncpy(srcLanguage, language, ISO_639_2_LANGUAGE_CODE_LENGTH);\r
-       srcLanguage[ISO_639_2_LANGUAGE_CODE_LENGTH] = '\0';\r
+       char srcLanguage[_ISO_639_2_LANGUAGE_CODE_LENGTH + 1];\r
+       strncpy(srcLanguage, language, _ISO_639_2_LANGUAGE_CODE_LENGTH);\r
+       srcLanguage[_ISO_639_2_LANGUAGE_CODE_LENGTH] = '\0';\r
 \r
        languageCode = Locale::StringToLanguageCode(srcLanguage);\r
        SysTryReturnResult(NID_UI_IME, languageCode != LANGUAGE_INVALID, E_INVALID_ARG,\r
                                        "Invalid argument(s) is used. The srcLanguage is %s.", srcLanguage);\r
 \r
        // CountryCode\r
-       char srcCountry[COUNTRY_CODE_LENGTH + 1];\r
-       strncpy(srcCountry, language + ISO_639_2_LANGUAGE_CODE_LENGTH + 1, COUNTRY_CODE_LENGTH);\r
-       srcCountry[COUNTRY_CODE_LENGTH] = '\0';\r
+       char srcCountry[_COUNTRY_CODE_LENGTH + 1];\r
+       strncpy(srcCountry, language + _ISO_639_2_LANGUAGE_CODE_LENGTH + 1, _COUNTRY_CODE_LENGTH);\r
+       srcCountry[_COUNTRY_CODE_LENGTH] = '\0';\r
 \r
        countryCode = Locale::StringToCountryCode(srcCountry);\r
        SysTryReturnResult(NID_UI_IME, countryCode != COUNTRY_INVALID, E_INVALID_ARG,\r
index 81a189d..790eeb1 100644 (file)
@@ -44,18 +44,13 @@ namespace Tizen { namespace Ui { namespace Ime {
 /**\r
 * @class _InputMethodInfoImpl\r
 * @brief This class is a concrete class of the %_InputMethodInfoImpl class.\r
-* @since 2.0\r
+* @since 2.1\r
 *\r
 */\r
 class _InputMethodInfoImpl\r
        : public Tizen::Base::Object\r
 {\r
 public:\r
-       virtual ~_InputMethodInfoImpl(void);\r
-\r
-       static _InputMethodInfoImpl* CreateInputMethodInfoImplN(void);\r
-       static _InputMethodInfoImpl* CreateInputMethodInfoImplN(const _InputMethodInfoImpl& impl);\r
-\r
        static _InputMethodInfoImpl* GetInstance(InputMethodInfo& inputMethodInfo);\r
 \r
        _InputMethodInfoImpl& operator=(const _InputMethodInfoImpl& impl);\r
@@ -77,8 +72,11 @@ public:
 private:\r
        _InputMethodInfoImpl(void);\r
        _InputMethodInfoImpl(const _InputMethodInfoImpl& impl);\r
+       virtual ~_InputMethodInfoImpl(void);\r
 \r
 private:\r
+       friend class InputMethodInfo;\r
+\r
        Tizen::App::AppId __appId;\r
        Tizen::Base::String __uuid;\r
        Tizen::Base::String __name;\r
index b9d8baa..166cb1c 100644 (file)
@@ -34,7 +34,6 @@
 #include <FBaseString.h>\r
 #include <FBaseSysLog.h>\r
 #include <FLclLocale.h>\r
-#include <FUiImeInputMethodInfo.h>\r
 \r
 #include <FApp_AppManagerImpl.h>\r
 #include <FBase_StringConverter.h>\r
@@ -48,28 +47,20 @@ using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;\r
 using namespace Tizen::Locales;\r
 \r
-const AppId PRELOADED_IME_APPID = "sja4pgHCvq.Tizen";\r
-const char* PRELOADED_IME_UUID = "12aa3425-f88d-45f4-a509-cee8dfe904e3";\r
-const char* PRELOADED_IME_LANGUAGE = "eng-US";\r
+static const AppId PRELOADED_IME_APPID = "sja4pgHCvq.Tizen";\r
+static const char* PRELOADED_IME_UUID = "12aa3425-f88d-45f4-a509-cee8dfe904e3";\r
 \r
 namespace Tizen { namespace Ui { namespace Ime {\r
 \r
-_InputMethodManagerImpl* _InputMethodManagerImpl::__pInputMethodManagerImpl = null;\r
-\r
 _InputMethodManagerImpl::_InputMethodManagerImpl(void)\r
-       :__pInputMethodManager(null)\r
-       ,__pInputMethodAppIdList(null)\r
+       :__pInputMethodAppIdList(null)\r
 {\r
 }\r
 \r
 _InputMethodManagerImpl::~_InputMethodManagerImpl(void)\r
 {\r
-       __pInputMethodManagerImpl = null;\r
-\r
        delete __pInputMethodAppIdList;\r
        __pInputMethodAppIdList = null;\r
-\r
-       __pInputMethodManager = null;\r
 }\r
 \r
 result\r
@@ -77,17 +68,13 @@ _InputMethodManagerImpl::Construct(void)
 {\r
        result r = E_SUCCESS;\r
 \r
-       __pInputMethodAppIdList = new(std::nothrow) ArrayList(SingleObjectDeleter);\r
-       SysTryReturnResult(NID_UI_IME, __pInputMethodAppIdList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+       std::unique_ptr<ArrayList> pInputMethodAppIdList(new(std::nothrow) ArrayList(SingleObjectDeleter));\r
+       SysTryReturnResult(NID_UI_IME, pInputMethodAppIdList, E_OUT_OF_MEMORY, "Memory allocation failed.");\r
 \r
-       r = __pInputMethodAppIdList->Construct();\r
-       SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
-\r
-       return r;\r
+       r = pInputMethodAppIdList->Construct();\r
+       SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, r, "Propagating.");\r
 \r
-CATCH:\r
-       delete __pInputMethodAppIdList;\r
-       __pInputMethodAppIdList = null;\r
+       __pInputMethodAppIdList = pInputMethodAppIdList.release();\r
 \r
        return r;\r
 }\r
@@ -95,26 +82,7 @@ CATCH:
 _InputMethodManagerImpl*\r
 _InputMethodManagerImpl::GetInstance(InputMethodManager& inputMethodManager)\r
 {\r
-       result r = E_SUCCESS;\r
-\r
-       if (!__pInputMethodManagerImpl)\r
-       {\r
-               __pInputMethodManagerImpl = new(std::nothrow) _InputMethodManagerImpl();\r
-               SysTryReturn(NID_UI_IME, __pInputMethodManagerImpl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
-\r
-               r = __pInputMethodManagerImpl->Construct();\r
-               SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
-\r
-               __pInputMethodManagerImpl->__pInputMethodManager = &inputMethodManager;\r
-       }\r
-\r
-       return __pInputMethodManagerImpl;\r
-\r
-CATCH:\r
-       delete __pInputMethodManagerImpl;\r
-       __pInputMethodManagerImpl = null;\r
-\r
-       return null;\r
+       return inputMethodManager.__pInputMethodManagerImpl;\r
 }\r
 \r
 InputMethodInfo*\r
@@ -127,29 +95,28 @@ _InputMethodManagerImpl::GetInputMethodInfoN(const char* pAppRootPath)
        // declare variables\r
        xmlDocPtr pXmlDoc = null;\r
        xmlNodePtr pXmlRootElement = null;\r
-       InputMethodInfo* pInputMethodInfo = null;\r
 \r
        // get the manifest file path\r
-       const char* MANIFEST_FILE_PATH = "/info/manifest.xml";\r
+       const char* _MANIFEST_FILE_PATH = "/info/manifest.xml";\r
 \r
-       int length = strlen(pAppRootPath) + strlen(MANIFEST_FILE_PATH) + 1;\r
+       int length = strlen(pAppRootPath) + strlen(_MANIFEST_FILE_PATH) + 1;\r
        char manifestFilePath[length];\r
        memset(manifestFilePath, '\0', length);\r
 \r
        strncpy(manifestFilePath, pAppRootPath, strlen(pAppRootPath));\r
-       strcat(manifestFilePath, MANIFEST_FILE_PATH);\r
+       strcat(manifestFilePath, _MANIFEST_FILE_PATH);\r
 \r
        // get InputMethodInfo\r
+       std::unique_ptr<InputMethodInfo> pInputMethodInfo(new(std::nothrow) InputMethodInfo());\r
+       SysTryReturn(NID_UI_IME, pInputMethodInfo, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
        pXmlDoc = xmlParseFile(manifestFilePath);\r
        SysTryReturn(NID_UI_IME, pXmlDoc, null, E_SYSTEM, "[E_SYSTEM] A failure occurs from the underlying system.");\r
 \r
        pXmlRootElement = xmlDocGetRootElement(pXmlDoc);\r
        SysTryCatch(NID_UI_IME, pXmlRootElement, , E_SYSTEM, "[E_SYSTEM] A failure occurs from the underlying system.");\r
 \r
-       pInputMethodInfo = new(std::nothrow) InputMethodInfo();\r
-       SysTryCatch(NID_UI_IME, pInputMethodInfo, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
-\r
-       r = ParseInputMethodInfo(pXmlRootElement, pInputMethodInfo);\r
+       r = ParseInputMethodInfo(pXmlRootElement, pInputMethodInfo.get());\r
        SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
 \r
        if (pXmlDoc)\r
@@ -160,7 +127,7 @@ _InputMethodManagerImpl::GetInputMethodInfoN(const char* pAppRootPath)
 \r
        xmlCleanupParser();\r
 \r
-       return pInputMethodInfo;\r
+       return pInputMethodInfo.release();\r
 \r
 CATCH:\r
        if (pXmlDoc)\r
@@ -171,8 +138,6 @@ CATCH:
 \r
        xmlCleanupParser();\r
 \r
-       delete pInputMethodInfo;\r
-\r
        return null;\r
 }\r
 \r
@@ -255,12 +220,19 @@ _InputMethodManagerImpl::PackageManagerAppIdHandler(pkgmgrinfo_appinfo_h handle,
        char* appId = NULL;\r
        pkgmgrinfo_appinfo_get_appid(handle, &appId);\r
 \r
+       _InputMethodManagerImpl* pImpl = null;\r
        ArrayList* pInputMethodAppIdList = null;\r
 \r
        AppId* pAppId = new(std::nothrow) AppId(appId);\r
        SysTryReturn(NID_UI_IME, pAppId, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
 \r
-       pInputMethodAppIdList = static_cast<ArrayList*>(__pInputMethodManagerImpl->GetInputMethodAppIdList());\r
+       InputMethodManager* pInputMethodManager = InputMethodManager::GetInstance();\r
+       r = GetLastResult();\r
+       SysTryCatch(NID_UI_IME, pInputMethodManager, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+       pImpl = pInputMethodManager->__pInputMethodManagerImpl;\r
+\r
+       pInputMethodAppIdList = static_cast<ArrayList*>(pImpl->GetInputMethodAppIdList());\r
        r = pInputMethodAppIdList->Add(pAppId);\r
        SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
 \r
@@ -275,21 +247,62 @@ CATCH:
 }\r
 \r
 InputMethodInfo*\r
-_InputMethodManagerImpl::GetCurrentInputMethodInfoN(void) const\r
+_InputMethodManagerImpl::GetActiveInputMethodInfoN(void) const\r
 {\r
-       InputMethodInfo* pInputMethodInfo = null;\r
+       result r = E_SUCCESS;\r
 \r
-       int length = -1;\r
        char* pUuid = null;\r
-       length = scim::isf_control_get_active_ise(&pUuid);\r
+       int length = isf_control_get_active_ise(&pUuid);\r
        SysTryReturn(NID_UI_IME, (length != -1) && pUuid, null, E_SYSTEM,\r
-                               "[E_SYSTEM] A failure occurs from the underlying system. The uuid length of the current input method is %d", length);\r
+                               "[E_SYSTEM] A failure occurs from the underlying system. The uuid length of the active input method is %d", length);\r
 \r
-       // need to implement\r
+       InputMethodInfo* pActiveInputMethodInfo = null;\r
+\r
+       std::unique_ptr<IList> pInputMethodInfoList(null);\r
+       std::unique_ptr<IBidirectionalEnumerator> pItor(null);\r
+\r
+       pInputMethodInfoList.reset(GetInputMethodInfoListN());\r
+       r = GetLastResult();\r
+       SysTryCatch(NID_UI_IME, pInputMethodInfoList, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+       pItor.reset(pInputMethodInfoList->GetBidirectionalEnumeratorN());\r
+       r = GetLastResult();\r
+       SysTryCatch(NID_UI_IME, pItor, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+       while (pItor->MoveNext() != E_OUT_OF_RANGE)\r
+       {\r
+               InputMethodInfo* pInputMethodInfo = static_cast<InputMethodInfo*>(pItor->GetCurrent());\r
+               r = GetLastResult();\r
+               SysTryCatch(NID_UI_IME, pInputMethodInfo, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+               _InputMethodInfoImpl* pInputMethodInfoImpl = _InputMethodInfoImpl::GetInstance(*pInputMethodInfo);\r
+               r = GetLastResult();\r
+               SysTryCatch(NID_UI_IME, pInputMethodInfoImpl, , r, "[%s] Propagating.", GetErrorMessage(r));\r
 \r
+               if (strcmp(pInputMethodInfoImpl->GetUuid(), pUuid) == 0)\r
+               {\r
+                       pActiveInputMethodInfo = new(std::nothrow) InputMethodInfo();\r
+                       SysTryCatch(NID_UI_IME, pActiveInputMethodInfo, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+                       _InputMethodInfoImpl* pActiveInputMethodInfoImpl = _InputMethodInfoImpl::GetInstance(*pActiveInputMethodInfo);\r
+                       r = GetLastResult();\r
+                       SysTryCatch(NID_UI_IME, pActiveInputMethodInfoImpl, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+                       *pActiveInputMethodInfoImpl = *pInputMethodInfoImpl;\r
+                       break;\r
+               }\r
+       }\r
+\r
+       free(pUuid);\r
+\r
+       return pActiveInputMethodInfo;\r
+\r
+CATCH:\r
        free(pUuid);\r
 \r
-       return pInputMethodInfo;\r
+       delete pActiveInputMethodInfo;\r
+\r
+       return null;\r
 }\r
 \r
 IList*\r
@@ -305,21 +318,28 @@ _InputMethodManagerImpl::GetInputMethodInfoListN(void) const
 \r
        int ospImeCount = 0;\r
 \r
-       ArrayList* pInputMethodInfoList = null;\r
        InputMethodInfo* pInputMethodInfo = null;\r
        _InputMethodInfoImpl* pInputMethodInfoImpl = null;\r
 \r
+       std::unique_ptr<IList> pLanguageList(null);\r
+\r
+       std::unique_ptr<ArrayList> pInputMethodInfoList(new(std::nothrow) ArrayList(SingleObjectDeleter));\r
+       SysTryReturn(NID_UI_IME, pInputMethodInfoList, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+       r = pInputMethodInfoList->Construct();\r
+       SysTryReturn(NID_UI_IME, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
        char* pAppRootPath = null;\r
 \r
        // get preloaded IME info\r
        char** dpList = null;\r
-       int preloadedImeCount = scim::isf_control_get_ise_list(&dpList);\r
+       int preloadedImeCount = isf_control_get_ise_list(&dpList);\r
        SysTryReturn(NID_UI_IME, (dpList != null) && (preloadedImeCount > 0), null, E_SYSTEM, "[E_SYSTEM] A failure occurs from the underlying system.");\r
 \r
        int ret = -1;\r
        char* pName = null;\r
        char* pLanguage = null;\r
-       scim::ISE_TYPE_T type;\r
+       ISE_TYPE_T type;\r
        int option = 0;\r
 \r
        int preloadedImeIndex = -1;\r
@@ -328,7 +348,7 @@ _InputMethodManagerImpl::GetInputMethodInfoListN(void) const
        {\r
                if (!strcmp(dpList[i], PRELOADED_IME_UUID))\r
                {\r
-                       ret = scim::isf_control_get_ise_info(dpList[i], &pName, &pLanguage, type, option);\r
+                       ret = isf_control_get_ise_info(dpList[i], &pName, &pLanguage, &type, &option);\r
                        SysTryCatch(NID_UI_IME, ret == 0, , E_SYSTEM, "[E_SYSTEM] A failure occurs from the underlying system.");\r
 \r
                        preloadedImeCount = 1;\r
@@ -341,15 +361,6 @@ _InputMethodManagerImpl::GetInputMethodInfoListN(void) const
        r = RequestInputMethodAppIdList();\r
        SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
 \r
-       ospImeCount = __pInputMethodAppIdList->GetCount();\r
-\r
-       // make a InputMethodInfo list\r
-       pInputMethodInfoList = new(std::nothrow) ArrayList(SingleObjectDeleter);\r
-       SysTryCatch(NID_UI_IME, pInputMethodInfoList, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
-\r
-       r = pInputMethodInfoList->Construct(preloadedImeCount + ospImeCount);\r
-       SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
-\r
        // add preloaded IME info\r
        pInputMethodInfo = new(std::nothrow) InputMethodInfo();\r
        SysTryCatch(NID_UI_IME, pInputMethodInfo, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
@@ -361,7 +372,11 @@ _InputMethodManagerImpl::GetInputMethodInfoListN(void) const
        pInputMethodInfoImpl->SetAppId(PRELOADED_IME_APPID);\r
        pInputMethodInfoImpl->SetUuid(dpList[preloadedImeIndex]);\r
        pInputMethodInfoImpl->SetName(String(pName));\r
-       pInputMethodInfoImpl->AddLanguage(PRELOADED_IME_LANGUAGE);\r
+       pLanguageList.reset(GetInputMethodLanguageListN(pLanguage));\r
+       r = GetLastResult();\r
+       SysTryCatch(NID_UI_IME, pLanguageList, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+       r = pInputMethodInfoImpl->SetLanguageList(*(pLanguageList.get()));\r
+       SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
 \r
        SysLog(NID_UI_IME, "The UUID of the preloaded IME application is %s.", dpList[preloadedImeIndex]);\r
 \r
@@ -374,6 +389,8 @@ _InputMethodManagerImpl::GetInputMethodInfoListN(void) const
        free(pLanguage);\r
 \r
        // add osp IME info\r
+       ospImeCount = __pInputMethodAppIdList->GetCount();\r
+\r
        for (int i = 0; i < ospImeCount; i++)\r
        {\r
                AppId* pAppId = static_cast<AppId*>(__pInputMethodAppIdList->GetAt(i));\r
@@ -398,14 +415,13 @@ _InputMethodManagerImpl::GetInputMethodInfoListN(void) const
                delete[] pAppRootPath;\r
        }\r
 \r
-       return pInputMethodInfoList;\r
+       return pInputMethodInfoList.release();\r
 \r
 CATCH:\r
        free(dpList);\r
        free(pName);\r
        free(pLanguage);\r
 \r
-       delete pInputMethodInfoList;\r
        delete pInputMethodInfo;\r
        delete[] pAppRootPath;\r
 \r
@@ -413,7 +429,7 @@ CATCH:
 }\r
 \r
 result\r
-_InputMethodManagerImpl::SetInputMethod(AppId id)\r
+_InputMethodManagerImpl::SetInputMethod(const AppId& id)\r
 {\r
        result r = E_SUCCESS;\r
 \r
@@ -423,14 +439,14 @@ _InputMethodManagerImpl::SetInputMethod(AppId id)
        if (id == PRELOADED_IME_APPID)\r
        {\r
                char** dpList = null;\r
-               int preloadedImeCount = scim::isf_control_get_ise_list(&dpList);\r
+               int preloadedImeCount = isf_control_get_ise_list(&dpList);\r
                SysTryReturnResult(NID_UI_IME, (dpList != null) && (preloadedImeCount > 0), E_SYSTEM, "A failure occurs from the underlying system.");\r
 \r
                for (int i = 0; i < preloadedImeCount; i++)\r
                {\r
                        if (!strcmp(dpList[i], PRELOADED_IME_UUID))\r
                        {\r
-                               scim::isf_control_set_active_ise_by_uuid(dpList[i]);\r
+                               isf_control_set_active_ise_by_uuid(dpList[i]);\r
                                break;\r
                        }\r
                }\r
@@ -441,32 +457,37 @@ _InputMethodManagerImpl::SetInputMethod(AppId id)
        }\r
 \r
        String appRootPath;\r
-       char* pAppRootPath = null;\r
-       InputMethodInfo* pInputMethodInfo = null;\r
-       _InputMethodInfoImpl* pInputMethodInfoImpl = null;\r
-\r
        r = _AppManagerImpl::GetAppRootPath(id, appRootPath);\r
        SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, r, "Propagating.");\r
 \r
-       pAppRootPath = _StringConverter::CopyToCharArrayN(appRootPath.GetPointer());\r
+       std::unique_ptr<char[]> pAppRootPath(_StringConverter::CopyToCharArrayN(appRootPath.GetPointer()));\r
        r = GetLastResult();\r
        SysTryReturnResult(NID_UI_IME, pAppRootPath, r, "Propagating.");\r
 \r
-       pInputMethodInfo = GetInputMethodInfoN(pAppRootPath);\r
+       std::unique_ptr<InputMethodInfo> pInputMethodInfo(GetInputMethodInfoN(pAppRootPath.get()));\r
        r = GetLastResult();\r
-       SysTryCatch(NID_UI_IME, pInputMethodInfo, , r, "[%s] Propagating.", GetErrorMessage(r));\r
-\r
-       pInputMethodInfoImpl = _InputMethodInfoImpl::GetInstance(*pInputMethodInfo);\r
-       scim::isf_control_set_active_ise_by_uuid(pInputMethodInfoImpl->GetUuid());\r
+       SysTryReturnResult(NID_UI_IME, pInputMethodInfo, r, "Propagating.");\r
 \r
-       // Fall through\r
-CATCH:\r
-       delete[] pAppRootPath;\r
-       delete pInputMethodInfo;\r
+       _InputMethodInfoImpl* pInputMethodInfoImpl = _InputMethodInfoImpl::GetInstance(*(pInputMethodInfo.get()));\r
+       isf_control_set_active_ise_by_uuid(pInputMethodInfoImpl->GetUuid());\r
 \r
        return r;\r
 }\r
 \r
+bool\r
+_InputMethodManagerImpl::IsActiveInputMethod(const AppId& id) const\r
+{\r
+       result r = E_SUCCESS;\r
+\r
+       std::unique_ptr<InputMethodInfo> pActiveInputMethodInfo(GetActiveInputMethodInfoN());\r
+       r = GetLastResult();\r
+       SysTryReturn(NID_UI_IME, pActiveInputMethodInfo, false, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+       bool active = ((id == pActiveInputMethodInfo->GetAppId())? true: false);\r
+\r
+       return active;\r
+}\r
+\r
 IList*\r
 _InputMethodManagerImpl::GetInputMethodLanguageListN(const char* pLanguageList) const\r
 {\r
@@ -476,47 +497,46 @@ _InputMethodManagerImpl::GetInputMethodLanguageListN(const char* pLanguageList)
 \r
        const char* pItor = pLanguageList;\r
 \r
-       const int ISO_639_1_CODE_LENGTH = 5;\r
-       char arrayLanguage[ISO_639_1_CODE_LENGTH + 1];\r
+       const int _ISO_639_1_CODE_LENGTH = 5;\r
+       char arrayLanguage[_ISO_639_1_CODE_LENGTH + 1];\r
        memset(arrayLanguage, '\0', sizeof(arrayLanguage));\r
 \r
-       const int LANGUAGE_CODE_LENGTH = 2;\r
-       char arrayLanguageCode[LANGUAGE_CODE_LENGTH + 1];\r
+       const int _LANGUAGE_CODE_LENGTH = 2;\r
+       char arrayLanguageCode[_LANGUAGE_CODE_LENGTH + 1];\r
        memset(arrayLanguageCode, '\0', sizeof(arrayLanguageCode));\r
 \r
-       const int COUNTRY_CODE_LENGTH = 2;\r
-       char arrayCountryCode[COUNTRY_CODE_LENGTH + 1];\r
+       const int _COUNTRY_CODE_LENGTH = 2;\r
+       char arrayCountryCode[_COUNTRY_CODE_LENGTH + 1];\r
        memset(arrayCountryCode, '\0', sizeof(arrayCountryCode));\r
 \r
        Locale* pLanguage = null;\r
 \r
-       ArrayList* pInputMethodLanguageList = new(std::nothrow) ArrayList(SingleObjectDeleter);\r
+       std::unique_ptr<ArrayList> pInputMethodLanguageList(new(std::nothrow) ArrayList(SingleObjectDeleter));\r
        SysTryReturn(NID_UI_IME, pInputMethodLanguageList, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
 \r
        r = pInputMethodLanguageList->Construct();\r
-       SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+       SysTryReturn(NID_UI_IME, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));\r
 \r
        while ( pItor != null)\r
        {\r
-               strncpy(arrayLanguage, pItor, ISO_639_1_CODE_LENGTH);\r
+               strncpy(arrayLanguage, pItor, _ISO_639_1_CODE_LENGTH);\r
 \r
-               strncpy(arrayLanguageCode, arrayLanguage, LANGUAGE_CODE_LENGTH);\r
-               strncpy(arrayCountryCode, arrayLanguage + LANGUAGE_CODE_LENGTH + 1, COUNTRY_CODE_LENGTH);\r
+               strncpy(arrayLanguageCode, arrayLanguage, _LANGUAGE_CODE_LENGTH);\r
+               strncpy(arrayCountryCode, arrayLanguage + _LANGUAGE_CODE_LENGTH + 1, _COUNTRY_CODE_LENGTH);\r
 \r
                LanguageCode languageCode = Locale::TwoLetterLanguageCodeStringToLanguageCode(String(arrayLanguageCode));\r
                r = GetLastResult();\r
-               SysTryCatch(NID_UI_IME, languageCode < LANGUAGE_MAX, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+               SysTryReturn(NID_UI_IME, languageCode < LANGUAGE_MAX, null, r, "[%s] Propagating.", GetErrorMessage(r));\r
 \r
                CountryCode countryCode = Locale::StringToCountryCode(String(arrayCountryCode));\r
                r = GetLastResult();\r
-               SysTryCatch(NID_UI_IME, countryCode < COUNTRY_MAX, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+               SysTryReturn(NID_UI_IME, countryCode < COUNTRY_MAX, null, r, "[%s] Propagating.", GetErrorMessage(r));\r
 \r
                pLanguage = new(std::nothrow) Locale(languageCode, countryCode);\r
-               SysTryCatch(NID_UI_IME, pLanguage, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+               SysTryReturn(NID_UI_IME, pLanguage, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
 \r
                r = pInputMethodLanguageList->Add(pLanguage);\r
                SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
-               pLanguage = null;\r
 \r
                memset(arrayLanguage, '\0', sizeof(arrayLanguage));\r
                memset(arrayLanguageCode, '\0', sizeof(arrayLanguageCode));\r
@@ -530,11 +550,10 @@ _InputMethodManagerImpl::GetInputMethodLanguageListN(const char* pLanguageList)
                }\r
        }\r
 \r
-       return pInputMethodLanguageList;\r
+       return pInputMethodLanguageList.release();\r
 \r
 CATCH:\r
        delete pLanguage;\r
-       delete pInputMethodLanguageList;\r
 \r
        return null;\r
 }\r
index faf6f10..b5814ea 100644 (file)
@@ -46,29 +46,30 @@ namespace Tizen { namespace Ui { namespace Ime {
 /**\r
 * @class _InputMethodManagerImpl\r
 * @brief This class is a concrete class of the %_InputMethodManagerImpl class.\r
-* @since 2.0\r
+* @since 2.1\r
 *\r
 */\r
 class _InputMethodManagerImpl\r
        : public Tizen::Base::Object\r
 {\r
 public:\r
-       virtual ~_InputMethodManagerImpl(void);\r
-\r
        static _InputMethodManagerImpl* GetInstance(InputMethodManager& inputMethodManager);\r
 \r
        static InputMethodInfo* GetInputMethodInfoN(const char* pAppRootPath);\r
        static result ParseInputMethodInfo(const xmlNodePtr pXmlRootElement, InputMethodInfo* pInfo);\r
        static int PackageManagerAppIdHandler(pkgmgrinfo_appinfo_h handle, void* pUserData);\r
 \r
-       InputMethodInfo* GetCurrentInputMethodInfoN(void) const;\r
+       InputMethodInfo* GetActiveInputMethodInfoN(void) const;\r
        Tizen::Base::Collection::IList* GetInputMethodAppIdList(void) const;\r
        Tizen::Base::Collection::IList* GetInputMethodInfoListN(void) const;\r
 \r
-       result SetInputMethod(Tizen::App::AppId id);\r
+       result SetInputMethod(const Tizen::App::AppId& id);\r
+\r
+       bool IsActiveInputMethod(const Tizen::App::AppId& id) const;\r
 \r
 private:\r
        _InputMethodManagerImpl(void);\r
+       virtual ~_InputMethodManagerImpl(void);\r
 \r
        _InputMethodManagerImpl(const _InputMethodManagerImpl& rhs);\r
        _InputMethodManagerImpl& operator=(const _InputMethodManagerImpl& rhs);\r
@@ -79,9 +80,8 @@ private:
        result RequestInputMethodAppIdList(void) const;\r
 \r
 private:\r
-       static _InputMethodManagerImpl* __pInputMethodManagerImpl;\r
+       friend class InputMethodManager;\r
 \r
-       InputMethodManager* __pInputMethodManager;\r
        Tizen::Base::Collection::ArrayList* __pInputMethodAppIdList;\r
 };\r
 \r
index 63edd77..86cd77b 100644 (file)
  */\r
 \r
 #include <new>\r
+#include <unique_ptr.h>\r
 \r
 #include <FBaseSysLog.h>\r
 \r
 #include "FUiIme_ImeInfo.h"\r
 #include "FUiIme_InputServiceBinder.h"\r
-#include "FUiIme_ScimDataConverter.h"\r
 \r
 using namespace Tizen::Base;\r
 \r
@@ -38,22 +38,18 @@ _InputServiceBinder* _InputServiceBinder::__pInputServiceBinder = null;
 \r
 _InputServiceBinder::_InputServiceBinder(void)\r
        :__pHelperAgent(null)\r
-       ,__pScimDataConverter(null)\r
 {\r
 }\r
 \r
 _InputServiceBinder::~_InputServiceBinder(void)\r
 {\r
-       if (IsBound() == true)\r
+       if (IsBound())\r
        {\r
                Unbind();\r
        }\r
 \r
        delete __pHelperAgent;\r
        __pHelperAgent = null;\r
-\r
-       delete __pScimDataConverter;\r
-       __pScimDataConverter = null;\r
 }\r
 \r
 result\r
@@ -61,17 +57,10 @@ _InputServiceBinder::Construct(void)
 {\r
        result r = E_SUCCESS;\r
 \r
-       __pHelperAgent = new(std::nothrow) scim::HelperAgent();\r
-       SysTryReturnResult(NID_UI_IME, __pHelperAgent, E_OUT_OF_MEMORY, "Memory allocation failed.");\r
-\r
-       __pScimDataConverter = new(std::nothrow) _ScimDataConverter();\r
-       SysTryCatch(NID_UI_IME, __pScimDataConverter, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
-\r
-       return r;\r
+       std::unique_ptr<scim::HelperAgent> pHelperAgent(new(std::nothrow) scim::HelperAgent());\r
+       SysTryReturnResult(NID_UI_IME, pHelperAgent, E_OUT_OF_MEMORY, "Memory allocation failed.");\r
 \r
-CATCH:\r
-       delete __pHelperAgent;\r
-       __pHelperAgent = null;\r
+       __pHelperAgent = pHelperAgent.release();\r
 \r
        return r;\r
 }\r
@@ -120,7 +109,7 @@ _InputServiceBinder::Bind(void)
        scim::HelperInfo helperInfo(uuid, name, "", "",\r
                                                                scim::SCIM_HELPER_STAND_ALONE | scim::SCIM_HELPER_NEED_SCREEN_INFO | scim::SCIM_HELPER_AUTO_RESTART);\r
 \r
-       if (IsBound() == true)\r
+       if (IsBound())\r
        {\r
                r = Unbind();\r
                SysTryReturn(NID_UI_IME, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));\r
@@ -139,7 +128,7 @@ _InputServiceBinder::Unbind(void)
 {\r
        result r = E_SUCCESS;\r
 \r
-       SysTryReturnResult(NID_UI_IME, IsBound() == true, E_HOST_NOT_FOUND, "The destination host is not found.");\r
+       SysTryReturnResult(NID_UI_IME, IsBound(), E_HOST_NOT_FOUND, "The destination host is not found.");\r
 \r
        __pHelperAgent->close_connection();\r
 \r
index 6f273c6..982b1de 100644 (file)
 \r
 namespace Tizen { namespace Ui { namespace Ime {\r
 \r
-class _ScimDataConverter;\r
-\r
 /**\r
  * ID of a binding with the input service\r
  *\r
- * @since 2.0\r
+ * @since 2.1\r
  */\r
 typedef int BindingId;\r
 \r
 /**\r
 * @class _InputServiceBinder\r
 * @brief This class is a concrete class of the %_InputServiceBinder class.\r
-* @since 2.0\r
+* @since 2.1\r
 *\r
 */\r
 class _InputServiceBinder\r
        : public Tizen::Base::Object\r
 {\r
 public:\r
-       virtual ~_InputServiceBinder(void);\r
-\r
        static _InputServiceBinder* GetInstance(void);\r
 \r
        scim::HelperAgent* GetHelperAgent(void) const;\r
@@ -68,6 +64,7 @@ public:
 \r
 private:\r
        _InputServiceBinder(void);\r
+       virtual ~_InputServiceBinder(void);\r
 \r
        _InputServiceBinder(const _InputServiceBinder& rhs);\r
        _InputServiceBinder& operator=(const _InputServiceBinder& rhs);\r
@@ -78,7 +75,6 @@ private:
        static _InputServiceBinder* __pInputServiceBinder;\r
 \r
        scim::HelperAgent* __pHelperAgent;\r
-       _ScimDataConverter* __pScimDataConverter;\r
 };\r
 \r
 }}} // Tizen::Ui::Ime\r
index ff39c57..fc77ebe 100644 (file)
  */\r
 \r
 #include <Ecore_IMF.h>\r
+#include <Ecore_X.h>\r
+#include <Elementary.h>\r
+#include <glib.h>\r
+#include <string.h>\r
+#include <unique_ptr.h>\r
+#include <X11/Xatom.h>\r
+#include <X11/Xlib.h>\r
 \r
 #include <FAppApp.h>\r
 #include <FBaseString.h>\r
 #include <FBaseSysLog.h>\r
 #include <FGrpRectangle.h>\r
+#include <FLclLocale.h>\r
 #include <FUiInputConnectionTypes.h>\r
-\r
+#include <FUiIOrientationEventListener.h>\r
+\r
+#include "FUi_ControlManager.h"\r
+#include "FUi_EcoreEvas.h"\r
+#include "FUi_EcoreEvasMgr.h"\r
+#include "FUiCtrl_Form.h"\r
+#include "FUiCtrl_FormImpl.h"\r
+#include "FUiCtrl_Frame.h"\r
 #include "FUiIme_InputMethodImpl.h"\r
 #include "FUiIme_InputServiceSignalListener.h"\r
 #include "FUiIme_ScimDataConverter.h"\r
+#include "FUiIme_TargetWindowAgent.h"\r
 \r
 using namespace Tizen::Base;\r
 using namespace Tizen::Graphics;\r
+using namespace Tizen::Locales;\r
 using namespace Tizen::Ui;\r
+using namespace Tizen::Ui::Controls;\r
 \r
 namespace Tizen { namespace Ui { namespace Ime {\r
 \r
@@ -57,16 +75,12 @@ void
 _InputServiceSignalListener::SetInputMethodProvider(IInputMethodProvider* pProvider)\r
 {\r
        __pIInputMethodProvider = pProvider;\r
-\r
-       return;\r
 }\r
 \r
 void\r
 _InputServiceSignalListener::SetInputMethodListener(IInputMethodListener* pListener)\r
 {\r
        __pIInputMethodListener = pListener;\r
-\r
-       return;\r
 }\r
 \r
 void\r
@@ -107,8 +121,6 @@ _InputServiceSignalListener::GetEnterKeyAction(const scim::HelperAgent* pHelperA
                action = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;\r
                break;\r
        }\r
-\r
-       return;\r
 }\r
 \r
 void\r
@@ -120,10 +132,7 @@ _InputServiceSignalListener::GetInputPanelBounds(const scim::HelperAgent* pHelpe
 \r
        Rectangle inputPanelBounds = __pIInputMethodProvider->GetInputPanelBounds();\r
 \r
-       _ScimDataConverter converter;\r
-       converter.ConvertRectangle(inputPanelBounds, bounds);\r
-\r
-       return;\r
+       _ScimDataConverter::ConvertRectangle(inputPanelBounds, bounds);\r
 }\r
 \r
 void\r
@@ -158,8 +167,17 @@ _InputServiceSignalListener::GetInputPanelStyle(const scim::HelperAgent* pHelper
                style = ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;\r
                break;\r
        }       \r
+}\r
 \r
-       return;\r
+void\r
+_InputServiceSignalListener::GetLanguage(const scim::HelperAgent* pHelperAgent, int inputContext, char** pLocale)\r
+{\r
+       SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+       //Locale language = __pIInputMethodProvider->GetLanguage();\r
+       //std::unique_ptr<char[]> pLanguage(_ScimDataConverter::ConvertLanguageN(language));\r
+\r
+       //*pLocale = strdup(pLanguage.get());\r
 }\r
 \r
 void\r
@@ -170,8 +188,6 @@ _InputServiceSignalListener::SetCapsModeEnabled(const scim::HelperAgent* pHelper
        bool enable = (mode != 0 ? true : false);\r
 \r
        __pIInputMethodProvider->SetCapsModeEnabled(enable);\r
-\r
-       return;\r
 }\r
 \r
 void\r
@@ -215,8 +231,6 @@ _InputServiceSignalListener::SetEnterKeyAction(const scim::HelperAgent* pHelperA
        }\r
 \r
        __pIInputMethodProvider->SetEnterKeyAction(inputPanelAction);\r
-\r
-       return;\r
 }\r
 \r
 void\r
@@ -227,8 +241,6 @@ _InputServiceSignalListener::SetEnterKeyActionEnabled(const scim::HelperAgent* p
        bool enable = (disable != 0 ? false : true);\r
 \r
        __pIInputMethodProvider->SetEnterKeyActionEnabled(enable);\r
-\r
-       return;\r
 }\r
 \r
 void\r
@@ -266,8 +278,6 @@ _InputServiceSignalListener::SetInputPanelStyle(const scim::HelperAgent* pHelper
        }       \r
 \r
        __pIInputMethodProvider->SetInputPanelStyle(inputPanelStyle);\r
-\r
-       return;\r
 }\r
 \r
 void\r
@@ -275,16 +285,14 @@ _InputServiceSignalListener::SetLanguage(const scim::HelperAgent* pHelperAgent,
 {\r
        SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
 \r
-       Tizen::Locales::LanguageCode languageCode = (language == ECORE_IMF_INPUT_PANEL_LANG_ALPHABET ? Tizen::Locales::LANGUAGE_ENG : Tizen::Locales::LANGUAGE_INVALID);\r
+       LanguageCode languageCode = (language == ECORE_IMF_INPUT_PANEL_LANG_ALPHABET ? LANGUAGE_ENG : LANGUAGE_INVALID);\r
 \r
-       if (languageCode == Tizen::Locales::LANGUAGE_INVALID)\r
+       if (languageCode == LANGUAGE_INVALID)\r
        {\r
                return;\r
        }\r
 \r
        //__pIInputMethodProvider->SetLanguage(languageCode);\r
-\r
-       return;\r
 }\r
 \r
 void\r
@@ -296,7 +304,22 @@ _InputServiceSignalListener::HideInputPanel(const scim::HelperAgent* pHelperAgen
 \r
        __pIInputMethodProvider->HideInputPanel();\r
 \r
-       return;\r
+       result r = E_SUCCESS;\r
+\r
+       _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();\r
+       SysTryReturnVoidResult(NID_UI_IME, pEcoreEvasMgr, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+       _EcoreEvas* pEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();\r
+       SysTryReturnVoidResult(NID_UI_IME, pEcoreEvas, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+       Evas_Object* pEvasObject = pEcoreEvas->GetWindowObject();\r
+       SysTryReturnVoidResult(NID_UI_IME, pEvasObject, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+    Ecore_X_Window keyboardWindow = elm_win_xwindow_get(pEvasObject);\r
+\r
+       _TargetWindowAgent* pTargetWindowAgent = _TargetWindowAgent::GetInstance();\r
+       r = GetLastResult();\r
+       SysTryReturnVoidResult(NID_UI_IME, pTargetWindowAgent, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+       pTargetWindowAgent->UnsetTargetWindow(keyboardWindow);\r
 }\r
 \r
 void\r
@@ -305,8 +328,6 @@ _InputServiceSignalListener::IsEnterKeyActionEnabled(const scim::HelperAgent* pH
        SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
 \r
        enable = static_cast<scim::uint32>(__pIInputMethodProvider->IsEnterKeyActionEnabled());\r
-\r
-       return;\r
 }\r
 \r
 void\r
@@ -318,7 +339,28 @@ _InputServiceSignalListener::ShowInputPanel(const scim::HelperAgent* pHelperAgen
 \r
        __pIInputMethodProvider->ShowInputPanel();\r
 \r
-       return;\r
+       result r = E_SUCCESS;\r
+\r
+       _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();\r
+       SysTryReturnVoidResult(NID_UI_IME, pEcoreEvasMgr, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+       _EcoreEvas* pEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();\r
+       SysTryReturnVoidResult(NID_UI_IME, pEcoreEvas, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+       Evas_Object* pEvasObject = pEcoreEvas->GetWindowObject();\r
+       SysTryReturnVoidResult(NID_UI_IME, pEvasObject, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+    Ecore_X_Window keyboardWindow = elm_win_xwindow_get(pEvasObject);\r
+\r
+       _TargetWindowAgent* pTargetWindowAgent = _TargetWindowAgent::GetInstance();\r
+       r = GetLastResult();\r
+       SysTryReturnVoidResult(NID_UI_IME, pTargetWindowAgent, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+       pTargetWindowAgent->SetTargetWindow(keyboardWindow);\r
+\r
+       int angle = pTargetWindowAgent->GetOrientation();\r
+       r = GetLastResult();\r
+       SysTryReturnVoidResult(NID_UI_IME, angle != -1, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+       pTargetWindowAgent->SetOrientation(angle);\r
 }\r
 \r
 void\r
@@ -327,8 +369,6 @@ _InputServiceSignalListener::OnCursorPositionChanged(const scim::HelperAgent* pH
        SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodListener, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
 \r
        __pIInputMethodListener->OnCursorPositionChanged(position);\r
-\r
-       return;\r
 }\r
 \r
 void\r
@@ -338,20 +378,15 @@ _InputServiceSignalListener::OnSurroundingTextReceived(const scim::HelperAgent*
 \r
        String ospText;\r
 \r
-       _ScimDataConverter converter;\r
-       converter.ConvertString(text, ospText);\r
+       _ScimDataConverter::ConvertString(text, ospText);\r
 \r
        __pIInputMethodListener->OnSurroundingTextReceived(ospText, cursorPosition);\r
-\r
-       return;\r
 }\r
 \r
 void\r
 _InputServiceSignalListener::OnTerminate (const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& uuid)\r
 {\r
        Tizen::App::App::GetInstance()->Terminate();\r
-\r
-       return;\r
 }\r
 \r
 }}} // Tizen::Ui::Ime\r
index 7aa819c..1ebd54f 100644 (file)
@@ -31,7 +31,6 @@
 #include <scim.h>\r
 #define null 0\r
 \r
-#include <FBaseObject.h>\r
 #include <FUiImeIInputMethodListener.h>\r
 #include <FUiImeIInputMethodProvider.h>\r
 \r
@@ -40,22 +39,19 @@ namespace Tizen { namespace Ui { namespace Ime {
 /**\r
 * @class _InputServiceSignalListener\r
 * @brief This class is a concrete class of the %_InputServiceSignalListener class.\r
-* @since 2.0\r
+* @since 2.1\r
 *\r
 */\r
 class _InputServiceSignalListener\r
-       : public Tizen::Base::Object\r
 {\r
 public:\r
-       _InputServiceSignalListener();\r
-       virtual ~_InputServiceSignalListener();\r
-\r
-       void SetInputMethodProvider(IInputMethodProvider* pProvider);\r
-       void SetInputMethodListener(IInputMethodListener* pListener);\r
+       static void SetInputMethodProvider(IInputMethodProvider* pProvider);\r
+       static void SetInputMethodListener(IInputMethodListener* pListener);\r
 \r
        static void GetEnterKeyAction(const scim::HelperAgent* pHelperAgent, scim::uint32& action);\r
        static void GetInputPanelBounds(const scim::HelperAgent* pHelperAgent, scim::rectinfo& bounds);\r
        static void GetInputPanelStyle(const scim::HelperAgent* pHelperAgent, scim::uint32& style);\r
+       static void GetLanguage(const scim::HelperAgent* pHelperAgent, int inputContext, char** pLocale);\r
 \r
        static void SetCapsModeEnabled(const scim::HelperAgent* pHelperAgent, scim::uint32& mode);\r
        static void SetEnterKeyAction(const scim::HelperAgent* pHelperAgent, scim::uint32& action);\r
@@ -74,6 +70,9 @@ public:
        static void OnTerminate(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& uuid);\r
 \r
 private:\r
+       _InputServiceSignalListener();\r
+       ~_InputServiceSignalListener();\r
+\r
        _InputServiceSignalListener(const _InputServiceSignalListener& rhs);\r
        _InputServiceSignalListener& operator=(const _InputServiceSignalListener& rhs);\r
 \r
diff --git a/src/FUiIme_Key.cpp b/src/FUiIme_Key.cpp
new file mode 100644 (file)
index 0000000..bf4959e
--- /dev/null
@@ -0,0 +1,87 @@
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file       FUiIme_Key.cpp\r
+ * @brief      This is the implementation file for the types related to the key.\r
+ *\r
+ * This implementation file contains definition of the types related to the key.\r
+ */\r
+\r
+#include "FUiIme_Key.h"\r
+\r
+using namespace Tizen::Ui;\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+extern const _KeyCode _KEY_CODE_MAP[] = {\r
+       {KEY_CLEAR, scim::SCIM_KEY_Clear},\r
+       {KEY_0, scim::SCIM_KEY_0},\r
+       {KEY_1, scim::SCIM_KEY_1},\r
+       {KEY_2, scim::SCIM_KEY_2},\r
+       {KEY_3, scim::SCIM_KEY_3},\r
+       {KEY_4, scim::SCIM_KEY_4},\r
+       {KEY_5, scim::SCIM_KEY_5},\r
+       {KEY_6, scim::SCIM_KEY_6},\r
+       {KEY_7, scim::SCIM_KEY_7},\r
+       {KEY_8, scim::SCIM_KEY_8},\r
+       {KEY_9, scim::SCIM_KEY_9},\r
+       {KEY_ASTERISK, scim::SCIM_KEY_asterisk},\r
+       {KEY_SHARP, scim::SCIM_KEY_ssharp},\r
+       {KEY_LEFT, scim::SCIM_KEY_Left},\r
+       {KEY_UP, scim::SCIM_KEY_Up},\r
+       {KEY_DOWN, scim::SCIM_KEY_Down},\r
+       {KEY_RIGHT, scim::SCIM_KEY_Right},\r
+       {KEY_A, scim::SCIM_KEY_A},\r
+       {KEY_B, scim::SCIM_KEY_B},\r
+       {KEY_C, scim::SCIM_KEY_C},\r
+       {KEY_D, scim::SCIM_KEY_D},\r
+       {KEY_E, scim::SCIM_KEY_E},\r
+       {KEY_F, scim::SCIM_KEY_F},\r
+       {KEY_G, scim::SCIM_KEY_G},\r
+       {KEY_H, scim::SCIM_KEY_H},\r
+       {KEY_I, scim::SCIM_KEY_I},\r
+       {KEY_J, scim::SCIM_KEY_J},\r
+       {KEY_K, scim::SCIM_KEY_K},\r
+       {KEY_L, scim::SCIM_KEY_L},\r
+       {KEY_M, scim::SCIM_KEY_M},\r
+       {KEY_N, scim::SCIM_KEY_N},\r
+       {KEY_O, scim::SCIM_KEY_O},\r
+       {KEY_P, scim::SCIM_KEY_P},\r
+       {KEY_Q, scim::SCIM_KEY_Q},\r
+       {KEY_R, scim::SCIM_KEY_R},\r
+       {KEY_S, scim::SCIM_KEY_S},\r
+       {KEY_T, scim::SCIM_KEY_T},\r
+       {KEY_U, scim::SCIM_KEY_U},\r
+       {KEY_V, scim::SCIM_KEY_V},\r
+       {KEY_W, scim::SCIM_KEY_W},\r
+       {KEY_X, scim::SCIM_KEY_X},\r
+       {KEY_Y, scim::SCIM_KEY_Y},\r
+       {KEY_Z, scim::SCIM_KEY_Z},\r
+       {KEY_BACKSPACE,scim::SCIM_KEY_BackSpace},\r
+       {KEY_COMMA, scim::SCIM_KEY_comma},\r
+       {KEY_ENTER, scim::SCIM_KEY_Return},\r
+       {KEY_CAPSLOCK, scim::SCIM_KEY_Caps_Lock},\r
+       {KEY_QUESTION, scim::SCIM_KEY_question},\r
+       {KEY_ALT, scim::SCIM_KEY_Alt_L},\r
+       {KEY_SPACE, scim::SCIM_KEY_space},\r
+       {KEY_DOT, scim::SCIM_KEY_period}\r
+};\r
+\r
+extern const int _MAX_KEY_CODE = sizeof(_KEY_CODE_MAP) / sizeof(_KEY_CODE_MAP[0]);\r
+\r
+}}} // Tizen::Ui::Ime\r
index a4ea729..ade452b 100644 (file)
  * @file FUiIme_Key.h
  * @brief This is the header file for types related to the key which are used in the Tizen::Ui::Ime namespace.
  *
- * This header file contains types related to the key and the key map between OSP and SCIM.
+ * This header file contains types related to the key and the key map in both OSP and SCIM.
  */
 
 #ifndef _FUI_IME_INTERNAL_KEY_H_
 #define _FUI_IME_INTERNAL_KEY_H_
 
-#include "FUiIKeyEventListener.h"
+#define Uses_SCIM_EVENT
+#undef null
+#include <scim.h>
+#define null 0
+
+#include <FUiKeyTypes.h>
 
 namespace Tizen { namespace Ui { namespace Ime {
 
 /**
 * @struct _KeyCode
 * Structure to hold the information of the input method key.
-* @since 2.0
+* @since 2.1
 */
 struct _KeyCode
 {
@@ -41,65 +46,13 @@ struct _KeyCode
 };
 
 /**
-* @brief KEY_CODE_MAP
+* @brief _KEY_CODE_MAP
 * Table to map osp keys and scim keys.
-* @since 2.0
+* @since 2.1
 */
-static const _KeyCode KEY_CODE_MAP[] = {
-       {Tizen::Ui::KEY_CLEAR, scim::SCIM_KEY_Clear},
-       {Tizen::Ui::KEY_0, scim::SCIM_KEY_0},
-       {Tizen::Ui::KEY_1, scim::SCIM_KEY_1},
-       {Tizen::Ui::KEY_2, scim::SCIM_KEY_2},
-       {Tizen::Ui::KEY_3, scim::SCIM_KEY_3},
-       {Tizen::Ui::KEY_4, scim::SCIM_KEY_4},
-       {Tizen::Ui::KEY_5, scim::SCIM_KEY_5},
-       {Tizen::Ui::KEY_6, scim::SCIM_KEY_6},
-       {Tizen::Ui::KEY_7, scim::SCIM_KEY_7},
-       {Tizen::Ui::KEY_8, scim::SCIM_KEY_8},
-       {Tizen::Ui::KEY_9, scim::SCIM_KEY_9},
-       {Tizen::Ui::KEY_ASTERISK, scim::SCIM_KEY_asterisk},
-       {Tizen::Ui::KEY_SHARP, scim::SCIM_KEY_ssharp},
-       {Tizen::Ui::KEY_LEFT, scim::SCIM_KEY_Left},
-       {Tizen::Ui::KEY_UP, scim::SCIM_KEY_Up},
-       {Tizen::Ui::KEY_DOWN, scim::SCIM_KEY_Down},
-       {Tizen::Ui::KEY_RIGHT, scim::SCIM_KEY_Right},
-       {Tizen::Ui::KEY_A, scim::SCIM_KEY_A},
-       {Tizen::Ui::KEY_B, scim::SCIM_KEY_B},
-       {Tizen::Ui::KEY_C, scim::SCIM_KEY_C},
-       {Tizen::Ui::KEY_D, scim::SCIM_KEY_D},
-       {Tizen::Ui::KEY_E, scim::SCIM_KEY_E},
-       {Tizen::Ui::KEY_F, scim::SCIM_KEY_F},
-       {Tizen::Ui::KEY_G, scim::SCIM_KEY_G},
-       {Tizen::Ui::KEY_H, scim::SCIM_KEY_H},
-       {Tizen::Ui::KEY_I, scim::SCIM_KEY_I},
-       {Tizen::Ui::KEY_J, scim::SCIM_KEY_J},
-       {Tizen::Ui::KEY_K, scim::SCIM_KEY_K},
-       {Tizen::Ui::KEY_L, scim::SCIM_KEY_L},
-       {Tizen::Ui::KEY_M, scim::SCIM_KEY_M},
-       {Tizen::Ui::KEY_N, scim::SCIM_KEY_N},
-       {Tizen::Ui::KEY_O, scim::SCIM_KEY_O},
-       {Tizen::Ui::KEY_P, scim::SCIM_KEY_P},
-       {Tizen::Ui::KEY_Q, scim::SCIM_KEY_Q},
-       {Tizen::Ui::KEY_R, scim::SCIM_KEY_R},
-       {Tizen::Ui::KEY_S, scim::SCIM_KEY_S},
-       {Tizen::Ui::KEY_T, scim::SCIM_KEY_T},
-       {Tizen::Ui::KEY_U, scim::SCIM_KEY_U},
-       {Tizen::Ui::KEY_V, scim::SCIM_KEY_V},
-       {Tizen::Ui::KEY_W, scim::SCIM_KEY_W},
-       {Tizen::Ui::KEY_X, scim::SCIM_KEY_X},
-       {Tizen::Ui::KEY_Y, scim::SCIM_KEY_Y},
-       {Tizen::Ui::KEY_Z, scim::SCIM_KEY_Z},
-       {Tizen::Ui::KEY_BACKSPACE,scim::SCIM_KEY_BackSpace},
-       {Tizen::Ui::KEY_COMMA, scim::SCIM_KEY_comma},
-       {Tizen::Ui::KEY_ENTER, scim::SCIM_KEY_Return},
-       {Tizen::Ui::KEY_CAPSLOCK, scim::SCIM_KEY_Caps_Lock},
-       {Tizen::Ui::KEY_QUESTION, scim::SCIM_KEY_question},
-       {Tizen::Ui::KEY_ALT, scim::SCIM_KEY_Alt_L},
-       {Tizen::Ui::KEY_SPACE, scim::SCIM_KEY_space},
-       {Tizen::Ui::KEY_DOT, scim::SCIM_KEY_period}
-};
+extern const _KeyCode _KEY_CODE_MAP[];
 
-static const int MAX_KEY_CODE = sizeof(KEY_CODE_MAP) / sizeof(KEY_CODE_MAP[0]);
+extern const int _MAX_KEY_CODE;
 
 }}} // Tizen::Ui::Ime
 
index 75fb107..95cb143 100644 (file)
  * This implementation file contains definition of the %_ScimDataConverter class.\r
  */\r
 \r
+#include <new>\r
+#include <unique_ptr.h>\r
 #include <vector> // vector in scim_event.h\r
 \r
-#define Uses_SCIM_EVENT\r
-#define Uses_SCIM_UTILITY\r
-#undef null\r
-#include <scim.h> // SCIM_KEY_NullKey, SCIM_KEY_NullMask, SCIM_KEY_ReleaseMask\r
-#define null 0\r
-\r
 #include <FBaseSysLog.h>\r
-#include <FBaseString.h>\r
 #include <FBase_StringConverter.h>\r
 \r
 #include "FUiIme_Key.h"\r
 #include "FUiIme_ScimDataConverter.h"\r
 \r
 using namespace Tizen::Base;\r
+using namespace Tizen::Graphics;\r
 using namespace Tizen::Locales;\r
 using namespace Tizen::Ui;\r
 \r
@@ -54,7 +50,7 @@ _ScimDataConverter::~_ScimDataConverter()
 }\r
 \r
 result\r
-_ScimDataConverter::ConvertKey(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState state, scim::KeyEvent& event) const\r
+_ScimDataConverter::ConvertKey(KeyCode code, KeyState state, scim::KeyEvent& event)\r
 {\r
        result r = E_SUCCESS;\r
 \r
@@ -63,11 +59,11 @@ _ScimDataConverter::ConvertKey(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState stat
        event.layout = scim::SCIM_KEYBOARD_Default;\r
 \r
        // event.code\r
-       for (int i = 0; i < MAX_KEY_CODE; i++)\r
+       for (int i = 0; i < _MAX_KEY_CODE; i++)\r
        {\r
-               if (code == KEY_CODE_MAP[i].keyCode)\r
+               if (code == _KEY_CODE_MAP[i].keyCode)\r
                {\r
-                       event.code = KEY_CODE_MAP[i].scimKeyCode;\r
+                       event.code = _KEY_CODE_MAP[i].scimKeyCode;\r
                        break;\r
                }\r
        }\r
@@ -90,55 +86,75 @@ _ScimDataConverter::ConvertKey(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState stat
        return r;\r
 }\r
 \r
-void \r
-_ScimDataConverter::ConvertRectangle(const Tizen::Graphics::Rectangle& src, scim::rectinfo& dest) const\r
+char*\r
+_ScimDataConverter::ConvertLanguageN(const Locale& language)\r
+{\r
+       result r = E_SUCCESS;\r
+\r
+       const int _ISO_639_1_CODE_LENGTH = 5;\r
+       char* pLanguage = new(std::nothrow) char[_ISO_639_1_CODE_LENGTH + 1];\r
+       SysTryReturn(NID_UI_IME, pLanguage, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+       memset(pLanguage, '\0', sizeof(pLanguage));\r
+\r
+       const int _LANGUAGE_CODE_LENGTH = 2;\r
+       const int _COUNTRY_CODE_LENGTH = 2;\r
+\r
+       std::unique_ptr<char[]> pLanguageCode(null);\r
+       pLanguageCode.reset(_StringConverter::CopyToCharArrayN(Locale::LanguageCodeToTwoLetterLanguageCodeString(language.GetLanguageCode())));\r
+       r = GetLastResult();\r
+       SysTryReturn(NID_UI_IME, pLanguageCode, null, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+       std::unique_ptr<char[]> pCountryCode(null);\r
+       pCountryCode.reset(_StringConverter::CopyToCharArrayN(Locale::CountryCodeToString(language.GetCountryCode())));\r
+       r = GetLastResult();\r
+       SysTryReturn(NID_UI_IME, pCountryCode, null, r, "[%s] Propagating.", GetErrorMessage(r));       \r
+\r
+       strncpy(pLanguage, pLanguageCode.get(), _LANGUAGE_CODE_LENGTH);\r
+       strcat(pLanguage, "_");\r
+       strncpy(pLanguage, pCountryCode.get(), _COUNTRY_CODE_LENGTH);\r
+\r
+       return pLanguage;\r
+}\r
+\r
+void\r
+_ScimDataConverter::ConvertRectangle(const Rectangle& src, scim::rectinfo& dest)\r
 {\r
        dest.pos_x = src.x;\r
        dest.pos_y = src.y;\r
        dest.width = src.width;\r
        dest.height = src.height;\r
-\r
-       return;\r
 }\r
 \r
 result\r
-_ScimDataConverter::ConvertString(const Tizen::Base::String& src, scim::String& dest) const\r
+_ScimDataConverter::ConvertString(const String& src, scim::String& dest)\r
 {\r
        result r = E_SUCCESS;\r
 \r
-       char* pCharSrc = null;\r
-\r
-       pCharSrc = _StringConverter::CopyToCharArrayN(src);\r
+       std::unique_ptr<char[]> pCharSrc(_StringConverter::CopyToCharArrayN(src));\r
        r = GetLastResult();\r
        SysTryReturnResult(NID_UI_IME, pCharSrc, r, "Propagating.");\r
 \r
-       dest = pCharSrc;\r
-\r
-       delete[] pCharSrc;\r
+       dest = pCharSrc.get();\r
 \r
        return r;\r
 }\r
 \r
 result\r
-_ScimDataConverter::ConvertString(const Tizen::Base::String& src, scim::WideString& dest) const\r
+_ScimDataConverter::ConvertString(const String& src, scim::WideString& dest)\r
 {\r
        result r = E_SUCCESS;\r
 \r
-       char* pCharSrc = null;\r
-\r
-       pCharSrc = _StringConverter::CopyToCharArrayN(src);\r
+       std::unique_ptr<char[]> pCharSrc(_StringConverter::CopyToCharArrayN(src));\r
        r = GetLastResult();\r
        SysTryReturnResult(NID_UI_IME, pCharSrc, r, "Propagating.");\r
 \r
-       dest = scim::utf8_mbstowcs(pCharSrc, strlen(pCharSrc));\r
-\r
-       delete[] pCharSrc;\r
+       dest = scim::utf8_mbstowcs(pCharSrc.get(), strlen(pCharSrc.get()));\r
 \r
        return r;\r
 }\r
 \r
 result\r
-_ScimDataConverter::ConvertString(const scim::String& src, Tizen::Base::String& dest) const\r
+_ScimDataConverter::ConvertString(const scim::String& src, String& dest)\r
 {\r
        result r = E_SUCCESS;\r
 \r
index 008d4ad..f1f30e9 100644 (file)
 \r
 #include <string> // basic_string in scim_types.h\r
 \r
+#define Uses_SCIM_EVENT\r
 #define Uses_SCIM_TYPES\r
 #undef null\r
 #include <scim.h>\r
 #define null 0\r
 \r
 #include <FBaseDataType.h>\r
-#include <FBaseObject.h>\r
+#include <FBaseString.h>\r
 #include <FGrpRectangle.h>\r
 #include <FLclLocale.h>\r
 #include <FUiIKeyEventListener.h>\r
 \r
-namespace scim\r
-{\r
-struct KeyEvent;\r
-} // scim\r
-\r
-namespace Tizen { namespace Base\r
-{\r
-class String;\r
-}} // Tizen::Base\r
-\r
 namespace Tizen { namespace Ui { namespace Ime {\r
 \r
 /**\r
 * @class _ScimDataConverter\r
 * @brief This class is a concrete class of the %_ScimDataConverter class.\r
-* @since 2.0\r
+* @since 2.1\r
 *\r
 */\r
 class _ScimDataConverter\r
-       : public Tizen::Base::Object\r
 {\r
 public:\r
-       _ScimDataConverter();\r
-       virtual ~_ScimDataConverter();\r
+       static result ConvertKey(Tizen::Ui::KeyCode keyCode, Tizen::Ui::KeyState keyState, scim::KeyEvent& keyEvent);\r
 \r
-       result ConvertKey(Tizen::Ui::KeyCode keyCode, Tizen::Ui::KeyState keyState, scim::KeyEvent& keyEvent) const;\r
+       static char* ConvertLanguageN(const Tizen::Locales::Locale& language);\r
 \r
-       void ConvertRectangle(const Tizen::Graphics::Rectangle& src, scim::rectinfo& dest) const;\r
+       static void ConvertRectangle(const Tizen::Graphics::Rectangle& src, scim::rectinfo& dest);\r
 \r
-       result ConvertString(const Tizen::Base::String& src, scim::String& dest) const;\r
-       result ConvertString(const Tizen::Base::String& src, scim::WideString& dest) const;\r
-       result ConvertString(const scim::String& src, Tizen::Base::String& dest) const;\r
+       static result ConvertString(const Tizen::Base::String& src, scim::String& dest);\r
+       static result ConvertString(const Tizen::Base::String& src, scim::WideString& dest);\r
+       static result ConvertString(const scim::String& src, Tizen::Base::String& dest);\r
 \r
 private:\r
+       _ScimDataConverter();\r
+       ~_ScimDataConverter();\r
+\r
        _ScimDataConverter(const _ScimDataConverter&);\r
        _ScimDataConverter& operator=(const _ScimDataConverter&);\r
 };\r
diff --git a/src/FUiIme_TargetWindowAgent.cpp b/src/FUiIme_TargetWindowAgent.cpp
new file mode 100644 (file)
index 0000000..af47445
--- /dev/null
@@ -0,0 +1,251 @@
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file       FUiIme_TargetWindowAgent.cpp\r
+ * @brief      This is the implementation file for the %_TargetWindowAgent class.\r
+ *\r
+ * This implementation file contains definition of the %_TargetWindowAgent class.\r
+ */\r
+\r
+#include <new>\r
+\r
+#include <Elementary.h>\r
+#include <glib.h>\r
+#include <X11/Xatom.h>\r
+#include <X11/Xlib.h>\r
+\r
+#include <FBaseSysLog.h>\r
+#include <FUiIOrientationEventListener.h>\r
+\r
+#include "FUi_ControlManager.h"\r
+#include "FUiCtrl_Form.h"\r
+#include "FUiCtrl_FormImpl.h"\r
+#include "FUiCtrl_Frame.h"\r
+#include "FUiIme_TargetWindowAgent.h"\r
+\r
+using namespace Tizen::Ui;\r
+using namespace Tizen::Ui::Controls;\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+_TargetWindowAgent* _TargetWindowAgent::__pTargetWindowAgent = null;\r
+\r
+_TargetWindowAgent::_TargetWindowAgent(void)\r
+       :__keyboardWindow(0)\r
+{\r
+}\r
+\r
+_TargetWindowAgent::~_TargetWindowAgent(void)\r
+{\r
+       __pTargetWindowAgent = null;\r
+\r
+       __keyboardWindow = 0;\r
+}\r
+\r
+_TargetWindowAgent*\r
+_TargetWindowAgent::GetInstance(void)\r
+{\r
+       if (__pTargetWindowAgent == null)\r
+       {\r
+               __pTargetWindowAgent = new(std::nothrow) _TargetWindowAgent();\r
+               SysTryReturn(NID_UI_IME, __pTargetWindowAgent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+       }\r
+\r
+       return __pTargetWindowAgent;\r
+}\r
+\r
+result\r
+_TargetWindowAgent::SetTargetWindow(Ecore_X_Window keyboardWindow)\r
+{\r
+       SysLog(NID_UI_IME, "The handle of the keyboard window is %x.", keyboardWindow);\r
+       SysTryReturnResult(NID_UI_IME, keyboardWindow > 0, E_INVALID_ARG, "Invalid argument(s) is used.");\r
+\r
+       result r = E_SUCCESS;\r
+\r
+       if (__keyboardWindow)\r
+       {\r
+               UnsetTargetWindow(__keyboardWindow);\r
+       }\r
+\r
+       __keyboardWindow = keyboardWindow;\r
+\r
+       Atom actualTypeReturn;\r
+       int actualFormatReturn;\r
+       unsigned long nItemsReturn;\r
+       unsigned long bytesAfterReturn;\r
+       unsigned char* pPropReturn = null;\r
+\r
+    gint ret = 0;\r
+    ret = XGetWindowProperty(static_cast<Display*>(ecore_x_display_get()),\r
+                                                       ecore_x_window_root_get(__keyboardWindow),\r
+                                                       ecore_x_atom_get("_ISF_ACTIVE_WINDOW"),\r
+                                                       0,\r
+                                                       G_MAXLONG,\r
+                                                       false,\r
+                                                       XA_WINDOW,\r
+                                                       &actualTypeReturn,\r
+                                                       &actualFormatReturn,\r
+                                                       &nItemsReturn,\r
+                                                       &bytesAfterReturn,\r
+                                                       &pPropReturn);\r
+       SysTryReturnResult(NID_UI_IME, ret == Success, E_SYSTEM, "A failure occurs from the underlying system.");\r
+\r
+       if (pPropReturn)\r
+       {\r
+               if (actualTypeReturn == XA_WINDOW)\r
+               {\r
+                       Ecore_X_Window targetWindow = *(reinterpret_cast<Ecore_X_Window*>(pPropReturn));\r
+                       SysLog(NID_UI_IME, "The handle of the target window is %x.", targetWindow);\r
+\r
+                       ecore_x_icccm_transient_for_set(__keyboardWindow, targetWindow);\r
+               }\r
+\r
+               XFree(pPropReturn);\r
+       }\r
+\r
+       return r;\r
+}\r
+\r
+result\r
+_TargetWindowAgent::UnsetTargetWindow(Ecore_X_Window keyboardWindow)\r
+{\r
+       SysTryReturnResult(NID_UI_IME, (keyboardWindow > 0) && (keyboardWindow == __keyboardWindow), E_INVALID_ARG,\r
+                               "Invalid argument(s) is used. The handle of the keyboard window is %x.", keyboardWindow);\r
+\r
+       result r = E_SUCCESS;\r
+\r
+       ecore_x_icccm_transient_for_unset(keyboardWindow);\r
+\r
+       __keyboardWindow = 0;\r
+\r
+       return r;\r
+}\r
+\r
+int\r
+_TargetWindowAgent::GetOrientation(void)\r
+{\r
+       SysTryReturn(NID_UI_IME, __keyboardWindow != 0, -1, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+       Atom actualTypeReturn;\r
+       int actualFormatReturn;\r
+       unsigned long nItemsReturn;\r
+       unsigned long bytesAfterReturn;\r
+       unsigned char* pPropReturn = null;\r
+\r
+    gint ret = 0;\r
+       ret = XGetWindowProperty(static_cast<Display*>(ecore_x_display_get()),\r
+                                                       ecore_x_window_root_get(__keyboardWindow),\r
+                                                       ecore_x_atom_get("_E_ILLUME_ROTATE_ROOT_ANGLE"),\r
+                                                       0,\r
+                                                       G_MAXLONG,\r
+                                                       false,\r
+                                                       XA_CARDINAL,\r
+                                                       &actualTypeReturn,\r
+                                                       &actualFormatReturn,\r
+                                                       &nItemsReturn,\r
+                                                       &bytesAfterReturn,\r
+                                                       &pPropReturn);\r
+       SysTryReturn(NID_UI_IME, ret == Success, -1, E_SYSTEM, "[E_SYSTEM] A failure occurs from the underlying system.");\r
+\r
+       unsigned int angle = 0;\r
+       if (pPropReturn)\r
+       {\r
+               angle = ((actualTypeReturn == XA_CARDINAL)? *(reinterpret_cast<unsigned int*>(pPropReturn)): -1);\r
+\r
+               XFree(pPropReturn);\r
+       }\r
+\r
+       return angle;\r
+}\r
+\r
+result\r
+_TargetWindowAgent::SetOrientation(int angle)\r
+{\r
+       SysTryReturnResult(NID_UI_IME, __keyboardWindow != 0, E_OBJ_NOT_FOUND, "The required instance does not exist.");\r
+\r
+       result r = E_SUCCESS;\r
+\r
+       Orientation orientation = ORIENTATION_NONE;\r
+       switch (angle)\r
+       {\r
+       case 0:\r
+               orientation = ORIENTATION_PORTRAIT;\r
+               break;\r
+       case 90:\r
+               orientation = ORIENTATION_LANDSCAPE_REVERSE;\r
+               break;\r
+       case 180:\r
+               orientation = ORIENTATION_PORTRAIT_REVERSE;\r
+               break;\r
+       case 270:\r
+               orientation = ORIENTATION_LANDSCAPE;\r
+               break;\r
+       default:\r
+               SysTryReturnResult(NID_UI_IME, true, E_INVALID_ARG, "Invalid argument(s) is used. The angle is %d.", angle);\r
+               break;\r
+       }\r
+\r
+       _ControlManager* pControlManager = _ControlManager::GetInstance();\r
+       SysTryReturnResult(NID_UI_IME, pControlManager, E_OBJ_NOT_FOUND, "The required instance does not exist.");\r
+       _Frame* pFrameCore = static_cast<_Frame*>(pControlManager->GetCurrentFrame());\r
+       SysTryReturnResult(NID_UI_IME, pFrameCore, E_OBJ_NOT_FOUND, "The required instance does not exist.");\r
+       _Form* pFormCore = pFrameCore->GetCurrentForm();\r
+       SysTryReturnResult(NID_UI_IME, pFormCore, E_OBJ_NOT_FOUND, "The required instance does not exist.");\r
+       _FormImpl* pFormImpl = static_cast<_FormImpl*>(pFormCore->GetUserData());\r
+       SysTryReturnResult(NID_UI_IME, pFormImpl, E_OBJ_NOT_FOUND, "The required instance does not exist.");\r
+       \r
+       pFormImpl->SetOrientation(orientation);\r
+       SysLog(NID_UI_IME, "Set the orientation of the current form to %d.", orientation);\r
+\r
+       return r;\r
+}\r
+\r
+bool\r
+_TargetWindowAgent::IsActive(Ecore_X_Window keyboardWindow, Ecore_X_Window activeWindow)\r
+{\r
+       SysLog(NID_UI_IME, "The handle of the keyboard window is %x and that of the active window is %x.", keyboardWindow, activeWindow);\r
+       SysTryReturn(NID_UI_IME, (keyboardWindow > 0) && (activeWindow > 0), false, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument(s) is used.");\r
+\r
+       bool active = false;\r
+\r
+       Ecore_X_Window transientWindow = keyboardWindow;\r
+\r
+       const int MAX_LOOP_COUNT = 100;\r
+       int count = 0;\r
+\r
+       while (transientWindow && (count < MAX_LOOP_COUNT))\r
+       {\r
+               Ecore_X_Window targetWindow = ecore_x_icccm_transient_for_get(transientWindow);\r
+               SysLog(NID_UI_IME, "The handle of the target window is %x.", targetWindow);\r
+\r
+               if (targetWindow == activeWindow)\r
+               {\r
+                       active = true;\r
+                       break;\r
+               }\r
+\r
+               transientWindow = targetWindow;\r
+               count++;\r
+       }\r
+\r
+       SysLog(NID_UI_IME, "Is the window that the input field is involved active? %d.", active);\r
+\r
+       return active;\r
+}\r
+\r
+}}} // Tizen::Ui::Ime\r
diff --git a/src/FUiIme_TargetWindowAgent.h b/src/FUiIme_TargetWindowAgent.h
new file mode 100644 (file)
index 0000000..164b092
--- /dev/null
@@ -0,0 +1,70 @@
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_TargetWindowAgent.h\r
+ * @brief This is the header file for the %_TargetWindowAgent class.\r
+ *\r
+ * This header file contains the declarations of the %_TargetWindowAgent class.\r
+ */\r
+\r
+#ifndef _FUI_IME_INTERNAL_TARGET_WINDOW_AGENT_H_\r
+#define _FUI_IME_INTERNAL_TARGET_WINDOW_AGENT_H_\r
+\r
+#include <Ecore_X.h>\r
+\r
+#include <FBaseDataType.h>\r
+#include <FBaseObject.h>\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+/**\r
+* @class _TargetWindowAgent\r
+* @brief This class is a concrete class of the %_TargetWindowAgent class.\r
+* @since 2.1\r
+*\r
+*/\r
+class _TargetWindowAgent\r
+       : public Tizen::Base::Object\r
+{\r
+public:\r
+       static _TargetWindowAgent* GetInstance(void);\r
+\r
+       result SetTargetWindow(Ecore_X_Window keyboardWindow);\r
+       result UnsetTargetWindow(Ecore_X_Window keyboardWindow);\r
+\r
+       int GetOrientation(void);\r
+       result SetOrientation(int angle);\r
+\r
+       bool IsActive(Ecore_X_Window keyboardWindow, Ecore_X_Window activeWindow);\r
+\r
+private:\r
+       _TargetWindowAgent();\r
+       virtual ~_TargetWindowAgent(void);\r
+\r
+       _TargetWindowAgent(const _TargetWindowAgent& rhs);\r
+       _TargetWindowAgent& operator=(const _TargetWindowAgent& rhs);\r
+\r
+private:\r
+       static _TargetWindowAgent* __pTargetWindowAgent;\r
+\r
+       Ecore_X_Window __keyboardWindow;\r
+};\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif // _FUI_IME_INTERNAL_TARGET_WINDOW_AGENT_H_\r
index a377bad..95b5312 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/capability.h>
 #include <privilege-control.h>
 #include <string.h>
+#include <unique_ptr.h>
 #include <unistd.h> // readlink()
 
 #define Uses_SCIM_CONFIG_BASE
 
 #include <FBase_StringConverter.h>
 
-static const char* LOG_TAG_IME = "IME";
+static const char* _LOG_TAG_IME = "IME";
 
-static const int MAX_LANGUAGE_BUFFER_SIZE = 371; // 53*7
-static const int MAX_BUFFER_SIZE = 256;
-static const int MAX_PACKAGE_NAME = 100;
-static const char* MANIFEST_FILE_PATH = "info/manifest.xml";
+static const int _MAX_LANGUAGE_BUFFER_SIZE = 371; // 53*7
+static const int _MAX_BUFFER_SIZE = 256;
+static const int _MAX_PACKAGE_NAME = 100;
+static const char* _MANIFEST_FILE_PATH = "info/manifest.xml";
 
 static int __argc = 0;
 static char** __pArgv = NULL;
 
-static char __appId[MAX_BUFFER_SIZE];
-static char __uuid[MAX_BUFFER_SIZE];
-static char __name[MAX_BUFFER_SIZE];
-static char __language[MAX_LANGUAGE_BUFFER_SIZE];
+static char __appId[_MAX_BUFFER_SIZE];
+static char __uuid[_MAX_BUFFER_SIZE];
+static char __name[_MAX_BUFFER_SIZE];
+static char __language[_MAX_LANGUAGE_BUFFER_SIZE];
 
 #ifdef __cplusplus
 extern "C"
@@ -157,27 +158,27 @@ DoPreExec(const char* bin_path)
        handle = dlopen("libosp-env-config.so", RTLD_LAZY | RTLD_GLOBAL);
        if (!handle)
        {
-               LOG(LOG_DEBUG, LOG_TAG_IME, "IME > Failed to dlopen libosp-env-config.so (%s)", dlerror());
+               LOG(LOG_DEBUG, _LOG_TAG_IME, "IME > Failed to dlopen libosp-env-config.so (%s)", dlerror());
                return -1;
        }
-       LOG(LOG_DEBUG, LOG_TAG_IME, "IME > dlopen() ok");
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "IME > dlopen() ok");
 
        DoPreExecFunc = reinterpret_cast <int (*)(const char*, const char*)>(dlsym(handle, "do_pre_exec"));
        errormsg = dlerror();
        if (errormsg != NULL)
        {
-               LOG(LOG_DEBUG, LOG_TAG_IME, "IME > Failed to dlsym() (%s)", errormsg);
+               LOG(LOG_DEBUG, _LOG_TAG_IME, "IME > Failed to dlsym() (%s)", errormsg);
                dlclose(handle);
                return -1;
        }
-       LOG(LOG_DEBUG, LOG_TAG_IME, "IME > dlsym() ok");
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "IME > dlsym() ok");
 
        ret = DoPreExecFunc(NULL, bin_path);
        if (ret < 0)
        {
-               LOG(LOG_DEBUG, LOG_TAG_IME, "IME > Failed to do_pre_exe() (%d)", ret);
+               LOG(LOG_DEBUG, _LOG_TAG_IME, "IME > Failed to do_pre_exe() (%d)", ret);
        }
-       LOG(LOG_DEBUG, LOG_TAG_IME, "IME > do_pre_exe() ok");
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "IME > do_pre_exe() ok");
 
        dlclose(handle);
 
@@ -206,7 +207,7 @@ GetDirFdFromPath(const char* pPath)
                }   
        }   
 
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > wrong path format: %s.", __func__, __LINE__, pPath);
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > wrong path format: %s.", __func__, __LINE__, pPath);
 
        return -1; 
 
@@ -215,7 +216,7 @@ OUT:
 
        const int fd = open(dname, O_RDONLY | O_CLOEXEC | O_DIRECTORY);
 
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > directory path: %s, fd: %d", __func__, __LINE__, dname, fd);
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > directory path: %s, fd: %d", __func__, __LINE__, dname, fd);
 
        return fd; 
 }
@@ -227,7 +228,7 @@ GetPackageNameFromAppIdAppExecutableName(const char appId[], const char exeName[
 
        snprintf(pkgName, maxPkgName, "%s.%s", appId, exeName);
 
-       LOG(LOG_DEBUG, LOG_TAG_IME, "IME, packageName is %s", pkgName);
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "IME, packageName is %s", pkgName);
 
        return true;
 }
@@ -241,7 +242,7 @@ PrintArgs(int argc, char* argv[])
        do
        {
                value = argv[i];
-               LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > %dth arg: [%s]", __func__, __LINE__, i, value);
+               LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > %dth arg: [%s]", __func__, __LINE__, i, value);
                i++;
        }
        while (value);
@@ -267,7 +268,7 @@ ParseXmlNode(const xmlNodePtr pXmlNode)
                                        xmlFree(pXmlChar);
                                }
 
-                               LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __appId is %s.", __func__, __LINE__, __appId);
+                               LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > __appId is %s.", __func__, __LINE__, __appId);
                        }
                        else if (!xmlStrcmp(pItorNode->name, reinterpret_cast<const xmlChar*>("Uuid")))
                        {
@@ -280,7 +281,7 @@ ParseXmlNode(const xmlNodePtr pXmlNode)
                                        xmlFree(pXmlChar);
                                }
 
-                               LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __uuid is %s.", __func__, __LINE__, __uuid);
+                               LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > __uuid is %s.", __func__, __LINE__, __uuid);
                        }
                        else if (!xmlStrcmp(pItorNode->name, reinterpret_cast<const xmlChar*>("DisplayName")))
                        {
@@ -293,11 +294,11 @@ ParseXmlNode(const xmlNodePtr pXmlNode)
                                        xmlFree(pXmlChar);
                                }
 
-                               LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __name is %s.", __func__, __LINE__, __name);
+                               LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > __name is %s.", __func__, __LINE__, __name);
                        }
                        else if (!xmlStrcmp(pItorNode->name, reinterpret_cast<const xmlChar*>("Language")))
                        {
-                               const int LANGUAGE_CODE_LENGTH = 3;
+                               const int _LANGUAGE_CODE_LENGTH = 3;
 
                                xmlChar* pXmlChar = null;
                                pXmlChar = xmlNodeGetContent(pItorNode);
@@ -309,28 +310,25 @@ ParseXmlNode(const xmlNodePtr pXmlNode)
                                                strcat(__language, ",");
                                        }
 
-                                       char languageCode[LANGUAGE_CODE_LENGTH + 1];
-                                       strncpy(languageCode, reinterpret_cast<char*>(pXmlChar), LANGUAGE_CODE_LENGTH);
-
+                                       char languageCode[_LANGUAGE_CODE_LENGTH + 1];
+                                       memset(languageCode, '\0', _LANGUAGE_CODE_LENGTH + 1);
+                                       strncpy(languageCode, reinterpret_cast<char*>(pXmlChar), _LANGUAGE_CODE_LENGTH);
                                        Tizen::Base::String twoLetterLanguageCode = Tizen::Locales::Locale::LanguageCodeToTwoLetterLanguageCodeString(Tizen::Locales::Locale::StringToLanguageCode(languageCode));
 
                                        // append language code
-                                       char* pLanguageCode = null;
-                                       pLanguageCode = Tizen::Base::_StringConverter::CopyToCharArrayN(twoLetterLanguageCode.GetPointer());
-
+                                       std::unique_ptr<char[]> pLanguageCode(Tizen::Base::_StringConverter::CopyToCharArrayN(twoLetterLanguageCode.GetPointer()));
                                        if (pLanguageCode)
                                        {
-                                               strcat(__language, pLanguageCode);
-                                               delete[] pLanguageCode;
+                                               strcat(__language, pLanguageCode.get());
                                        }
 
                                        // append country code
-                                       strcat(__language, reinterpret_cast<char*>(pXmlChar + LANGUAGE_CODE_LENGTH));
+                                       strcat(__language, reinterpret_cast<char*>(pXmlChar + _LANGUAGE_CODE_LENGTH));
 
                                        xmlFree(pXmlChar);
                                }
 
-                               LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __language is %s.", __func__, __LINE__, __language);
+                               LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > __language is %s.", __func__, __LINE__, __language);
                        }
 
                        if (pItorNode->children)
@@ -339,29 +337,27 @@ ParseXmlNode(const xmlNodePtr pXmlNode)
                        }
                }
        }
-
-       return;
 }
 
 static void
 ParseImeInfo(const char* filePath)
 {
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > The filePath is %s.", __func__, __LINE__, filePath);
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > The filePath is %s.", __func__, __LINE__, filePath);
 
        xmlDocPtr pXmlDoc = null;
        xmlNodePtr pRootElement = null;
 
        pXmlDoc = xmlParseFile(filePath);
-       if (!pXmlDoc)
+       if (pXmlDoc == null)
        {
-               LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > xmlParseFile() has failed.", __func__, __LINE__);
+               LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > xmlParseFile() has failed.", __func__, __LINE__);
                goto CATCH;
        }
 
        pRootElement = xmlDocGetRootElement(pXmlDoc);
-       if (!pRootElement)
+       if (pRootElement == null)
        {
-               LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > xmlDocGetRootElement() has falied.", __func__, __LINE__);
+               LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > xmlDocGetRootElement() has falied.", __func__, __LINE__);
                goto CATCH;
        }
 
@@ -375,70 +371,62 @@ CATCH:
        }
 
        xmlCleanupParser();
-
-       return;
 }
 
 void _OSP_EXPORT_
 scim_module_init (void)
 {
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > scim_module_init() has been called.", __func__, __LINE__);
-
-       return;
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > scim_module_init() has been called.", __func__, __LINE__);
 }
 
 void _OSP_EXPORT_
 scim_module_exit (void)
 {
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > scim_module_exit() has been called.", __func__, __LINE__);
-
-       return;
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > scim_module_exit() has been called.", __func__, __LINE__);
 }
 
 void _OSP_EXPORT_
 scim_helper_module_set_path_info(const char* path)
 {
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > The path is %s.", __func__, __LINE__, path);
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > The path is %s.", __func__, __LINE__, path);
 
-       memset(__appId, '\0', MAX_BUFFER_SIZE);
-       memset(__uuid, '\0', MAX_BUFFER_SIZE);
-       memset(__name, '\0', MAX_BUFFER_SIZE);
-       memset(__language, '\0', MAX_LANGUAGE_BUFFER_SIZE);
+       memset(__appId, '\0', _MAX_BUFFER_SIZE);
+       memset(__uuid, '\0', _MAX_BUFFER_SIZE);
+       memset(__name, '\0', _MAX_BUFFER_SIZE);
+       memset(__language, '\0', _MAX_LANGUAGE_BUFFER_SIZE);
 
-       char symbolicLinkPath[MAX_BUFFER_SIZE];
-       memset(symbolicLinkPath, '\0', MAX_BUFFER_SIZE);
-       ssize_t numberOfBytes = -1;
-       numberOfBytes = readlink(path, symbolicLinkPath, MAX_BUFFER_SIZE);
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > The numberOfBytes is %d.", __func__, __LINE__, numberOfBytes);
+       char symbolicLinkPath[_MAX_BUFFER_SIZE];
+       memset(symbolicLinkPath, '\0', _MAX_BUFFER_SIZE);
+       ssize_t byteCount = -1;
+       byteCount = readlink(path, symbolicLinkPath, _MAX_BUFFER_SIZE);
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > The byteCount is %d.", __func__, __LINE__, byteCount);
 
        // parse ime info
        const char* pSeparator = strstr(symbolicLinkPath, "/bin");
 
-       char manifestFilePath[MAX_BUFFER_SIZE];
-       memset(manifestFilePath, '\0', MAX_BUFFER_SIZE);
+       char manifestFilePath[_MAX_BUFFER_SIZE];
+       memset(manifestFilePath, '\0', _MAX_BUFFER_SIZE);
 
        strncpy(manifestFilePath, symbolicLinkPath, pSeparator - symbolicLinkPath + 1);
-       strcat(manifestFilePath, MANIFEST_FILE_PATH);
+       strcat(manifestFilePath, _MANIFEST_FILE_PATH);
 
        ParseImeInfo(manifestFilePath);
 
        // initialize ime info
        InitImeInfo(__uuid, __name, __language);
-
-       return;
 }
 
 bool _OSP_EXPORT_
 scim_helper_module_get_helper_info (unsigned int idx, scim::HelperInfo& info)
 {
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > scim_helper_module_get_helper_info() has been called.", __func__, __LINE__);
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > scim_helper_module_get_helper_info() has been called.", __func__, __LINE__);
 
        if (idx == 0)
        {
                info = scim::HelperInfo(__uuid, __name, "", "",
                                                                scim::SCIM_HELPER_STAND_ALONE | scim::SCIM_HELPER_NEED_SCREEN_INFO | scim::SCIM_HELPER_AUTO_RESTART);
 
-               LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __uuid is %s and __name is %s.", __func__, __LINE__, __uuid, __name);
+               LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > __uuid is %s and __name is %s.", __func__, __LINE__, __uuid, __name);
 
                return true;
        }
@@ -449,7 +437,7 @@ scim_helper_module_get_helper_info (unsigned int idx, scim::HelperInfo& info)
 scim::String _OSP_EXPORT_
 scim_helper_module_get_helper_language (unsigned int idx)
 {
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __language is %s.", __func__, __LINE__, __language);
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > __language is %s.", __func__, __LINE__, __language);
 
        return __language;
 }
@@ -457,7 +445,7 @@ scim_helper_module_get_helper_language (unsigned int idx)
 unsigned int _OSP_EXPORT_
 scim_helper_module_number_of_helpers (void)
 {
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > scim_helper_module_number_of_helpers() has been called.", __func__, __LINE__);
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > scim_helper_module_number_of_helpers() has been called.", __func__, __LINE__);
 
        return 1;
 }
@@ -467,28 +455,29 @@ scim_helper_module_set_arg_info(int argc, char* argv[])
 {
        __argc = argc;
        __pArgv = argv;
-
-       return;
 }
 
 void _OSP_EXPORT_
 scim_helper_module_run_helper(const scim::String& uuid, const scim::ConfigPointer& config, const scim::String& display)
 {
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > scim_helper_module_run_helper() has been called.", __func__, __LINE__);
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > scim_helper_module_run_helper() has been called.", __func__, __LINE__);
 
        // get binaryPath
-       char binaryPath[MAX_BUFFER_SIZE];
-       memset(binaryPath, '\0', MAX_BUFFER_SIZE);
+       char binaryPath[_MAX_BUFFER_SIZE];
+       memset(binaryPath, '\0', _MAX_BUFFER_SIZE);
 
-       snprintf(binaryPath, MAX_BUFFER_SIZE, "/opt/apps/%s/bin/%s", __appId, __name);
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > The binary path is %s.", __func__, __LINE__, binaryPath);
+       snprintf(binaryPath, _MAX_BUFFER_SIZE - 1, "/opt/apps/%s/bin/%s", __appId, __name);
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > The binary path is %s.", __func__, __LINE__, binaryPath);
 
        // set __pArgv
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __pArgv[0] is %s.", __func__, __LINE__, __pArgv[0]);
-       snprintf(*__pArgv, strlen(binaryPath) + 1, "%s", binaryPath);
+       int argvCount = strlen(__pArgv[0]);
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > __pArgv[0] is %s and the length of __pArgv[0] is %d.", __func__, __LINE__, __pArgv[0], argvCount);
+
+       memset(__pArgv[0], '\0', argvCount);
+       snprintf(__pArgv[0], strlen(binaryPath) + 1, "%s", binaryPath);
        PrintArgs(__argc, __pArgv);
 
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > uid is %d and euid is %d.", __func__, __LINE__, getuid(), geteuid());
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > uid is %d and euid is %d.", __func__, __LINE__, getuid(), geteuid());
 
        if (getuid() == 0)
        {
@@ -496,10 +485,10 @@ scim_helper_module_run_helper(const scim::String& uuid, const scim::ConfigPointe
                DoPreExec(binaryPath);
 
                // adjust privilege
-               char packageName[MAX_PACKAGE_NAME];
-               memset(packageName, '\0', MAX_PACKAGE_NAME);
+               char packageName[_MAX_PACKAGE_NAME];
+               memset(packageName, '\0', _MAX_PACKAGE_NAME);
 
-               GetPackageNameFromAppIdAppExecutableName(__appId, __name, packageName, MAX_PACKAGE_NAME);
+               GetPackageNameFromAppIdAppExecutableName(__appId, __name, packageName, _MAX_PACKAGE_NAME);
                AdjustPrivilege(packageName);
        }
 
@@ -509,7 +498,7 @@ scim_helper_module_run_helper(const scim::String& uuid, const scim::ConfigPointe
        int fd = GetDirFdFromPath(__pArgv[0]);
        if (fd == -1)
        {
-               LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > Openning a executable binary in the designated path has failed."
+               LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > Openning a executable binary in the designated path has failed."
                        , __func__, __LINE__);
                return;
        }
@@ -519,10 +508,8 @@ scim_helper_module_run_helper(const scim::String& uuid, const scim::ConfigPointe
        //
        OspMain(__argc, __pArgv);
 
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > scim_helper_module_run_helper() has been terminated.", __func__, __LINE__);
-       LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > uid is %d and euid is %d.", __func__, __LINE__, getuid(), geteuid());
-
-       return;
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > scim_helper_module_run_helper() has been terminated.", __func__, __LINE__);
+       LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > uid is %d and euid is %d.", __func__, __LINE__, getuid(), geteuid());
 }
 
 #ifdef __cplusplus