Skip to content

Commit

Permalink
chore: renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
ramezgerges committed Oct 16, 2024
1 parent 3695807 commit 6475d1a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/Uno.UI.Runtime.Skia.X11/Builder/X11HostBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal partial class X11HostBuilder : IPlatformHostBuilder
[GeneratedRegex(@"^(?:(?<hostname>[\w\.-]+))?:(?<displaynumber>\d+)(?:\.(?<screennumber>\d+))?$")]
private static partial Regex DisplayRegex();

private int _targetFps = 60;
private int _renderFrameRate = 60;

public X11HostBuilder()
{
Expand All @@ -19,9 +19,9 @@ public X11HostBuilder()
/// <summary>
/// Sets the FPS that the application should try to achieve.
/// </summary>
public X11HostBuilder TargetFps(int targetFps)
public X11HostBuilder RenderFrameRate(int renderFrameRate)
{
_targetFps = targetFps;
_renderFrameRate = renderFrameRate;
return this;
}

Expand All @@ -31,5 +31,5 @@ public bool IsSupported
DisplayRegex().Match(displayString).Success;

public SkiaHost Create(Func<Microsoft.UI.Xaml.Application> appBuilder)
=> new X11ApplicationHost(appBuilder, _targetFps);
=> new X11ApplicationHost(appBuilder, _renderFrameRate);
}
8 changes: 4 additions & 4 deletions src/Uno.UI.Runtime.Skia.X11/X11ApplicationHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Uno.WinUI.Runtime.Skia.X11;
public partial class X11ApplicationHost : SkiaHost, ISkiaApplicationHost, IDisposable
{
[ThreadStatic] private static bool _isDispatcherThread;
[ThreadStatic] private static int _targetFps;
[ThreadStatic] private static int _renderFrameRate;
private readonly EventLoop _eventLoop;

private readonly Func<Application> _appBuilder;
Expand Down Expand Up @@ -71,7 +71,7 @@ static X11ApplicationHost()
ApiExtensibility.Register<XamlRoot>(typeof(Uno.Graphics.INativeOpenGLWrapper), xamlRoot => new X11NativeOpenGLWrapper(xamlRoot));
}

public X11ApplicationHost(Func<Application> appBuilder, int targetFps = 60)
public X11ApplicationHost(Func<Application> appBuilder, int renderFrameRate = 60)
{
_appBuilder = appBuilder;

Expand All @@ -81,13 +81,13 @@ public X11ApplicationHost(Func<Application> appBuilder, int targetFps = 60)
_eventLoop.Schedule(() =>
{
_isDispatcherThread = true;

Check warning on line 83 in src/Uno.UI.Runtime.Skia.X11/X11ApplicationHost.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Uno.UI.Runtime.Skia.X11/X11ApplicationHost.cs#L83

Remove this assignment of '_isDispatcherThread' or initialize it statically.
_targetFps = targetFps;
_renderFrameRate = renderFrameRate;

Check warning on line 84 in src/Uno.UI.Runtime.Skia.X11/X11ApplicationHost.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Uno.UI.Runtime.Skia.X11/X11ApplicationHost.cs#L84

Remove this assignment of '_renderFrameRate' or initialize it statically.
}, UI.Dispatching.NativeDispatcherPriority.Normal);
CoreDispatcher.DispatchOverride = _eventLoop.Schedule;
CoreDispatcher.HasThreadAccessOverride = () => _isDispatcherThread;
}

internal static int TargetFps => _targetFps;
internal static int RenderFrameRate => _renderFrameRate;

[LibraryImport("libc", StringMarshallingCustomType = typeof(AnsiStringMarshaller))]
private static partial void setlocale(int type, string s);
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI.Runtime.Skia.X11/X11XamlRootHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public X11XamlRootHost(X11WindowWrapper wrapper, Window winUIWindow, XamlRoot xa
_configureCallback = configureCallback;

_renderTimer = new DispatcherTimer();
_renderTimer.Interval = TimeSpan.FromSeconds(1.0 / X11ApplicationHost.TargetFps); // we're on the UI thread
_renderTimer.Interval = TimeSpan.FromSeconds(1.0 / X11ApplicationHost.RenderFrameRate); // we're on the UI thread
_renderTimer.Tick += (sender, o) =>
{
if (Interlocked.Exchange(ref _needsConfigureCallback, 0) == 1)
Expand Down

0 comments on commit 6475d1a

Please sign in to comment.