Ensure borders on IME mode foreground icon

This commit is contained in:
Soreepeong 2023-12-08 15:41:37 +09:00
parent 01b45c98ac
commit 2c3139d8b7
3 changed files with 59 additions and 10 deletions

View file

@ -611,29 +611,51 @@ public enum SeIconChar
QuestRepeatable = 0xE0BF,
/// <summary>
/// The IME hiragana icon unicode character.
/// The [あ] character indicating that the Japanese IME is in full-width Hiragana input mode.
/// </summary>
/// <remarks>
/// Half-width Hiragana exists as a Windows API constant, but the feature is unused, or at least unexposed to the end user via the IME.
/// </remarks>
ImeHiragana = 0xE020,
/// <summary>
/// The IME katakana icon unicode character.
/// The [ア] character indicating that the Japanese IME is in full-width Katakana input mode.
/// </summary>
ImeKatakana = 0xE021,
/// <summary>
/// The IME alphanumeric icon unicode character.
/// The [] character indicating that Japanese or Korean IME is in full-width Latin character input mode.
/// </summary>
ImeAlphanumeric = 0xE022,
/// <summary>
/// The IME katakana half-width icon unicode character.
/// The [_ア] character indicating that the Japanese IME is in half-width Katakana input mode.
/// </summary>
ImeKatakanaHalfWidth = 0xE023,
/// <summary>
/// The IME alphanumeric half-width icon unicode character.
/// The [_A] character indicating that Japanese or Korean IME is in half-width Latin character input mode.
/// </summary>
ImeAlphanumericHalfWidth = 0xE024,
/// <summary>
/// The [가] character indicating that the Korean IME is in Hangul input mode.
/// </summary>
/// <remarks>
/// Use <see cref="ImeAlphanumeric"/> and <see cref="ImeAlphanumericHalfWidth"/> for alphanumeric input mode,
/// toggled via Alt+=.
/// </remarks>
ImeKoreanHangul = 0xE025,
/// <summary>
/// The [中] character indicating that the Chinese IME is in Han character input mode.
/// </summary>
ImeChineseHan = 0xE026,
/// <summary>
/// The [英] character indicating that the Chinese IME is in Latin character input mode.
/// </summary>
ImeChineseLatin = 0xE027,
/// <summary>
/// The instance (1) icon unicode character.

View file

@ -19,7 +19,7 @@ using static TerraFX.Interop.Windows.Windows;
namespace Dalamud.Interface.Internal;
/// <summary>
/// This class handles IME for non-English users.
/// This class handles CJK IME.
/// </summary>
[ServiceManager.EarlyLoadedService]
internal sealed unsafe class DalamudIme : IDisposable, IServiceType
@ -251,7 +251,7 @@ internal sealed unsafe class DalamudIme : IDisposable, IServiceType
{
case LANG.LANG_KOREAN:
if (native)
this.InputModeIcon = "\uE025";
this.InputModeIcon = $"{(char)SeIconChar.ImeKoreanHangul}";
else if (fullwidth)
this.InputModeIcon = $"{(char)SeIconChar.ImeAlphanumeric}";
else
@ -274,11 +274,10 @@ internal sealed unsafe class DalamudIme : IDisposable, IServiceType
break;
case LANG.LANG_CHINESE:
// TODO: does Chinese IME also need "open" check?
if (native)
this.InputModeIcon = "\uE026";
this.InputModeIcon = $"{(char)SeIconChar.ImeChineseHan}";
else
this.InputModeIcon = "\uE027";
this.InputModeIcon = $"{(char)SeIconChar.ImeChineseLatin}";
break;
default:

View file

@ -133,6 +133,20 @@ internal unsafe class DalamudImeWindow : Window
if (!expandUpward && drawIme)
{
for (var dx = -2; dx <= 2; dx++)
{
for (var dy = -2; dy <= 2; dy++)
{
if (dx != 0 || dy != 0)
{
drawList.AddText(
cursor + new Vector2(dx, dy),
ImGui.GetColorU32(ImGuiCol.WindowBg),
ime.InputModeIcon);
}
}
}
drawList.AddText(cursor, ImGui.GetColorU32(ImGuiCol.Text), ime.InputModeIcon);
cursor.Y += candTextSize.Y + spaceY;
}
@ -179,6 +193,20 @@ internal unsafe class DalamudImeWindow : Window
if (expandUpward && drawIme)
{
for (var dx = -2; dx <= 2; dx++)
{
for (var dy = -2; dy <= 2; dy++)
{
if (dx != 0 || dy != 0)
{
drawList.AddText(
cursor + new Vector2(dx, dy),
ImGui.GetColorU32(ImGuiCol.WindowBg),
ime.InputModeIcon);
}
}
}
drawList.AddText(cursor, ImGui.GetColorU32(ImGuiCol.Text), ime.InputModeIcon);
}