-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.Generic;
using Tizen;
+using static Interop.SclNuiCSharp;
namespace ISEDefaultNUI
{
{
List<LanguageInfo> languageInfos = languageInfoList.FindAll(x => x.Enabled == true);
int index = languageInfos.FindIndex(x => x.Name == languageInfoList[currentLanguage].Name);
- if (index == languageInfos.Count - 1)
+ if (index == languageInfos.Count - 1)\r
return languageInfos[0];
- else
+ else\r
return languageInfos[index + 1];
}
{
List<LanguageInfo> languageInfos = languageInfoList.FindAll(x => x.Enabled == true);
int index = languageInfos.FindIndex(x => x.Name == languageInfoList[currentLanguage].Name);
- if (index == 0)
+ if (index == 0)\r
return languageInfos[languageInfos.Count - 1];
- else
+ else\r
return languageInfos[index - 1];
}
int index = -1;
index = languageInfoList.FindIndex(x => x.Name == language.Name);
if (index == -1)
- return false;
- else
- return true;
+ return false;\r
+\r
+ Log.Info("NUIIME", "Current Language : " + languageInfoList[index].Name);\r
+ currentLanguage = index;
+ return true;
}
public string GetUuid(string name)
if (!languageInfo.Enabled && !languageInfo.EnabledTemporarily)
return false;
- //Reset Language (flush imengine)
+ Log.Info("NUIIME", "Reset Language : " + GetCurrentLanguage());
+ if (languageInfo.Name.Equals(name))
+ FlushImengine(languageInfo.Name);
return true;
}
+
+ public void FlushImengine(string language)\r
+ {\r
+ Log.Info("NUIIME", "Flush Imengine : " + language);\r
+\r
+ KeyboardState keyboardState = KeyboardState.Instance;\r
+ if (keyboardState.PreviousModifier == (uint)SclNuiKeyModifier.MultitapStart || keyboardState.PreviousModifier == (uint)SclNuiKeyModifier.MultitapRepeat)\r
+ Common.SendString(keyboardState.MultitapValue);\r
+\r
+ keyboardState.MultitapValue = "";\r
+ keyboardState.PreviousModifier = (uint)SclNuiKeyModifier.None;\r
+\r
+ LanguageInfo currentLanguage = GetLanguageInfo(language);\r
+ if (currentLanguage != null)\r
+ {\r
+ if (currentLanguage.LoadInIME)\r
+ SclResetImengine();\r
+ else\r
+ SclDbusResetImengine();\r
+ }\r
+ }
}
}
if (node.Attributes["accepts_caps_mode"] != null)
languageInfo.AcceptsCapsMode = Convert.ToBoolean(node.Attributes["accepts_caps_mode"].Value);
+ if (node.Attributes["need_surrounding_text"] != null)\r
+ languageInfo.NeedSurroundingText = Convert.ToBoolean(node.Attributes["need_surrounding_text"].Value);\r
+\r
languageInfo.Enabled = false;
languageInfo.SelectedInputMode = inputModeInfo.Name;
SclNui.EnableSound(false);
SclNui.EnableVibration(false);
SclNui.EnableMagnifier(false);
-
- LanguageInfo currentLanguage = LanguageManager.Instance.GetLanguageInfo(IseConfig.Instance.SelectedLanguage);
- if (!currentLanguage.LoadInIME)
- {
- /* FIXME : This comment should be removed when using IMEngine
- string uuid = LanguageManager.Instance.GetUuid(currentLanguage.KeyboardISEUuid);
- ApplicationInfo applicationInfo = new ApplicationInfo(uuid);
- SclDbus.SetImengine(uuid, applicationInfo.PackageId);
- */
- }
}
private static void Terminate()
private static void IMEShow(int ic)
{
+ IseConfig.Instance.ReadIseConfig();
+ LanguageManager.Instance.SetEnabledLanguages(IseConfig.Instance.EnabledLanguages);
+
switch (KeyboardState.Instance.Layout)
{
case KeyboardLayout.PhoneNumber:
case KeyboardLayout.IP:
case KeyboardLayout.Month:
case KeyboardLayout.NumberOnly:
- /* FIXME : This comment should be removed when using IMEngine
- * InputMethodEditor.SetIMEngine(ResourceManager.DefaultKeyboardUuid);
- */
+
+ ApplicationInfo applicationInfo = new ApplicationInfo(ResourceManager.DefaultKeyboardUuid);
+ SclDbusSetImengine(ResourceManager.DefaultKeyboardUuid, applicationInfo.PackageId);
break;
default:
break;
{
SclNui.SetInputMode(defaultValue.Values[(int)layoutIndex].InputMode);
}
+ else\r
+ {\r
+ LanguageInfo selectLanguage = LanguageManager.Instance.GetLanguageInfo(IseConfig.Instance.SelectedLanguage);\r
+ LanguageManager.Instance.SelectLanguage(selectLanguage);\r
+ if (forcePrimaryLatin || selectLanguage.LoadInIME)\r
+ {\r
+ SclSetEngineLoaderFlag(false);\r
+ SclSetImengine(LanguageManager.Instance.GetUuid(selectLanguage.KeyboardISEUuid));\r
+ }\r
+ else\r
+ {\r
+ SclSetImengine(ResourceManager.DefaultKeyboardUuid);\r
+ SclSetEngineLoaderFlag(true);\r
+ string uuid = LanguageManager.Instance.GetUuid(selectLanguage.KeyboardISEUuid);\r
+ ApplicationInfo applicationInfo = new ApplicationInfo(uuid);\r
+ SclDbusSetImengine(uuid, applicationInfo.PackageId);\r
+ }\r
+ }
SclNui.SetCurrentSublayout(defaultValue.Values[(int)layoutIndex].SublayoutName);
}
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.31129.286
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ISEDefaultNUI", "ISEDefaultNUI.csproj", "{0AA1B59F-5B99-4FE8-BB34-3FE03FD16418}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SettingKeyboard", "..\SettingKeyboard\SettingKeyboard.csproj", "{D3191982-0DF3-4E08-A4BD-5AADC746BC7C}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {0AA1B59F-5B99-4FE8-BB34-3FE03FD16418}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0AA1B59F-5B99-4FE8-BB34-3FE03FD16418}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0AA1B59F-5B99-4FE8-BB34-3FE03FD16418}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0AA1B59F-5B99-4FE8-BB34-3FE03FD16418}.Release|Any CPU.Build.0 = Release|Any CPU
- {D3191982-0DF3-4E08-A4BD-5AADC746BC7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D3191982-0DF3-4E08-A4BD-5AADC746BC7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D3191982-0DF3-4E08-A4BD-5AADC746BC7C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D3191982-0DF3-4E08-A4BD-5AADC746BC7C}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {90570B69-2C91-4F6C-8751-2BD5B81E11D6}
- EndGlobalSection
-EndGlobal
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio Version 16\r
+VisualStudioVersion = 16.0.31129.286\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ISEDefaultNUI", "ISEDefaultNUI.csproj", "{0AA1B59F-5B99-4FE8-BB34-3FE03FD16418}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SettingKeyboard", "..\SettingKeyboard\SettingKeyboard.csproj", "{D3191982-0DF3-4E08-A4BD-5AADC746BC7C}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Release|Any CPU = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {0AA1B59F-5B99-4FE8-BB34-3FE03FD16418}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {0AA1B59F-5B99-4FE8-BB34-3FE03FD16418}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {0AA1B59F-5B99-4FE8-BB34-3FE03FD16418}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {0AA1B59F-5B99-4FE8-BB34-3FE03FD16418}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {D3191982-0DF3-4E08-A4BD-5AADC746BC7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {D3191982-0DF3-4E08-A4BD-5AADC746BC7C}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {D3191982-0DF3-4E08-A4BD-5AADC746BC7C}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {D3191982-0DF3-4E08-A4BD-5AADC746BC7C}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {90570B69-2C91-4F6C-8751-2BD5B81E11D6}\r
+ EndGlobalSection\r
+EndGlobal\r
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void UpdateWindowPositionCallback(int type, int x, int y, int rotationX, int rotationY, IntPtr user_data);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void ProcessKeyEventWithImengineCallback(UInt32 code, UInt32 mask, UInt32 layout, UInt32 devClass, UInt32 devSubclass, string devName, UInt32 serial, IntPtr user_data);
+
[DllImport(Libraries.SclNui, EntryPoint = "scl_nui_init")]
internal static extern int SclNuiInit(string entry_filepath);
[DllImport(Libraries.SclNui, EntryPoint = "scl_dbus_long_press_candidate_item")]
internal static extern void SclDbusLongPressCandidateItem(UInt32 index);
+
+ [DllImport(Libraries.SclNui, EntryPoint = "scl_set_imengine")]
+ internal static extern int SclSetImengine(string engineId);
+
+ [DllImport(Libraries.SclNui, EntryPoint = "scl_flush_imengine")]
+ internal static extern int SclFlushImengine();
+
+ [DllImport(Libraries.SclNui, EntryPoint = "scl_reset_imengine")]
+ internal static extern int SclResetImengine();
+
+ [DllImport(Libraries.SclNui, EntryPoint = "scl_send_imengine_event")]
+ internal static extern int SclSendImengineEvent(int command, UInt32 value);
+
+ [DllImport(Libraries.SclNui, EntryPoint = "scl_set_engine_loader_flag")]
+ internal static extern int SclSetEngineLoaderFlag(bool flag);
+
+ [DllImport(Libraries.SclNui, EntryPoint = "scl_set_process_key_event_with_imengine_cb")]
+ internal static extern int SclSetProcessKeyEventWithImengineCb(ProcessKeyEventWithImengineCallback callbackFunction, IntPtr userData);
}
}
using Tizen.NUI.Components;
using Tizen.Uix.InputMethod;
using static Interop.SclNuiCSharp;
-\r
+
namespace ISEDefaultNUI
{
class SCLNUI : Page
private DragStateChangedCallback _onDragStateChangedEvent = null;
private EventNotificationCallback _onEventNotification = null;
private UpdateWindowPositionCallback _updateWindowPositionChangedEvent = null;
+ private ProcessKeyEventWithImengineCallback _onProcessKeyEventWithImengineEvent = null;
private List<ImageView> image_list;
private List<TextLabel> label_list;
private Timer commitTimer;
private Timer showEmoticonTimer;
private View emoticonView = null;
- private EmoticonPage emoticonPage = null;\r
+ private EmoticonPage emoticonPage = null;
enum LabelAlignment
{
label_list = new List<TextLabel>();
commitTimer = new Timer(1000);
- commitTimer.Tick += CommitTimerTick;\r
-\r
- showEmoticonTimer = new Timer(10);\r
+ commitTimer.Tick += CommitTimerTick;
+
+ showEmoticonTimer = new Timer(10);
showEmoticonTimer.Tick += showEmoticonTimerTick;
/* Draw text callback */
SclNuiSetShiftState((uint)ShiftState.Off);
KeyboardState.Instance.ResetMultitapState(true);
InputMethodEditor.RequestHide();
- }\r
-\r
+ }
+
else if (key_event > 0)
{
Common.SendKeyEvent((KeyCode)key_event);
break;
case SclNuiKeyType.Modechange:
break;
- case SclNuiKeyType.User:\r
+ case SclNuiKeyType.User:
{
String substring = keyValue.Substring(0, 15);
Log.Info("NUIIME", "key substring " + substring);
- if (substring.Equals("EMOTICON_GROUP_"))\r
- emoticonPage?.SetEmoticonGroup(keyValue);\r
- }\r
+ if (substring.Equals("EMOTICON_GROUP_"))
+ emoticonPage?.SetEmoticonGroup(keyValue);
+ }
break;
case SclNuiKeyType.Max:
break;
appControl.LaunchMode = AppControlLaunchMode.Group;
AppControl.SendLaunchRequest(appControl);
}
- else if (keyValue.Equals("EMOTICON_LAYOUT"))\r
- {\r
- ShowEmoticonLayout();\r
+ else if (keyValue.Equals("EMOTICON_LAYOUT"))
+ {
+ ShowEmoticonLayout();
}
if (keyValue.Equals("Space") && afterPositionX != 0 && Math.Abs(beforePositionX - afterPositionX) > 100 && !inputMode.Equals("SYM_QTY_1"))
IseConfig.Instance.SelectedLanguage = nextLanguage.Name;
IseConfig.Instance.WriteIseConfig();
- if (!nextLanguage.LoadInIME)
+ if (nextLanguage.LoadInIME)
+ {
+ SclSetEngineLoaderFlag(false);
+ SclSetImengine(LanguageManager.Instance.GetUuid(nextLanguage.KeyboardISEUuid));
+ }
+ else
{
- /* FIXME : This comment should be removed when using IMEngine
+ SclSetImengine(ResourceManager.DefaultKeyboardUuid);
+ SclSetEngineLoaderFlag(true);
string uuid = LanguageManager.Instance.GetUuid(nextLanguage.KeyboardISEUuid);
ApplicationInfo applicationInfo = new ApplicationInfo(uuid);
SclDbusSetImengine(uuid, applicationInfo.PackageId);
- */
}
+ LanguageManager.Instance.FlushImengine(nextLanguage.Name);
SclNui.SetInputMode(nextLanguage.SelectedInputMode);
SclNui.SetCurrentSublayout("DEFAULT");
SclNui.SetStringSubstitution("_LANGUAGE_", nextLanguage.DisplayName);
};
SclNuiKeyClickEventCb(_onKeyClickEvent);
+ InputMethodEditor.SetProcessKeyCallback((KeyCode code, KeyMask mask, InputMethodDeviceInformation device) => {
+ if (keyboardState.VisibleState)
+ {
+
+ }
+
+ return false;
+ });
+
+ _onProcessKeyEventWithImengineEvent = (UInt32 code, UInt32 mask, UInt32 layout, UInt32 devClass, UInt32 devSubclass, string devName, UInt32 serial, IntPtr user_data) =>
+ {
+ LanguageInfo currentLanguage = LanguageManager.Instance.GetLanguageInfo(LanguageManager.Instance.GetCurrentLanguage());
+ SclDbusProcessKeyEvent(code, mask, layout, devClass, devSubclass, devName, serial, currentLanguage.NeedSurroundingText);
+ };
+ SclSetProcessKeyEventWithImengineCb(_onProcessKeyEventWithImengineEvent, (IntPtr)null);
+
_onDragStateChangedEvent = (IntPtr key_value, int key_event, int key_type, int event_type, int current_x, int current_y) =>
{
return (int)SclNuiEventReturnType.PassOn;
return true;
}
- private void ShowEmoticonLayout()\r
+ private void ShowEmoticonLayout()
{
- if (showEmoticonTimer.IsRunning())\r
- showEmoticonTimer.Stop();\r
-\r
- showEmoticonTimer.Start();\r
+ if (showEmoticonTimer.IsRunning())
+ showEmoticonTimer.Stop();
+
+ showEmoticonTimer.Start();
}
private bool showEmoticonTimerTick(object source, Timer.TickEventArgs e)
- {\r
- Log.Info("NUIIME", "emoticon layout timer");\r
+ {
+ Log.Info("NUIIME", "emoticon layout timer");
OnShowEmoticonLayoutTimer();
- return false;\r
+ return false;
}
private void OnResized(object sender, Window.ResizedEventArgs e)