Ingen beskrivning
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

EnableIMECompositionCommand.cs 1.4KB

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