0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2025-01-09 20:01:58 +00:00
ryujinx-fork/src/Ryujinx.Headless.SDL2/HeadlessDynamicTextInputHandler.cs
TSRBerry 40daca5684
[Ryujinx.Headless.SDL2] Address dotnet-format issues (#5379)
* dotnet format style --severity info

Some changes were manually reverted.

* dotnet format analyzers --serverity info

Some changes have been minimally adapted.

* Restore a few unused methods and variables

* Address or silence dotnet format CA1806 and a few CA1854 warnings

* Address most dotnet format whitespace warnings

* Apply dotnet format whitespace formatting

A few of them have been manually reverted and the corresponding warning was silenced

* Simplify properties and array initialization, Use const when possible, Remove trailing commas

* Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas"

This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e.

* dotnet format whitespace after rebase

* First dotnet format pass

* Add trailing commas

* Fix naming and formatting issues
2023-06-28 19:03:27 +02:00

51 lines
1.5 KiB
C#

using Ryujinx.HLE.Ui;
using System.Threading;
using System.Threading.Tasks;
namespace Ryujinx.Headless.SDL2
{
/// <summary>
/// Headless text processing class, right now there is no way to forward the input to it.
/// </summary>
internal class HeadlessDynamicTextInputHandler : IDynamicTextInputHandler
{
private bool _canProcessInput;
public event DynamicTextChangedHandler TextChangedEvent;
public event KeyPressedHandler KeyPressedEvent { add { } remove { } }
public event KeyReleasedHandler KeyReleasedEvent { add { } remove { } }
public bool TextProcessingEnabled
{
get
{
return Volatile.Read(ref _canProcessInput);
}
set
{
Volatile.Write(ref _canProcessInput, value);
// Launch a task to update the text.
Task.Run(() =>
{
Thread.Sleep(100);
TextChangedEvent?.Invoke("Ryujinx", 7, 7, false);
});
}
}
public HeadlessDynamicTextInputHandler()
{
// Start with input processing turned off so the text box won't accumulate text
// if the user is playing on the keyboard.
_canProcessInput = false;
}
public void SetText(string text, int cursorBegin) { }
public void SetText(string text, int cursorBegin, int cursorEnd) { }
public void Dispose() { }
}
}