From 5c7cb049be664d9a71af2a56810f1ed17cdb009c Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 17 Aug 2021 16:27:53 +0900 Subject: [PATCH] Add SetSize API for NUI IME Signed-off-by: Jihoon Kim --- .../Interop/Interop.InputMethod.cs | 3 +++ .../Tizen.Uix.InputMethod/InputMethodEditor.cs | 30 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/Tizen.Uix.InputMethod/Interop/Interop.InputMethod.cs b/src/Tizen.Uix.InputMethod/Interop/Interop.InputMethod.cs index 42d8ff5..4b952ab 100755 --- a/src/Tizen.Uix.InputMethod/Interop/Interop.InputMethod.cs +++ b/src/Tizen.Uix.InputMethod/Interop/Interop.InputMethod.cs @@ -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); diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs index af9e111..83eea31 100644 --- a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs @@ -2296,5 +2296,35 @@ namespace Tizen.Uix.InputMethod throw InputMethodExceptionFactory.CreateException(error); } } + + /// + /// 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(); + /// + /// + /// http://tizen.org/privilege/ime + /// + /// The native window handle. + /// The width in the portrait mode. + /// The height in the portrait mode. + /// The width in the landscape mode. + /// The height in the landscape mode. + /// + /// 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. + /// + /// 9 + 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); + } + } } } -- 2.7.4