mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-11-21 17:40:52 +01:00
UI: Fix diaglog popups doubling the window controls and laying text over the menu bar.
This commit is contained in:
parent
045f9a39bb
commit
430073817c
21 changed files with 75 additions and 60 deletions
|
@ -122,7 +122,7 @@ namespace Ryujinx.Ava.UI.Applet
|
|||
{
|
||||
try
|
||||
{
|
||||
MainWindow.ViewModel.AppHost.NpadManager.BlockInputUpdates();
|
||||
_parent.ViewModel.AppHost.NpadManager.BlockInputUpdates();
|
||||
var response = await SwkbdAppletDialog.ShowInputDialog(LocaleManager.Instance[LocaleKeys.SoftwareKeyboard], args);
|
||||
|
||||
if (response.Result == UserResult.Ok)
|
||||
|
@ -144,7 +144,7 @@ namespace Ryujinx.Ava.UI.Applet
|
|||
});
|
||||
|
||||
dialogCloseEvent.WaitOne();
|
||||
MainWindow.ViewModel.AppHost.NpadManager.UnblockInputUpdates();
|
||||
_parent.ViewModel.AppHost.NpadManager.UnblockInputUpdates();
|
||||
|
||||
userText = error ? null : inputText;
|
||||
|
||||
|
@ -154,7 +154,7 @@ namespace Ryujinx.Ava.UI.Applet
|
|||
public void ExecuteProgram(Switch device, ProgramSpecifyKind kind, ulong value)
|
||||
{
|
||||
device.Configuration.UserChannelPersistence.ExecuteProgram(kind, value);
|
||||
MainWindow.ViewModel.AppHost?.Stop();
|
||||
_parent.ViewModel.AppHost?.Stop();
|
||||
}
|
||||
|
||||
public bool DisplayErrorAppletDialog(string title, string message, string[] buttons)
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace Ryujinx.Ava.UI.Applet
|
|||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
_hiddenTextBox.Clear();
|
||||
MainWindow.ViewModel.RendererHostControl.Focus();
|
||||
_parent.ViewModel.RendererHostControl.Focus();
|
||||
|
||||
_parent = null;
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace Ryujinx.Ava.UI.Applet
|
||||
{
|
||||
internal partial class ErrorAppletWindow : StyleableWindow
|
||||
internal partial class ErrorAppletWindow : StyleableAppWindow
|
||||
{
|
||||
private readonly Window _owner;
|
||||
private object _buttonResponse;
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
}
|
||||
|
||||
public static Task<UserResult> ShowDeferredContentDialog(
|
||||
StyleableWindow window,
|
||||
Window window,
|
||||
string title,
|
||||
string primaryText,
|
||||
string secondaryText,
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace Ryujinx.Ava.UI.Models
|
|||
TitleId = info.ProgramId;
|
||||
UserId = info.UserId;
|
||||
|
||||
var appData = MainWindow.ViewModel.Applications.FirstOrDefault(x => x.IdString.Equals(TitleIdString, StringComparison.OrdinalIgnoreCase));
|
||||
var appData = MainWindow.MainWindowViewModel.Applications.FirstOrDefault(x => x.IdString.Equals(TitleIdString, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
InGameList = appData != null;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
private readonly string _amiiboJsonPath;
|
||||
private readonly byte[] _amiiboLogoBytes;
|
||||
private readonly HttpClient _httpClient;
|
||||
private readonly StyleableWindow _owner;
|
||||
private readonly StyleableAppWindow _owner;
|
||||
|
||||
private Bitmap _amiiboImage;
|
||||
private List<AmiiboApi> _amiiboList;
|
||||
|
@ -49,7 +49,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
private static readonly AmiiboJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
|
||||
public AmiiboWindowViewModel(StyleableWindow owner, string lastScannedAmiiboId, string titleId)
|
||||
public AmiiboWindowViewModel(StyleableAppWindow owner, string lastScannedAmiiboId, string titleId)
|
||||
{
|
||||
_owner = owner;
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
_mainWindow.InputManager.GamepadDriver.OnGamepadConnected += HandleOnGamepadConnected;
|
||||
_mainWindow.InputManager.GamepadDriver.OnGamepadDisconnected += HandleOnGamepadDisconnected;
|
||||
|
||||
MainWindow.ViewModel.AppHost?.NpadManager.BlockInputUpdates();
|
||||
_mainWindow.ViewModel.AppHost?.NpadManager.BlockInputUpdates();
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
|
@ -357,18 +357,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
|
||||
private void HandleOnGamepadDisconnected(string id)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
LoadDevices();
|
||||
});
|
||||
Dispatcher.UIThread.Post(LoadDevices);
|
||||
}
|
||||
|
||||
private void HandleOnGamepadConnected(string id)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
LoadDevices();
|
||||
});
|
||||
Dispatcher.UIThread.Post(LoadDevices);
|
||||
}
|
||||
|
||||
private string GetCurrentGamepadId()
|
||||
|
@ -847,7 +841,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
}
|
||||
}
|
||||
|
||||
MainWindow.ViewModel.AppHost?.NpadManager.ReloadConfiguration(newConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
||||
_mainWindow.ViewModel.AppHost?.NpadManager.ReloadConfiguration(newConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
||||
|
||||
// Atomically replace and signal input change.
|
||||
// NOTE: Do not modify InputConfig.Value directly as other code depends on the on-change event.
|
||||
|
@ -879,7 +873,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
_mainWindow.InputManager.GamepadDriver.OnGamepadConnected -= HandleOnGamepadConnected;
|
||||
_mainWindow.InputManager.GamepadDriver.OnGamepadDisconnected -= HandleOnGamepadDisconnected;
|
||||
|
||||
MainWindow.ViewModel.AppHost?.NpadManager.UnblockInputUpdates();
|
||||
_mainWindow.ViewModel.AppHost?.NpadManager.UnblockInputUpdates();
|
||||
|
||||
SelectedGamepad?.Dispose();
|
||||
|
||||
|
|
|
@ -95,26 +95,23 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||
|
||||
if (VisualRoot is MainWindow window)
|
||||
{
|
||||
Window = window;
|
||||
DataContext = ViewModel = window.ViewModel;
|
||||
}
|
||||
|
||||
ViewModel = MainWindow.ViewModel;
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private async void StopEmulation_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await MainWindow.ViewModel.AppHost?.ShowExitPrompt().OrCompleted()!;
|
||||
await ViewModel.AppHost?.ShowExitPrompt().OrCompleted()!;
|
||||
}
|
||||
|
||||
private void PauseEmulation_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MainWindow.ViewModel.AppHost?.Pause();
|
||||
ViewModel.AppHost?.Pause();
|
||||
}
|
||||
|
||||
private void ResumeEmulation_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MainWindow.ViewModel.AppHost?.Resume();
|
||||
ViewModel.AppHost?.Resume();
|
||||
}
|
||||
|
||||
public async void OpenSettings(object sender, RoutedEventArgs e)
|
||||
|
@ -178,7 +175,7 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||
Window.VirtualFileSystem,
|
||||
ViewModel.AppHost.Device.Processes.ActiveApplication.ProgramIdText,
|
||||
name,
|
||||
MainWindow.ViewModel.SelectedApplication.Path).ShowDialog(Window);
|
||||
ViewModel.SelectedApplication.Path).ShowDialog(Window);
|
||||
|
||||
ViewModel.AppHost.Device.EnableCheats();
|
||||
}
|
||||
|
@ -186,7 +183,7 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||
private void ScanAmiiboMenuItem_AttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e)
|
||||
{
|
||||
if (sender is MenuItem)
|
||||
ViewModel.IsAmiiboRequested = MainWindow.ViewModel.AppHost.Device.System.SearchingForAmiibo(out _);
|
||||
ViewModel.IsAmiiboRequested = ViewModel.AppHost.Device.System.SearchingForAmiibo(out _);
|
||||
}
|
||||
|
||||
private async void InstallFileTypes_Click(object sender, RoutedEventArgs e)
|
||||
|
|
|
@ -26,16 +26,15 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||
if (VisualRoot is MainWindow window)
|
||||
{
|
||||
Window = window;
|
||||
DataContext = window.ViewModel;
|
||||
}
|
||||
|
||||
DataContext = MainWindow.ViewModel;
|
||||
}
|
||||
|
||||
private void VsyncStatus_PointerReleased(object sender, PointerReleasedEventArgs e)
|
||||
{
|
||||
MainWindow.ViewModel.AppHost.ToggleVSync();
|
||||
Window.ViewModel.AppHost.ToggleVSync();
|
||||
|
||||
Logger.Info?.Print(LogClass.Application, $"VSync toggled to: {MainWindow.ViewModel.AppHost.Device.EnableDeviceVsync}");
|
||||
Logger.Info?.Print(LogClass.Application, $"VSync toggled to: {Window.ViewModel.AppHost.Device.EnableDeviceVsync}");
|
||||
}
|
||||
|
||||
private void DockedStatus_PointerReleased(object sender, PointerReleasedEventArgs e)
|
||||
|
@ -57,9 +56,9 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||
private void VolumeStatus_OnPointerWheelChanged(object sender, PointerWheelEventArgs e)
|
||||
{
|
||||
// Change the volume by 5% at a time
|
||||
float newValue = MainWindow.ViewModel.Volume + (float)e.Delta.Y * 0.05f;
|
||||
float newValue = Window.ViewModel.Volume + (float)e.Delta.Y * 0.05f;
|
||||
|
||||
MainWindow.ViewModel.Volume = newValue switch
|
||||
Window.ViewModel.Volume = newValue switch
|
||||
{
|
||||
< 0 => 0,
|
||||
> 1 => 1,
|
||||
|
|
|
@ -22,12 +22,11 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||
{
|
||||
base.OnAttachedToVisualTree(e);
|
||||
|
||||
if (VisualRoot is MainWindow)
|
||||
if (VisualRoot is MainWindow window)
|
||||
{
|
||||
ViewModel = MainWindow.ViewModel;
|
||||
DataContext = ViewModel = window.ViewModel;
|
||||
}
|
||||
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
public void Sort_Checked(object sender, RoutedEventArgs args)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<window:StyleableWindow
|
||||
<window:StyleableAppWindow
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
@ -72,4 +72,4 @@
|
|||
Click="CancelButton_Click" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</window:StyleableWindow>
|
||||
</window:StyleableAppWindow>
|
||||
|
|
|
@ -5,7 +5,7 @@ using Ryujinx.UI.Common.Models.Amiibo;
|
|||
|
||||
namespace Ryujinx.Ava.UI.Windows
|
||||
{
|
||||
public partial class AmiiboWindow : StyleableWindow
|
||||
public partial class AmiiboWindow : StyleableAppWindow
|
||||
{
|
||||
public AmiiboWindow(bool showAll, string lastScannedAmiiboId, string titleId)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<window:StyleableWindow
|
||||
<window:StyleableAppWindow
|
||||
x:Class="Ryujinx.Ava.UI.Windows.CheatWindow"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
|
@ -123,4 +123,4 @@
|
|||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</window:StyleableWindow>
|
||||
</window:StyleableAppWindow>
|
||||
|
|
|
@ -14,7 +14,7 @@ using System.Linq;
|
|||
|
||||
namespace Ryujinx.Ava.UI.Windows
|
||||
{
|
||||
public partial class CheatWindow : StyleableWindow
|
||||
public partial class CheatWindow : StyleableAppWindow
|
||||
{
|
||||
private readonly string _enabledCheatsPath;
|
||||
public bool NoCheatsFound { get; }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<window:StyleableWindow
|
||||
<window:StyleableAppWindow
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
@ -11,15 +11,15 @@
|
|||
x:Class="Ryujinx.Ava.UI.Windows.ContentDialogOverlayWindow"
|
||||
Title="ContentDialogOverlayWindow"
|
||||
Focusable="False">
|
||||
<window:StyleableWindow.Styles>
|
||||
<window:StyleableAppWindow.Styles>
|
||||
<Style Selector="ui|ContentDialog /template/ Panel#LayoutRoot">
|
||||
<Setter Property="Background"
|
||||
Value="Transparent" />
|
||||
</Style>
|
||||
</window:StyleableWindow.Styles>
|
||||
</window:StyleableAppWindow.Styles>
|
||||
<ui:ContentDialog Name="ContentDialog"
|
||||
IsPrimaryButtonEnabled="True"
|
||||
IsSecondaryButtonEnabled="True"
|
||||
IsVisible="False"
|
||||
Focusable="True"/>
|
||||
</window:StyleableWindow>
|
||||
</window:StyleableAppWindow>
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
{
|
||||
InitializeComponent();
|
||||
|
||||
TransparencyLevelHint = new[] { WindowTransparencyLevel.Transparent };
|
||||
TransparencyLevelHint = [WindowTransparencyLevel.Transparent];
|
||||
WindowStartupLocation = WindowStartupLocation.Manual;
|
||||
SystemDecorations = SystemDecorations.None;
|
||||
ExtendClientAreaTitleBarHeightHint = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<window:StyleableWindow
|
||||
<window:StyleableAppWindow
|
||||
x:Class="Ryujinx.Ava.UI.Windows.MainWindow"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
|
@ -200,4 +200,4 @@
|
|||
Grid.Row="2" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</window:StyleableWindow>
|
||||
</window:StyleableAppWindow>
|
||||
|
|
|
@ -35,9 +35,11 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace Ryujinx.Ava.UI.Windows
|
||||
{
|
||||
public partial class MainWindow : StyleableWindow
|
||||
public partial class MainWindow : StyleableAppWindow
|
||||
{
|
||||
internal static MainWindowViewModel ViewModel { get; private set; }
|
||||
internal static MainWindowViewModel MainWindowViewModel { get; private set; }
|
||||
|
||||
public MainWindowViewModel ViewModel { get; }
|
||||
|
||||
internal readonly AvaHostUIHandler UiHandler;
|
||||
|
||||
|
@ -69,7 +71,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
|
||||
public MainWindow()
|
||||
{
|
||||
DataContext = ViewModel = new MainWindowViewModel();
|
||||
DataContext = ViewModel = MainWindowViewModel = new MainWindowViewModel();
|
||||
|
||||
InitializeComponent();
|
||||
Load();
|
||||
|
@ -78,8 +80,8 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
|
||||
ViewModel.Title = App.FormatTitle();
|
||||
|
||||
TitleBar.ExtendsContentIntoTitleBar = true;
|
||||
TitleBar.TitleBarHitTestType = TitleBarHitTestType.Complex;
|
||||
//TitleBar.ExtendsContentIntoTitleBar = true;
|
||||
//TitleBar.TitleBarHitTestType = TitleBarHitTestType.Complex;
|
||||
|
||||
|
||||
// NOTE: Height of MenuBar and StatusBar is not usable here, since it would still be 0 at this point.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<window:StyleableWindow
|
||||
<window:StyleableAppWindow
|
||||
x:Class="Ryujinx.Ava.UI.Windows.SettingsWindow"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
|
@ -127,4 +127,4 @@
|
|||
Command="{Binding ApplyButton}" />
|
||||
</ReversibleStackPanel>
|
||||
</Grid>
|
||||
</window:StyleableWindow>
|
||||
</window:StyleableAppWindow>
|
||||
|
|
|
@ -8,7 +8,7 @@ using System;
|
|||
|
||||
namespace Ryujinx.Ava.UI.Windows
|
||||
{
|
||||
public partial class SettingsWindow : StyleableWindow
|
||||
public partial class SettingsWindow : StyleableAppWindow
|
||||
{
|
||||
internal SettingsViewModel ViewModel { get; set; }
|
||||
|
||||
|
|
|
@ -11,7 +11,31 @@ using System.Reflection;
|
|||
|
||||
namespace Ryujinx.Ava.UI.Windows
|
||||
{
|
||||
public class StyleableWindow : AppWindow
|
||||
public class StyleableAppWindow : AppWindow
|
||||
{
|
||||
public StyleableAppWindow()
|
||||
{
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
TransparencyLevelHint = [WindowTransparencyLevel.None];
|
||||
|
||||
LocaleManager.Instance.LocaleChanged += LocaleChanged;
|
||||
LocaleChanged();
|
||||
}
|
||||
|
||||
private void LocaleChanged()
|
||||
{
|
||||
FlowDirection = LocaleManager.Instance.IsRTL() ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
|
||||
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome | ExtendClientAreaChromeHints.OSXThickTitleBar;
|
||||
}
|
||||
}
|
||||
|
||||
public class StyleableWindow : Window
|
||||
{
|
||||
public StyleableWindow()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue