ecore_imf: Add API to set alignment of the input panel 58/310458/4 video_shell_devel accepted/tizen/unified/20240603.032252 accepted/tizen/unified/x/20240604.013015
authorInhong Han <inhong1.han@samsung.com>
Mon, 29 Apr 2024 07:49:20 +0000 (16:49 +0900)
committerInhong Han <inhong1.han@samsung.com>
Wed, 22 May 2024 01:06:00 +0000 (10:06 +0900)
Change-Id: Id6eef10d12b94d73cef78d13f6180efbd0ed66a9

src/lib/ecore_imf/Ecore_IMF.h
src/lib/ecore_imf/ecore_imf_context.c

index a4729b9..fbe7671 100644 (file)
@@ -516,6 +516,26 @@ typedef enum _Ecore_IMF_Device_Subclass
 } Ecore_IMF_Device_Subclass; /**< A general subclass of device @since 1.14 */
 
 /**
+ * @enum _Ecore_IMF_Input_Panel_Align
+ * @brief Enumeration for defining the types of Ecore_IMF Input Panel align
+ * @since 1.28
+ *
+ * @since_tizen 9.0
+ */
+typedef enum _Ecore_IMF_Input_Panel_Align
+{
+   ECORE_IMF_INPUT_PANEL_ALIGN_TOP_LEFT, /**< The top-left corner */
+   ECORE_IMF_INPUT_PANEL_ALIGN_TOP_CENTER, /**< The top-center position */
+   ECORE_IMF_INPUT_PANEL_ALIGN_TOP_RIGHT, /**< The top-right corner */
+   ECORE_IMF_INPUT_PANEL_ALIGN_MIDDLE_LEFT, /**< The middle-left position */
+   ECORE_IMF_INPUT_PANEL_ALIGN_MIDDLE_CENTER, /**< The middle-center position */
+   ECORE_IMF_INPUT_PANEL_ALIGN_MIDDLE_RIGHT, /**< The middle-right position */
+   ECORE_IMF_INPUT_PANEL_ALIGN_BOTTOM_LEFT, /**< The bottom-left corner */
+   ECORE_IMF_INPUT_PANEL_ALIGN_BOTTOM_CENTER, /**< The bottom-center position */
+   ECORE_IMF_INPUT_PANEL_ALIGN_BOTTOM_RIGHT, /**< The bottom-right corner */
+} Ecore_IMF_Input_Panel_Align;
+
+/**
  * @struct _Ecore_IMF_Event_Preedit_Start
  * @brief The structure type used with the Preedit_Start Input Method event
  */
@@ -816,6 +836,7 @@ struct _Ecore_IMF_Context_Class
    void (*prediction_hint_set) (Ecore_IMF_Context *ctx, const char *prediction_hint); /**< Set the prediction hint to the input panel */
    void (*mime_type_accept_set) (Ecore_IMF_Context *ctx, const char *mime_type); /**< Set the MIME type to the input panel */
    void (*input_panel_position_set) (Ecore_IMF_Context *ctx, int x, int y); /**< Set the position of the input panel */
+   void (*input_panel_position_align_set) (Ecore_IMF_Context *ctx, int x, int y, Ecore_IMF_Input_Panel_Align align); /**< Set the alignment of the input panel */
 };
 
 /**
@@ -2133,6 +2154,29 @@ EAPI Eina_Bool                    ecore_imf_context_prediction_hint_hash_del(Eco
  */
 EAPI const Eina_Hash             *ecore_imf_context_prediction_hint_hash_get(Ecore_IMF_Context *ctx);
 
+/**
+ * @internal
+ *
+ * @ingroup Ecore_IMF_Context_Group
+ * @brief Sets the alignment and its x,y coordinates of the input panel.
+ *
+ * Regardless of the rotation degree, the x, y values of the top-left corner on the screen are based on 0, 0.
+ * When the IME size is changed, its size will change according to the set alignment.
+ *
+ * @remarks This API can be used to set the alignment of a floating IME.
+ *
+ * @since 1.28.0
+ *
+ * @param[in] ctx An #Ecore_IMF_Context
+ * @param x The x coordinate of the #Ecore_IMF_Input_Panel_Align value
+ * @param y The y coordinate of the #Ecore_IMF_Input_Panel_Align value
+ * @param align one of the #Ecore_IMF_Input_Panel_Align values specifying the desired alignment
+ * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
+ *
+ * @since_tizen 9.0
+ */
+EAPI Eina_Bool                   ecore_imf_context_input_panel_position_align_set(Ecore_IMF_Context *ctx, int x, int y, Ecore_IMF_Input_Panel_Align align);
+
 /* The following entry points must be exported by each input method module
  */
 
index 73d105b..6537b44 100644 (file)
@@ -1542,3 +1542,21 @@ ecore_imf_context_prediction_hint_hash_get(Ecore_IMF_Context *ctx)
 
    return ctx->prediction_hint_hash;
 }
+
+EAPI Eina_Bool
+ecore_imf_context_input_panel_position_align_set(Ecore_IMF_Context *ctx, int x, int y, Ecore_IMF_Input_Panel_Align align)
+{
+   if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+     {
+        ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+                         "ecore_imf_context_input_panel_position_align_set");
+        return EINA_FALSE;
+     }
+
+   if (ctx->klass && ctx->klass->input_panel_position_align_set)
+     ctx->klass->input_panel_position_align_set(ctx, x, y, align);
+   else
+      return EINA_FALSE;
+
+   return EINA_TRUE;
+}