Add SetSize API for NUI IME
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 17 Aug 2021 07:27:53 +0000 (16:27 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 2 Sep 2021 04:00:40 +0000 (13:00 +0900)
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/Tizen.Uix.InputMethod/Interop/Interop.InputMethod.cs
src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs

index 42d8ff5..4b952ab 100755 (executable)
@@ -294,6 +294,9 @@ internal static partial class Interop
         [DllImport(Libraries.InputMethod, EntryPoint = "ime_commit_content")]
         internal static extern ErrorCode ImeCommitContent(string content, string description, string mimeType);
 
+        [DllImport(Libraries.InputMethod, EntryPoint = "ime_set_native_window_size")]
+        internal static extern ErrorCode ImeSetNativeWindowSize(IntPtr window, int portraitWidth, int portraitHeight, int landscapeWidth, int landscapeHeight);
+
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         internal delegate void ImeCreateCb(IntPtr userData);
 
index af9e111..83eea31 100644 (file)
@@ -2296,5 +2296,35 @@ namespace Tizen.Uix.InputMethod
                 throw InputMethodExceptionFactory.CreateException(error);
             }
         }
+
+        /// <summary>
+        /// This API updates the given native input panel window's size information.
+        /// The native window handle of NUI Window can be got by below code.
+        /// var handle = new Window.SafeNativeWindowHandle();
+        /// IntPtr nativeHandle = handle.DangerousGetHandle();
+        /// </summary>
+        /// <privilege>
+        /// http://tizen.org/privilege/ime
+        /// </privilege>
+        /// <param name="window">The native window handle.</param>
+        /// <param name="portraitWidth">The width in the portrait mode.</param>
+        /// <param name="portraitHeight">The height in the portrait mode.</param>
+        /// <param name="landscapeWidth">The width in the landscape mode.</param>
+        /// <param name="landscapeHeight">The height in the landscape mode.</param>
+        /// <exception cref="InvalidOperationException">
+        /// This can occur due to the following reasons:
+        /// 1) The application does not have the privilege to call this function.
+        /// 2) The IME main loop has not started yet.
+        /// </exception>
+        /// <since_tizen> 9 </since_tizen>
+        public static void SetSize(IntPtr window, int portraitWidth, int portraitHeight, int landscapeWidth, int landscapeHeight)
+        {
+            ErrorCode error = ImeSetNativeWindowSize(window, portraitWidth, portraitHeight, landscapeWidth, landscapeHeight);
+            if (error != ErrorCode.None)
+            {
+                Log.Error(LogTag, "SetSize Failed with error " + error);
+                throw InputMethodExceptionFactory.CreateException(error);
+            }
+        }
     }
 }