Avalonia - Use embedded window for avalonia (#3674)
* wip * use embedded window * fix race condition on opengl Windows * fix glx issues on prime nvidia * fix mouse support win32 * clean up * addressed review * addressed review * fix warnings * fix sotware keyboard dialog * Update Ryujinx.Ava/Ui/Applet/SwkbdAppletDialog.axaml.cs Co-authored-by: gdkchan <gab.dark.100@gmail.com> * remove double semi Co-authored-by: gdkchan <gab.dark.100@gmail.com>
This commit is contained in:
27
Ryujinx.Ava/Ui/Windows/ContentDialogOverlayWindow.axaml
Normal file
27
Ryujinx.Ava/Ui/Windows/ContentDialogOverlayWindow.axaml
Normal file
@@ -0,0 +1,27 @@
|
||||
<window:StyleableWindow xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="800"
|
||||
d:DesignHeight="450"
|
||||
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
x:Class="Ryujinx.Ava.Ui.Windows.ContentDialogOverlayWindow"
|
||||
xmlns:window="clr-namespace:Ryujinx.Ava.Ui.Windows"
|
||||
Title="ContentDialogOverlayWindow">
|
||||
<window:StyleableWindow.Styles>
|
||||
<Style Selector="ui|ContentDialog /template/ Panel#LayoutRoot">
|
||||
<Setter Property="Background"
|
||||
Value="Transparent" />
|
||||
</Style>
|
||||
</window:StyleableWindow.Styles>
|
||||
<ContentControl
|
||||
Focusable="False"
|
||||
IsVisible="False"
|
||||
KeyboardNavigation.IsTabStop="False">
|
||||
<ui:ContentDialog Name="ContentDialog"
|
||||
IsPrimaryButtonEnabled="True"
|
||||
IsSecondaryButtonEnabled="True"
|
||||
IsVisible="False" />
|
||||
</ContentControl>
|
||||
</window:StyleableWindow>
|
25
Ryujinx.Ava/Ui/Windows/ContentDialogOverlayWindow.axaml.cs
Normal file
25
Ryujinx.Ava/Ui/Windows/ContentDialogOverlayWindow.axaml.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Ryujinx.Ava.Ui.Windows
|
||||
{
|
||||
public partial class ContentDialogOverlayWindow : StyleableWindow
|
||||
{
|
||||
public ContentDialogOverlayWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
#if DEBUG
|
||||
this.AttachDevTools();
|
||||
#endif
|
||||
ExtendClientAreaToDecorationsHint = true;
|
||||
TransparencyLevelHint = WindowTransparencyLevel.Transparent;
|
||||
WindowStartupLocation = WindowStartupLocation.Manual;
|
||||
SystemDecorations = SystemDecorations.None;
|
||||
ExtendClientAreaTitleBarHeightHint = 0;
|
||||
Background = Brushes.Transparent;
|
||||
CanResize = false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -462,6 +462,7 @@
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{DynamicResource ThemeContentBackgroundColor}"
|
||||
IsVisible="{Binding ShowLoadProgress}"
|
||||
Name="LoadingView"
|
||||
ZIndex="1000">
|
||||
<Grid
|
||||
Margin="40"
|
||||
|
@@ -58,7 +58,7 @@ namespace Ryujinx.Ava.Ui.Windows
|
||||
internal AppHost AppHost { get; private set; }
|
||||
public InputManager InputManager { get; private set; }
|
||||
|
||||
internal RendererControl RendererControl { get; private set; }
|
||||
internal RendererHost RendererControl { get; private set; }
|
||||
internal MainWindowViewModel ViewModel { get; private set; }
|
||||
public SettingsWindow SettingsWindow { get; set; }
|
||||
|
||||
@@ -237,7 +237,16 @@ namespace Ryujinx.Ava.Ui.Windows
|
||||
|
||||
_mainViewContent = MainContent.Content as Control;
|
||||
|
||||
RendererControl = Program.UseVulkan ? new VulkanRendererControl(ConfigurationState.Instance.Logger.GraphicsDebugLevel) : new OpenGLRendererControl(3, 3, ConfigurationState.Instance.Logger.GraphicsDebugLevel);
|
||||
RendererControl = new RendererHost(ConfigurationState.Instance.Logger.GraphicsDebugLevel);
|
||||
if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.OpenGl)
|
||||
{
|
||||
RendererControl.CreateOpenGL();
|
||||
}
|
||||
else
|
||||
{
|
||||
RendererControl.CreateVulkan();
|
||||
}
|
||||
|
||||
AppHost = new AppHost(RendererControl, InputManager, path, VirtualFileSystem, ContentManager, AccountManager, _userChannelPersistence, this);
|
||||
|
||||
if (!AppHost.LoadGuestApplication().Result)
|
||||
@@ -296,8 +305,8 @@ namespace Ryujinx.Ava.Ui.Windows
|
||||
|
||||
public void SwitchToGameControl(bool startFullscreen = false)
|
||||
{
|
||||
ViewModel.ShowContent = true;
|
||||
ViewModel.ShowLoadProgress = false;
|
||||
ViewModel.ShowContent = true;
|
||||
ViewModel.IsLoadingIndeterminate = false;
|
||||
|
||||
Dispatcher.UIThread.InvokeAsync(() =>
|
||||
@@ -346,17 +355,17 @@ namespace Ryujinx.Ava.Ui.Windows
|
||||
|
||||
Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
if (MainContent.Content != _mainViewContent)
|
||||
{
|
||||
MainContent.Content = _mainViewContent;
|
||||
}
|
||||
|
||||
ViewModel.ShowMenuAndStatusBar = true;
|
||||
ViewModel.ShowContent = true;
|
||||
ViewModel.ShowLoadProgress = false;
|
||||
ViewModel.IsLoadingIndeterminate = false;
|
||||
Cursor = Cursor.Default;
|
||||
|
||||
if (MainContent.Content != _mainViewContent)
|
||||
{
|
||||
MainContent.Content = _mainViewContent;
|
||||
}
|
||||
|
||||
AppHost = null;
|
||||
|
||||
HandleRelaunch();
|
||||
|
@@ -211,9 +211,9 @@ namespace Ryujinx.Ava.Ui.Windows
|
||||
}
|
||||
}
|
||||
|
||||
private async void SaveButton_Clicked(object sender, RoutedEventArgs e)
|
||||
private void SaveButton_Clicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await SaveSettings();
|
||||
SaveSettings();
|
||||
|
||||
Close();
|
||||
}
|
||||
@@ -224,14 +224,14 @@ namespace Ryujinx.Ava.Ui.Windows
|
||||
Close();
|
||||
}
|
||||
|
||||
private async void ApplyButton_Clicked(object sender, RoutedEventArgs e)
|
||||
private void ApplyButton_Clicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await SaveSettings();
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
private async Task SaveSettings()
|
||||
private void SaveSettings()
|
||||
{
|
||||
await ViewModel.SaveSettings();
|
||||
ViewModel.SaveSettings();
|
||||
|
||||
ControllerSettings?.SaveCurrentProfile();
|
||||
|
||||
|
Reference in New Issue
Block a user