aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Ava/UI/Views/Input
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Ava/UI/Views/Input')
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml19
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs69
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml1
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml1
4 files changed, 44 insertions, 46 deletions
diff --git a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml
index 2395b353..65a66d9e 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml
+++ b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml
@@ -14,7 +14,6 @@
d:DesignWidth="800"
x:Class="Ryujinx.Ava.UI.Views.Input.ControllerInputView"
x:DataType="viewModels:ControllerInputViewModel"
- x:CompileBindings="True"
mc:Ignorable="d"
Focusable="True">
<Design.DataContext>
@@ -66,7 +65,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
SelectionChanged="PlayerIndexBox_OnSelectionChanged"
- Items="{Binding PlayerIndexes}"
+ ItemsSource="{Binding PlayerIndexes}"
SelectedIndex="{Binding PlayerId}">
<ComboBox.ItemTemplate>
<DataTemplate>
@@ -94,15 +93,15 @@
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsProfile}" />
- <ui:ComboBox
+ <ui:FAComboBox
Grid.Column="1"
IsEditable="True"
Name="ProfileBox"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
SelectedIndex="0"
- Items="{Binding ProfilesList}"
- Text="{Binding ProfileName}" />
+ ItemsSource="{Binding ProfilesList}"
+ Text="{Binding ProfileName, Mode=TwoWay}" />
<Button
Grid.Column="2"
MinWidth="0"
@@ -170,7 +169,7 @@
Name="DeviceBox"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
- Items="{Binding DeviceList}"
+ ItemsSource="{Binding DeviceList}"
SelectedIndex="{Binding Device}" />
<Button
Grid.Column="2"
@@ -203,8 +202,8 @@
<ComboBox
Grid.Column="1"
HorizontalAlignment="Stretch"
- Items="{ReflectionBinding Controllers}"
- SelectedIndex="{ReflectionBinding Controller}">
+ ItemsSource="{Binding Controllers}"
+ SelectedIndex="{Binding Controller}">
<ComboBox.ItemTemplate>
<DataTemplate DataType="models:ControllerModel">
<TextBlock Text="{Binding Name}" />
@@ -723,7 +722,7 @@
<Button
Margin="10"
Grid.Column="1"
- Command="{ReflectionBinding ShowMotionConfig}">
+ Command="{Binding ShowMotionConfig}">
<TextBlock Text="{locale:Locale ControllerSettingsConfigureGeneral}" />
</Button>
</Grid>
@@ -750,7 +749,7 @@
<Button
Margin="10"
Grid.Column="1"
- Command="{ReflectionBinding ShowRumbleConfig}">
+ Command="{Binding ShowRumbleConfig}">
<TextBlock Text="{locale:Locale ControllerSettingsConfigureGeneral}" />
</Button>
</Grid>
diff --git a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs
index 19009f5f..35129706 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs
+++ b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs
@@ -31,8 +31,7 @@ namespace Ryujinx.Ava.UI.Views.Input
{
if (visual is ToggleButton button && visual is not CheckBox)
{
- button.Checked += Button_Checked;
- button.Unchecked += Button_Unchecked;
+ button.IsCheckedChanged += Button_IsCheckedChanged;
}
}
}
@@ -47,48 +46,56 @@ namespace Ryujinx.Ava.UI.Views.Input
}
}
- private void Button_Checked(object sender, RoutedEventArgs e)
+ private void Button_IsCheckedChanged(object sender, RoutedEventArgs e)
{
if (sender is ToggleButton button)
{
- if (_currentAssigner != null && button == _currentAssigner.ToggledButton)
+ if ((bool)button.IsChecked)
{
- return;
- }
+ if (_currentAssigner != null && button == _currentAssigner.ToggledButton)
+ {
+ return;
+ }
- bool isStick = button.Tag != null && button.Tag.ToString() == "stick";
+ bool isStick = button.Tag != null && button.Tag.ToString() == "stick";
- if (_currentAssigner == null && (bool)button.IsChecked)
- {
- _currentAssigner = new ButtonKeyAssigner(button);
+ if (_currentAssigner == null)
+ {
+ _currentAssigner = new ButtonKeyAssigner(button);
- FocusManager.Instance.Focus(this, NavigationMethod.Pointer);
+ this.Focus(NavigationMethod.Pointer);
- PointerPressed += MouseClick;
+ PointerPressed += MouseClick;
- IKeyboard keyboard = (IKeyboard)ViewModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations.
- IButtonAssigner assigner = CreateButtonAssigner(isStick);
+ IKeyboard keyboard = (IKeyboard)ViewModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations.
+ IButtonAssigner assigner = CreateButtonAssigner(isStick);
- _currentAssigner.ButtonAssigned += (sender, e) =>
+ _currentAssigner.ButtonAssigned += (sender, e) =>
+ {
+ if (e.IsAssigned)
+ {
+ ViewModel.IsModified = true;
+ }
+ };
+
+ _currentAssigner.GetInputAndAssign(assigner, keyboard);
+ }
+ else
{
- if (e.IsAssigned)
+ if (_currentAssigner != null)
{
- ViewModel.IsModified = true;
- }
- };
+ ToggleButton oldButton = _currentAssigner.ToggledButton;
- _currentAssigner.GetInputAndAssign(assigner, keyboard);
+ _currentAssigner.Cancel();
+ _currentAssigner = null;
+ button.IsChecked = false;
+ }
+ }
}
else
{
- if (_currentAssigner != null)
- {
- ToggleButton oldButton = _currentAssigner.ToggledButton;
-
- _currentAssigner.Cancel();
- _currentAssigner = null;
- button.IsChecked = false;
- }
+ _currentAssigner?.Cancel();
+ _currentAssigner = null;
}
}
}
@@ -120,12 +127,6 @@ namespace Ryujinx.Ava.UI.Views.Input
return assigner;
}
- private void Button_Unchecked(object sender, RoutedEventArgs e)
- {
- _currentAssigner?.Cancel();
- _currentAssigner = null;
- }
-
private void MouseClick(object sender, PointerPressedEventArgs e)
{
bool shouldUnbind = false;
diff --git a/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml
index b1832437..71d5d746 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml
+++ b/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml
@@ -8,7 +8,6 @@
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
mc:Ignorable="d"
x:Class="Ryujinx.Ava.UI.Views.Input.MotionInputView"
- x:CompileBindings="True"
x:DataType="viewModels:MotionInputViewModel"
Focusable="True">
<Grid Margin="10">
diff --git a/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml
index 3882ebe2..16190d39 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml
+++ b/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml
@@ -8,7 +8,6 @@
mc:Ignorable="d"
x:Class="Ryujinx.Ava.UI.Views.Input.RumbleInputView"
x:DataType="viewModels:RumbleInputViewModel"
- x:CompileBindings="True"
Focusable="True">
<Grid Margin="10">
<Grid.RowDefinitions>