danwalmsley
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with
29 additions and
32 deletions
azure-pipelines.yml
readme.md
src/Avalonia.Base/Platform/IRuntimePlatform.cs
src/Avalonia.Controls/AppBuilderBase.cs
src/Avalonia.DotNetFrameworkRuntime/AppBuilder.cs
src/Avalonia.Native/AvaloniaNativePlatform.cs
src/Linux/Avalonia.LinuxFramebuffer/Mice.cs
src/Markup/Avalonia.Markup.Xaml/PortableXaml/AvaloniaRuntimeTypeProvider.cs
src/Shared/PlatformSupport/AssetLoader.cs
src/Shared/PlatformSupport/StandardRuntimePlatform.cs
src/Skia/Avalonia.Skia/TypefaceCache.cs
src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs
src/Windows/Avalonia.Win32/Win32Platform.cs
@ -57,10 +57,13 @@ jobs:
inputs:
pathToPublish : '$(Build.SourcesDirectory)/Build/Products/Release/'
artifactName : 'Avalonia.Native.OSX'
condition : and(succeeded(), eq(variables['system.pullrequest.isfork'], false))
- task : PublishBuildArtifacts@1
inputs:
pathToPublish : '$(Build.SourcesDirectory)/artifacts/bin'
artifactName : 'BinariesOSX'
condition : and(succeeded(), eq(variables['system.pullrequest.isfork'], false))
- job : Windows
pool:
@ -79,11 +82,14 @@ jobs:
inputs:
pathtoPublish : '$(Build.SourcesDirectory)/artifacts/nuget'
artifactName : 'NuGet'
condition : and(succeeded(), eq(variables['system.pullrequest.isfork'], false))
- task : PublishBuildArtifacts@1
inputs:
pathToPublish : '$(Build.SourcesDirectory)/artifacts/zip'
artifactName : 'Samples'
condition : and(succeeded(), eq(variables['system.pullrequest.isfork'], false))
- task : PublishBuildArtifacts@1
inputs:
pathToPublish : '$(Build.SourcesDirectory)/artifacts/bin'
artifactName : 'BinariesWindows'
condition : and(succeeded(), eq(variables['system.pullrequest.isfork'], false))
@ -2,9 +2,9 @@
# Avalonia
| Gitter Chat | Build Status | Windows Build Status | Linux/Mac Build Status | Open Collective |
|---|---|---|---|---|
| [](https://gitter.im/AvaloniaUI/Avalonia?utm_campaign=pr-badge& utm_content=badge& utm_medium=badge& utm_source=badge) | [](https://dev.azure.com/AvaloniaUI/AvaloniaUI/_build/latest?definitionId=4) | [](https://ci.appveyor.com/project/AvaloniaUI/Avalonia/branch/master) | [](https://travis-ci.org/AvaloniaUI/Avalonia) | [](#backers) [](#sponsors) |
| Gitter Chat | Build Status (Win, Linux, OSX) | Appveyor Build Status | Open Collective |
|---|---|---|---|
| [](https://gitter.im/AvaloniaUI/Avalonia?utm_campaign=pr-badge& utm_content=badge& utm_medium=badge& utm_source=badge) | [](https://dev.azure.com/AvaloniaUI/AvaloniaUI/_build/latest?definitionId=4) | [](https://ci.appveyor.com/project/AvaloniaUI/Avalonia/branch/master) | [](#backers) [](#sponsors) |
## About
@ -5,10 +5,7 @@ namespace Avalonia.Platform
{
public interface IRuntimePlatform
{
Assembly [ ] GetLoadedAssemblies ( ) ;
void PostThreadPoolItem ( Action cb ) ;
IDisposable StartSystemTimer ( TimeSpan interval , Action tick ) ;
string GetStackTrace ( ) ;
RuntimePlatformInfo GetRuntimeInfo ( ) ;
IUnmanagedBlob AllocBlob ( int size ) ;
}
@ -222,7 +222,7 @@ namespace Avalonia.Controls
private void SetupAvaloniaModules ( )
{
var moduleInitializers = from assembly in AvaloniaLocator . Current . GetService < IRuntimePlatform > ( ) . GetLoaded Assemblies ( )
var moduleInitializers = from assembly in AppDomain . CurrentDomain . GetAssemblies ( )
from attribute in assembly . GetCustomAttributes < ExportAvaloniaModuleAttribute > ( )
where attribute . ForWindowingSubsystem = = ""
| | attribute . ForWindowingSubsystem = = WindowingSubsystemName
@ -55,7 +55,7 @@ namespace Avalonia
LoadAssembliesInDirectory ( ) ;
var windowingSubsystemAttribute = ( from assembly in RuntimePlatform . GetLoaded Assemblies ( )
var windowingSubsystemAttribute = ( from assembly in AppDomain . CurrentDomain . GetAssemblies ( )
from attribute in assembly . GetCustomAttributes < ExportWindowingSubsystemAttribute > ( )
where attribute . RequiredOS = = os & & CheckEnvironment ( attribute . EnvironmentChecker )
orderby attribute . Priority ascending
@ -65,7 +65,7 @@ namespace Avalonia
throw new InvalidOperationException ( "No windowing subsystem found. Are you missing assembly references?" ) ;
}
var renderingSubsystemAttribute = ( from assembly in RuntimePlatform . GetLoaded Assemblies ( )
var renderingSubsystemAttribute = ( from assembly in AppDomain . CurrentDomain . GetAssemblies ( )
from attribute in assembly . GetCustomAttributes < ExportRenderingSubsystemAttribute > ( )
where attribute . RequiredOS = = os & & CheckEnvironment ( attribute . EnvironmentChecker )
where attribute . RequiresWindowingSubsystem = = null
@ -120,7 +120,7 @@ namespace Avalonia.Native
{
public AvaloniaNativeMacOptions MacOptions { get ; set ; }
public bool UseDeferredRendering { get ; set ; } = true ;
public bool UseGpu { get ; set ; } = fals e;
public bool UseGpu { get ; set ; } = tru e;
internal AvaloniaNativeOptions ( IAvaloniaNativeFactory factory )
{
var mac = factory . GetMacOptions ( ) ;
@ -22,7 +22,7 @@ namespace Avalonia.LinuxFramebuffer
_ height = height ;
}
public void Start ( ) = > AvaloniaLocator . Current . GetService < IRuntimePlatform > ( ) . PostThreadPoolItem ( Worker ) ;
public void Start ( ) = > ThreadPool . UnsafeQueueUserWorkItem ( _ = > Worker ( ) , null ) ;
private void Worker ( )
{
@ -91,9 +91,7 @@ namespace Avalonia.Markup.Xaml.Context
private void ScanNewAssemblies ( )
{
IEnumerable < Assembly > assemblies = AvaloniaLocator . Current
. GetService < IRuntimePlatform > ( )
? . GetLoadedAssemblies ( ) ;
IEnumerable < Assembly > assemblies = AppDomain . CurrentDomain . GetAssemblies ( ) ;
if ( assemblies ! = null )
{
@ -157,7 +157,7 @@ namespace Avalonia.Shared.PlatformSupport
AssemblyDescriptor rv ;
if ( ! AssemblyNameCache . TryGetValue ( name , out rv ) )
{
var loadedAssemblies = AvaloniaLocator . Current . GetService < IRuntimePlatform > ( ) . GetLoaded Assemblies ( ) ;
var loadedAssemblies = AppDomain . CurrentDomain . GetAssemblies ( ) ;
var match = loadedAssemblies . FirstOrDefault ( a = > a . GetName ( ) . Name = = name ) ;
if ( match ! = null )
{
@ -13,15 +13,11 @@ namespace Avalonia.Shared.PlatformSupport
{
internal partial class StandardRuntimePlatform : IRuntimePlatform
{
public void PostThreadPoolItem ( Action cb ) = > ThreadPool . UnsafeQueueUserWorkItem ( _ = > cb ( ) , null ) ;
public Assembly [ ] GetLoadedAssemblies ( ) = > AppDomain . CurrentDomain . GetAssemblies ( ) ;
public IDisposable StartSystemTimer ( TimeSpan interval , Action tick )
{
return new Timer ( _ = > tick ( ) , null , interval , interval ) ;
}
public string GetStackTrace ( ) = > Environment . StackTrace ;
public IUnmanagedBlob AllocBlob ( int size ) = > new UnmanagedBlob ( this , size ) ;
class UnmanagedBlob : IUnmanagedBlob
@ -12,7 +12,7 @@ namespace Avalonia.Skia
/// </summary>
internal static class TypefaceCache
{
public static SKTypeface Default = SKTypeface . FromFamilyName ( FontFamily . Default . Name ) ;
public static SKTypeface Default = CreateDefaultTypeface ( ) ;
static readonly Dictionary < string , Dictionary < FontKey , SKTypeface > > Cache = new Dictionary < string , Dictionary < FontKey , SKTypeface > > ( ) ;
struct FontKey
@ -49,6 +49,13 @@ namespace Avalonia.Skia
// Equals and GetHashCode ommitted
}
private static SKTypeface CreateDefaultTypeface ( )
{
var defaultTypeface = SKTypeface . FromFamilyName ( FontFamily . Default . Name ) ? ? SKTypeface . FromFamilyName ( null ) ;
return defaultTypeface ;
}
private static SKTypeface GetTypeface ( string name , FontKey key )
{
var familyKey = name ;
@ -60,12 +67,8 @@ namespace Avalonia.Skia
if ( ! entry . TryGetValue ( key , out var typeface ) )
{
typeface = SKTypeface . FromFamilyName ( familyKey , key . Weight , SKFontStyleWidth . Normal , key . Slant ) ;
if ( typeface . FamilyName ! = name )
{
typeface = Default ;
}
typeface = SKTypeface . FromFamilyName ( familyKey , key . Weight , SKFontStyleWidth . Normal , key . Slant )
? ? Default ;
entry [ key ] = typeface ;
}
@ -756,9 +756,6 @@ namespace Avalonia.Win32.Interop
[DllImport("kernel32.dll")]
public static extern IntPtr GetModuleHandle ( string lpModuleName ) ;
[DllImport("kernel32.dll")]
public static extern uint GetCurrentThreadId ( ) ;
[DllImport("user32.dll")]
public static extern int GetSystemMetrics ( SystemMetric smIndex ) ;
@ -42,7 +42,7 @@ namespace Avalonia.Win32
class Win32Platform : IPlatformThreadingInterface , IPlatformSettings , IWindowingPlatform , IPlatformIconLoader
{
private static readonly Win32Platform s_instance = new Win32Platform ( ) ;
private static uint _ uiThread ;
private static Thread _ uiThread ;
private UnmanagedMethods . WndProc _ wndProcDelegate ;
private IntPtr _ hwnd ;
private readonly List < Delegate > _d elegates = new List < Delegate > ( ) ;
@ -82,7 +82,7 @@ namespace Avalonia.Win32
. Bind < IPlatformIconLoader > ( ) . ToConstant ( s_instance ) ;
Win32GlManager . Initialize ( ) ;
UseDeferredRendering = deferredRendering ;
_ uiThread = UnmanagedMethods . GetCurrentThreadId ( ) ;
_ uiThread = Thread . CurrentThread ;
if ( OleContext . Current ! = null )
AvaloniaLocator . CurrentMutable . Bind < IPlatformDragSource > ( ) . ToSingleton < DragSource > ( ) ;
@ -146,7 +146,7 @@ namespace Avalonia.Win32
new IntPtr ( SignalL ) ) ;
}
public bool CurrentThreadIsLoopThread = > _ uiThread = = UnmanagedMethods . GetCurrentThreadId ( ) ;
public bool CurrentThreadIsLoopThread = > _ uiThread = = Thread . CurrentThread ;
public event Action < DispatcherPriority ? > Signaled ;