Vixen
dd8b0a81
csharp
public sealed class PlatformTextInput

Turns "this element has the focus and takes text" into text input being on, in that window.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

⚠ The wire the framework shipped without, and the reason desktop looked fine. ITextInput.Activate's only caller in the whole repository was the game host's debug console, and SetCandidateArea — implemented on every one of the six platforms — had no caller at all outside a headless test. SDL leaves text input running, so a desktop TextField received characters anyway and the gap was invisible; on the web and on a phone a focused field receives nothing, and everywhere the IME's candidate list is drawn at a corner of the screen instead of under the caret.

Once a frame, after the update, exactly like Apply. The focus moves between frames and the caret moves within a frame, so there is no event to hang either half on that is not "the frame".

⚠ Stateful, and that is what makes it affordable. SetCandidateArea is a window-manager call on the desktop and a DOM write on the web; issuing one every frame for a caret that has not moved is sixty a second for nothing. So the last window and the last rectangle are remembered and only a change is pushed — which also makes "how many times was the platform told" a thing a test can count, and counting it is how this file's own tests prove the wire without a display server.

Fields and properties (1)

  • public IWindow? Active

    The window text input was last turned on for, or when it is off.

Methods (3)

  • public PlatformTextInput(ITextInput textInput)

    Turns "this element has the focus and takes text" into text input being on, in that window.

  • public IWindow? Apply(PlatformWindowHost host)

    Brings text input into line with what the document says has the focus.

  • public void Deactivate()

    Turns text input off, if this turned it on.

Used by (2)

  • UiApplicationVixen.Ui.Desktop
  • EditorHostVixen.Editor.Host