diff options
| author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-04-16 09:09:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-16 07:09:02 +0000 |
| commit | 6dbcdfea47e60aadefd59a75e43549793481f853 (patch) | |
| tree | 84122acbd9faffca6894f32a69e108edcf0fba9a /Ryujinx.Ava/UI/Applet | |
| parent | c5258cf082b10f335f81487f22b7eeb86075e09e (diff) | |
Ava: Fix nca extraction window never closing & minor cleanup (#4569)
* ava: Remove unused doWhileDeferred parameters
* ava: Minimally improve swkbd dialog
It's currently impossible to get the dialog to redirect focus to the InputBox.
* ava: Fix nca extraction dialog never closing
Also contains some minor cleanup
Diffstat (limited to 'Ryujinx.Ava/UI/Applet')
| -rw-r--r-- | Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml | 3 | ||||
| -rw-r--r-- | Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml.cs | 45 |
2 files changed, 10 insertions, 38 deletions
diff --git a/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml b/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml index 43ccf9e7..65504569 100644 --- a/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml +++ b/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml @@ -48,6 +48,7 @@ Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" + Focusable="True" KeyUp="Message_KeyUp" Text="{Binding Message}" TextInput="Message_TextInput" @@ -61,4 +62,4 @@ HorizontalAlignment="Stretch" TextWrapping="Wrap" /> </Grid> -</UserControl>
\ No newline at end of file +</UserControl> diff --git a/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml.cs b/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml.cs index fb689ec2..cb69e96b 100644 --- a/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml.cs +++ b/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml.cs @@ -45,6 +45,13 @@ namespace Ryujinx.Ava.UI.Controls InitializeComponent(); } + protected override void OnGotFocus(GotFocusEventArgs e) + { + // FIXME: This does not work. Might be a bug in Avalonia with DialogHost + // Currently focus will be redirected to the overlay window instead. + Input.Focus(); + } + public string Message { get; set; } = ""; public string MainText { get; set; } = ""; public string SecondaryText { get; set; } = ""; @@ -59,24 +66,6 @@ namespace Ryujinx.Ava.UI.Controls string input = string.Empty; - var overlay = new ContentDialogOverlayWindow() - { - Height = window.Bounds.Height, - Width = window.Bounds.Width, - Position = window.PointToScreen(new Point()) - }; - - window.PositionChanged += OverlayOnPositionChanged; - - void OverlayOnPositionChanged(object sender, PixelPointEventArgs e) - { - overlay.Position = window.PointToScreen(new Point()); - } - - contentDialog = overlay.ContentDialog; - - bool opened = false; - content.SetInputLengthValidation(args.StringLengthMin, args.StringLengthMax); content._host = contentDialog; @@ -97,25 +86,7 @@ namespace Ryujinx.Ava.UI.Controls }; contentDialog.Closed += handler; - overlay.Opened += OverlayOnActivated; - - async void OverlayOnActivated(object sender, EventArgs e) - { - if (opened) - { - return; - } - - opened = true; - - overlay.Position = window.PointToScreen(new Point()); - - await contentDialog.ShowAsync(overlay); - contentDialog.Closed -= handler; - overlay.Close(); - }; - - await overlay.ShowDialog(window); + await ContentDialogHelper.ShowAsync(contentDialog); return (result, input); } |
