Browse Source

Merge branch 'master' into typed-property-changed

pull/4648/head
Steven Kirk 6 years ago
committed by GitHub
parent
commit
3fb6bb2ffc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      build/NetFX.props
  2. 4
      build/SkiaSharp.props
  3. 6
      src/Avalonia.DesignerSupport/Remote/HtmlTransport/HtmlTransport.cs
  4. 12
      src/Avalonia.Input/KeyGesture.cs
  5. 4
      src/Avalonia.Input/PointerEventArgs.cs
  6. 9
      src/Avalonia.OpenGL/Angle/AngleEglInterface.cs
  7. 6
      src/Avalonia.OpenGL/AngleOptions.cs
  8. 38
      src/Avalonia.OpenGL/EglDisplay.cs
  9. 1
      src/Avalonia.Themes.Fluent/CheckBox.xaml
  10. 1
      src/Avalonia.Themes.Fluent/RadioButton.xaml
  11. 2
      src/Avalonia.X11/Glx/GlxDisplay.cs
  12. 4
      src/Avalonia.X11/Glx/GlxPlatformFeature.cs
  13. 4
      src/Avalonia.X11/X11Platform.cs

2
build/NetFX.props

@ -1,7 +1,7 @@
<Project>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
</Project>

4
build/SkiaSharp.props

@ -1,6 +1,6 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="SkiaSharp" Version="2.80.2-preview.33" />
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="SkiaSharp.NativeAssets.Linux" Version="2.80.2-preview.33" />
<PackageReference Include="SkiaSharp" Version="2.80.2" />
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="SkiaSharp.NativeAssets.Linux" Version="2.80.2" />
</ItemGroup>
</Project>

6
src/Avalonia.DesignerSupport/Remote/HtmlTransport/HtmlTransport.cs

@ -38,11 +38,13 @@ namespace Avalonia.DesignerSupport.Remote.HtmlTransport
public HtmlWebSocketTransport(IAvaloniaRemoteTransportConnection signalTransport, Uri listenUri)
{
if (listenUri.Scheme != "http")
throw new ArgumentException("listenUri");
throw new ArgumentException("URI scheme is not HTTP.", nameof(listenUri));
var resourcePrefix = "Avalonia.DesignerSupport.Remote.HtmlTransport.webapp.build.";
_resources = typeof(HtmlWebSocketTransport).Assembly.GetManifestResourceNames()
.Where(r => r.StartsWith(resourcePrefix) && r.EndsWith(".gz")).ToDictionary(
.Where(r => r.StartsWith(resourcePrefix, StringComparison.OrdinalIgnoreCase)
&& r.EndsWith(".gz", StringComparison.OrdinalIgnoreCase))
.ToDictionary(
r => r.Substring(resourcePrefix.Length).Substring(0,r.Length-resourcePrefix.Length-3),
r =>
{

12
src/Avalonia.Input/KeyGesture.cs

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace Avalonia.Input
@ -29,7 +27,7 @@ namespace Avalonia.Input
KeyModifiers = modifiers;
}
public bool Equals(KeyGesture other)
public bool Equals(KeyGesture? other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
@ -37,12 +35,12 @@ namespace Avalonia.Input
return Key == other.Key && KeyModifiers == other.KeyModifiers;
}
public override bool Equals(object obj)
public override bool Equals(object? obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
return obj is KeyGesture && Equals((KeyGesture)obj);
return obj is KeyGesture gesture && Equals(gesture);
}
public override int GetHashCode()
@ -53,12 +51,12 @@ namespace Avalonia.Input
}
}
public static bool operator ==(KeyGesture left, KeyGesture right)
public static bool operator ==(KeyGesture? left, KeyGesture? right)
{
return Equals(left, right);
}
public static bool operator !=(KeyGesture left, KeyGesture right)
public static bool operator !=(KeyGesture? left, KeyGesture? right)
{
return !Equals(left, right);
}

4
src/Avalonia.Input/PointerEventArgs.cs

@ -86,14 +86,14 @@ namespace Avalonia.Input
}
[Obsolete("Use GetCurrentPoint")]
public PointerPoint GetPointerPoint(IVisual relativeTo) => GetCurrentPoint(relativeTo);
public PointerPoint GetPointerPoint(IVisual? relativeTo) => GetCurrentPoint(relativeTo);
/// <summary>
/// Returns the PointerPoint associated with the current event
/// </summary>
/// <param name="relativeTo">The visual which coordinate system to use. Pass null for toplevel coordinate system</param>
/// <returns></returns>
public PointerPoint GetCurrentPoint(IVisual relativeTo)
public PointerPoint GetCurrentPoint(IVisual? relativeTo)
=> new PointerPoint(Pointer, GetPosition(relativeTo), _properties);
/// <summary>

9
src/Avalonia.OpenGL/Angle/AngleEglInterface.cs

@ -17,14 +17,19 @@ namespace Avalonia.OpenGL.Angle
static Func<string, IntPtr> LoadAngle()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
throw new PlatformNotSupportedException();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
var disp = eglGetProcAddress("eglGetPlatformDisplayEXT");
if (disp == IntPtr.Zero)
{
throw new OpenGlException("libegl.dll doesn't have eglGetPlatformDisplayEXT entry point");
}
return eglGetProcAddress;
}
throw new PlatformNotSupportedException();
}
}

