blob: aae01a0ce603c52336c7775d36339f5046c4a7fc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
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() { }
}
}
|