A game about forced loneliness, made by TACStudios
at master 1.5 kB view raw
1using System.Runtime.InteropServices; 2using UnityEngine.InputSystem.Utilities; 3 4namespace UnityEngine.InputSystem.LowLevel 5{ 6 /// <summary> 7 /// Device Command that enables IME Composition within the application. Primarily handled by Keyboard devices. 8 /// </summary> 9 [StructLayout(LayoutKind.Explicit, Size = InputDeviceCommand.kBaseCommandSize + sizeof(byte))] 10 public unsafe struct EnableIMECompositionCommand : IInputDeviceCommandInfo 11 { 12 public static FourCC Type { get { return new FourCC('I', 'M', 'E', 'M'); } } 13 14 internal const int kSize = InputDeviceCommand.kBaseCommandSize + +sizeof(uint); 15 16 [FieldOffset(0)] 17 public InputDeviceCommand baseCommand; 18 19 /// <summary> 20 /// Set to true, and if true, Input Method Editors will be used while typing. 21 /// </summary> 22 public bool imeEnabled 23 { 24 get { return m_ImeEnabled != 0; } 25 } 26 27 [FieldOffset(InputDeviceCommand.kBaseCommandSize)] 28 byte m_ImeEnabled; 29 30 public FourCC typeStatic 31 { 32 get { return Type; } 33 } 34 35 public static EnableIMECompositionCommand Create(bool enabled) 36 { 37 return new EnableIMECompositionCommand 38 { 39 baseCommand = new InputDeviceCommand(Type, InputDeviceCommand.kBaseCommandSize + sizeof(byte)), 40 m_ImeEnabled = enabled ? byte.MaxValue : (byte)0 41 }; 42 } 43 } 44}