6
src/Avalonia.OpenGL/AngleOptions.cs

@ -10,6 +10,12 @@ namespace Avalonia.OpenGL
DirectX11
}
public IList<GlVersion> GlProfiles { get; set; } = new List<GlVersion>
{
new GlVersion(GlProfileType.OpenGLES, 3, 0),
new GlVersion(GlProfileType.OpenGLES, 2, 0)
};
public IList<PlatformApi> AllowedPlatformApis { get; set; } = null;
}
}

38
src/Avalonia.OpenGL/EglDisplay.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using Avalonia.Platform.Interop;
using static Avalonia.OpenGL.EglConsts;
@ -61,20 +62,43 @@ namespace Avalonia.OpenGL
if (!_egl.Initialize(_display, out var major, out var minor))
throw OpenGlException.GetFormattedException("eglInitialize", _egl);
foreach (var cfg in new[]
var glProfiles = AvaloniaLocator.Current.GetService<AngleOptions>()?.GlProfiles
?? new[]
{
new GlVersion(GlProfileType.OpenGLES, 3, 0),
new GlVersion(GlProfileType.OpenGLES, 2, 0)
};
var cfgs = glProfiles.Select(x =>
{
new
var typeBit = EGL_OPENGL_ES3_BIT;
switch (x.Major)
{
case 2:
typeBit = EGL_OPENGL_ES2_BIT;
break;
case 1:
typeBit = EGL_OPENGL_ES_BIT;
break;
}
return new
{
Attributes = new[]
{
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_CONTEXT_MAJOR_VERSION, x.Major,
EGL_CONTEXT_MINOR_VERSION, x.Minor,
EGL_NONE
},
Api = EGL_OPENGL_ES_API,
RenderableTypeBit = EGL_OPENGL_ES2_BIT,
Version = new GlVersion(GlProfileType.OpenGLES, 2, 0)
}
})
RenderableTypeBit = typeBit,
Version = x
};
});
foreach (var cfg in cfgs)
{
if (!_egl.BindApi(cfg.Api))
continue;

1
src/Avalonia.Themes.Fluent/CheckBox.xaml

@ -8,6 +8,7 @@
<Setter Property="Background" Value="{DynamicResource CheckBoxBackgroundUnchecked}" />
<Setter Property="Foreground" Value="{DynamicResource CheckBoxForegroundUnchecked}" />
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxBorderBrushUnchecked}" />
<Setter Property="Padding" Value="8,0,0,0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />

1
src/Avalonia.Themes.Fluent/RadioButton.xaml

@ -13,6 +13,7 @@
<Setter Property="Background" Value="{DynamicResource RadioButtonBackground}" />
<Setter Property="Foreground" Value="{DynamicResource RadioButtonForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource RadioButtonBorderBrush}" />
<Setter Property="Padding" Value="8,0,0,0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />

2
src/Avalonia.X11/Glx/GlxDisplay.cs

@ -18,7 +18,7 @@ namespace Avalonia.X11.Glx
public XVisualInfo* VisualInfo => _visual;
public GlxContext DeferredContext { get; }
public GlxInterface Glx { get; } = new GlxInterface();
public GlxDisplay(X11Info x11, List<GlVersion> probeProfiles)
public GlxDisplay(X11Info x11, IList<GlVersion> probeProfiles)
{
_x11 = x11;
_probeProfiles = probeProfiles.ToList();

4
src/Avalonia.X11/Glx/GlxPlatformFeature.cs

@ -12,7 +12,7 @@ namespace Avalonia.X11.Glx
public GlxContext DeferredContext { get; private set; }
public IGlContext MainContext => DeferredContext;
public static bool TryInitialize(X11Info x11, List<GlVersion> glProfiles)
public static bool TryInitialize(X11Info x11, IList<GlVersion> glProfiles)
{
var feature = TryCreate(x11, glProfiles);
if (feature != null)
@ -24,7 +24,7 @@ namespace Avalonia.X11.Glx
return false;
}
public static GlxGlPlatformFeature TryCreate(X11Info x11, List<GlVersion> glProfiles)
public static GlxGlPlatformFeature TryCreate(X11Info x11, IList<GlVersion> glProfiles)
{
try
{

4
src/Avalonia.X11/X11Platform.cs

@ -103,7 +103,7 @@ namespace Avalonia
public bool UseDBusMenu { get; set; }
public bool UseDeferredRendering { get; set; } = true;
public List<GlVersion> GlProfiles { get; set; } = new List<GlVersion>
public IList<GlVersion> GlProfiles { get; set; } = new List<GlVersion>
{
new GlVersion(GlProfileType.OpenGL, 4, 0),
new GlVersion(GlProfileType.OpenGL, 3, 2),
@ -113,7 +113,7 @@ namespace Avalonia
new GlVersion(GlProfileType.OpenGLES, 2, 0)
};
public List<string> GlxRendererBlacklist { get; set; } = new List<string>
public IList<string> GlxRendererBlacklist { get; set; } = new List<string>
{
// llvmpipe is a software GL rasterizer. If it's returned by glGetString,
// that usually means that something in the system is horribly misconfigured

Loading…
Cancel
Save