فهرست منبع

Ava UI: Remove `IsActive` checks from dialog methods (#5456)

* Remove `IsActive` checks from dialog methods

* Remove old windows bandaid

* Remove null dialog code path entirely and return nothing.
MutantAura 2 سال پیش
والد
کامیت
9e04e6cba1
2فایلهای تغییر یافته به همراه7 افزوده شده و 5 حذف شده
  1. 0 2
      src/Ryujinx.Ava/UI/Applet/AvaHostUiHandler.cs
  2. 7 3
      src/Ryujinx.Ava/UI/Helpers/ContentDialogHelper.cs

+ 0 - 2
src/Ryujinx.Ava/UI/Applet/AvaHostUiHandler.cs

@@ -53,8 +53,6 @@ namespace Ryujinx.Ava.UI.Applet
 
 
                     bool opened = false;
                     bool opened = false;
 
 
-                    _parent.Activate();
-
                     UserResult response = await ContentDialogHelper.ShowDeferredContentDialog(_parent,
                     UserResult response = await ContentDialogHelper.ShowDeferredContentDialog(_parent,
                        title,
                        title,
                        message,
                        message,

+ 7 - 3
src/Ryujinx.Ava/UI/Helpers/ContentDialogHelper.cs

@@ -315,8 +315,10 @@ namespace Ryujinx.Ava.UI.Helpers
 
 
             Window parent = GetMainWindow();
             Window parent = GetMainWindow();
 
 
-            if (parent is { IsActive: true } and MainWindow window && window.ViewModel.IsGameRunning)
+            if (parent is MainWindow window && window.ViewModel.IsGameRunning)
             {
             {
+                parent.Activate();
+
                 contentDialogOverlayWindow = new()
                 contentDialogOverlayWindow = new()
                 {
                 {
                     Height = parent.Bounds.Height,
                     Height = parent.Bounds.Height,
@@ -369,7 +371,9 @@ namespace Ryujinx.Ava.UI.Helpers
                 }
                 }
                 else
                 else
                 {
                 {
-                    result = await contentDialog.ShowAsync();
+                    result = ContentDialogResult.None;
+
+                    Logger.Warning?.Print(LogClass.Ui, "Content dialog overlay failed to populate. Default value has been returned.");
                 }
                 }
 
 
                 return result;
                 return result;
@@ -390,7 +394,7 @@ namespace Ryujinx.Ava.UI.Helpers
             {
             {
                 foreach (Window item in al.Windows)
                 foreach (Window item in al.Windows)
                 {
                 {
-                    if (item.IsActive && item is MainWindow window)
+                    if (item is MainWindow window)
                     {
                     {
                         return window;
                         return window;
                     }
                     }