fix avalonia inline keyboard input
This commit is contained in:
parent
9e6c6b6a80
commit
d3f6126113
3 changed files with 6 additions and 5 deletions
|
@ -41,12 +41,12 @@ namespace Ryujinx.Ava.UI.Applet
|
||||||
|
|
||||||
private void TextChanged(string text)
|
private void TextChanged(string text)
|
||||||
{
|
{
|
||||||
TextChangedEvent?.Invoke(text ?? string.Empty, _hiddenTextBox.SelectionStart, _hiddenTextBox.SelectionEnd, true);
|
TextChangedEvent?.Invoke(text ?? string.Empty, _hiddenTextBox.SelectionStart, _hiddenTextBox.SelectionEnd, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectionChanged(int selection)
|
private void SelectionChanged(int selection)
|
||||||
{
|
{
|
||||||
TextChangedEvent?.Invoke(_hiddenTextBox.Text ?? string.Empty, _hiddenTextBox.SelectionStart, _hiddenTextBox.SelectionEnd, true);
|
TextChangedEvent?.Invoke(_hiddenTextBox.Text ?? string.Empty, _hiddenTextBox.SelectionStart, _hiddenTextBox.SelectionEnd, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AvaloniaDynamicTextInputHandler_TextInput(object sender, string text)
|
private void AvaloniaDynamicTextInputHandler_TextInput(object sender, string text)
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.Helpers
|
namespace Ryujinx.Ava.UI.Helpers
|
||||||
{
|
{
|
||||||
public class OffscreenTextBox : TextBox
|
public class OffscreenTextBox : TextBox
|
||||||
{
|
{
|
||||||
|
protected override Type StyleKeyOverride => typeof(TextBox);
|
||||||
|
|
||||||
public static RoutedEvent<KeyEventArgs> GetKeyDownRoutedEvent()
|
public static RoutedEvent<KeyEventArgs> GetKeyDownRoutedEvent()
|
||||||
{
|
{
|
||||||
return KeyDownEvent;
|
return KeyDownEvent;
|
||||||
|
|
|
@ -42,12 +42,10 @@
|
||||||
</Window.KeyBindings>
|
</Window.KeyBindings>
|
||||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<helpers:OffscreenTextBox Name="HiddenTextBox" Grid.Row="0" />
|
<helpers:OffscreenTextBox IsEnabled="False" Opacity="0" Name="HiddenTextBox" IsHitTestVisible="False" IsTabStop="False" />
|
||||||
<Grid
|
<Grid
|
||||||
Grid.Row="1"
|
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch">
|
VerticalAlignment="Stretch">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue