diff options
| author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2022-11-30 23:34:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-30 23:34:25 +0100 |
| commit | 3fb583c98c39da58f0752c652ca60be87ff1f566 (patch) | |
| tree | 6be74e635521ca677f9bfb5d5847a4a3ee5e364b /Ryujinx.Ava/Ui/Controls | |
| parent | d2686e0a5b4f8ce70cbbd5cfcb02434921580834 (diff) | |
Avalonia: Clean up leftover RenderTimer & Fix minimum and initial window size (#3935)
* ava: Cleanup RenderTimer
* ava: Remove ContentControl from RendererHost
* ava: Remove unused actual scale factor
* ava: Enable UseGpu for Linux
* ava: Set better initial size & Scale the window properly
* ava: Realign properties
* ava: Use explicit type & specify where the note applies
Diffstat (limited to 'Ryujinx.Ava/Ui/Controls')
| -rw-r--r-- | Ryujinx.Ava/Ui/Controls/RenderTimer.cs | 100 | ||||
| -rw-r--r-- | Ryujinx.Ava/Ui/Controls/RendererHost.axaml | 7 | ||||
| -rw-r--r-- | Ryujinx.Ava/Ui/Controls/RendererHost.axaml.cs | 2 |
3 files changed, 1 insertions, 108 deletions
diff --git a/Ryujinx.Ava/Ui/Controls/RenderTimer.cs b/Ryujinx.Ava/Ui/Controls/RenderTimer.cs deleted file mode 100644 index 577115ea..00000000 --- a/Ryujinx.Ava/Ui/Controls/RenderTimer.cs +++ /dev/null @@ -1,100 +0,0 @@ -using Avalonia.Rendering; -using System; -using System.Threading; -using System.Timers; - -namespace Ryujinx.Ava.Ui.Controls -{ - internal class RenderTimer : IRenderTimer, IDisposable - { - public event Action<TimeSpan> Tick - { - add - { - _tick += value; - - if (_subscriberCount++ == 0) - { - Start(); - } - } - - remove - { - if (--_subscriberCount == 0) - { - Stop(); - } - - _tick -= value; - } - } - - private Thread _tickThread; - private readonly System.Timers.Timer _timer; - - private Action<TimeSpan> _tick; - private int _subscriberCount; - - private bool _isRunning; - - private AutoResetEvent _resetEvent; - - public RenderTimer() - { - _timer = new System.Timers.Timer(15); - _resetEvent = new AutoResetEvent(true); - _timer.Elapsed += Timer_Elapsed; - } - - private void Timer_Elapsed(object sender, ElapsedEventArgs e) - { - TickNow(); - } - - public void Start() - { - _timer.Start(); - if (_tickThread == null) - { - _tickThread = new Thread(RunTick); - _tickThread.Name = "RenderTimerTickThread"; - _tickThread.IsBackground = true; - _isRunning = true; - _tickThread.Start(); - } - } - - public void RunTick() - { - while (_isRunning) - { - _resetEvent.WaitOne(); - _tick?.Invoke(TimeSpan.FromMilliseconds(Environment.TickCount)); - } - } - - public void TickNow() - { - lock (_timer) - { - _resetEvent.Set(); - } - } - - public void Stop() - { - _timer.Stop(); - } - - public void Dispose() - { - _timer.Elapsed -= Timer_Elapsed; - _timer.Stop(); - _isRunning = false; - _resetEvent.Set(); - _tickThread.Join(); - _resetEvent.Dispose(); - } - } -} diff --git a/Ryujinx.Ava/Ui/Controls/RendererHost.axaml b/Ryujinx.Ava/Ui/Controls/RendererHost.axaml index be72fd61..5b27182d 100644 --- a/Ryujinx.Ava/Ui/Controls/RendererHost.axaml +++ b/Ryujinx.Ava/Ui/Controls/RendererHost.axaml @@ -4,11 +4,4 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Ryujinx.Ava.Ui.Controls.RendererHost"> - <ContentControl - HorizontalAlignment="Stretch" - HorizontalContentAlignment="Stretch" - VerticalAlignment="Stretch" - VerticalContentAlignment="Stretch" - Name="View" - /> </UserControl> diff --git a/Ryujinx.Ava/Ui/Controls/RendererHost.axaml.cs b/Ryujinx.Ava/Ui/Controls/RendererHost.axaml.cs index 0d1984fd..b6986b7c 100644 --- a/Ryujinx.Ava/Ui/Controls/RendererHost.axaml.cs +++ b/Ryujinx.Ava/Ui/Controls/RendererHost.axaml.cs @@ -41,7 +41,7 @@ namespace Ryujinx.Ava.Ui.Controls { _currentWindow.WindowCreated += CurrentWindow_WindowCreated; _currentWindow.SizeChanged += CurrentWindow_SizeChanged; - View.Content = _currentWindow; + Content = _currentWindow; } public void CreateVulkan() |
