ecore_imf: Add Ecore_IMF function to set or get the input panel-specific data
authorjihoon <jihoon@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 6 Feb 2012 09:46:38 +0000 (09:46 +0000)
committerjihoon <jihoon@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 6 Feb 2012 09:46:38 +0000 (09:46 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@67711 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/ecore_imf/Ecore_IMF.h
src/lib/ecore_imf/ecore_imf_context.c
src/modules/immodules/scim/scim_module.cpp
src/modules/immodules/xim/ecore_imf_xim.c

index 84f0e93..740012f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 2012-02-06  Jihoon Kim (jihoon)
 
         * Set ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL as default layout in ecore_imf_context_add.
+        * Add Ecore_IMF function to set or get the input panel-specific data.
index 866c6d2..2c589ed 100644 (file)
@@ -345,6 +345,8 @@ struct _Ecore_IMF_Context_Class
    void (*input_panel_language_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang);
    Ecore_IMF_Input_Panel_Lang (*input_panel_language_get) (Ecore_IMF_Context *ctx);
    void (*cursor_location_set) (Ecore_IMF_Context *ctx, int x, int y, int w, int h);
+   void (*input_panel_imdata_set)(Ecore_IMF_Context *ctx, const void* data, int len);
+   void (*input_panel_imdata_get)(Ecore_IMF_Context *ctx, void* data, int *len);
 };
 
 struct _Ecore_IMF_Context_Info
@@ -418,6 +420,8 @@ EAPI void                          ecore_imf_context_input_panel_language_set(Ec
 EAPI Ecore_IMF_Input_Panel_Lang    ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx);
 EAPI void                          ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx, Eina_Bool enable);
 EAPI Eina_Bool                     ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx);
+EAPI void                          ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len);
+EAPI void                          ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len);
 
 /* The following entry points must be exported by each input method module
  */
index 49d6ea3..2dddc42 100644 (file)
@@ -1378,3 +1378,55 @@ ecore_imf_context_input_panel_enabled_get (Ecore_IMF_Context *ctx)
    return ctx->input_panel_enabled;
 }
 
+/**
+ * Set the input panel-specific data to deliver to the input panel.
+ * this API is used by applications to deliver specific data to the input panel.
+ * the data format MUST be negotiated by both application and the input panel.
+ * The size and format of data are defined by the input panel.
+ *
+ * @param ctx An #Ecore_IMF_Context.
+ * @param data The specific data to be set to the input panel.
+ * @param len the length of data, in bytes, to send to the input panel
+ * @ingroup Ecore_IMF_Context_Group
+ * @since 1.2.0
+ */
+EAPI void
+ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len)
+{
+   if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+     {
+        ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+                         "ecore_imf_context_input_panel_imdata_set");
+        return;
+     }
+
+   if (!data) return;
+
+   if (ctx->klass->input_panel_imdata_set)
+     ctx->klass->input_panel_imdata_set(ctx, data, len);
+}
+
+/**
+ * Get the specific data of the current active input panel.
+ *
+ * @param ctx An #Ecore_IMF_Context.
+ * @param data The specific data to be got from the input panel
+ * @param len The length of data
+ * @ingroup Ecore_IMF_Context_Group
+ * @since 1.2.0
+ */
+EAPI void
+ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len)
+{
+   if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+     {
+        ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+                         "ecore_imf_context_input_panel_imdata_get");
+        return;
+     }
+
+   if (!data) return;
+
+   if (ctx->klass->input_panel_imdata_get)
+     ctx->klass->input_panel_imdata_get(ctx, data, len);
+}
index eff6381..06330f4 100644 (file)
@@ -38,7 +38,9 @@ extern "C"
         NULL,                                   /* isf_imf_context_input_panel_layout_get, */
         NULL,                                   /* isf_imf_context_input_panel_language_set, */
         NULL,                                   /* isf_imf_context_input_panel_language_get, */
-        isf_imf_context_cursor_location_set     /* cursor_location_set */
+        isf_imf_context_cursor_location_set,    /* cursor_location_set */
+        NULL,                                   /* input_panel_imdata_set */
+        NULL,                                   /* input_panel_imdata_get */
    };
 
    static Ecore_IMF_Context *imf_module_create (void);
index ea7ee7f..29a8cd0 100644 (file)
@@ -759,6 +759,8 @@ static Ecore_IMF_Context_Class xim_class = {
    .input_panel_language_set = NULL,
    .input_panel_language_get = NULL,
    .cursor_location_set = _ecore_imf_context_xim_cursor_location_set,
+   .input_panel_imdata_set = NULL,
+   .input_panel_imdata_get = NULL,
 };
 
 static Ecore_IMF_Context *