From a0e8dca6e97bc55f8b68df2eef020457849cf939 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 11 Sep 2018 22:47:03 +0200 Subject: [PATCH 01/50] Use PixelSize for device-dependent sizes. --- src/Avalonia.Controls/Image.cs | 5 +- src/Avalonia.Controls/Remote/RemoteWidget.cs | 8 +- .../Remote/Server/RemoteServerTopLevelImpl.cs | 2 +- src/Avalonia.Visuals/Avalonia.Visuals.csproj | 1 + src/Avalonia.Visuals/Media/Imaging/Bitmap.cs | 31 ++-- src/Avalonia.Visuals/Media/Imaging/IBitmap.cs | 21 ++- .../Media/Imaging/RenderTargetBitmap.cs | 29 +-- .../Media/Imaging/WriteableBitmap.cs | 11 +- src/Avalonia.Visuals/Media/PixelSize.cs | 174 ++++++++++++++++++ src/Avalonia.Visuals/Platform/IBitmapImpl.cs | 8 +- .../Platform/ILockedFramebuffer.cs | 9 +- .../Platform/IPlatformRenderInterface.cs | 32 ++-- .../Platform/LockedFramebuffer.cs | 10 +- .../Rendering/DeferredRenderer.cs | 8 +- .../Avalonia.Gtk3/ImageSurfaceFramebuffer.cs | 10 +- src/Gtk/Avalonia.Gtk3/X11Framebuffer.cs | 18 +- .../LockedFramebuffer.cs | 9 +- .../Avalonia.MonoMac/EmulatedFramebuffer.cs | 12 +- src/Skia/Avalonia.Skia/DrawingContextImpl.cs | 6 +- .../Avalonia.Skia/FramebufferRenderTarget.cs | 2 +- src/Skia/Avalonia.Skia/ImmutableBitmap.cs | 27 ++- .../Avalonia.Skia/PlatformRenderInterface.cs | 30 ++- src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs | 18 +- src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs | 28 ++- .../Avalonia.Direct2D1/Direct2D1Platform.cs | 20 +- .../FramebufferShimRenderTarget.cs | 4 +- .../Media/DrawingContextImpl.cs | 8 +- .../Media/ImageBrushImpl.cs | 4 +- .../Media/Imaging/BitmapImpl.cs | 4 +- .../Media/Imaging/D2DBitmapImpl.cs | 4 +- .../Imaging/D2DRenderTargetBitmapImpl.cs | 3 - .../Media/Imaging/WicBitmapImpl.cs | 38 ++-- .../Imaging/WicRenderTargetBitmapImpl.cs | 12 +- .../Media/Imaging/WriteableWicBitmapImpl.cs | 7 +- .../Avalonia.Direct2D1/PrimitiveExtensions.cs | 4 + .../Wpf/WritableBitmapSurface.cs | 3 +- .../Avalonia.Win32/FramebufferManager.cs | 4 +- .../Avalonia.Win32/WindowFramebuffer.cs | 28 ++- .../Avalonia.Controls.UnitTests/ImageTests.cs | 8 +- .../Avalonia.RenderTests/Media/BitmapTests.cs | 21 +-- tests/Avalonia.RenderTests/TestBase.cs | 11 +- .../MockPlatformRenderInterface.cs | 18 +- .../VisualTree/MockRenderInterface.cs | 6 +- 43 files changed, 436 insertions(+), 280 deletions(-) create mode 100644 src/Avalonia.Visuals/Media/PixelSize.cs diff --git a/src/Avalonia.Controls/Image.cs b/src/Avalonia.Controls/Image.cs index 802b700a07..7fa68147d7 100644 --- a/src/Avalonia.Controls/Image.cs +++ b/src/Avalonia.Controls/Image.cs @@ -57,7 +57,7 @@ namespace Avalonia.Controls if (source != null) { Rect viewPort = new Rect(Bounds.Size); - Size sourceSize = new Size(source.PixelWidth, source.PixelHeight); + Size sourceSize = new Size(source.PixelSize.Width, source.PixelSize.Height); Vector scale = Stretch.CalculateScaling(Bounds.Size, sourceSize); Size scaledSize = sourceSize * scale; Rect destRect = viewPort @@ -83,8 +83,7 @@ namespace Avalonia.Controls if (source != null) { - Size sourceSize = new Size(source.PixelWidth, source.PixelHeight); - + Size sourceSize = new Size(source.PixelSize.Width, source.PixelSize.Height); if (double.IsInfinity(availableSize.Width) || double.IsInfinity(availableSize.Height)) { return sourceSize; diff --git a/src/Avalonia.Controls/Remote/RemoteWidget.cs b/src/Avalonia.Controls/Remote/RemoteWidget.cs index 2d4f2e6b52..5a5ae97f4a 100644 --- a/src/Avalonia.Controls/Remote/RemoteWidget.cs +++ b/src/Avalonia.Controls/Remote/RemoteWidget.cs @@ -59,9 +59,9 @@ namespace Avalonia.Controls.Remote if (_lastFrame != null) { var fmt = (PixelFormat) _lastFrame.Format; - if (_bitmap == null || _bitmap.PixelWidth != _lastFrame.Width || - _bitmap.PixelHeight != _lastFrame.Height) - _bitmap = new WriteableBitmap(_lastFrame.Width, _lastFrame.Height, fmt); + if (_bitmap == null || _bitmap.PixelSize.Width != _lastFrame.Width || + _bitmap.PixelSize.Height != _lastFrame.Height) + _bitmap = new WriteableBitmap(new PixelSize(_lastFrame.Width, _lastFrame.Height), new Vector(96, 96), fmt); using (var l = _bitmap.Lock()) { var lineLen = (fmt == PixelFormat.Rgb565 ? 2 : 4) * _lastFrame.Width; @@ -69,7 +69,7 @@ namespace Avalonia.Controls.Remote Marshal.Copy(_lastFrame.Data, y * _lastFrame.Stride, new IntPtr(l.Address.ToInt64() + l.RowBytes * y), lineLen); } - context.DrawImage(_bitmap, 1, new Rect(0, 0, _bitmap.PixelWidth, _bitmap.PixelHeight), + context.DrawImage(_bitmap, 1, new Rect(0, 0, _bitmap.PixelSize.Width, _bitmap.PixelSize.Height), new Rect(Bounds.Size)); } base.Render(context); diff --git a/src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs b/src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs index b302f2f5ec..551428244a 100644 --- a/src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs +++ b/src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs @@ -108,7 +108,7 @@ namespace Avalonia.Controls.Remote.Server var handle = GCHandle.Alloc(data, GCHandleType.Pinned); try { - _framebuffer = new LockedFramebuffer(handle.AddrOfPinnedObject(), width, height, width * bpp, _dpi, (PixelFormat)fmt, + _framebuffer = new LockedFramebuffer(handle.AddrOfPinnedObject(), new PixelSize(width, height), width * bpp, _dpi, (PixelFormat)fmt, null); Paint?.Invoke(new Rect(0, 0, width, height)); } diff --git a/src/Avalonia.Visuals/Avalonia.Visuals.csproj b/src/Avalonia.Visuals/Avalonia.Visuals.csproj index c34752a3ef..c88001cc0a 100644 --- a/src/Avalonia.Visuals/Avalonia.Visuals.csproj +++ b/src/Avalonia.Visuals/Avalonia.Visuals.csproj @@ -1,6 +1,7 @@  netstandard2.0 + Avalonia diff --git a/src/Avalonia.Visuals/Media/Imaging/Bitmap.cs b/src/Avalonia.Visuals/Media/Imaging/Bitmap.cs index cb98ed9a9c..0ad826f5a9 100644 --- a/src/Avalonia.Visuals/Media/Imaging/Bitmap.cs +++ b/src/Avalonia.Visuals/Media/Imaging/Bitmap.cs @@ -56,30 +56,29 @@ namespace Avalonia.Media.Imaging { PlatformImpl.Dispose(); } - + /// /// Initializes a new instance of the class. /// - /// Pixel format - /// Pointer to source bytes - /// Bitmap width - /// Bitmap height - /// Bytes per row - public Bitmap(PixelFormat format, IntPtr data, int width, int height, int stride) + /// The pixel format. + /// The pointer to the source bytes. + /// The size of the bitmap in device pixels. + /// The DPI of the bitmap. + /// The number of bytes per row. + public Bitmap(PixelFormat format, IntPtr data, PixelSize size, Vector dpi, int stride) { PlatformImpl = RefCountable.Create(AvaloniaLocator.Current.GetService() - .LoadBitmap(format, data, width, height, stride)); + .LoadBitmap(format, data, size, dpi, stride)); } - /// - /// Gets the width of the bitmap, in pixels. - /// - public int PixelWidth => PlatformImpl.Item.PixelWidth; + /// + public Vector Dpi => PlatformImpl.Item.Dpi; - /// - /// Gets the height of the bitmap, in pixels. - /// - public int PixelHeight => PlatformImpl.Item.PixelHeight; + /// + public Size Size => PlatformImpl.Item.PixelSize.ToSize(Dpi); + + /// + public PixelSize PixelSize => PlatformImpl.Item.PixelSize; /// /// Gets the platform-specific bitmap implementation. diff --git a/src/Avalonia.Visuals/Media/Imaging/IBitmap.cs b/src/Avalonia.Visuals/Media/Imaging/IBitmap.cs index 465173059e..90b13088e1 100644 --- a/src/Avalonia.Visuals/Media/Imaging/IBitmap.cs +++ b/src/Avalonia.Visuals/Media/Imaging/IBitmap.cs @@ -14,20 +14,33 @@ namespace Avalonia.Media.Imaging public interface IBitmap : IDisposable { /// - /// Gets the width of the bitmap, in pixels. + /// Gets the dots per inch (DPI) of the image. /// - int PixelWidth { get; } + /// + /// Note that Skia does not currently support reading the DPI of an image so this value + /// will always be 96dpi on Skia. + /// + Vector Dpi { get; } /// - /// Gets the height of the bitmap, in pixels. + /// Gets the size of the bitmap, in device pixels. /// - int PixelHeight { get; } + PixelSize PixelSize { get; } /// /// Gets the platform-specific bitmap implementation. /// IRef PlatformImpl { get; } + /// + /// Gets the size of the image, in device independent pixels. + /// + /// + /// Note that Skia does not currently support reading the DPI of an image so this value + /// will equal on Skia. + /// + Size Size { get; } + /// /// Saves the bitmap to a file. /// diff --git a/src/Avalonia.Visuals/Media/Imaging/RenderTargetBitmap.cs b/src/Avalonia.Visuals/Media/Imaging/RenderTargetBitmap.cs index db2259dde3..d0b85ef14e 100644 --- a/src/Avalonia.Visuals/Media/Imaging/RenderTargetBitmap.cs +++ b/src/Avalonia.Visuals/Media/Imaging/RenderTargetBitmap.cs @@ -17,12 +17,19 @@ namespace Avalonia.Media.Imaging /// /// Initializes a new instance of the class. /// - /// The width of the bitmap in pixels. - /// The height of the bitmap in pixels. - /// The horizontal DPI of the bitmap. - /// The vertical DPI of the bitmap. - public RenderTargetBitmap(int pixelWidth, int pixelHeight, double dpiX = 96, double dpiY = 96) - : this(RefCountable.Create(CreateImpl(pixelWidth, pixelHeight, dpiX, dpiY))) + /// The size of the bitmap. + public RenderTargetBitmap(PixelSize pixelSize) + : this(pixelSize, new Vector(96, 96)) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The size of the bitmap in device pixels. + /// The DPI of the bitmap. + public RenderTargetBitmap(PixelSize pixelSize, Vector dpi) + : this(RefCountable.Create(CreateImpl(pixelSize, dpi))) { } @@ -45,15 +52,13 @@ namespace Avalonia.Media.Imaging /// /// Creates a platform-specific implementation for a . /// - /// The width of the bitmap. - /// The height of the bitmap. - /// The horizontal DPI of the bitmap. - /// The vertical DPI of the bitmap. + /// The size of the bitmap in device pixels. + /// The DPI of the bitmap. /// The platform-specific implementation. - private static IRenderTargetBitmapImpl CreateImpl(int width, int height, double dpiX, double dpiY) + private static IRenderTargetBitmapImpl CreateImpl(PixelSize size, Vector dpi) { IPlatformRenderInterface factory = AvaloniaLocator.Current.GetService(); - return factory.CreateRenderTargetBitmap(width, height, dpiX, dpiY); + return factory.CreateRenderTargetBitmap(size, dpi); } /// diff --git a/src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs b/src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs index 529c2efa42..88c0799cb9 100644 --- a/src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs +++ b/src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs @@ -7,8 +7,15 @@ namespace Avalonia.Media.Imaging /// public class WriteableBitmap : Bitmap { - public WriteableBitmap(int width, int height, PixelFormat? format = null) - : base(AvaloniaLocator.Current.GetService().CreateWriteableBitmap(width, height, format)) + /// + /// Initializes a new instance of the class. + /// + /// The size of the bitmap in device pixels. + /// The DPI of the bitmap. + /// The pixel format (optional). + /// An . + public WriteableBitmap(PixelSize size, Vector dpi, PixelFormat? format = null) + : base(AvaloniaLocator.Current.GetService().CreateWriteableBitmap(size, dpi, format)) { } diff --git a/src/Avalonia.Visuals/Media/PixelSize.cs b/src/Avalonia.Visuals/Media/PixelSize.cs new file mode 100644 index 0000000000..3d0ae0b351 --- /dev/null +++ b/src/Avalonia.Visuals/Media/PixelSize.cs @@ -0,0 +1,174 @@ +// Copyright (c) The Avalonia Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Globalization; +using Avalonia.Utilities; + +namespace Avalonia +{ + /// + /// Represents a size in device pixels. + /// + public readonly struct PixelSize + { + /// + /// A size representing zero + /// + public static readonly PixelSize Empty = new PixelSize(0, 0); + + /// + /// Initializes a new instance of the structure. + /// + /// The width. + /// The height. + public PixelSize(int width, int height) + { + Width = width; + Height = height; + } + + /// + /// Gets the aspect ratio of the size. + /// + public double AspectRatio => (double)Width / Height; + + /// + /// Gets the width. + /// + public int Width { get; } + + /// + /// Gets the height. + /// + public int Height { get; } + + /// + /// Checks for equality between two s. + /// + /// The first size. + /// The second size. + /// True if the sizes are equal; otherwise false. + public static bool operator ==(PixelSize left, PixelSize right) + { + return left.Width == right.Width && left.Height == right.Height; + } + + /// + /// Checks for inequality between two s. + /// + /// The first size. + /// The second size. + /// True if the sizes are unequal; otherwise false. + public static bool operator !=(PixelSize left, PixelSize right) + { + return !(left == right); + } + + /// + /// Parses a string. + /// + /// The string. + /// The . + public static PixelSize Parse(string s) + { + using (var tokenizer = new StringTokenizer(s, CultureInfo.InvariantCulture, exceptionMessage: "Invalid Size")) + { + return new PixelSize( + tokenizer.ReadInt32(), + tokenizer.ReadInt32()); + } + } + + /// + /// Checks for equality between a size and an object. + /// + /// The object. + /// + /// True if is a size that equals the current size. + /// + public override bool Equals(object obj) + { + if (obj is PixelSize other) + { + return this == other; + } + + return false; + } + + /// + /// Returns a hash code for a . + /// + /// The hash code. + public override int GetHashCode() + { + unchecked + { + int hash = 17; + hash = (hash * 23) + Width.GetHashCode(); + hash = (hash * 23) + Height.GetHashCode(); + return hash; + } + } + + /// + /// Returns a new with the same height and the specified width. + /// + /// The width. + /// The new . + public PixelSize WithWidth(int width) => new PixelSize(width, Height); + + /// + /// Returns a new with the same width and the specified height. + /// + /// The height. + /// The new . + public PixelSize WithHeight(int height) => new PixelSize(Width, height); + + /// + /// Converts the to a device-independent using the + /// specified dots per inch (DPI). + /// + /// The dots per inch. + /// The device-independent size. + public Size ToSize(double dpi) => new Size(Width / (dpi / 96), Height / (dpi / 96)); + + /// + /// Converts the to a device-independent using the + /// specified dots per inch (DPI). + /// + /// The dots per inch. + /// The device-independent size. + public Size ToSize(Vector dpi) => new Size(Width / (dpi.X / 96), Height / (dpi.Y / 96)); + + /// + /// Converts a to device pixels using the specified dots per inch (DPI). + /// + /// The size. + /// The dots per inch. + /// The device-independent size. + public static PixelSize FromSize(Size size, double dpi) => new PixelSize( + (int)(size.Width * (dpi / 96)), + (int)(size.Height * (dpi / 96))); + + /// + /// Converts a to device pixels using the specified dots per inch (DPI). + /// + /// The size. + /// The dots per inch. + /// The device-independent size. + public static PixelSize FromSize(Size size, Vector dpi) => new PixelSize( + (int)(size.Width * (dpi.X / 96)), + (int)(size.Height * (dpi.Y / 96))); + + /// + /// Returns the string representation of the size. + /// + /// The string representation of the size. + public override string ToString() + { + return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", Width, Height); + } + } +} diff --git a/src/Avalonia.Visuals/Platform/IBitmapImpl.cs b/src/Avalonia.Visuals/Platform/IBitmapImpl.cs index d60838452e..f9608f9ea0 100644 --- a/src/Avalonia.Visuals/Platform/IBitmapImpl.cs +++ b/src/Avalonia.Visuals/Platform/IBitmapImpl.cs @@ -12,14 +12,14 @@ namespace Avalonia.Platform public interface IBitmapImpl : IDisposable { /// - /// Gets the width of the bitmap, in pixels. + /// Gets the dots per inch (DPI) of the image. /// - int PixelWidth { get; } + Vector Dpi { get; } /// - /// Gets the height of the bitmap, in pixels. + /// Gets the size of the bitmap, in device pixels. /// - int PixelHeight { get; } + PixelSize PixelSize { get; } /// /// Saves the bitmap to a file. diff --git a/src/Avalonia.Visuals/Platform/ILockedFramebuffer.cs b/src/Avalonia.Visuals/Platform/ILockedFramebuffer.cs index 45ca1a5a99..2f631142d2 100644 --- a/src/Avalonia.Visuals/Platform/ILockedFramebuffer.cs +++ b/src/Avalonia.Visuals/Platform/ILockedFramebuffer.cs @@ -10,14 +10,9 @@ namespace Avalonia.Platform IntPtr Address { get; } /// - /// Framebuffer width + /// Gets the framebuffer size in device pixels. /// - int Width { get; } - - /// - /// Framebuffer height - /// - int Height { get; } + PixelSize Size{ get; } /// /// Number of bytes per row diff --git a/src/Avalonia.Visuals/Platform/IPlatformRenderInterface.cs b/src/Avalonia.Visuals/Platform/IPlatformRenderInterface.cs index cc17efd2bb..aacdef0538 100644 --- a/src/Avalonia.Visuals/Platform/IPlatformRenderInterface.cs +++ b/src/Avalonia.Visuals/Platform/IPlatformRenderInterface.cs @@ -49,25 +49,19 @@ namespace Avalonia.Platform /// /// Creates a render target bitmap implementation. /// - /// The width of the bitmap. - /// The height of the bitmap. - /// The horizontal DPI of the bitmap. - /// The vertical DPI of the bitmap. + /// The size of the bitmap in device pixels. + /// The DPI of the bitmap. /// An . - IRenderTargetBitmapImpl CreateRenderTargetBitmap( - int width, - int height, - double dpiX, - double dpiY); + IRenderTargetBitmapImpl CreateRenderTargetBitmap(PixelSize size, Vector dpi); /// /// Creates a writeable bitmap implementation. /// - /// The width of the bitmap. - /// The height of the bitmap. + /// The size of the bitmap in device pixels. + /// The DPI of the bitmap. /// Pixel format (optional). /// An . - IWriteableBitmapImpl CreateWriteableBitmap(int width, int height, PixelFormat? format = null); + IWriteableBitmapImpl CreateWriteableBitmap(PixelSize size, Vector dpi, PixelFormat? format = null); /// /// Loads a bitmap implementation from a file.. @@ -84,14 +78,14 @@ namespace Avalonia.Platform IBitmapImpl LoadBitmap(Stream stream); /// - /// Loads a bitmap implementation from a pixels in memory.. + /// Loads a bitmap implementation from a pixels in memory. /// - /// Pixel format - /// Pointer to source bytes - /// Bitmap width - /// Bitmap height - /// Bytes per row + /// The pixel format. + /// The pointer to source bytes. + /// The size of the bitmap in device pixels. + /// The DPI of the bitmap. + /// The number of bytes per row. /// An . - IBitmapImpl LoadBitmap(PixelFormat format, IntPtr data, int width, int height, int stride); + IBitmapImpl LoadBitmap(PixelFormat format, IntPtr data, PixelSize size, Vector dpi, int stride); } } diff --git a/src/Avalonia.Visuals/Platform/LockedFramebuffer.cs b/src/Avalonia.Visuals/Platform/LockedFramebuffer.cs index c03b714956..c5b3c048b1 100644 --- a/src/Avalonia.Visuals/Platform/LockedFramebuffer.cs +++ b/src/Avalonia.Visuals/Platform/LockedFramebuffer.cs @@ -6,21 +6,19 @@ namespace Avalonia.Platform { private readonly Action _onDispose; - public LockedFramebuffer(IntPtr address, int width, int height, int rowBytes, Vector dpi, PixelFormat format, + public LockedFramebuffer(IntPtr address, PixelSize size, int rowBytes, Vector dpi, PixelFormat format, Action onDispose) { _onDispose = onDispose; Address = address; - Width = width; - Height = height; + Size = Size; RowBytes = rowBytes; Dpi = dpi; Format = format; } public IntPtr Address { get; } - public int Width { get; } - public int Height { get; } + public PixelSize Size { get; } public int RowBytes { get; } public Vector Dpi { get; } public PixelFormat Format { get; } @@ -30,4 +28,4 @@ namespace Avalonia.Platform _onDispose?.Invoke(); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs index dc1d2933d0..52172f654e 100644 --- a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs +++ b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs @@ -344,7 +344,7 @@ namespace Avalonia.Rendering foreach (var layer in scene.Layers) { var bitmap = Layers[layer.LayerRoot].Bitmap; - var sourceRect = new Rect(0, 0, bitmap.Item.PixelWidth, bitmap.Item.PixelHeight); + var sourceRect = new Rect(0, 0, bitmap.Item.PixelSize.Width, bitmap.Item.PixelSize.Height); if (layer.GeometryClip != null) { @@ -368,7 +368,7 @@ namespace Avalonia.Rendering if (_overlay != null) { - var sourceRect = new Rect(0, 0, _overlay.Item.PixelWidth, _overlay.Item.PixelHeight); + var sourceRect = new Rect(0, 0, _overlay.Item.PixelSize.Width, _overlay.Item.PixelSize.Height); context.DrawImage(_overlay, 0.5, sourceRect, clientRect); } @@ -453,8 +453,8 @@ namespace Avalonia.Rendering var pixelSize = size * scaling; if (_overlay == null || - _overlay.Item.PixelWidth != pixelSize.Width || - _overlay.Item.PixelHeight != pixelSize.Height) + _overlay.Item.PixelSize.Width != pixelSize.Width || + _overlay.Item.PixelSize.Height != pixelSize.Height) { _overlay?.Dispose(); _overlay = RefCountable.Create(parentContext.CreateLayer(size)); diff --git a/src/Gtk/Avalonia.Gtk3/ImageSurfaceFramebuffer.cs b/src/Gtk/Avalonia.Gtk3/ImageSurfaceFramebuffer.cs index cd0074c287..44d887241c 100644 --- a/src/Gtk/Avalonia.Gtk3/ImageSurfaceFramebuffer.cs +++ b/src/Gtk/Avalonia.Gtk3/ImageSurfaceFramebuffer.cs @@ -22,8 +22,7 @@ namespace Avalonia.Gtk3 height *= _factor; _surface = new ManagedCairoSurface(width, height); - Width = width; - Height = height; + Size = new PixelSize(width, height); Address = _surface.Buffer; RowBytes = _surface.Stride; Native.CairoSurfaceFlush(_surface.Surface); @@ -115,18 +114,17 @@ namespace Avalonia.Gtk3 if (_impl.CurrentCairoContext != IntPtr.Zero) Draw(_impl.CurrentCairoContext, _surface.Surface, _factor); else - DrawToWidget(_widget, _surface.Surface, Width, Height, _factor); + DrawToWidget(_widget, _surface.Surface, Size.Width, Size.Height, _factor); _surface.Dispose(); } else - _impl.SetNextRenderOperation(new RenderOp(_widget, _surface, _factor, Width, Height)); + _impl.SetNextRenderOperation(new RenderOp(_widget, _surface, _factor, Size.Width, Size.Height)); _surface = null; } } public IntPtr Address { get; } - public int Width { get; } - public int Height { get; } + public PixelSize Size { get; } public int RowBytes { get; } diff --git a/src/Gtk/Avalonia.Gtk3/X11Framebuffer.cs b/src/Gtk/Avalonia.Gtk3/X11Framebuffer.cs index dde29f85c2..c84d7c7541 100644 --- a/src/Gtk/Avalonia.Gtk3/X11Framebuffer.cs +++ b/src/Gtk/Avalonia.Gtk3/X11Framebuffer.cs @@ -13,12 +13,11 @@ namespace Avalonia.Gtk3 { _display = display; _xid = xid; - Width = width*factor; - Height = height*factor; - RowBytes = Width * 4; + Size = new PixelSize(width * factor, height * factor); + RowBytes = Size.Width * 4; Dpi = new Vector(96, 96) * factor; Format = PixelFormat.Bgra8888; - _blob = AvaloniaLocator.Current.GetService().AllocBlob(RowBytes * Height); + _blob = AvaloniaLocator.Current.GetService().AllocBlob(RowBytes * Size.Height); Address = _blob.Address; } @@ -26,8 +25,8 @@ namespace Avalonia.Gtk3 { var image = new X11.XImage(); int bitsPerPixel = 32; - image.width = Width; - image.height = Height; + image.width = Size.Width; + image.height = Size.Height; image.format = 2; //ZPixmap; image.data = Address; image.byte_order = 0;// LSBFirst; @@ -35,12 +34,12 @@ namespace Avalonia.Gtk3 image.bitmap_bit_order = 0;// LSBFirst; image.bitmap_pad = bitsPerPixel; image.depth = 24; - image.bytes_per_line = RowBytes - Width * 4; + image.bytes_per_line = RowBytes - Size.Width * 4; image.bits_per_pixel = bitsPerPixel; X11.XLockDisplay(_display); X11.XInitImage(ref image); var gc = X11.XCreateGC(_display, _xid, 0, IntPtr.Zero); - X11.XPutImage(_display, _xid, gc, ref image, 0, 0, 0, 0, (uint) Width, (uint) Height); + X11.XPutImage(_display, _xid, gc, ref image, 0, 0, 0, 0, (uint)Size.Width, (uint)Size.Height); X11.XFreeGC(_display, gc); X11.XSync(_display, true); X11.XUnlockDisplay(_display); @@ -48,8 +47,7 @@ namespace Avalonia.Gtk3 } public IntPtr Address { get; } - public int Width { get; } - public int Height { get; } + public PixelSize Size { get; } public int RowBytes { get; } public Vector Dpi { get; } public PixelFormat Format { get; } diff --git a/src/Linux/Avalonia.LinuxFramebuffer/LockedFramebuffer.cs b/src/Linux/Avalonia.LinuxFramebuffer/LockedFramebuffer.cs index 795d9648ea..ed59166eb8 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/LockedFramebuffer.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/LockedFramebuffer.cs @@ -19,7 +19,7 @@ namespace Avalonia.LinuxFramebuffer _address = address; Dpi = dpi; //Use double buffering to avoid flicker - Address = Marshal.AllocHGlobal(RowBytes * Height); + Address = Marshal.AllocHGlobal(RowBytes * Size.Height); } @@ -31,17 +31,16 @@ namespace Avalonia.LinuxFramebuffer public void Dispose() { VSync(); - NativeUnsafeMethods.memcpy(_address, Address, new IntPtr(RowBytes * Height)); + NativeUnsafeMethods.memcpy(_address, Address, new IntPtr(RowBytes * Size.Height)); Marshal.FreeHGlobal(Address); Address = IntPtr.Zero; } public IntPtr Address { get; private set; } - public int Width => (int)_varInfo.xres; - public int Height => (int) _varInfo.yres; + public PixelSize Size => new PixelSize((int)_varInfo.xres, (int) _varInfo.yres); public int RowBytes => (int) _fixedInfo.line_length; public Vector Dpi { get; } public PixelFormat Format => _varInfo.blue.offset == 16 ? PixelFormat.Rgba8888 : PixelFormat.Bgra8888; } -} \ No newline at end of file +} diff --git a/src/OSX/Avalonia.MonoMac/EmulatedFramebuffer.cs b/src/OSX/Avalonia.MonoMac/EmulatedFramebuffer.cs index 4da67ae1dd..8838c43201 100644 --- a/src/OSX/Avalonia.MonoMac/EmulatedFramebuffer.cs +++ b/src/OSX/Avalonia.MonoMac/EmulatedFramebuffer.cs @@ -24,12 +24,11 @@ namespace Avalonia.MonoMac _isDeferred = !Dispatcher.UIThread.CheckAccess(); _logicalSize = _view.LogicalSize; var pixelSize = _view.PixelSize; - Width = (int)pixelSize.Width; - Height = (int)pixelSize.Height; - RowBytes = Width * 4; + Size = new PixelSize((int)pixelSize.Width, (int)pixelSize.Height); + RowBytes = Size.Width * 4; Dpi = new Vector(96 * pixelSize.Width / _logicalSize.Width, 96 * pixelSize.Height / _logicalSize.Height); Format = PixelFormat.Rgba8888; - var size = Height * RowBytes; + var size = Size.Height * RowBytes; _blob = AvaloniaLocator.Current.GetService().AllocBlob(size); memset(Address, 0, new IntPtr(size)); } @@ -43,7 +42,7 @@ namespace Avalonia.MonoMac try { using (var colorSpace = CGColorSpace.CreateDeviceRGB()) - using (var bContext = new CGBitmapContext(Address, Width, Height, 8, Width * 4, + using (var bContext = new CGBitmapContext(Address, Size.Width, Size.Height, 8, Size.Width * 4, colorSpace, (CGImageAlphaInfo)nfo)) image = bContext.ToImage(); lock (_view.SyncRoot) @@ -79,8 +78,7 @@ namespace Avalonia.MonoMac } public IntPtr Address => _blob.Address; - public int Width { get; } - public int Height { get; } + public PixelSize Size { get; } public int RowBytes { get; } public Vector Dpi { get; } public PixelFormat Format { get; } diff --git a/src/Skia/Avalonia.Skia/DrawingContextImpl.cs b/src/Skia/Avalonia.Skia/DrawingContextImpl.cs index 685987ae80..c8fb8f4033 100644 --- a/src/Skia/Avalonia.Skia/DrawingContextImpl.cs +++ b/src/Skia/Avalonia.Skia/DrawingContextImpl.cs @@ -135,7 +135,7 @@ namespace Avalonia.Skia public void DrawImage(IRef source, IBrush opacityMask, Rect opacityMaskRect, Rect destRect) { PushOpacityMask(opacityMask, opacityMaskRect); - DrawImage(source, 1, new Rect(0, 0, source.Item.PixelWidth, source.Item.PixelHeight), destRect, BitmapInterpolationMode.Default); + DrawImage(source, 1, new Rect(0, 0, source.Item.PixelSize.Width, source.Item.PixelSize.Height), destRect, BitmapInterpolationMode.Default); PopOpacityMask(); } @@ -384,7 +384,7 @@ namespace Avalonia.Skia private void ConfigureTileBrush(ref PaintWrapper paintWrapper, Size targetSize, ITileBrush tileBrush, IDrawableBitmapImpl tileBrushImage) { var calc = new TileBrushCalculator(tileBrush, - new Size(tileBrushImage.PixelWidth, tileBrushImage.PixelHeight), targetSize); + new Size(tileBrushImage.PixelSize.Width, tileBrushImage.PixelSize.Height), targetSize); var intermediate = CreateRenderTarget( (int)calc.IntermediateSize.Width, @@ -394,7 +394,7 @@ namespace Avalonia.Skia using (var context = intermediate.CreateDrawingContext(null)) { - var rect = new Rect(0, 0, tileBrushImage.PixelWidth, tileBrushImage.PixelHeight); + var rect = new Rect(0, 0, tileBrushImage.PixelSize.Width, tileBrushImage.PixelSize.Height); context.Clear(Colors.Transparent); context.PushClip(calc.IntermediateClip); diff --git a/src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs b/src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs index 829b9097c9..b2c936d6ad 100644 --- a/src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs +++ b/src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs @@ -41,7 +41,7 @@ namespace Avalonia.Skia public IDrawingContextImpl CreateDrawingContext(IVisualBrushRenderer visualBrushRenderer) { var framebuffer = _platformSurface.Lock(); - var framebufferImageInfo = new SKImageInfo(framebuffer.Width, framebuffer.Height, + var framebufferImageInfo = new SKImageInfo(framebuffer.Size.Width, framebuffer.Size.Height, framebuffer.Format.ToSkColorType(), SKAlphaType.Premul); CreateSurface(framebufferImageInfo, framebuffer); diff --git a/src/Skia/Avalonia.Skia/ImmutableBitmap.cs b/src/Skia/Avalonia.Skia/ImmutableBitmap.cs index 332b8547bf..ee3a3b1a32 100644 --- a/src/Skia/Avalonia.Skia/ImmutableBitmap.cs +++ b/src/Skia/Avalonia.Skia/ImmutableBitmap.cs @@ -31,22 +31,24 @@ namespace Avalonia.Skia throw new ArgumentException("Unable to load bitmap from provided data"); } - PixelWidth = _image.Width; - PixelHeight = _image.Height; + PixelSize = new PixelSize(_image.Width, _image.Height); + + // TODO: Skia doesn't have an API for DPI. + Dpi = new Vector(96, 96); } } /// /// Create immutable bitmap from given pixel data copy. /// - /// Width of data pixels. - /// Height of data pixels. + /// Size of the bitmap. + /// DPI of the bitmap. /// Stride of data pixels. /// Format of data pixels. /// Data pixels. - public ImmutableBitmap(int width, int height, int stride, PixelFormat format, IntPtr data) + public ImmutableBitmap(PixelSize size, Vector dpi, int stride, PixelFormat format, IntPtr data) { - var imageInfo = new SKImageInfo(width, height, format.ToSkColorType(), SKAlphaType.Premul); + var imageInfo = new SKImageInfo(size.Width, size.Height, format.ToSkColorType(), SKAlphaType.Premul); _image = SKImage.FromPixelCopy(imageInfo, data, stride); @@ -55,15 +57,12 @@ namespace Avalonia.Skia throw new ArgumentException("Unable to create bitmap from provided data"); } - PixelWidth = width; - PixelHeight = height; + PixelSize = size; + Dpi = dpi; } - /// - public int PixelWidth { get; } - - /// - public int PixelHeight { get; } + public Vector Dpi { get; } + public PixelSize PixelSize { get; } /// public void Dispose() @@ -89,4 +88,4 @@ namespace Avalonia.Skia context.Canvas.DrawImage(_image, sourceRect, destRect, paint); } } -} \ No newline at end of file +} diff --git a/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs b/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs index d4e6403dc9..b6a674271c 100644 --- a/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs +++ b/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs @@ -49,34 +49,28 @@ namespace Avalonia.Skia } /// - public IBitmapImpl LoadBitmap(PixelFormat format, IntPtr data, int width, int height, int stride) + public IBitmapImpl LoadBitmap(PixelFormat format, IntPtr data, PixelSize size, Vector dpi, int stride) { - return new ImmutableBitmap(width, height, stride, format, data); + return new ImmutableBitmap(size, dpi, stride, format, data); } /// - public IRenderTargetBitmapImpl CreateRenderTargetBitmap( - int width, - int height, - double dpiX, - double dpiY) + public IRenderTargetBitmapImpl CreateRenderTargetBitmap(PixelSize size, Vector dpi) { - if (width < 1) + if (size.Width < 1) { - throw new ArgumentException("Width can't be less than 1", nameof(width)); + throw new ArgumentException("Width can't be less than 1", nameof(size)); } - if (height < 1) + if (size.Height < 1) { - throw new ArgumentException("Height can't be less than 1", nameof(height)); + throw new ArgumentException("Height can't be less than 1", nameof(size)); } - var dpi = new Vector(dpiX, dpiY); - var createInfo = new SurfaceRenderTarget.CreateInfo { - Width = width, - Height = height, + Width = size.Width, + Height = size.Height, Dpi = dpi, DisableTextLcdRendering = false }; @@ -100,9 +94,9 @@ namespace Avalonia.Skia } /// - public IWriteableBitmapImpl CreateWriteableBitmap(int width, int height, PixelFormat? format = null) + public IWriteableBitmapImpl CreateWriteableBitmap(PixelSize size, Vector dpi, PixelFormat? format = null) { - return new WriteableBitmapImpl(width, height, format); + return new WriteableBitmapImpl(size, dpi, format); } } -} \ No newline at end of file +} diff --git a/src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs b/src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs index 88200dcfbe..e84c512796 100644 --- a/src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs +++ b/src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs @@ -15,7 +15,6 @@ namespace Avalonia.Skia /// public class SurfaceRenderTarget : IRenderTargetBitmapImpl, IDrawableBitmapImpl { - private readonly Vector _dpi; private readonly SKSurface _surface; private readonly SKCanvas _canvas; private readonly bool _disableLcdRendering; @@ -26,12 +25,11 @@ namespace Avalonia.Skia /// Create info. public SurfaceRenderTarget(CreateInfo createInfo) { - PixelWidth = createInfo.Width; - PixelHeight = createInfo.Height; - _dpi = createInfo.Dpi; - _disableLcdRendering = createInfo.DisableTextLcdRendering; + PixelSize = new PixelSize(createInfo.Width, createInfo.Height); + Dpi = createInfo.Dpi; - _surface = CreateSurface(PixelWidth, PixelHeight, createInfo.Format); + _disableLcdRendering = createInfo.DisableTextLcdRendering; + _surface = CreateSurface(PixelSize.Width, PixelSize.Height, createInfo.Format); _canvas = _surface?.Canvas; @@ -71,7 +69,7 @@ namespace Avalonia.Skia var createInfo = new DrawingContextImpl.CreateInfo { Canvas = _canvas, - Dpi = _dpi, + Dpi = Dpi, VisualBrushRenderer = visualBrushRenderer, DisableTextLcdRendering = _disableLcdRendering }; @@ -80,10 +78,10 @@ namespace Avalonia.Skia } /// - public int PixelWidth { get; } + public Vector Dpi { get; } /// - public int PixelHeight { get; } + public PixelSize PixelSize { get; } /// public void Save(string fileName) @@ -166,4 +164,4 @@ namespace Avalonia.Skia public bool DisableTextLcdRendering; } } -} \ No newline at end of file +} diff --git a/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs b/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs index ab6c399ff4..3abff10098 100644 --- a/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs +++ b/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs @@ -20,13 +20,13 @@ namespace Avalonia.Skia /// /// Create new writeable bitmap. /// - /// Width. - /// Height. - /// Format. - public WriteableBitmapImpl(int width, int height, PixelFormat? format = null) + /// The size of the bitmap in device pixels. + /// The DPI of the bitmap. + /// The pixel format. + public WriteableBitmapImpl(PixelSize size, Vector dpi, PixelFormat? format = null) { - PixelHeight = height; - PixelWidth = width; + PixelSize = size; + Dpi = dpi; var colorType = PixelFormatHelper.ResolveColorType(format); @@ -36,24 +36,23 @@ namespace Avalonia.Skia { _bitmap = new SKBitmap(); - var nfo = new SKImageInfo(width, height, colorType, SKAlphaType.Premul); + var nfo = new SKImageInfo(size.Width, size.Height, colorType, SKAlphaType.Premul); var blob = runtimePlatform.AllocBlob(nfo.BytesSize); _bitmap.InstallPixels(nfo, blob.Address, nfo.RowBytes, null, s_releaseDelegate, blob); } else { - _bitmap = new SKBitmap(width, height, colorType, SKAlphaType.Premul); + _bitmap = new SKBitmap(size.Width, size.Height, colorType, SKAlphaType.Premul); } _bitmap.Erase(SKColor.Empty); } - /// - public int PixelWidth { get; } + public Vector Dpi { get; } /// - public int PixelHeight { get; } + public PixelSize PixelSize { get; } /// public void Draw(DrawingContextImpl context, SKRect sourceRect, SKRect destRect, SKPaint paint) @@ -133,10 +132,7 @@ namespace Avalonia.Skia public IntPtr Address => _bitmap.GetPixels(); /// - public int Width => _bitmap.Width; - - /// - public int Height => _bitmap.Height; + public PixelSize Size => new PixelSize(_bitmap.Width, _bitmap.Height); /// public int RowBytes => _bitmap.RowBytes; @@ -148,4 +144,4 @@ namespace Avalonia.Skia public PixelFormat Format => _bitmap.ColorType.ToPixelFormat(); } } -} \ No newline at end of file +} diff --git a/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs b/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs index c330377e20..3ec18dac5e 100644 --- a/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs +++ b/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs @@ -110,9 +110,9 @@ namespace Avalonia.Direct2D1 SharpDX.Configuration.EnableReleaseOnFinalizer = true; } - public IBitmapImpl CreateBitmap(int width, int height) + public IBitmapImpl CreateBitmap(PixelSize size, Vector dpi) { - return new WicBitmapImpl(width, height); + return new WicBitmapImpl(size, dpi); } public IFormattedTextImpl CreateFormattedText( @@ -159,18 +159,14 @@ namespace Avalonia.Direct2D1 throw new NotSupportedException("Don't know how to create a Direct2D1 renderer from any of provided surfaces"); } - public IRenderTargetBitmapImpl CreateRenderTargetBitmap( - int width, - int height, - double dpiX, - double dpiY) + public IRenderTargetBitmapImpl CreateRenderTargetBitmap(PixelSize size, Vector dpi) { - return new WicRenderTargetBitmapImpl(width, height, dpiX, dpiY); + return new WicRenderTargetBitmapImpl(size, dpi); } - public IWriteableBitmapImpl CreateWriteableBitmap(int width, int height, PixelFormat? format = null) + public IWriteableBitmapImpl CreateWriteableBitmap(PixelSize size, Vector dpi, PixelFormat? format = null) { - return new WriteableWicBitmapImpl(width, height, format); + return new WriteableWicBitmapImpl(size, dpi, format); } public IStreamGeometryImpl CreateStreamGeometry() @@ -188,9 +184,9 @@ namespace Avalonia.Direct2D1 return new WicBitmapImpl(stream); } - public IBitmapImpl LoadBitmap(PixelFormat format, IntPtr data, int width, int height, int stride) + public IBitmapImpl LoadBitmap(PixelFormat format, IntPtr data, PixelSize size, Vector dpi, int stride) { - return new WicBitmapImpl(format, data, width, height, stride); + return new WicBitmapImpl(format, data, size, dpi, stride); } } } diff --git a/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs b/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs index 5ae174083c..f7e7ed3dc2 100644 --- a/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs +++ b/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs @@ -40,7 +40,7 @@ namespace Avalonia.Direct2D1 private readonly ILockedFramebuffer _target; public FramebufferShim(ILockedFramebuffer target) : - base(target.Width, target.Height, target.Dpi.X, target.Dpi.Y, target.Format) + base(target.Size, target.Dpi, target.Format) { _target = target; } @@ -51,7 +51,7 @@ namespace Avalonia.Direct2D1 { using (var l = WicImpl.Lock(BitmapLockFlags.Read)) { - for (var y = 0; y < _target.Height; y++) + for (var y = 0; y < _target.Size.Height; y++) { UnmanagedMethods.CopyMemory( (_target.Address + _target.RowBytes * y), diff --git a/src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs index b842f26edb..efe26ba01a 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs @@ -330,12 +330,8 @@ namespace Avalonia.Direct2D1.Media { var platform = AvaloniaLocator.Current.GetService(); var dpi = new Vector(_deviceContext.DotsPerInch.Width, _deviceContext.DotsPerInch.Height); - var pixelSize = size * (dpi / 96); - return platform.CreateRenderTargetBitmap( - (int)pixelSize.Width, - (int)pixelSize.Height, - dpi.X, - dpi.Y); + var pixelSize = PixelSize.FromSize(size, dpi); + return platform.CreateRenderTargetBitmap(pixelSize, dpi); } } diff --git a/src/Windows/Avalonia.Direct2D1/Media/ImageBrushImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/ImageBrushImpl.cs index 3fc8760a9e..55877cefcb 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/ImageBrushImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/ImageBrushImpl.cs @@ -20,7 +20,7 @@ namespace Avalonia.Direct2D1.Media BitmapImpl bitmap, Size targetSize) { - var calc = new TileBrushCalculator(brush, new Size(bitmap.PixelWidth, bitmap.PixelHeight), targetSize); + var calc = new TileBrushCalculator(brush, bitmap.PixelSize.ToSize(96), targetSize); if (!calc.NeedsIntermediate) { @@ -99,7 +99,7 @@ namespace Avalonia.Direct2D1.Media using (var context = new RenderTarget(result).CreateDrawingContext(null)) { - var rect = new Rect(0, 0, bitmap.PixelWidth, bitmap.PixelHeight); + var rect = new Rect(0, 0, bitmap.PixelSize.Width, bitmap.PixelSize.Height); context.Clear(Colors.Transparent); context.PushClip(calc.IntermediateClip); diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/BitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/BitmapImpl.cs index 30af01283a..f3879b4eff 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/BitmapImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/BitmapImpl.cs @@ -7,8 +7,8 @@ namespace Avalonia.Direct2D1.Media { public abstract class BitmapImpl : IBitmapImpl, IDisposable { - public abstract int PixelWidth { get; } - public abstract int PixelHeight { get; } + public abstract Vector Dpi { get; } + public abstract PixelSize PixelSize { get; } public abstract OptionalDispose GetDirect2DBitmap(SharpDX.Direct2D1.RenderTarget target); diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DBitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DBitmapImpl.cs index b0edb9c3bf..1ee869ecb9 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DBitmapImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DBitmapImpl.cs @@ -30,8 +30,8 @@ namespace Avalonia.Direct2D1.Media _direct2DBitmap = d2DBitmap ?? throw new ArgumentNullException(nameof(d2DBitmap)); } - public override int PixelWidth => _direct2DBitmap.PixelSize.Width; - public override int PixelHeight => _direct2DBitmap.PixelSize.Height; + public override Vector Dpi => _direct2DBitmap.DotsPerInch.ToAvaloniaVector(); + public override PixelSize PixelSize => _direct2DBitmap.PixelSize.ToAvalonia(); public override void Dispose() { diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DRenderTargetBitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DRenderTargetBitmapImpl.cs index 3646d9e9e1..88602b935e 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DRenderTargetBitmapImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DRenderTargetBitmapImpl.cs @@ -19,9 +19,6 @@ namespace Avalonia.Direct2D1.Media.Imaging _renderTarget = renderTarget; } - public override int PixelWidth => _renderTarget.PixelSize.Width; - public override int PixelHeight => _renderTarget.PixelSize.Height; - public static D2DRenderTargetBitmapImpl CreateCompatible( SharpDX.Direct2D1.RenderTarget renderTarget, Size size) diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs index b16ea45fc6..89b96953ad 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs @@ -42,10 +42,10 @@ namespace Avalonia.Direct2D1.Media /// /// Initializes a new instance of the class. /// - /// The width of the bitmap. - /// The height of the bitmap. + /// The size of the bitmap in device pixels. + /// The DPI of the bitmap. /// Pixel format - public WicBitmapImpl(int width, int height, APixelFormat? pixelFormat = null) + public WicBitmapImpl(PixelSize size, Vector dpi, APixelFormat? pixelFormat = null) { if (!pixelFormat.HasValue) { @@ -55,19 +55,22 @@ namespace Avalonia.Direct2D1.Media PixelFormat = pixelFormat; WicImpl = new Bitmap( Direct2D1Platform.ImagingFactory, - width, - height, + size.Width, + size.Height, pixelFormat.Value.ToWic(), BitmapCreateCacheOption.CacheOnLoad); + WicImpl.SetResolution(dpi.X, dpi.Y); } - public WicBitmapImpl(APixelFormat format, IntPtr data, int width, int height, int stride) + public WicBitmapImpl(APixelFormat format, IntPtr data, PixelSize size, Vector dpi, int stride) { - WicImpl = new Bitmap(Direct2D1Platform.ImagingFactory, width, height, format.ToWic(), BitmapCreateCacheOption.CacheOnDemand); + WicImpl = new Bitmap(Direct2D1Platform.ImagingFactory, size.Width, size.Height, format.ToWic(), BitmapCreateCacheOption.CacheOnDemand); + WicImpl.SetResolution(dpi.X, dpi.Y); + PixelFormat = format; using (var l = WicImpl.Lock(BitmapLockFlags.Write)) { - for (var row = 0; row < height; row++) + for (var row = 0; row < size.Height; row++) { UnmanagedMethods.CopyMemory( (l.Data.DataPointer + row * l.Stride), @@ -77,17 +80,18 @@ namespace Avalonia.Direct2D1.Media } } - protected APixelFormat? PixelFormat { get; } + public override Vector Dpi + { + get + { + WicImpl.GetResolution(out double x, out double y); + return new Vector(x, y); + } + } - /// - /// Gets the width of the bitmap, in pixels. - /// - public override int PixelWidth => WicImpl.Size.Width; + public override PixelSize PixelSize => WicImpl.Size.ToAvalonia(); - /// - /// Gets the height of the bitmap, in pixels. - /// - public override int PixelHeight => WicImpl.Size.Height; + protected APixelFormat? PixelFormat { get; } public override void Dispose() { diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicRenderTargetBitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicRenderTargetBitmapImpl.cs index aa8b3ead42..ca441e7b69 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicRenderTargetBitmapImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicRenderTargetBitmapImpl.cs @@ -13,17 +13,15 @@ namespace Avalonia.Direct2D1.Media private readonly WicRenderTarget _renderTarget; public WicRenderTargetBitmapImpl( - int width, - int height, - double dpiX, - double dpiY, + PixelSize size, + Vector dpi, Platform.PixelFormat? pixelFormat = null) - : base(width, height, pixelFormat) + : base(size, dpi, pixelFormat) { var props = new RenderTargetProperties { - DpiX = (float)dpiX, - DpiY = (float)dpiY, + DpiX = (float)dpi.X, + DpiY = (float)dpi.Y, }; _renderTarget = new WicRenderTarget( diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs index 5ca78ef278..e3bd3b3218 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs @@ -10,8 +10,8 @@ namespace Avalonia.Direct2D1.Media.Imaging { class WriteableWicBitmapImpl : WicBitmapImpl, IWriteableBitmapImpl { - public WriteableWicBitmapImpl(int width, int height, PixelFormat? pixelFormat) - : base(width, height, pixelFormat) + public WriteableWicBitmapImpl(PixelSize size, Vector dpi, PixelFormat? pixelFormat) + : base(size, dpi, pixelFormat) { } @@ -33,8 +33,7 @@ namespace Avalonia.Direct2D1.Media.Imaging } public IntPtr Address => _lock.Data.DataPointer; - public int Width => _lock.Size.Width; - public int Height => _lock.Size.Height; + public PixelSize Size => _lock.Size.ToAvalonia(); public int RowBytes => _lock.Stride; public Vector Dpi { get; } = new Vector(96, 96); public PixelFormat Format => _format; diff --git a/src/Windows/Avalonia.Direct2D1/PrimitiveExtensions.cs b/src/Windows/Avalonia.Direct2D1/PrimitiveExtensions.cs index 124e33c5a3..5209014271 100644 --- a/src/Windows/Avalonia.Direct2D1/PrimitiveExtensions.cs +++ b/src/Windows/Avalonia.Direct2D1/PrimitiveExtensions.cs @@ -41,6 +41,10 @@ namespace Avalonia.Direct2D1 return new Rect(new Point(r.Left, r.Top), new Point(r.Right, r.Bottom)); } + public static PixelSize ToAvalonia(this Size2 p) => new PixelSize(p.Width, p.Height); + + public static Vector ToAvaloniaVector(this Size2F p) => new Vector(p.Width, p.Height); + public static RawRectangleF ToSharpDX(this Rect r) { return new RawRectangleF((float)r.X, (float)r.Y, (float)r.Right, (float)r.Bottom); diff --git a/src/Windows/Avalonia.Win32.Interop/Wpf/WritableBitmapSurface.cs b/src/Windows/Avalonia.Win32.Interop/Wpf/WritableBitmapSurface.cs index 79340fa335..05fa9d9426 100644 --- a/src/Windows/Avalonia.Win32.Interop/Wpf/WritableBitmapSurface.cs +++ b/src/Windows/Avalonia.Win32.Interop/Wpf/WritableBitmapSurface.cs @@ -58,8 +58,7 @@ namespace Avalonia.Win32.Interop.Wpf } public IntPtr Address => _bitmap.BackBuffer; - public int Width => _bitmap.PixelWidth; - public int Height => _bitmap.PixelHeight; + public PixelSize Size => new PixelSize(_bitmap.PixelWidth, _bitmap.PixelHeight); public int RowBytes => _bitmap.BackBufferStride; public Vector Dpi { get; } public PixelFormat Format => PixelFormat.Bgra8888; diff --git a/src/Windows/Avalonia.Win32/FramebufferManager.cs b/src/Windows/Avalonia.Win32/FramebufferManager.cs index bb0bde34ff..c910703181 100644 --- a/src/Windows/Avalonia.Win32/FramebufferManager.cs +++ b/src/Windows/Avalonia.Win32/FramebufferManager.cs @@ -21,11 +21,11 @@ namespace Avalonia.Win32 UnmanagedMethods.GetClientRect(_hwnd, out rc); var width = rc.right - rc.left; var height = rc.bottom - rc.top; - if ((_fb == null || _fb.Width != width || _fb.Height != height) && width > 0 && height > 0) + if ((_fb == null || _fb.Size.Width != width || _fb.Size.Height != height) && width > 0 && height > 0) { _fb?.Deallocate(); _fb = null; - _fb = new WindowFramebuffer(_hwnd, width, height); + _fb = new WindowFramebuffer(_hwnd, new PixelSize(width, height)); } return _fb; } diff --git a/src/Windows/Avalonia.Win32/WindowFramebuffer.cs b/src/Windows/Avalonia.Win32/WindowFramebuffer.cs index 6193ebd02b..9c331f662d 100644 --- a/src/Windows/Avalonia.Win32/WindowFramebuffer.cs +++ b/src/Windows/Avalonia.Win32/WindowFramebuffer.cs @@ -11,21 +11,21 @@ namespace Avalonia.Win32 private IUnmanagedBlob _bitmapBlob; private UnmanagedMethods.BITMAPINFOHEADER _bmpInfo; - public WindowFramebuffer(IntPtr handle, int width, int height) + public WindowFramebuffer(IntPtr handle, PixelSize size) { - if (width <= 0) - throw new ArgumentException("width is less than zero"); - if (height <= 0) - throw new ArgumentException("height is less than zero"); + if (size.Width <= 0) + throw new ArgumentException("Width is less than zero"); + if (size.Height <= 0) + throw new ArgumentException("Height is less than zero"); _handle = handle; _bmpInfo.Init(); _bmpInfo.biPlanes = 1; _bmpInfo.biBitCount = 32; _bmpInfo.Init(); - _bmpInfo.biWidth = width; - _bmpInfo.biHeight = -height; - _bitmapBlob = AvaloniaLocator.Current.GetService().AllocBlob(width * height * 4); + _bmpInfo.biWidth = size.Width; + _bmpInfo.biHeight = -size.Height; + _bitmapBlob = AvaloniaLocator.Current.GetService().AllocBlob(size.Width * size.Height * 4); } ~WindowFramebuffer() @@ -34,7 +34,7 @@ namespace Avalonia.Win32 } public IntPtr Address => _bitmapBlob.Address; - public int RowBytes => Width * 4; + public int RowBytes => Size.Width * 4; public PixelFormat Format => PixelFormat.Bgra8888; public Vector Dpi @@ -61,19 +61,17 @@ namespace Avalonia.Win32 } } - public int Width => _bmpInfo.biWidth; - - public int Height => -_bmpInfo.biHeight; + public PixelSize Size => new PixelSize(_bmpInfo.biWidth, _bmpInfo.biHeight); public void DrawToDevice(IntPtr hDC, int destX = 0, int destY = 0, int srcX = 0, int srcY = 0, int width = -1, int height = -1) { if (width == -1) - width = Width; + width = Size.Width; if (height == -1) - height = Height; + height = Size.Height; UnmanagedMethods.SetDIBitsToDevice(hDC, destX, destY, (uint) width, (uint) height, srcX, srcY, - 0, (uint)Height, _bitmapBlob.Address, ref _bmpInfo, 0); + 0, (uint)Size.Height, _bitmapBlob.Address, ref _bmpInfo, 0); } public bool DrawToWindow(IntPtr hWnd, int destX = 0, int destY = 0, int srcX = 0, int srcY = 0, int width = -1, diff --git a/tests/Avalonia.Controls.UnitTests/ImageTests.cs b/tests/Avalonia.Controls.UnitTests/ImageTests.cs index 7f2b5e77f9..7a0e5681d7 100644 --- a/tests/Avalonia.Controls.UnitTests/ImageTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ImageTests.cs @@ -13,7 +13,7 @@ namespace Avalonia.Controls.UnitTests [Fact] public void Measure_Should_Return_Correct_Size_For_No_Stretch() { - var bitmap = Mock.Of(x => x.PixelWidth == 50 && x.PixelHeight == 100); + var bitmap = Mock.Of(x => x.Size == new Size(50, 100)); var target = new Image(); target.Stretch = Stretch.None; target.Source = bitmap; @@ -26,7 +26,7 @@ namespace Avalonia.Controls.UnitTests [Fact] public void Measure_Should_Return_Correct_Size_For_Fill_Stretch() { - var bitmap = Mock.Of(x => x.PixelWidth == 50 && x.PixelHeight == 100); + var bitmap = Mock.Of(x => x.Size == new Size(50, 100)); var target = new Image(); target.Stretch = Stretch.Fill; target.Source = bitmap; @@ -39,7 +39,7 @@ namespace Avalonia.Controls.UnitTests [Fact] public void Measure_Should_Return_Correct_Size_For_Uniform_Stretch() { - var bitmap = Mock.Of(x => x.PixelWidth == 50 && x.PixelHeight == 100); + var bitmap = Mock.Of(x => x.Size == new Size(50, 100)); var target = new Image(); target.Stretch = Stretch.Uniform; target.Source = bitmap; @@ -52,7 +52,7 @@ namespace Avalonia.Controls.UnitTests [Fact] public void Measure_Should_Return_Correct_Size_For_UniformToFill_Stretch() { - var bitmap = Mock.Of(x => x.PixelWidth == 50 && x.PixelHeight == 100); + var bitmap = Mock.Of(x => x.Size == new Size(50, 100)); var target = new Image(); target.Stretch = Stretch.UniformToFill; target.Source = bitmap; diff --git a/tests/Avalonia.RenderTests/Media/BitmapTests.cs b/tests/Avalonia.RenderTests/Media/BitmapTests.cs index 4cee05a0d9..e6cd800529 100644 --- a/tests/Avalonia.RenderTests/Media/BitmapTests.cs +++ b/tests/Avalonia.RenderTests/Media/BitmapTests.cs @@ -29,14 +29,13 @@ namespace Avalonia.Direct2D1.RenderTests.Media class Framebuffer : ILockedFramebuffer, IFramebufferPlatformSurface { - public Framebuffer(PixelFormat fmt, int width, int height) + public Framebuffer(PixelFormat fmt, PixelSize size) { Format = fmt; var bpp = fmt == PixelFormat.Rgb565 ? 2 : 4; - Width = width; - Height = height; - RowBytes = bpp * width; - Address = Marshal.AllocHGlobal(Height * RowBytes); + Size = size; + RowBytes = bpp * size.Width; + Address = Marshal.AllocHGlobal(size.Height * RowBytes); } public IntPtr Address { get; } @@ -45,12 +44,10 @@ namespace Avalonia.Direct2D1.RenderTests.Media public PixelFormat Format { get; } - public int Height { get; } + public PixelSize Size { get; } public int RowBytes { get; } - public int Width { get; } - public void Dispose() { //no-op @@ -74,7 +71,7 @@ namespace Avalonia.Direct2D1.RenderTests.Media public void FramebufferRenderResultsShouldBeUsableAsBitmap(PixelFormat fmt) { var testName = nameof(FramebufferRenderResultsShouldBeUsableAsBitmap) + "_" + fmt; - var fb = new Framebuffer(fmt, 80, 80); + var fb = new Framebuffer(fmt, new PixelSize(80, 80)); var r = Avalonia.AvaloniaLocator.Current.GetService(); using (var target = r.CreateRenderTarget(new object[] { fb })) using (var ctx = target.CreateDrawingContext(null)) @@ -87,9 +84,9 @@ namespace Avalonia.Direct2D1.RenderTests.Media ctx.PopOpacity(); } - var bmp = new Bitmap(fmt, fb.Address, fb.Width, fb.Height, fb.RowBytes); + var bmp = new Bitmap(fmt, fb.Address, fb.Size, new Vector(96, 96), fb.RowBytes); fb.Deallocate(); - using (var rtb = new RenderTargetBitmap(100, 100)) + using (var rtb = new RenderTargetBitmap(new PixelSize(100, 100), new Vector(96, 96))) { using (var ctx = rtb.CreateDrawingContext(null)) { @@ -108,7 +105,7 @@ namespace Avalonia.Direct2D1.RenderTests.Media [InlineData(PixelFormat.Bgra8888), InlineData(PixelFormat.Rgba8888)] public void WriteableBitmapShouldBeUsable(PixelFormat fmt) { - var writeableBitmap = new WriteableBitmap(256, 256, fmt); + var writeableBitmap = new WriteableBitmap(new PixelSize(256, 256), new Vector(96, 96), fmt); var data = new int[256 * 256]; for (int y = 0; y < 256; y++) diff --git a/tests/Avalonia.RenderTests/TestBase.cs b/tests/Avalonia.RenderTests/TestBase.cs index 19413b32eb..2892615e48 100644 --- a/tests/Avalonia.RenderTests/TestBase.cs +++ b/tests/Avalonia.RenderTests/TestBase.cs @@ -73,22 +73,21 @@ namespace Avalonia.Direct2D1.RenderTests var immediatePath = Path.Combine(OutputPath, testName + ".immediate.out.png"); var deferredPath = Path.Combine(OutputPath, testName + ".deferred.out.png"); var factory = AvaloniaLocator.Current.GetService(); + var pixelSize = new PixelSize((int)target.Width, (int)target.Height); + var size = new Size(target.Width, target.Height); + var dpi = new Vector(96, 96); - using (RenderTargetBitmap bitmap = new RenderTargetBitmap( - (int)target.Width, - (int)target.Height)) + using (RenderTargetBitmap bitmap = new RenderTargetBitmap(pixelSize, dpi)) { - Size size = new Size(target.Width, target.Height); target.Measure(size); target.Arrange(new Rect(size)); bitmap.Render(target); bitmap.Save(immediatePath); } - using (var rtb = factory.CreateRenderTargetBitmap((int)target.Width, (int)target.Height, 96, 96)) + using (var rtb = factory.CreateRenderTargetBitmap(pixelSize, dpi)) using (var renderer = new DeferredRenderer(target, rtb)) { - Size size = new Size(target.Width, target.Height); target.Measure(size); target.Arrange(new Rect(size)); renderer.UnitTestUpdateScene(); diff --git a/tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs b/tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs index de2b517956..f8ad7e63f2 100644 --- a/tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs +++ b/tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs @@ -25,11 +25,7 @@ namespace Avalonia.UnitTests return Mock.Of(); } - public IRenderTargetBitmapImpl CreateRenderTargetBitmap( - int width, - int height, - double dpiX, - double dpiY) + public IRenderTargetBitmapImpl CreateRenderTargetBitmap(PixelSize size, Vector dpi) { return Mock.Of(); } @@ -39,7 +35,10 @@ namespace Avalonia.UnitTests return new MockStreamGeometryImpl(); } - public IWriteableBitmapImpl CreateWriteableBitmap(int width, int height, PixelFormat? format = default(PixelFormat?)) + public IWriteableBitmapImpl CreateWriteableBitmap( + PixelSize size, + Vector dpi, + PixelFormat? format = default(PixelFormat?)) { throw new NotImplementedException(); } @@ -54,7 +53,12 @@ namespace Avalonia.UnitTests return Mock.Of(); } - public IBitmapImpl LoadBitmap(PixelFormat format, IntPtr data, int width, int height, int stride) + public IBitmapImpl LoadBitmap( + PixelFormat format, + IntPtr data, + PixelSize size, + Vector dpi, + int stride) { throw new NotImplementedException(); } diff --git a/tests/Avalonia.Visuals.UnitTests/VisualTree/MockRenderInterface.cs b/tests/Avalonia.Visuals.UnitTests/VisualTree/MockRenderInterface.cs index 93b5a8a764..92c12c6b9e 100644 --- a/tests/Avalonia.Visuals.UnitTests/VisualTree/MockRenderInterface.cs +++ b/tests/Avalonia.Visuals.UnitTests/VisualTree/MockRenderInterface.cs @@ -24,7 +24,7 @@ namespace Avalonia.Visuals.UnitTests.VisualTree throw new NotImplementedException(); } - public IRenderTargetBitmapImpl CreateRenderTargetBitmap(int width, int height, double dpiX, double dpiY) + public IRenderTargetBitmapImpl CreateRenderTargetBitmap(PixelSize size, Vector dpi) { throw new NotImplementedException(); } @@ -44,12 +44,12 @@ namespace Avalonia.Visuals.UnitTests.VisualTree throw new NotImplementedException(); } - public IBitmapImpl LoadBitmap(PixelFormat format, IntPtr data, int width, int height, int stride) + public IBitmapImpl LoadBitmap(PixelFormat format, IntPtr data, PixelSize size, Vector dpi, int stride) { throw new NotImplementedException(); } - public IWriteableBitmapImpl CreateWriteableBitmap(int width, int height, PixelFormat? fmt) + public IWriteableBitmapImpl CreateWriteableBitmap(PixelSize size, Vector dpi, PixelFormat? fmt) { throw new NotImplementedException(); } From 465b2cd0dab99911ed0a6dae04483dad51c41761 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 11 Sep 2018 23:49:40 +0200 Subject: [PATCH 02/50] Add PixelSize to mobile APIs. --- .../Platform/SkiaPlatform/AndroidFramebuffer.cs | 8 ++++---- src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs | 12 +++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs index 405da12967..2afa4e83f1 100644 --- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs +++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs @@ -20,9 +20,10 @@ namespace Avalonia.Android.Platform.SkiaPlatform ANativeWindow_Buffer buffer; var rc = new ARect() { - right = Width = ANativeWindow_getWidth(_window), - bottom = Height = ANativeWindow_getHeight(_window) + right = ANativeWindow_getWidth(_window), + bottom = ANativeWindow_getHeight(_window) }; + Size = new PixelSize(rc.right, rc.bottom); ANativeWindow_lock(_window, out buffer, ref rc); Format = buffer.format == AndroidPixelFormat.WINDOW_FORMAT_RGB_565 @@ -41,8 +42,7 @@ namespace Avalonia.Android.Platform.SkiaPlatform } public IntPtr Address { get; set; } - public int Width { get; } - public int Height { get; } + public PixelSize Size { get; } public int RowBytes { get; } public Vector Dpi { get; } = new Vector(96, 96); public PixelFormat Format { get; } diff --git a/src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs b/src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs index b3b41fe724..89c7aaf76c 100644 --- a/src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs +++ b/src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs @@ -23,12 +23,11 @@ namespace Avalonia.iOS var frame = view.Frame; _viewWidth = frame.Width; _viewHeight = frame.Height; - Width = (int) frame.Width * factor; - Height = (int) frame.Height * factor; - RowBytes = Width * 4; + Size = new PixelSize((int)frame.Width * factor, (int)frame.Height * factor); + RowBytes = Size.Width * 4; Dpi = new Vector(96, 96) * factor; Format = PixelFormat.Rgba8888; - Address = Marshal.AllocHGlobal(Height * RowBytes); + Address = Marshal.AllocHGlobal(Size.Height * RowBytes); } public void Dispose() @@ -37,7 +36,7 @@ namespace Avalonia.iOS return; var nfo = (int) CGBitmapFlags.ByteOrder32Big | (int) CGImageAlphaInfo.PremultipliedLast; using (var colorSpace = CGColorSpace.CreateDeviceRGB()) - using (var bContext = new CGBitmapContext(Address, Width, Height, 8, Width * 4, + using (var bContext = new CGBitmapContext(Address, Size.Width, Size.Height, 8, Size.Width * 4, colorSpace, (CGImageAlphaInfo) nfo)) using (var image = bContext.ToImage()) using (var context = UIGraphics.GetCurrentContext()) @@ -52,8 +51,7 @@ namespace Avalonia.iOS } public IntPtr Address { get; private set; } - public int Width { get; } - public int Height { get; } + public PixelSize Size { get; } public int RowBytes { get; } public Vector Dpi { get; } public PixelFormat Format { get; } From 0de606b995353ebf215db6ef785648db4096b8ff Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 11 Sep 2018 23:57:50 +0200 Subject: [PATCH 03/50] Fix failing tests. --- tests/Avalonia.Controls.UnitTests/ImageTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Avalonia.Controls.UnitTests/ImageTests.cs b/tests/Avalonia.Controls.UnitTests/ImageTests.cs index 7a0e5681d7..e92fc572b4 100644 --- a/tests/Avalonia.Controls.UnitTests/ImageTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ImageTests.cs @@ -13,7 +13,7 @@ namespace Avalonia.Controls.UnitTests [Fact] public void Measure_Should_Return_Correct_Size_For_No_Stretch() { - var bitmap = Mock.Of(x => x.Size == new Size(50, 100)); + var bitmap = Mock.Of(x => x.PixelSize == new PixelSize(50, 100)); var target = new Image(); target.Stretch = Stretch.None; target.Source = bitmap; @@ -26,7 +26,7 @@ namespace Avalonia.Controls.UnitTests [Fact] public void Measure_Should_Return_Correct_Size_For_Fill_Stretch() { - var bitmap = Mock.Of(x => x.Size == new Size(50, 100)); + var bitmap = Mock.Of(x => x.PixelSize == new PixelSize(50, 100)); var target = new Image(); target.Stretch = Stretch.Fill; target.Source = bitmap; @@ -39,7 +39,7 @@ namespace Avalonia.Controls.UnitTests [Fact] public void Measure_Should_Return_Correct_Size_For_Uniform_Stretch() { - var bitmap = Mock.Of(x => x.Size == new Size(50, 100)); + var bitmap = Mock.Of(x => x.PixelSize == new PixelSize(50, 100)); var target = new Image(); target.Stretch = Stretch.Uniform; target.Source = bitmap; @@ -52,7 +52,7 @@ namespace Avalonia.Controls.UnitTests [Fact] public void Measure_Should_Return_Correct_Size_For_UniformToFill_Stretch() { - var bitmap = Mock.Of(x => x.Size == new Size(50, 100)); + var bitmap = Mock.Of(x => x.PixelSize == new PixelSize(50, 100)); var target = new Image(); target.Stretch = Stretch.UniformToFill; target.Source = bitmap; From bb8549ef94bd7ef8c81455b218fdb7af0f610b7f Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Fri, 12 Oct 2018 17:03:16 +0300 Subject: [PATCH 04/50] listbox toggle selection not working unit test #1971 --- .../ListBoxTests.cs | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/tests/Avalonia.Controls.UnitTests/ListBoxTests.cs b/tests/Avalonia.Controls.UnitTests/ListBoxTests.cs index 1debccd3c5..ebfd56027d 100644 --- a/tests/Avalonia.Controls.UnitTests/ListBoxTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ListBoxTests.cs @@ -1,13 +1,11 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Collections.ObjectModel; using System.Linq; using Avalonia.Collections; using Avalonia.Controls.Presenters; using Avalonia.Controls.Templates; -using Avalonia.Data; +using Avalonia.Input; using Avalonia.LogicalTree; using Avalonia.Styling; using Avalonia.UnitTests; @@ -196,6 +194,45 @@ namespace Avalonia.Controls.UnitTests target.Presenter.Panel.Children.Cast().Select(x => (string)x.Content)); } + [Fact] + public void Toggle_Selection_Should_Update_Containers() + { + var items = Enumerable.Range(0, 10).Select(x => $"Item {x}").ToArray(); + var target = new ListBox + { + Template = ListBoxTemplate(), + Items = items, + SelectionMode = SelectionMode.Toggle, + ItemTemplate = new FuncDataTemplate(x => new TextBlock { Height = 10 }) + }; + + Prepare(target); + + var lbItems = target.GetLogicalChildren().OfType().ToArray(); + + var item = lbItems[0]; + + Assert.Equal(false, item.IsSelected); + + RaisePressedEvent(target, item, MouseButton.Left); + + Assert.Equal(true, item.IsSelected); + + RaisePressedEvent(target, item, MouseButton.Left); + + Assert.Equal(false, item.IsSelected); + } + + private void RaisePressedEvent(ListBox listBox, ListBoxItem item, MouseButton mouseButton) + { + listBox.RaiseEvent(new PointerPressedEventArgs + { + Source = item, + RoutedEvent = InputElement.PointerPressedEvent, + MouseButton = mouseButton + }); + } + private FuncControlTemplate ListBoxTemplate() { return new FuncControlTemplate(parent => From 889156df434cd59eccf267101ea470e68e62ab4e Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Tue, 16 Oct 2018 01:09:43 +0300 Subject: [PATCH 05/50] fixes #1971 listbox toggle selection --- .../Primitives/SelectingItemsControl.cs | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs b/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs index f8440aac47..ccbdc71b1d 100644 --- a/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs +++ b/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs @@ -62,7 +62,7 @@ namespace Avalonia.Controls.Primitives AvaloniaProperty.RegisterDirect( nameof(SelectedItem), o => o.SelectedItem, - (o, v) => o.SelectedItem = v, + (o, v) => o.SelectedItem = v, defaultBindingMode: BindingMode.TwoWay); /// @@ -88,7 +88,7 @@ namespace Avalonia.Controls.Primitives /// public static readonly RoutedEvent IsSelectedChangedEvent = RoutedEvent.Register( - "IsSelectedChanged", + "IsSelectedChanged", RoutingStrategies.Bubble); /// @@ -96,7 +96,7 @@ namespace Avalonia.Controls.Primitives /// public static readonly RoutedEvent SelectionChangedEvent = RoutedEvent.Register( - "SelectionChanged", + "SelectionChanged", RoutingStrategies.Bubble); private static readonly IList Empty = new object[0]; @@ -521,7 +521,7 @@ namespace Avalonia.Controls.Primitives else if (multi && range) { SynchronizeItems( - SelectedItems, + SelectedItems, GetRange(Items, SelectedIndex, index)); } else @@ -583,7 +583,7 @@ namespace Avalonia.Controls.Primitives } /// - /// Updates the selection based on an event that may have originated in a container that + /// Updates the selection based on an event that may have originated in a container that /// belongs to the control. /// /// The control that raised the event. @@ -595,7 +595,7 @@ namespace Avalonia.Controls.Primitives /// false. /// protected bool UpdateSelectionFromEventSource( - IInteractive eventSource, + IInteractive eventSource, bool select = true, bool rangeModifier = false, bool toggleModifier = false) @@ -807,12 +807,10 @@ namespace Avalonia.Controls.Primitives SelectedIndex = -1; } } - else + + foreach (var item in e.OldItems) { - foreach (var item in e.OldItems) - { - MarkItemSelected(item, false); - } + MarkItemSelected(item, false); } removed = e.OldItems; From 3a9967f4988b4aeae4980064ba8f9a2296959524 Mon Sep 17 00:00:00 2001 From: Tom Daffin Date: Sun, 21 Oct 2018 08:06:27 -0600 Subject: [PATCH 06/50] Map GdkKey.grave to Key.OemTilde --- src/Gtk/Avalonia.Gtk3/KeyTransform.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Gtk/Avalonia.Gtk3/KeyTransform.cs b/src/Gtk/Avalonia.Gtk3/KeyTransform.cs index ae85d618d1..a62b611df1 100644 --- a/src/Gtk/Avalonia.Gtk3/KeyTransform.cs +++ b/src/Gtk/Avalonia.Gtk3/KeyTransform.cs @@ -185,8 +185,8 @@ namespace Avalonia.Gtk.Common { GdkKey.comma, Key.OemComma }, { GdkKey.minus, Key.OemMinus }, { GdkKey.period, Key.OemPeriod }, - { GdkKey.slash, Key.Oem2 } - //{ GdkKey.?, Key.OemTilde } + { GdkKey.slash, Key.Oem2 }, + { GdkKey.grave, Key.OemTilde }, //{ GdkKey.?, Key.AbntC1 } //{ GdkKey.?, Key.AbntC2 } //{ GdkKey.?, Key.Oem4 } From 376b48ef4d1b4cdaa30b471fba30b8f38292b528 Mon Sep 17 00:00:00 2001 From: Tom Daffin Date: Wed, 24 Oct 2018 05:21:24 -0600 Subject: [PATCH 07/50] Map some more Gdk keys --- src/Gtk/Avalonia.Gtk3/KeyTransform.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Gtk/Avalonia.Gtk3/KeyTransform.cs b/src/Gtk/Avalonia.Gtk3/KeyTransform.cs index a62b611df1..07037de40b 100644 --- a/src/Gtk/Avalonia.Gtk3/KeyTransform.cs +++ b/src/Gtk/Avalonia.Gtk3/KeyTransform.cs @@ -14,6 +14,7 @@ namespace Avalonia.Gtk.Common { GdkKey.Linefeed, Key.LineFeed }, { GdkKey.Clear, Key.Clear }, { GdkKey.Return, Key.Return }, + { GdkKey.KP_Enter, Key.Return }, { GdkKey.Pause, Key.Pause }, { GdkKey.Caps_Lock, Key.CapsLock }, //{ GdkKey.?, Key.HangulMode } @@ -112,7 +113,7 @@ namespace Avalonia.Gtk.Common { GdkKey.z, Key.Z }, //{ GdkKey.?, Key.LWin } //{ GdkKey.?, Key.RWin } - //{ GdkKey.?, Key.Apps } + { GdkKey.Menu, Key.Apps }, //{ GdkKey.?, Key.Sleep } { GdkKey.KP_0, Key.NumPad0 }, { GdkKey.KP_1, Key.NumPad1 }, @@ -125,11 +126,12 @@ namespace Avalonia.Gtk.Common { GdkKey.KP_8, Key.NumPad8 }, { GdkKey.KP_9, Key.NumPad9 }, { GdkKey.multiply, Key.Multiply }, - //{ GdkKey.?, Key.Add } + { GdkKey.KP_Multiply, Key.Multiply }, + { GdkKey.KP_Add, Key.Add }, //{ GdkKey.?, Key.Separator } - //{ GdkKey.?, Key.Subtract } + { GdkKey.KP_Subtract, Key.Subtract }, //{ GdkKey.?, Key.Decimal } - //{ GdkKey.?, Key.Divide } + { GdkKey.KP_Divide, Key.Divide }, { GdkKey.F1, Key.F1 }, { GdkKey.F2, Key.F2 }, { GdkKey.F3, Key.F3 }, @@ -182,6 +184,7 @@ namespace Avalonia.Gtk.Common //{ GdkKey.?, Key.LaunchApplication2 } { GdkKey.semicolon, Key.OemSemicolon }, { GdkKey.plus, Key.OemPlus }, + { GdkKey.equal, Key.OemPlus }, { GdkKey.comma, Key.OemComma }, { GdkKey.minus, Key.OemMinus }, { GdkKey.period, Key.OemPeriod }, @@ -189,10 +192,10 @@ namespace Avalonia.Gtk.Common { GdkKey.grave, Key.OemTilde }, //{ GdkKey.?, Key.AbntC1 } //{ GdkKey.?, Key.AbntC2 } - //{ GdkKey.?, Key.Oem4 } - //{ GdkKey.?, Key.OemPipe } - //{ GdkKey.?, Key.OemCloseBrackets } - //{ GdkKey.?, Key.Oem7 } + { GdkKey.bracketleft, Key.OemOpenBrackets }, + { GdkKey.backslash, Key.OemPipe }, + { GdkKey.bracketright, Key.OemCloseBrackets }, + { GdkKey.apostrophe, Key.OemQuotes }, //{ GdkKey.?, Key.Oem8 } //{ GdkKey.?, Key.Oem102 } //{ GdkKey.?, Key.ImeProcessed } From 82c17b95824ad3272df1b775435a939e620607a0 Mon Sep 17 00:00:00 2001 From: Tom Daffin Date: Wed, 24 Oct 2018 09:01:00 -0600 Subject: [PATCH 08/50] Map some more GdkKeys --- src/Gtk/Avalonia.Gtk3/KeyTransform.cs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/Gtk/Avalonia.Gtk3/KeyTransform.cs b/src/Gtk/Avalonia.Gtk3/KeyTransform.cs index 07037de40b..4299e07094 100644 --- a/src/Gtk/Avalonia.Gtk3/KeyTransform.cs +++ b/src/Gtk/Avalonia.Gtk3/KeyTransform.cs @@ -28,7 +28,9 @@ namespace Avalonia.Gtk.Common //{ GdkKey.?, Key.ImeModeChange } { GdkKey.space, Key.Space }, { GdkKey.Prior, Key.Prior }, + { GdkKey.KP_Prior, Key.Prior }, { GdkKey.Page_Down, Key.PageDown }, + { GdkKey.KP_Page_Down, Key.PageDown }, { GdkKey.End, Key.End }, { GdkKey.KP_End, Key.End }, { GdkKey.Home, Key.Home }, @@ -46,19 +48,20 @@ namespace Avalonia.Gtk.Common { GdkKey.Execute, Key.Execute }, //{ GdkKey.?, Key.Snapshot } { GdkKey.Insert, Key.Insert }, + { GdkKey.KP_Insert, Key.Insert }, { GdkKey.Delete, Key.Delete }, { GdkKey.KP_Delete, Key.Delete }, { GdkKey.Help, Key.Help }, - //{ GdkKey.?, Key.D0 } - //{ GdkKey.?, Key.D1 } - //{ GdkKey.?, Key.D2 } - //{ GdkKey.?, Key.D3 } - //{ GdkKey.?, Key.D4 } - //{ GdkKey.?, Key.D5 } - //{ GdkKey.?, Key.D6 } - //{ GdkKey.?, Key.D7 } - //{ GdkKey.?, Key.D8 } - //{ GdkKey.?, Key.D9 } + { GdkKey.Key_0, Key.D0 }, + { GdkKey.Key_1, Key.D1 }, + { GdkKey.Key_2, Key.D2 }, + { GdkKey.Key_3, Key.D3 }, + { GdkKey.Key_4, Key.D4 }, + { GdkKey.Key_5, Key.D5 }, + { GdkKey.Key_6, Key.D6 }, + { GdkKey.Key_7, Key.D7 }, + { GdkKey.Key_8, Key.D8 }, + { GdkKey.Key_9, Key.D9 }, { GdkKey.A, Key.A }, { GdkKey.B, Key.B }, { GdkKey.C, Key.C }, @@ -130,7 +133,7 @@ namespace Avalonia.Gtk.Common { GdkKey.KP_Add, Key.Add }, //{ GdkKey.?, Key.Separator } { GdkKey.KP_Subtract, Key.Subtract }, - //{ GdkKey.?, Key.Decimal } + { GdkKey.KP_Decimal, Key.Decimal }, { GdkKey.KP_Divide, Key.Divide }, { GdkKey.F1, Key.F1 }, { GdkKey.F2, Key.F2 }, From daec1be03337e9774869a150c5b245dbec3f476c Mon Sep 17 00:00:00 2001 From: Benedikt Schroeder Date: Fri, 26 Oct 2018 15:47:38 +0200 Subject: [PATCH 09/50] OpenTypeFont support for embedded fonts --- .../Media/Fonts/FontFamilyKey.cs | 35 +++++++++++++++---- .../Media/Fonts/FontFamilyLoader.cs | 4 +-- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/Avalonia.Visuals/Media/Fonts/FontFamilyKey.cs b/src/Avalonia.Visuals/Media/Fonts/FontFamilyKey.cs index cb996867c4..9af9509e4e 100644 --- a/src/Avalonia.Visuals/Media/Fonts/FontFamilyKey.cs +++ b/src/Avalonia.Visuals/Media/Fonts/FontFamilyKey.cs @@ -17,7 +17,10 @@ namespace Avalonia.Media.Fonts /// public FontFamilyKey(Uri source) { - if (source == null) throw new ArgumentNullException(nameof(source)); + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } if (source.AbsolutePath.Contains(".ttf")) { @@ -26,6 +29,14 @@ namespace Avalonia.Media.Fonts FileName = fileNameWithoutExtension + ".ttf"; Location = new Uri(source.OriginalString.Replace("." + FileName, string.Empty), UriKind.RelativeOrAbsolute); } + + if (source.AbsolutePath.Contains(".otf")) + { + var filePathWithoutExtension = source.AbsolutePath.Replace(".otf", string.Empty); + var fileNameWithoutExtension = filePathWithoutExtension.Split('.').Last(); + FileName = fileNameWithoutExtension + ".otf"; + Location = new Uri(source.OriginalString.Replace("." + FileName, string.Empty), UriKind.RelativeOrAbsolute); + } else { Location = source; @@ -77,11 +88,20 @@ namespace Avalonia.Media.Fonts /// public override bool Equals(object obj) { - if (!(obj is FontFamilyKey other)) return false; + if (!(obj is FontFamilyKey other)) + { + return false; + } - if (Location != other.Location) return false; + if (Location != other.Location) + { + return false; + } - if (FileName != other.FileName) return false; + if (FileName != other.FileName) + { + return false; + } return true; } @@ -94,7 +114,10 @@ namespace Avalonia.Media.Fonts /// public override string ToString() { - if (FileName == null) return Location.PathAndQuery; + if (FileName == null) + { + return Location.PathAndQuery; + } var builder = new UriBuilder(Location); @@ -103,4 +126,4 @@ namespace Avalonia.Media.Fonts return builder.ToString(); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/Fonts/FontFamilyLoader.cs b/src/Avalonia.Visuals/Media/Fonts/FontFamilyLoader.cs index 57e6c756cc..b6b83e2097 100644 --- a/src/Avalonia.Visuals/Media/Fonts/FontFamilyLoader.cs +++ b/src/Avalonia.Visuals/Media/Fonts/FontFamilyLoader.cs @@ -34,7 +34,7 @@ namespace Avalonia.Media.Fonts { var availableAssets = s_assetLoader.GetAssets(location); - var matchingAssets = availableAssets.Where(x => x.absolutePath.EndsWith(".ttf")); + var matchingAssets = availableAssets.Where(x => x.absolutePath.EndsWith(".ttf") || x.absolutePath.EndsWith(".otf")); return matchingAssets.Select(x => GetAssetUri(x.absolutePath, x.assembly)); } @@ -53,7 +53,7 @@ namespace Avalonia.Media.Fonts var compareTo = location.AbsolutePath + "." + fileName.Split('*').First(); var matchingResources = - availableResources.Where(x => x.absolutePath.Contains(compareTo) && x.absolutePath.EndsWith(".ttf")); + availableResources.Where(x => x.absolutePath.Contains(compareTo) && (x.absolutePath.EndsWith(".ttf") || x.absolutePath.EndsWith(".otf"))); return matchingResources.Select(x => GetAssetUri(x.absolutePath, x.assembly)); } From 2a7de6681b622294fabba11ca580315f34c53a60 Mon Sep 17 00:00:00 2001 From: Benedikt Schroeder Date: Sat, 27 Oct 2018 00:47:55 +0200 Subject: [PATCH 10/50] Fix FamilyKey --- .../Media/Fonts/FontFamilyKey.cs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Avalonia.Visuals/Media/Fonts/FontFamilyKey.cs b/src/Avalonia.Visuals/Media/Fonts/FontFamilyKey.cs index 9af9509e4e..99b0091139 100644 --- a/src/Avalonia.Visuals/Media/Fonts/FontFamilyKey.cs +++ b/src/Avalonia.Visuals/Media/Fonts/FontFamilyKey.cs @@ -29,19 +29,21 @@ namespace Avalonia.Media.Fonts FileName = fileNameWithoutExtension + ".ttf"; Location = new Uri(source.OriginalString.Replace("." + FileName, string.Empty), UriKind.RelativeOrAbsolute); } - - if (source.AbsolutePath.Contains(".otf")) - { - var filePathWithoutExtension = source.AbsolutePath.Replace(".otf", string.Empty); - var fileNameWithoutExtension = filePathWithoutExtension.Split('.').Last(); - FileName = fileNameWithoutExtension + ".otf"; - Location = new Uri(source.OriginalString.Replace("." + FileName, string.Empty), UriKind.RelativeOrAbsolute); - } else { - Location = source; + if (source.AbsolutePath.Contains(".otf")) + { + var filePathWithoutExtension = source.AbsolutePath.Replace(".otf", string.Empty); + var fileNameWithoutExtension = filePathWithoutExtension.Split('.').Last(); + FileName = fileNameWithoutExtension + ".otf"; + Location = new Uri(source.OriginalString.Replace("." + FileName, string.Empty), UriKind.RelativeOrAbsolute); + } + else + { + Location = source; + } } - } + } /// /// Location of stored font asset that belongs to a From dfd72016624109a9c64ff8a5e588584ef34e37a4 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Sat, 27 Oct 2018 13:48:32 +0800 Subject: [PATCH 11/50] Change the default font to system default. --- src/Avalonia.Visuals/Media/FontFamily.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Visuals/Media/FontFamily.cs b/src/Avalonia.Visuals/Media/FontFamily.cs index 70a4aee4cd..f36062f182 100644 --- a/src/Avalonia.Visuals/Media/FontFamily.cs +++ b/src/Avalonia.Visuals/Media/FontFamily.cs @@ -48,7 +48,7 @@ namespace Avalonia.Media /// /// Represents the default font family /// - public static FontFamily Default => new FontFamily("Courier New"); + public static FontFamily Default => new FontFamily("system-ui"); /// /// Gets the primary family name of the font family. From 1bb863134030f5d1ed752124dbb9b6ecb1113d5d Mon Sep 17 00:00:00 2001 From: Benedikt Schroeder Date: Sat, 27 Oct 2018 11:26:40 +0200 Subject: [PATCH 12/50] Remove extra whitespaces --- src/Avalonia.Visuals/Media/Fonts/FontFamilyKey.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Visuals/Media/Fonts/FontFamilyKey.cs b/src/Avalonia.Visuals/Media/Fonts/FontFamilyKey.cs index 99b0091139..90ccac0e46 100644 --- a/src/Avalonia.Visuals/Media/Fonts/FontFamilyKey.cs +++ b/src/Avalonia.Visuals/Media/Fonts/FontFamilyKey.cs @@ -43,7 +43,7 @@ namespace Avalonia.Media.Fonts Location = source; } } - } + } /// /// Location of stored font asset that belongs to a From 5a9e41364bfd6ec652372ccc63504d2924ddceca Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 14 Sep 2018 22:56:54 -0500 Subject: [PATCH 13/50] Convert project references to reference aggregate Avalonia.csproj --- build/Avalonia.csproj | 13 +++++++++++ build/CoreLibraries.props | 20 +++++++++++++++++ build/ReferenceCoreLibraries.props | 6 +++++ build/Rx.props | 4 ---- dirs.proj | 1 + global.json | 3 ++- samples/BindingDemo/BindingDemo.csproj | 20 +---------------- .../ControlCatalog.Desktop.csproj | 7 ------ .../ControlCatalog.NetCore.csproj | 5 ++--- samples/ControlCatalog/ControlCatalog.csproj | 7 +++--- samples/Previewer/Previewer.csproj | 16 ++------------ samples/RemoteDemo/RemoteDemo.csproj | 14 +----------- samples/RenderDemo/RenderDemo.csproj | 20 +---------------- samples/VirtualizationDemo/App.config | 22 ------------------- .../VirtualizationDemo.csproj | 20 +---------------- .../Direct3DInteropSample.csproj | 6 ++--- .../Avalonia.Animation.csproj | 3 ++- src/Avalonia.Base/Avalonia.Base.csproj | 1 + .../Avalonia.Controls.csproj | 3 ++- .../Avalonia.DesignerSupport.csproj | 3 ++- .../Avalonia.Diagnostics.csproj | 4 +++- .../Avalonia.DotNetCoreRuntime.csproj | 3 ++- .../Avalonia.DotNetFrameworkRuntime.csproj | 5 +++-- src/Avalonia.Input/Avalonia.Input.csproj | 3 ++- .../Avalonia.Interactivity.csproj | 1 + src/Avalonia.Layout/Avalonia.Layout.csproj | 3 ++- .../Avalonia.Logging.Serilog.csproj | 3 ++- .../Avalonia.ReactiveUI.csproj | 11 ++-------- src/Avalonia.Styling/Avalonia.Styling.csproj | 3 ++- .../Avalonia.Themes.Default.csproj | 3 ++- src/Avalonia.Visuals/Avalonia.Visuals.csproj | 3 ++- src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj | 3 ++- .../Avalonia.LinuxFramebuffer.csproj | 9 ++------ .../Avalonia.Markup.Xaml.csproj | 20 ++--------------- .../Avalonia.Markup/Avalonia.Markup.csproj | 1 + src/Skia/Avalonia.Skia/Avalonia.Skia.csproj | 3 ++- .../Avalonia.Direct2D1.csproj | 11 ++-------- src/Windows/Avalonia.Direct2D1/app.config | 19 ---------------- .../Avalonia.Win32.Interop.csproj | 14 ++---------- .../Avalonia.Win32/Avalonia.Win32.csproj | 1 + src/iOS/Avalonia.iOS/Avalonia.iOS.csproj | 9 +------- 41 files changed, 101 insertions(+), 225 deletions(-) create mode 100644 build/Avalonia.csproj create mode 100644 build/CoreLibraries.props create mode 100644 build/ReferenceCoreLibraries.props delete mode 100644 samples/VirtualizationDemo/App.config delete mode 100644 src/Windows/Avalonia.Direct2D1/app.config diff --git a/build/Avalonia.csproj b/build/Avalonia.csproj new file mode 100644 index 0000000000..94071f3fa3 --- /dev/null +++ b/build/Avalonia.csproj @@ -0,0 +1,13 @@ + + + netstandard2.0;net461;netcoreapp2.0 + + + + + + + + + + diff --git a/build/CoreLibraries.props b/build/CoreLibraries.props new file mode 100644 index 0000000000..154ae5db0b --- /dev/null +++ b/build/CoreLibraries.props @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/build/ReferenceCoreLibraries.props b/build/ReferenceCoreLibraries.props new file mode 100644 index 0000000000..57c663cec8 --- /dev/null +++ b/build/ReferenceCoreLibraries.props @@ -0,0 +1,6 @@ + + + + + + diff --git a/build/Rx.props b/build/Rx.props index f4affcacac..359ce53a92 100644 --- a/build/Rx.props +++ b/build/Rx.props @@ -1,9 +1,5 @@  - - - - diff --git a/dirs.proj b/dirs.proj index 3dbfe82512..3f4f8e2501 100644 --- a/dirs.proj +++ b/dirs.proj @@ -1,5 +1,6 @@ + diff --git a/global.json b/global.json index 38f403a701..4c8e07c2cb 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,7 @@ { "msbuild-sdks": { "Microsoft.Build.Traversal": "1.0.41", - "MSBuild.Sdk.Extras": "1.6.46" + "MSBuild.Sdk.Extras": "1.6.46", + "AggregatePackage.NuGet.Sdk" : "0.1.12" } } diff --git a/samples/BindingDemo/BindingDemo.csproj b/samples/BindingDemo/BindingDemo.csproj index f7568b9c51..b28ab5fd8a 100644 --- a/samples/BindingDemo/BindingDemo.csproj +++ b/samples/BindingDemo/BindingDemo.csproj @@ -4,27 +4,8 @@ netcoreapp2.0;net461 - - - - - - - - - - - - - - - - - - - @@ -32,4 +13,5 @@ + diff --git a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj index d60d087393..054de2a05f 100644 --- a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj +++ b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj @@ -6,16 +6,9 @@ - - - - - - - diff --git a/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj index ec841db5b2..ce061eabea 100644 --- a/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj +++ b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj @@ -6,10 +6,9 @@ - - - \ No newline at end of file + + diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj index 61f2443eb7..eb37c7856b 100644 --- a/samples/ControlCatalog/ControlCatalog.csproj +++ b/samples/ControlCatalog/ControlCatalog.csproj @@ -19,7 +19,7 @@ - + + + diff --git a/samples/Previewer/Previewer.csproj b/samples/Previewer/Previewer.csproj index b4dda473f2..0dbd87bf6d 100644 --- a/samples/Previewer/Previewer.csproj +++ b/samples/Previewer/Previewer.csproj @@ -8,19 +8,7 @@ %(Filename) - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/samples/RemoteDemo/RemoteDemo.csproj b/samples/RemoteDemo/RemoteDemo.csproj index 2487c66e41..653395f539 100644 --- a/samples/RemoteDemo/RemoteDemo.csproj +++ b/samples/RemoteDemo/RemoteDemo.csproj @@ -6,20 +6,8 @@ - - - - - - - - - - - - - + diff --git a/samples/RenderDemo/RenderDemo.csproj b/samples/RenderDemo/RenderDemo.csproj index f7568b9c51..b28ab5fd8a 100644 --- a/samples/RenderDemo/RenderDemo.csproj +++ b/samples/RenderDemo/RenderDemo.csproj @@ -4,27 +4,8 @@ netcoreapp2.0;net461 - - - - - - - - - - - - - - - - - - - @@ -32,4 +13,5 @@ + diff --git a/samples/VirtualizationDemo/App.config b/samples/VirtualizationDemo/App.config deleted file mode 100644 index cd4593817b..0000000000 --- a/samples/VirtualizationDemo/App.config +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/VirtualizationDemo/VirtualizationDemo.csproj b/samples/VirtualizationDemo/VirtualizationDemo.csproj index f7568b9c51..b28ab5fd8a 100644 --- a/samples/VirtualizationDemo/VirtualizationDemo.csproj +++ b/samples/VirtualizationDemo/VirtualizationDemo.csproj @@ -4,27 +4,8 @@ netcoreapp2.0;net461 - - - - - - - - - - - - - - - - - - - @@ -32,4 +13,5 @@ + diff --git a/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj b/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj index e0f3e92c74..3e318278c1 100644 --- a/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj +++ b/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj @@ -22,13 +22,11 @@ - - - - \ No newline at end of file + + diff --git a/src/Avalonia.Animation/Avalonia.Animation.csproj b/src/Avalonia.Animation/Avalonia.Animation.csproj index 46e41dd32a..3b6d1c1b33 100644 --- a/src/Avalonia.Animation/Avalonia.Animation.csproj +++ b/src/Avalonia.Animation/Avalonia.Animation.csproj @@ -1,9 +1,10 @@  netstandard2.0 + false - \ No newline at end of file + diff --git a/src/Avalonia.Base/Avalonia.Base.csproj b/src/Avalonia.Base/Avalonia.Base.csproj index 3d13169aa8..a72d20a57c 100644 --- a/src/Avalonia.Base/Avalonia.Base.csproj +++ b/src/Avalonia.Base/Avalonia.Base.csproj @@ -4,6 +4,7 @@ Avalonia.Base Avalonia True + false diff --git a/src/Avalonia.Controls/Avalonia.Controls.csproj b/src/Avalonia.Controls/Avalonia.Controls.csproj index 044ed47920..fddd4403e9 100644 --- a/src/Avalonia.Controls/Avalonia.Controls.csproj +++ b/src/Avalonia.Controls/Avalonia.Controls.csproj @@ -1,6 +1,7 @@  netstandard2.0 + false @@ -14,4 +15,4 @@ - \ No newline at end of file + diff --git a/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj b/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj index 5ccb98b64d..f9d6a8d183 100644 --- a/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj +++ b/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj @@ -1,6 +1,7 @@  netstandard2.0 + false - - + - diff --git a/packages/Avalonia.Desktop/Avalonia.Desktop.csproj b/packages/Avalonia.Desktop/Avalonia.Desktop.csproj new file mode 100644 index 0000000000..615237b162 --- /dev/null +++ b/packages/Avalonia.Desktop/Avalonia.Desktop.csproj @@ -0,0 +1,13 @@ + + + netstandard2.0 + + + + + + + + + + diff --git a/packages/Avalonia/Avalonia.csproj b/packages/Avalonia/Avalonia.csproj new file mode 100644 index 0000000000..c075c317f3 --- /dev/null +++ b/packages/Avalonia/Avalonia.csproj @@ -0,0 +1,13 @@ + + + netstandard2.0;net461;netcoreapp2.0 + + + + + + + + + + diff --git a/samples/BindingDemo/App.config b/samples/BindingDemo/App.config deleted file mode 100644 index 538be69997..0000000000 --- a/samples/BindingDemo/App.config +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/ControlCatalog.Desktop/App.config b/samples/ControlCatalog.Desktop/App.config deleted file mode 100644 index cd4593817b..0000000000 --- a/samples/ControlCatalog.Desktop/App.config +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj index ce061eabea..57619b8a67 100644 --- a/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj +++ b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj @@ -8,7 +8,10 @@ + + + diff --git a/samples/ControlCatalog/App.config b/samples/ControlCatalog/App.config deleted file mode 100644 index 0c47592f2c..0000000000 --- a/samples/ControlCatalog/App.config +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj index eb37c7856b..d0a746f87d 100644 --- a/samples/ControlCatalog/ControlCatalog.csproj +++ b/samples/ControlCatalog/ControlCatalog.csproj @@ -19,19 +19,7 @@ - - + diff --git a/samples/Previewer/Previewer.csproj b/samples/Previewer/Previewer.csproj index 0dbd87bf6d..2cdde0c945 100644 --- a/samples/Previewer/Previewer.csproj +++ b/samples/Previewer/Previewer.csproj @@ -10,5 +10,7 @@ + + diff --git a/samples/RemoteDemo/RemoteDemo.csproj b/samples/RemoteDemo/RemoteDemo.csproj index 653395f539..046999e06e 100644 --- a/samples/RemoteDemo/RemoteDemo.csproj +++ b/samples/RemoteDemo/RemoteDemo.csproj @@ -8,6 +8,7 @@ + diff --git a/samples/interop/WindowsInteropTest/App.config b/samples/interop/WindowsInteropTest/App.config deleted file mode 100644 index 4fe7131d2a..0000000000 --- a/samples/interop/WindowsInteropTest/App.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj index 66a92bb9d6..1915ab276e 100644 --- a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj +++ b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj @@ -116,9 +116,9 @@ {7062ae20-5dcc-4442-9645-8195bdece63e} Avalonia.Diagnostics - + {4a1abb09-9047-4bd5-a4ad-a055e52c5ee0} - Avalonia.DotNetFrameworkRuntime + Avalonia.DesktopRuntime {62024b2d-53eb-4638-b26b-85eeaa54866e} @@ -186,4 +186,4 @@ - \ No newline at end of file + diff --git a/src/Avalonia.DotNetFrameworkRuntime/AppBuilder.cs b/src/Avalonia.DesktopRuntime/AppBuilder.cs similarity index 100% rename from src/Avalonia.DotNetFrameworkRuntime/AppBuilder.cs rename to src/Avalonia.DesktopRuntime/AppBuilder.cs diff --git a/src/Avalonia.DesktopRuntime/Avalonia.DesktopRuntime.csproj b/src/Avalonia.DesktopRuntime/Avalonia.DesktopRuntime.csproj new file mode 100644 index 0000000000..65c4bcb4a2 --- /dev/null +++ b/src/Avalonia.DesktopRuntime/Avalonia.DesktopRuntime.csproj @@ -0,0 +1,16 @@ + + + + net461;netcoreapp2.0 + false + + + + + + + + + + + diff --git a/src/Avalonia.DotNetCoreRuntime/RuntimeInfo.cs b/src/Avalonia.DesktopRuntime/RuntimeInfo.cs similarity index 97% rename from src/Avalonia.DotNetCoreRuntime/RuntimeInfo.cs rename to src/Avalonia.DesktopRuntime/RuntimeInfo.cs index 0e70f09296..82eaadb895 100644 --- a/src/Avalonia.DotNetCoreRuntime/RuntimeInfo.cs +++ b/src/Avalonia.DesktopRuntime/RuntimeInfo.cs @@ -21,9 +21,12 @@ namespace Avalonia.Shared.PlatformSupport return new RuntimePlatformInfo { +#if NETCOREAPP2_0 IsCoreClr = true, - IsDesktop = true, +#elif NET461 IsDotNetFramework = false, +#endif + IsDesktop = true, IsMono = false, IsMobile = false, IsUnix = os != OperatingSystemType.WinNT, diff --git a/src/Avalonia.DotNetCoreRuntime/AppBuilder.cs b/src/Avalonia.DotNetCoreRuntime/AppBuilder.cs deleted file mode 100644 index 87f8a8de8d..0000000000 --- a/src/Avalonia.DotNetCoreRuntime/AppBuilder.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Reflection; -using Avalonia.Controls; -using Avalonia.Platform; -using Avalonia.Shared.PlatformSupport; - -namespace Avalonia -{ - /// - /// Initializes platform-specific services for an . - /// - public sealed class AppBuilder : AppBuilderBase - { - /// - /// Initializes a new instance of the class. - /// - public AppBuilder() - : base(new StandardRuntimePlatform(), - builder => StandardRuntimePlatformServices.Register(builder.Instance?.GetType() - ?.GetTypeInfo().Assembly)) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The instance. - public AppBuilder(Application app) : this() - { - Instance = app; - } - - /// - /// Instructs the to use the best settings for the platform. - /// - /// An instance. - public AppBuilder UsePlatformDetect() - { - var os = RuntimePlatform.GetRuntimeInfo().OperatingSystem; - //We don't have the ability to load every assembly right now, so we are - //stuck with manual configuration here - //Helpers are extracted to separate methods to take the advantage of the fact - //that CLR doesn't try to load dependencies before referencing method is jitted - if (os == OperatingSystemType.WinNT) - LoadWin32(); - else if(os==OperatingSystemType.OSX) - LoadAvaloniaNative(); - else - LoadGtk3(); - this.UseSkia(); - - return this; - } - - void LoadAvaloniaNative() => this.UseAvaloniaNative(); - void LoadWin32() => this.UseWin32(); - void LoadGtk3() => this.UseGtk3(); - } -} diff --git a/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj b/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj deleted file mode 100644 index 4f775b7381..0000000000 --- a/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - netcoreapp2.0 - $(DefineConstants);DOTNETCORE - false - - - - - - - - - - - - - - diff --git a/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj b/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj deleted file mode 100644 index 8d9b36bea3..0000000000 --- a/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - netcoreapp2.0;net461 - bin\$(Configuration)\Avalonia.DotNetFrameworkRuntime.xml - $(DefineConstants);FULLDOTNET - true - false - - - - - - - - - - - diff --git a/src/Avalonia.DotNetFrameworkRuntime/RuntimeInfo.cs b/src/Avalonia.DotNetFrameworkRuntime/RuntimeInfo.cs deleted file mode 100644 index 41545a146f..0000000000 --- a/src/Avalonia.DotNetFrameworkRuntime/RuntimeInfo.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using Avalonia.Platform; - -namespace Avalonia.Shared.PlatformSupport -{ - internal partial class StandardRuntimePlatform - { - private static readonly Lazy Info = new Lazy(() => - { - var isMono = Type.GetType("Mono.Runtime") != null; - var isUnix = Environment.OSVersion.Platform == PlatformID.Unix || - Environment.OSVersion.Platform == PlatformID.MacOSX; - return new RuntimePlatformInfo - { - IsCoreClr = false, - IsDesktop = true, - IsDotNetFramework = !isMono, - IsMono = isMono, - IsMobile = false, - IsUnix = isUnix, - OperatingSystem = isUnix ? DetectUnix() : OperatingSystemType.WinNT, - }; - }); - - [DllImport("libc")] - static extern int uname(IntPtr buf); - - static OperatingSystemType DetectUnix() - { - var buffer = Marshal.AllocHGlobal(0x1000); - uname(buffer); - var unixName = Marshal.PtrToStringAnsi(buffer); - Marshal.FreeHGlobal(buffer); - if(unixName=="Darwin") - return OperatingSystemType.OSX; - if (unixName == "Linux") - return OperatingSystemType.Linux; - return OperatingSystemType.Unknown; - } - - public RuntimePlatformInfo GetRuntimeInfo() => Info.Value; - } -} diff --git a/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.csproj b/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.csproj index b9af486ce9..1851f9fb70 100644 --- a/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.csproj +++ b/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.csproj @@ -3,7 +3,7 @@ netstandard2.0 - + diff --git a/src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj b/src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj index 8f2ef1c0d7..c4be3d4b45 100644 --- a/src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj +++ b/src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj @@ -12,5 +12,6 @@ + diff --git a/src/Linux/Avalonia.LinuxFramebuffer/Avalonia.LinuxFramebuffer.csproj b/src/Linux/Avalonia.LinuxFramebuffer/Avalonia.LinuxFramebuffer.csproj index 542e050fcd..c622bbb8c5 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/Avalonia.LinuxFramebuffer.csproj +++ b/src/Linux/Avalonia.LinuxFramebuffer/Avalonia.LinuxFramebuffer.csproj @@ -4,6 +4,7 @@ true - + + diff --git a/src/Shared/PlatformSupport/StandardRuntimePlatform.cs b/src/Shared/PlatformSupport/StandardRuntimePlatform.cs index 613cf2baf6..186c55d9eb 100644 --- a/src/Shared/PlatformSupport/StandardRuntimePlatform.cs +++ b/src/Shared/PlatformSupport/StandardRuntimePlatform.cs @@ -113,7 +113,7 @@ namespace Avalonia.Shared.PlatformSupport -#if FULLDOTNET || DOTNETCORE +#if NET461 || NETCOREAPP2_0 [DllImport("libc", SetLastError = true)] private static extern IntPtr mmap(IntPtr addr, IntPtr length, int prot, int flags, int fd, IntPtr offset); [DllImport("libc", SetLastError = true)] diff --git a/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj b/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj index 836d45c8ae..e6f5b342ab 100644 --- a/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj +++ b/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj @@ -16,6 +16,7 @@ + diff --git a/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj b/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj index 62b61001dc..70b2703f5e 100644 --- a/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj +++ b/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Windows/Avalonia.Win32.Interop/Avalonia.Win32.Interop.csproj b/src/Windows/Avalonia.Win32.Interop/Avalonia.Win32.Interop.csproj index 7c51f15db9..3405e5db49 100644 --- a/src/Windows/Avalonia.Win32.Interop/Avalonia.Win32.Interop.csproj +++ b/src/Windows/Avalonia.Win32.Interop/Avalonia.Win32.Interop.csproj @@ -7,7 +7,7 @@ true - + diff --git a/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj b/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj index 25b891119a..c0ee8f1373 100644 --- a/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj +++ b/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj @@ -14,6 +14,7 @@ + diff --git a/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj b/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj index da82a54f7a..683c256b7b 100644 --- a/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj +++ b/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj @@ -5,7 +5,7 @@ true - + diff --git a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj index dd33ee831d..7736105529 100644 --- a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj +++ b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj @@ -14,7 +14,7 @@ - + @@ -28,10 +28,6 @@ - - - - - \ No newline at end of file + diff --git a/tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj b/tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj index 42d99cc19a..ecc928461e 100644 --- a/tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj +++ b/tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj @@ -6,7 +6,7 @@ - + @@ -24,4 +24,4 @@ - \ No newline at end of file + diff --git a/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj b/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj index 4a297a340d..a9452b4def 100644 --- a/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj +++ b/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj @@ -7,7 +7,7 @@ - + @@ -26,4 +26,4 @@ - \ No newline at end of file + From 56019e8caf12bdccbb9c9ff5e871a8a81ad64648 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sat, 15 Sep 2018 15:04:43 -0500 Subject: [PATCH 15/50] Remove old NCrunch files. --- ... Avalonia.DesktopRuntime.v3.ncrunchproject} | 0 ...ia.DotNetFrameworkRuntime.v3.ncrunchproject | 6 ------ .ncrunch/Avalonia.Gtk.v3.ncrunchproject | 5 ----- .../Avalonia.HtmlRenderer.v3.ncrunchproject | 5 ----- ...valonia.Win32.NetStandard.v3.ncrunchproject | 3 --- .../Avalonia.Win32.Shared.v3.ncrunchproject | 3 --- .ncrunch/BindingTest.v3.ncrunchproject | 6 ------ .ncrunch/RemoteTest.v3.ncrunchproject | 5 ----- .ncrunch/RenderTest.v3.ncrunchproject | 8 -------- .ncrunch/VirtualizationTest.v3.ncrunchproject | 6 ------ samples/interop/WindowsInteropTest/App.config | 18 ++++++++++++++++++ 11 files changed, 18 insertions(+), 47 deletions(-) rename .ncrunch/{Avalonia.DotNetCoreRuntime.v3.ncrunchproject => Avalonia.DesktopRuntime.v3.ncrunchproject} (100%) delete mode 100644 .ncrunch/Avalonia.DotNetFrameworkRuntime.v3.ncrunchproject delete mode 100644 .ncrunch/Avalonia.Gtk.v3.ncrunchproject delete mode 100644 .ncrunch/Avalonia.HtmlRenderer.v3.ncrunchproject delete mode 100644 .ncrunch/Avalonia.Win32.NetStandard.v3.ncrunchproject delete mode 100644 .ncrunch/Avalonia.Win32.Shared.v3.ncrunchproject delete mode 100644 .ncrunch/BindingTest.v3.ncrunchproject delete mode 100644 .ncrunch/RemoteTest.v3.ncrunchproject delete mode 100644 .ncrunch/RenderTest.v3.ncrunchproject delete mode 100644 .ncrunch/VirtualizationTest.v3.ncrunchproject create mode 100644 samples/interop/WindowsInteropTest/App.config diff --git a/.ncrunch/Avalonia.DotNetCoreRuntime.v3.ncrunchproject b/.ncrunch/Avalonia.DesktopRuntime.v3.ncrunchproject similarity index 100% rename from .ncrunch/Avalonia.DotNetCoreRuntime.v3.ncrunchproject rename to .ncrunch/Avalonia.DesktopRuntime.v3.ncrunchproject diff --git a/.ncrunch/Avalonia.DotNetFrameworkRuntime.v3.ncrunchproject b/.ncrunch/Avalonia.DotNetFrameworkRuntime.v3.ncrunchproject deleted file mode 100644 index 3cd9a982c9..0000000000 --- a/.ncrunch/Avalonia.DotNetFrameworkRuntime.v3.ncrunchproject +++ /dev/null @@ -1,6 +0,0 @@ - - - False - True - - \ No newline at end of file diff --git a/.ncrunch/Avalonia.Gtk.v3.ncrunchproject b/.ncrunch/Avalonia.Gtk.v3.ncrunchproject deleted file mode 100644 index 6800b4a3fe..0000000000 --- a/.ncrunch/Avalonia.Gtk.v3.ncrunchproject +++ /dev/null @@ -1,5 +0,0 @@ - - - True - - \ No newline at end of file diff --git a/.ncrunch/Avalonia.HtmlRenderer.v3.ncrunchproject b/.ncrunch/Avalonia.HtmlRenderer.v3.ncrunchproject deleted file mode 100644 index 6800b4a3fe..0000000000 --- a/.ncrunch/Avalonia.HtmlRenderer.v3.ncrunchproject +++ /dev/null @@ -1,5 +0,0 @@ - - - True - - \ No newline at end of file diff --git a/.ncrunch/Avalonia.Win32.NetStandard.v3.ncrunchproject b/.ncrunch/Avalonia.Win32.NetStandard.v3.ncrunchproject deleted file mode 100644 index 95a483b433..0000000000 --- a/.ncrunch/Avalonia.Win32.NetStandard.v3.ncrunchproject +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.ncrunch/Avalonia.Win32.Shared.v3.ncrunchproject b/.ncrunch/Avalonia.Win32.Shared.v3.ncrunchproject deleted file mode 100644 index 95a483b433..0000000000 --- a/.ncrunch/Avalonia.Win32.Shared.v3.ncrunchproject +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.ncrunch/BindingTest.v3.ncrunchproject b/.ncrunch/BindingTest.v3.ncrunchproject deleted file mode 100644 index a4953e14f9..0000000000 --- a/.ncrunch/BindingTest.v3.ncrunchproject +++ /dev/null @@ -1,6 +0,0 @@ - - - True - True - - \ No newline at end of file diff --git a/.ncrunch/RemoteTest.v3.ncrunchproject b/.ncrunch/RemoteTest.v3.ncrunchproject deleted file mode 100644 index 319cd523ce..0000000000 --- a/.ncrunch/RemoteTest.v3.ncrunchproject +++ /dev/null @@ -1,5 +0,0 @@ - - - True - - \ No newline at end of file diff --git a/.ncrunch/RenderTest.v3.ncrunchproject b/.ncrunch/RenderTest.v3.ncrunchproject deleted file mode 100644 index e12537d535..0000000000 --- a/.ncrunch/RenderTest.v3.ncrunchproject +++ /dev/null @@ -1,8 +0,0 @@ - - - - MissingOrIgnoredProjectReference - - True - - \ No newline at end of file diff --git a/.ncrunch/VirtualizationTest.v3.ncrunchproject b/.ncrunch/VirtualizationTest.v3.ncrunchproject deleted file mode 100644 index a4953e14f9..0000000000 --- a/.ncrunch/VirtualizationTest.v3.ncrunchproject +++ /dev/null @@ -1,6 +0,0 @@ - - - True - True - - \ No newline at end of file diff --git a/samples/interop/WindowsInteropTest/App.config b/samples/interop/WindowsInteropTest/App.config new file mode 100644 index 0000000000..4fe7131d2a --- /dev/null +++ b/samples/interop/WindowsInteropTest/App.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file From acb3d46ca00a8080a69586a6817b92fbf1f65138 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sat, 15 Sep 2018 17:26:06 -0500 Subject: [PATCH 16/50] Enable generating NuGet packages via the MSBuild Pack target. --- Directory.Build.props | 5 +++++ build/LegacyProject.targets | 3 +++ build/ReferenceCoreLibraries.props | 4 ++-- build/SampleApp.props | 2 +- build/System.Drawing.Common.props | 2 +- dirs.proj | 2 +- .../ControlCatalog.Android.csproj | 1 + samples/Directory.Build.props | 5 ++++- .../WindowsInteropTest.csproj | 1 + .../Avalonia.Android/Avalonia.Android.csproj | 9 +------- .../Avalonia.AndroidTestApplication.csproj | 1 + .../Avalonia.DesignerSupport.csproj | 21 ------------------- .../Avalonia.DesktopRuntime.csproj | 4 ++++ src/Directory.Build.props | 3 ++- .../Avalonia.Win32.Interop.csproj | 1 + .../Avalonia.iOSTestApplication.csproj | 1 + src/tools/Directory.Build.props | 6 ++++++ .../Avalonia.Benchmarks.csproj | 4 ++-- .../Avalonia.DesignerSupport.TestApp.csproj | 3 ++- tests/Avalonia.Direct2D1.UnitTests/app.config | 15 ------------- .../Avalonia.Layout.UnitTests.csproj | 3 +-- tests/Avalonia.Layout.UnitTests/app.config | 15 ------------- .../Avalonia.UnitTests.csproj | 3 ++- 23 files changed, 42 insertions(+), 72 deletions(-) create mode 100644 Directory.Build.props create mode 100644 build/LegacyProject.targets create mode 100644 src/tools/Directory.Build.props delete mode 100644 tests/Avalonia.Direct2D1.UnitTests/app.config delete mode 100644 tests/Avalonia.Layout.UnitTests/app.config diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000000..50476c81f1 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,5 @@ + + + $(MSBuildThisFileDirectory)artifacts/nuget + + diff --git a/build/LegacyProject.targets b/build/LegacyProject.targets new file mode 100644 index 0000000000..0e0d49b1c2 --- /dev/null +++ b/build/LegacyProject.targets @@ -0,0 +1,3 @@ + + + diff --git a/build/ReferenceCoreLibraries.props b/build/ReferenceCoreLibraries.props index 57c663cec8..bd9d6ad843 100644 --- a/build/ReferenceCoreLibraries.props +++ b/build/ReferenceCoreLibraries.props @@ -1,6 +1,6 @@ - - + + diff --git a/build/SampleApp.props b/build/SampleApp.props index 2269cd5713..4e03e8aec9 100644 --- a/build/SampleApp.props +++ b/build/SampleApp.props @@ -3,6 +3,6 @@ WinExe - + diff --git a/build/System.Drawing.Common.props b/build/System.Drawing.Common.props index a568152bbd..2b3707d38a 100644 --- a/build/System.Drawing.Common.props +++ b/build/System.Drawing.Common.props @@ -1,5 +1,5 @@  - + diff --git a/dirs.proj b/dirs.proj index 3f4f8e2501..0c94bc9572 100644 --- a/dirs.proj +++ b/dirs.proj @@ -1,9 +1,9 @@ - + diff --git a/samples/ControlCatalog.Android/ControlCatalog.Android.csproj b/samples/ControlCatalog.Android/ControlCatalog.Android.csproj index 86030bf200..272632e7eb 100644 --- a/samples/ControlCatalog.Android/ControlCatalog.Android.csproj +++ b/samples/ControlCatalog.Android/ControlCatalog.Android.csproj @@ -155,4 +155,5 @@ + diff --git a/samples/Directory.Build.props b/samples/Directory.Build.props index 7325bab2a3..b9075b957b 100644 --- a/samples/Directory.Build.props +++ b/samples/Directory.Build.props @@ -1,3 +1,6 @@ + + false + - \ No newline at end of file + diff --git a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj index 1915ab276e..3ab30bd2b6 100644 --- a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj +++ b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj @@ -186,4 +186,5 @@ + diff --git a/src/Android/Avalonia.Android/Avalonia.Android.csproj b/src/Android/Avalonia.Android/Avalonia.Android.csproj index 3fa14055db..9c3d4fb3a1 100644 --- a/src/Android/Avalonia.Android/Avalonia.Android.csproj +++ b/src/Android/Avalonia.Android/Avalonia.Android.csproj @@ -4,14 +4,7 @@ true - - - - - - - - + diff --git a/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj b/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj index 48a7d42fc8..b493fd1ef2 100644 --- a/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj +++ b/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj @@ -153,4 +153,5 @@ + diff --git a/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj b/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj index f9d6a8d183..e732a7eef0 100644 --- a/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj +++ b/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj @@ -8,26 +8,6 @@ need change when there are breaking changes to designer support api. --> 0.7.0 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\Avalonia.DesignerSupport.xml - CS1591;CS0067 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Avalonia.DesignerSupport.xml CS1591 @@ -43,6 +23,5 @@ - diff --git a/src/Avalonia.DesktopRuntime/Avalonia.DesktopRuntime.csproj b/src/Avalonia.DesktopRuntime/Avalonia.DesktopRuntime.csproj index 65c4bcb4a2..b681d2b1ae 100644 --- a/src/Avalonia.DesktopRuntime/Avalonia.DesktopRuntime.csproj +++ b/src/Avalonia.DesktopRuntime/Avalonia.DesktopRuntime.csproj @@ -11,6 +11,10 @@ + + + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index d18a0e72ba..a3f0c01a51 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,4 +1,5 @@ + - \ No newline at end of file + diff --git a/src/Windows/Avalonia.Win32.Interop/Avalonia.Win32.Interop.csproj b/src/Windows/Avalonia.Win32.Interop/Avalonia.Win32.Interop.csproj index 3405e5db49..0d0dd98a77 100644 --- a/src/Windows/Avalonia.Win32.Interop/Avalonia.Win32.Interop.csproj +++ b/src/Windows/Avalonia.Win32.Interop/Avalonia.Win32.Interop.csproj @@ -5,6 +5,7 @@ true true true + Avalonia.Win32.Interoperability diff --git a/src/iOS/Avalonia.iOSTestApplication/Avalonia.iOSTestApplication.csproj b/src/iOS/Avalonia.iOSTestApplication/Avalonia.iOSTestApplication.csproj index 9a6b624a66..34c8ae7605 100644 --- a/src/iOS/Avalonia.iOSTestApplication/Avalonia.iOSTestApplication.csproj +++ b/src/iOS/Avalonia.iOSTestApplication/Avalonia.iOSTestApplication.csproj @@ -187,4 +187,5 @@ + diff --git a/src/tools/Directory.Build.props b/src/tools/Directory.Build.props new file mode 100644 index 0000000000..6ce26913b0 --- /dev/null +++ b/src/tools/Directory.Build.props @@ -0,0 +1,6 @@ + + + + false + + diff --git a/tests/Avalonia.Benchmarks/Avalonia.Benchmarks.csproj b/tests/Avalonia.Benchmarks/Avalonia.Benchmarks.csproj index 01729f4899..6550a23b7b 100644 --- a/tests/Avalonia.Benchmarks/Avalonia.Benchmarks.csproj +++ b/tests/Avalonia.Benchmarks/Avalonia.Benchmarks.csproj @@ -1,9 +1,9 @@  Exe - netcoreapp2.0 netcoreapp2.0 Exe + false @@ -23,4 +23,4 @@ - \ No newline at end of file + diff --git a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj index 7736105529..d2de6cd27d 100644 --- a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj +++ b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj @@ -1,7 +1,8 @@  Exe - netcoreapp2.0 + netcoreapp2.0 + false diff --git a/tests/Avalonia.Direct2D1.UnitTests/app.config b/tests/Avalonia.Direct2D1.UnitTests/app.config deleted file mode 100644 index e4df6c253e..0000000000 --- a/tests/Avalonia.Direct2D1.UnitTests/app.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/tests/Avalonia.Layout.UnitTests/Avalonia.Layout.UnitTests.csproj b/tests/Avalonia.Layout.UnitTests/Avalonia.Layout.UnitTests.csproj index ec8f1e6e8d..63f7f3ec0e 100644 --- a/tests/Avalonia.Layout.UnitTests/Avalonia.Layout.UnitTests.csproj +++ b/tests/Avalonia.Layout.UnitTests/Avalonia.Layout.UnitTests.csproj @@ -16,7 +16,6 @@ - @@ -26,4 +25,4 @@ - \ No newline at end of file + diff --git a/tests/Avalonia.Layout.UnitTests/app.config b/tests/Avalonia.Layout.UnitTests/app.config deleted file mode 100644 index 01de951354..0000000000 --- a/tests/Avalonia.Layout.UnitTests/app.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj b/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj index c189bbbe66..f065fcb63d 100644 --- a/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj +++ b/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj @@ -3,6 +3,7 @@ netstandard2.0 false Library + false @@ -20,4 +21,4 @@ - \ No newline at end of file + From 40a901347a057259218f137039e04d6fb7e9d2ac Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sat, 15 Sep 2018 18:34:27 -0500 Subject: [PATCH 17/50] Update Cake to build packages via MSBuild. --- build.cake | 148 +++-- dirs.proj | 9 + packages.cake | 508 ------------------ .../ControlCatalog.iOS.csproj | 1 + .../Avalonia.DesignerSupport.TestApp.csproj | 1 + 5 files changed, 83 insertions(+), 584 deletions(-) delete mode 100644 packages.cake diff --git a/build.cake b/build.cake index fbd915461f..0a54c0f0b5 100644 --- a/build.cake +++ b/build.cake @@ -21,32 +21,14 @@ using System.Linq; /////////////////////////////////////////////////////////////////////////////// #load "./parameters.cake" -#load "./packages.cake" - -////////////////////////////////////////////////////////////////////// -// PARAMETERS -////////////////////////////////////////////////////////////////////// - -class AvaloniaBuildData -{ - public AvaloniaBuildData(Parameters parameters, Packages packages) - { - Parameters = parameters; - Packages = packages; - } - - public Parameters Parameters { get; } - public Packages Packages { get; } -} /////////////////////////////////////////////////////////////////////////////// // SETUP /////////////////////////////////////////////////////////////////////////////// -Setup(context => +Setup(context => { var parameters = new Parameters(context); - var buildContext = new AvaloniaBuildData(parameters, new Packages(context, parameters)); Information("Building version {0} of Avalonia ({1}) using version {2} of Cake.", parameters.Version, @@ -73,14 +55,14 @@ Setup(context => Information("IsMyGetRelease: " + parameters.IsMyGetRelease); Information("IsNuGetRelease: " + parameters.IsNuGetRelease); - return buildContext; + return parameters; }); /////////////////////////////////////////////////////////////////////////////// // TEARDOWN /////////////////////////////////////////////////////////////////////////////// -Teardown((context, buildContext) => +Teardown((context, buildContext) => { Information("Finished running tasks."); }); @@ -90,13 +72,12 @@ Teardown((context, buildContext) => /////////////////////////////////////////////////////////////////////////////// Task("Clean-Impl") - .Does(data => + .Does(data => { - CleanDirectories(data.Parameters.BuildDirs); - CleanDirectory(data.Parameters.ArtifactsDir); - CleanDirectory(data.Parameters.NugetRoot); - CleanDirectory(data.Parameters.ZipRoot); - CleanDirectory(data.Parameters.BinRoot); + CleanDirectories(data.BuildDirs); + CleanDirectory(data.ArtifactsDir); + CleanDirectory(data.NugetRoot); + CleanDirectory(data.ZipRoot); }); void DotNetCoreBuild(Parameters parameters) @@ -110,12 +91,12 @@ void DotNetCoreBuild(Parameters parameters) } Task("Build-Impl") - .Does(data => + .Does(data => { - if(data.Parameters.IsRunningOnWindows) + if(data.IsRunningOnWindows) { - MSBuild(data.Parameters.MSBuildSolution, settings => { - settings.SetConfiguration(data.Parameters.Configuration); + MSBuild(data.MSBuildSolution, settings => { + settings.SetConfiguration(data.Configuration); settings.SetVerbosity(Verbosity.Minimal); settings.WithProperty("iOSRoslynPathHackRequired", "true"); settings.UseToolVersion(MSBuildToolVersion.VS2017); @@ -124,7 +105,7 @@ Task("Build-Impl") } else { - DotNetCoreBuild(data.Parameters); + DotNetCoreBuild(data); } }); @@ -151,45 +132,45 @@ void RunCoreTest(string project, Parameters parameters, bool coreOnly = false) } Task("Run-Unit-Tests-Impl") - .WithCriteria((context, data) => !data.Parameters.SkipTests) - .Does(data => + .WithCriteria((context, data) => !data.SkipTests) + .Does(data => { - RunCoreTest("./tests/Avalonia.Base.UnitTests", data.Parameters, false); - RunCoreTest("./tests/Avalonia.Controls.UnitTests", data.Parameters, false); - RunCoreTest("./tests/Avalonia.Input.UnitTests", data.Parameters, false); - RunCoreTest("./tests/Avalonia.Interactivity.UnitTests", data.Parameters, false); - RunCoreTest("./tests/Avalonia.Layout.UnitTests", data.Parameters, false); - RunCoreTest("./tests/Avalonia.Markup.UnitTests", data.Parameters, false); - RunCoreTest("./tests/Avalonia.Markup.Xaml.UnitTests", data.Parameters, false); - RunCoreTest("./tests/Avalonia.Styling.UnitTests", data.Parameters, false); - RunCoreTest("./tests/Avalonia.Visuals.UnitTests", data.Parameters, false); - RunCoreTest("./tests/Avalonia.Skia.UnitTests", data.Parameters, false); - RunCoreTest("./tests/Avalonia.ReactiveUI.UnitTests", data.Parameters, false); - if (data.Parameters.IsRunningOnWindows) + RunCoreTest("./tests/Avalonia.Base.UnitTests", data, false); + RunCoreTest("./tests/Avalonia.Controls.UnitTests", data, false); + RunCoreTest("./tests/Avalonia.Input.UnitTests", data, false); + RunCoreTest("./tests/Avalonia.Interactivity.UnitTests", data, false); + RunCoreTest("./tests/Avalonia.Layout.UnitTests", data, false); + RunCoreTest("./tests/Avalonia.Markup.UnitTests", data, false); + RunCoreTest("./tests/Avalonia.Markup.Xaml.UnitTests", data, false); + RunCoreTest("./tests/Avalonia.Styling.UnitTests", data, false); + RunCoreTest("./tests/Avalonia.Visuals.UnitTests", data, false); + RunCoreTest("./tests/Avalonia.Skia.UnitTests", data, false); + RunCoreTest("./tests/Avalonia.ReactiveUI.UnitTests", data, false); + if (data.IsRunningOnWindows) { - RunCoreTest("./tests/Avalonia.Direct2D1.UnitTests", data.Parameters, false); + RunCoreTest("./tests/Avalonia.Direct2D1.UnitTests", data, false); } }); Task("Run-Designer-Tests-Impl") - .WithCriteria((context, data) => !data.Parameters.SkipTests) - .Does(data => + .WithCriteria((context, data) => !data.SkipTests) + .Does(data => { - RunCoreTest("./tests/Avalonia.DesignerSupport.Tests", data.Parameters, false); + RunCoreTest("./tests/Avalonia.DesignerSupport.Tests", data, false); }); Task("Run-Render-Tests-Impl") - .WithCriteria((context, data) => !data.Parameters.SkipTests) - .WithCriteria((context, data) => data.Parameters.IsRunningOnWindows) - .Does(data => + .WithCriteria((context, data) => !data.SkipTests) + .WithCriteria((context, data) => data.IsRunningOnWindows) + .Does(data => { - RunCoreTest("./tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj", data.Parameters, true); - RunCoreTest("./tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj", data.Parameters, true); + RunCoreTest("./tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj", data, true); + RunCoreTest("./tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj", data, true); }); Task("Run-Leak-Tests-Impl") - .WithCriteria((context, data) => !data.Parameters.SkipTests) - .WithCriteria((context, data) => data.Parameters.IsRunningOnWindows) + .WithCriteria((context, data) => !data.SkipTests) + .WithCriteria((context, data) => data.IsRunningOnWindows) .Does(() => { var dotMemoryUnit = Context.Tools.Resolve("dotMemoryUnit.exe"); @@ -209,34 +190,49 @@ Task("Run-Leak-Tests-Impl") } }); -Task("Copy-Files-Impl") - .Does(data => -{ - CopyFiles(data.Packages.BinFiles, data.Parameters.BinRoot); -}); - Task("Zip-Files-Impl") - .Does(data => + .Does(data => { - Zip(data.Parameters.BinRoot, data.Parameters.ZipCoreArtifacts); + Zip(data.BinRoot, data.ZipCoreArtifacts); - Zip(data.Parameters.NugetRoot, data.Parameters.ZipNuGetArtifacts); + Zip(data.NugetRoot, data.ZipNuGetArtifacts); - Zip(data.Parameters.ZipSourceControlCatalogDesktopDirs, - data.Parameters.ZipTargetControlCatalogDesktopDirs, - GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.dll") + - GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.config") + - GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.so") + - GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.dylib") + - GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.exe")); + Zip(data.ZipSourceControlCatalogDesktopDirs, + data.ZipTargetControlCatalogDesktopDirs, + GetFiles(data.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.dll") + + GetFiles(data.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.config") + + GetFiles(data.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.so") + + GetFiles(data.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.dylib") + + GetFiles(data.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.exe")); }); +void DotNetCorePack(Parameters parameters) +{ + var settings = new DotNetCorePackSettings + { + Configuration = parameters.Configuration, + }; + + DotNetCorePack(parameters.MSBuildSolution, settings); +} + Task("Create-NuGet-Packages-Impl") - .Does(data => + .Does(data => { - foreach(var nuspec in data.Packages.NuspecNuGetSettings) + if(data.IsRunningOnWindows) + { + MSBuild(data.MSBuildSolution, settings => { + settings.SetConfiguration(data.Configuration); + settings.SetVerbosity(Verbosity.Minimal); + settings.WithProperty("iOSRoslynPathHackRequired", "true"); + settings.UseToolVersion(MSBuildToolVersion.VS2017); + settings.WithRestore(); + settings.WithTarget("Pack"); + }); + } + else { - NuGetPack(nuspec); + DotNetCorePack(data); } }); diff --git a/dirs.proj b/dirs.proj index 0c94bc9572..eac8e13870 100644 --- a/dirs.proj +++ b/dirs.proj @@ -24,4 +24,13 @@ + + + + diff --git a/packages.cake b/packages.cake deleted file mode 100644 index 4d6b5f6771..0000000000 --- a/packages.cake +++ /dev/null @@ -1,508 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Xml.Linq; - -public class Packages -{ - public List NuspecNuGetSettings { get; private set; } - public FilePath[] NugetPackages { get; private set; } - public FilePath[] BinFiles { get; private set; } - public string NugetPackagesDir {get; private set;} - public string SkiaSharpVersion {get; private set; } - public string SkiaSharpLinuxVersion {get; private set; } - public Dictionary>> PackageVersions{get; private set;} - - class DependencyBuilder : List - { - Packages _parent; - - public DependencyBuilder(Packages parent) - { - _parent = parent; - } - - string GetVersion(string name) - { - return _parent.PackageVersions[name].First().Item1; - } - - public DependencyBuilder Dep(string name, params string[] fws) - { - if(fws.Length == 0) - Add(new NuSpecDependency() { Id = name, Version = GetVersion(name) }); - foreach(var fw in fws) - Add(new NuSpecDependency() { Id = name, TargetFramework = fw, Version = GetVersion(name) }); - return this; - } - public DependencyBuilder Deps(string[] fws, params string[] deps) - { - foreach(var fw in fws) - foreach(var name in deps) - Add(new NuSpecDependency() { Id = name, TargetFramework = fw, Version = GetVersion(name) }); - return this; - } - } - - public Packages(ICakeContext context, Parameters parameters) - { - // NUGET NUSPECS - context.Information("Getting git modules:"); - - var ignoredSubModulesPaths = System.IO.File.ReadAllLines(".git/config").Where(m=>m.StartsWith("[submodule ")).Select(m => - { - var path = m.Split(' ')[1].Trim("\"[] \t".ToArray()); - context.Information(path); - return ((DirectoryPath)context.Directory(path)).FullPath; - }).ToList(); - - var normalizePath = new Func( - path => path.Replace(System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar).ToUpperInvariant()); - - // Key: Package Id - // Value is Tuple where Item1: Package Version, Item2: The *.csproj/*.props file path. - var packageVersions = new Dictionary>>(); - PackageVersions = packageVersions; - System.IO.Directory.EnumerateFiles(((DirectoryPath)context.Directory("./build")).FullPath, - "*.props", SearchOption.AllDirectories).ToList().ForEach(fileName => - { - if (!ignoredSubModulesPaths.Any(i => normalizePath(fileName).Contains(normalizePath(i)))) - { - var xdoc = XDocument.Load(fileName); - foreach (var reference in xdoc.Descendants().Where(x => x.Name.LocalName == "PackageReference")) - { - var name = reference.Attribute("Include").Value; - var versionAttribute = reference.Attribute("Version"); - var version = versionAttribute != null - ? versionAttribute.Value - : reference.Elements().First(x=>x.Name.LocalName == "Version").Value; - IList> versions; - packageVersions.TryGetValue(name, out versions); - if (versions == null) - { - versions = new List>(); - packageVersions[name] = versions; - } - versions.Add(Tuple.Create(version, fileName)); - } - } - }); - - context.Information("Checking installed NuGet package dependencies versions:"); - - packageVersions.ToList().ForEach(package => - { - var packageVersion = package.Value.First().Item1; - bool isValidVersion = package.Value.All(x => x.Item1 == packageVersion); - if (!isValidVersion) - { - context.Information("Error: package {0} has multiple versions installed:", package.Key); - foreach (var v in package.Value) - { - context.Information("{0}, file: {1}", v.Item1, v.Item2); - } - throw new Exception("Detected multiple NuGet package version installed for different projects."); - } - }); - - context.Information("Setting NuGet package dependencies versions:"); - - var SerilogVersion = packageVersions["Serilog"].FirstOrDefault().Item1; - var SerilogSinksDebugVersion = packageVersions["Serilog.Sinks.Debug"].FirstOrDefault().Item1; - var SerilogSinksTraceVersion = packageVersions["Serilog.Sinks.Trace"].FirstOrDefault().Item1; - var SystemReactiveVersion = packageVersions["System.Reactive"].FirstOrDefault().Item1; - var ReactiveUIVersion = packageVersions["reactiveui"].FirstOrDefault().Item1; - var SystemValueTupleVersion = packageVersions["System.ValueTuple"].FirstOrDefault().Item1; - SkiaSharpVersion = packageVersions["SkiaSharp"].FirstOrDefault().Item1; - SkiaSharpLinuxVersion = packageVersions["Avalonia.Skia.Linux.Natives"].FirstOrDefault().Item1; - var SharpDXVersion = packageVersions["SharpDX"].FirstOrDefault().Item1; - var SharpDXDirect2D1Version = packageVersions["SharpDX.Direct2D1"].FirstOrDefault().Item1; - var SharpDXDirect3D11Version = packageVersions["SharpDX.Direct3D11"].FirstOrDefault().Item1; - var SharpDXDirect3D9Version = packageVersions["SharpDX.Direct3D9"].FirstOrDefault().Item1; - var SharpDXDXGIVersion = packageVersions["SharpDX.DXGI"].FirstOrDefault().Item1; - var SystemMemoryVersion = packageVersions["System.Memory"].FirstOrDefault().Item1; - - context.Information("Package: Serilog, version: {0}", SerilogVersion); - context.Information("Package: System.Reactive, version: {0}", SystemReactiveVersion); - context.Information("Package: reactiveui, version: {0}", ReactiveUIVersion); - context.Information("Package: System.ValueTuple, version: {0}", SystemValueTupleVersion); - context.Information("Package: SkiaSharp, version: {0}", SkiaSharpVersion); - context.Information("Package: Avalonia.Skia.Linux.Natives, version: {0}", SkiaSharpLinuxVersion); - context.Information("Package: SharpDX, version: {0}", SharpDXVersion); - context.Information("Package: SharpDX.Direct2D1, version: {0}", SharpDXDirect2D1Version); - context.Information("Package: SharpDX.Direct3D11, version: {0}", SharpDXDirect3D11Version); - context.Information("Package: SharpDX.Direct3D9, version: {0}", SharpDXDirect3D9Version); - context.Information("Package: SharpDX.DXGI, version: {0}", SharpDXDXGIVersion); - context.Information("Package: System.Memory, version: {0}", SystemMemoryVersion); - - var nugetPackagesDir = System.Environment.GetEnvironmentVariable("NUGET_HOME") - ?? System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("USERPROFILE") ?? System.Environment.GetEnvironmentVariable("HOME"), ".nuget"); - - NugetPackagesDir = System.IO.Path.Combine(nugetPackagesDir, "packages"); - - var SetNuGetNuspecCommonProperties = new Action ((nuspec) => { - nuspec.Version = parameters.Version; - nuspec.Authors = new [] { "Avalonia Team" }; - nuspec.Owners = new [] { "stevenk" }; - nuspec.LicenseUrl = new Uri("http://opensource.org/licenses/MIT"); - nuspec.ProjectUrl = new Uri("https://github.com/AvaloniaUI/Avalonia/"); - nuspec.RequireLicenseAcceptance = false; - nuspec.Symbols = false; - nuspec.NoPackageAnalysis = true; - nuspec.Description = "The Avalonia UI framework"; - nuspec.Copyright = "Copyright 2018"; - nuspec.Tags = new [] { "Avalonia" }; - }); - - var coreLibraries = new string[][] - { - new [] { "./src/", "Avalonia.Animation"}, - new [] { "./src/", "Avalonia.Base"}, - new [] { "./src/", "Avalonia.Controls"}, - new [] { "./src/", "Avalonia.DesignerSupport"}, - new [] { "./src/", "Avalonia.Diagnostics"}, - new [] { "./src/", "Avalonia.Input"}, - new [] { "./src/", "Avalonia.Interactivity"}, - new [] { "./src/", "Avalonia.Layout"}, - new [] { "./src/", "Avalonia.Logging.Serilog"}, - new [] { "./src/", "Avalonia.Visuals"}, - new [] { "./src/", "Avalonia.Styling"}, - new [] { "./src/", "Avalonia.OpenGL"}, - new [] { "./src/", "Avalonia.Themes.Default"}, - new [] { "./src/Markup/", "Avalonia.Markup"}, - new [] { "./src/Markup/", "Avalonia.Markup.Xaml"}, - }; - - var extensionsToPack = new [] {".dll", ".xml", ".pdb"}; - - var coreLibrariesFiles = coreLibraries - .SelectMany(lib => extensionsToPack.Select(ext => new {lib, ext})) - .Select((lib) => { - return (FilePath)context.File(lib.lib[0] + lib.lib[1] + "/bin/" + parameters.DirSuffix + "/netstandard2.0/" + lib.lib[1] + lib.ext); - }).ToList(); - - var coreLibrariesNuSpecContent = coreLibrariesFiles.Select((file) => { - return new NuSpecContent { - Source = file.FullPath, Target = "lib/netstandard2.0" - }; - }); - - var netFrameworkCoreLibrariesNuSpecContent = coreLibrariesFiles.Select((file) => { - return new NuSpecContent { - Source = file.FullPath, Target = "lib/net461" - }; - }); - - var netcoreappCoreLibrariesNuSpecContent = coreLibrariesFiles.Select((file) => { - return new NuSpecContent { - Source = file.FullPath, Target = "lib/netcoreapp2.0" - }; - }); - - var netFrameworkRuntimePlatform = extensionsToPack.Select(libSuffix => { - return new NuSpecContent { - Source = ((FilePath)context.File("./src/Avalonia.DotNetFrameworkRuntime/bin/" + parameters.DirSuffix + "/net461/Avalonia.DotNetFrameworkRuntime" + libSuffix)).FullPath, - Target = "lib/net461" - }; - }); - - var netCoreRuntimePlatform = extensionsToPack.Select(libSuffix => { - return new NuSpecContent { - Source = ((FilePath)context.File("./src/Avalonia.DotNetCoreRuntime/bin/" + parameters.DirSuffix + "/netcoreapp2.0/Avalonia.DotNetCoreRuntime" + libSuffix)).FullPath, - Target = "lib/netcoreapp2.0" - }; - }); - - var toolHostApp = new NuSpecContent{ - Source = ((FilePath)context.File("./src/tools/Avalonia.Designer.HostApp/bin/" + parameters.DirSuffix + "/netcoreapp2.0/Avalonia.Designer.HostApp.dll")).FullPath, - Target = "tools/netcoreapp2.0/previewer" - }; - - var toolHostAppNetFx = new NuSpecContent{ - Source = ((FilePath)context.File("./src/tools/Avalonia.Designer.HostApp.NetFx/bin/" + parameters.DirSuffix + "/net461/Avalonia.Designer.HostApp.exe")).FullPath, - Target = "tools/net461/previewer" - }; - - var toolsContent = new[] { toolHostApp, toolHostAppNetFx }; - var coreFiles = coreLibrariesNuSpecContent - .Concat(netFrameworkCoreLibrariesNuSpecContent).Concat(netFrameworkRuntimePlatform) - .Concat(netcoreappCoreLibrariesNuSpecContent).Concat(netCoreRuntimePlatform) - .Concat(toolsContent) - .ToList(); - - var nuspecNuGetSettingsCore = new [] - { - /////////////////////////////////////////////////////////////////////////////// - // Avalonia - /////////////////////////////////////////////////////////////////////////////// - new NuGetPackSettings() - { - Id = "Avalonia", - Dependencies = new DependencyBuilder(this) - { - new NuSpecDependency() { Id = "Avalonia.Remote.Protocol", Version = parameters.Version, TargetFramework="netstandard2.0" }, - new NuSpecDependency() { Id = "Avalonia.Remote.Protocol", Version = parameters.Version, TargetFramework="netcoreapp2.0" }, - new NuSpecDependency() { Id = "Avalonia.Remote.Protocol", Version = parameters.Version, TargetFramework="net461" }, - new NuSpecDependency() { Id = "System.ValueTuple", Version = SystemValueTupleVersion, TargetFramework="net461" }, - new NuSpecDependency() { Id = "System.ComponentModel.TypeConverter", Version = "4.3.0", TargetFramework="net461" }, - new NuSpecDependency() { Id = "NETStandard.Library", Version = "2.0.0", TargetFramework="net461"} - } - .Deps(new string[]{"netstandard2.0", "netcoreapp2.0", "net461"}, - "Serilog", "Serilog.Sinks.Debug", "Serilog.Sinks.Trace", - "System.Memory", "System.Reactive", "System.ComponentModel.Annotations") - .ToArray(), - Files = coreFiles, - BasePath = context.Directory("./"), - OutputDirectory = parameters.NugetRoot - }, - /////////////////////////////////////////////////////////////////////////////// - // Avalonia.ReactiveUI - /////////////////////////////////////////////////////////////////////////////// - new NuGetPackSettings() - { - Id = "Avalonia.ReactiveUI", - Dependencies = new DependencyBuilder(this) - { - new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }, - }.Deps(new string[] {null}, "reactiveui"), - Files = new [] - { - new NuSpecContent { Source = "Avalonia.ReactiveUI.dll", Target = "lib/netstandard2.0" } - }, - BasePath = context.Directory("./src/Avalonia.ReactiveUI/bin/" + parameters.DirSuffix + "/netstandard2.0"), - OutputDirectory = parameters.NugetRoot - }, - /////////////////////////////////////////////////////////////////////////////// - // Avalonia.Remote.Protocol - /////////////////////////////////////////////////////////////////////////////// - new NuGetPackSettings() - { - Id = "Avalonia.Remote.Protocol", - Files = new [] - { - new NuSpecContent { Source = "Avalonia.Remote.Protocol.dll", Target = "lib/netstandard2.0" } - }, - BasePath = context.Directory("./src/Avalonia.Remote.Protocol/bin/" + parameters.DirSuffix + "/netstandard2.0"), - OutputDirectory = parameters.NugetRoot - }, - }; - - var nuspecNuGetSettingsMobile = new [] - { - /////////////////////////////////////////////////////////////////////////////// - // Avalonia.Android - /////////////////////////////////////////////////////////////////////////////// - new NuGetPackSettings() - { - Id = "Avalonia.Android", - Dependencies = new [] - { - new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }, - new NuSpecDependency() { Id = "Avalonia.Skia", Version = parameters.Version } - }, - Files = new [] - { - new NuSpecContent { Source = "Avalonia.Android.dll", Target = "lib/MonoAndroid10" } - }, - BasePath = context.Directory("./src/Android/Avalonia.Android/bin/" + parameters.DirSuffix + "/monoandroid44/MonoAndroid44/"), - OutputDirectory = parameters.NugetRoot - }, - /////////////////////////////////////////////////////////////////////////////// - // Avalonia.iOS - /////////////////////////////////////////////////////////////////////////////// - new NuGetPackSettings() - { - Id = "Avalonia.iOS", - Dependencies = new [] - { - new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }, - new NuSpecDependency() { Id = "Avalonia.Skia", Version = parameters.Version } - }, - Files = new [] - { - new NuSpecContent { Source = "Avalonia.iOS.dll", Target = "lib/Xamarin.iOS10" } - }, - BasePath = context.Directory("./src/iOS/Avalonia.iOS/bin/" + parameters.DirSuffix + "/xamarin.ios10/"), - OutputDirectory = parameters.NugetRoot - } - }; - - var nuspecNuGetSettingsDesktop = new [] - { - /////////////////////////////////////////////////////////////////////////////// - // Avalonia.Win32 - /////////////////////////////////////////////////////////////////////////////// - new NuGetPackSettings() - { - Id = "Avalonia.Win32", - Dependencies = new DependencyBuilder(this) - { - new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version } - }.Deps(new string[]{null}, "System.Drawing.Common"), - Files = new [] - { - new NuSpecContent { Source = "Avalonia.Win32/bin/" + parameters.DirSuffix + "/netstandard2.0/Avalonia.Win32.dll", Target = "lib/netstandard2.0" } - }, - BasePath = context.Directory("./src/Windows"), - OutputDirectory = parameters.NugetRoot - }, - /////////////////////////////////////////////////////////////////////////////// - // Avalonia.Direct2D1 - /////////////////////////////////////////////////////////////////////////////// - new NuGetPackSettings() - { - Id = "Avalonia.Direct2D1", - Dependencies = new [] - { - new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }, - new NuSpecDependency() { Id = "SharpDX", Version = SharpDXVersion }, - new NuSpecDependency() { Id = "SharpDX.Direct2D1", Version = SharpDXDirect2D1Version }, - new NuSpecDependency() { Id = "SharpDX.Direct3D11", Version = SharpDXDirect3D11Version }, - new NuSpecDependency() { Id = "SharpDX.DXGI", Version = SharpDXDXGIVersion } - }, - Files = new [] - { - new NuSpecContent { Source = "Avalonia.Direct2D1.dll", Target = "lib/netstandard2.0" } - }, - BasePath = context.Directory("./src/Windows/Avalonia.Direct2D1/bin/" + parameters.DirSuffix + "/netstandard2.0"), - OutputDirectory = parameters.NugetRoot - }, - /////////////////////////////////////////////////////////////////////////////// - // Avalonia.Gtk3 - /////////////////////////////////////////////////////////////////////////////// - new NuGetPackSettings() - { - Id = "Avalonia.Gtk3", - Dependencies = new [] - { - new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version } - }, - Files = new [] - { - new NuSpecContent { Source = "Avalonia.Gtk3.dll", Target = "lib/netstandard2.0" } - }, - BasePath = context.Directory("./src/Gtk/Avalonia.Gtk3/bin/" + parameters.DirSuffix + "/netstandard2.0"), - OutputDirectory = parameters.NugetRoot - }, - /////////////////////////////////////////////////////////////////////////////// - // Avalonia.Skia - /////////////////////////////////////////////////////////////////////////////// - new NuGetPackSettings() - { - Id = "Avalonia.Skia", - Dependencies = new [] - { - new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }, - new NuSpecDependency() { Id = "SkiaSharp", Version = SkiaSharpVersion }, - new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version, TargetFramework="netcoreapp2.0" }, - new NuSpecDependency() { Id = "SkiaSharp", Version = SkiaSharpVersion, TargetFramework="netcoreapp2.0" }, - new NuSpecDependency() { Id = "Avalonia.Skia.Linux.Natives", Version = SkiaSharpLinuxVersion, TargetFramework="netcoreapp2.0" }, - new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version, TargetFramework="net461" }, - new NuSpecDependency() { Id = "SkiaSharp", Version = SkiaSharpVersion, TargetFramework="net461" }, - new NuSpecDependency() { Id = "Avalonia.Skia.Linux.Natives", Version = SkiaSharpLinuxVersion, TargetFramework="net461" } - }, - Files = new [] - { - new NuSpecContent { Source = "Avalonia.Skia.dll", Target = "lib/netstandard2.0" } - }, - BasePath = context.Directory("./src/Skia/Avalonia.Skia/bin/" + parameters.DirSuffix + "/netstandard2.0"), - OutputDirectory = parameters.NugetRoot - }, - /////////////////////////////////////////////////////////////////////////////// - // Avalonia.Desktop - /////////////////////////////////////////////////////////////////////////////// - new NuGetPackSettings() - { - Id = "Avalonia.Desktop", - Dependencies = new [] - { - new NuSpecDependency() { Id = "Avalonia.Direct2D1", Version = parameters.Version }, - new NuSpecDependency() { Id = "Avalonia.Win32", Version = parameters.Version }, - new NuSpecDependency() { Id = "Avalonia.Skia", Version = parameters.Version }, - new NuSpecDependency() { Id = "Avalonia.Gtk3", Version = parameters.Version }, - new NuSpecDependency() { Id = "Avalonia.Native", Version = parameters.Version } - }, - Files = new NuSpecContent[] - { - new NuSpecContent { Source = "licence.md", Target = "" } - }, - BasePath = context.Directory("./"), - OutputDirectory = parameters.NugetRoot - }, - /////////////////////////////////////////////////////////////////////////////// - // Avalonia.LinuxFramebuffer - /////////////////////////////////////////////////////////////////////////////// - new NuGetPackSettings() - { - Id = "Avalonia.LinuxFramebuffer", - Dependencies = new [] - { - new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }, - new NuSpecDependency() { Id = "Avalonia.Skia", Version = parameters.Version } - }, - Files = new [] - { - new NuSpecContent { Source = "Avalonia.LinuxFramebuffer/bin/" + parameters.DirSuffix + "/netstandard2.0/Avalonia.LinuxFramebuffer.dll", Target = "lib/netstandard2.0" } - }, - BasePath = context.Directory("./src/Linux/"), - OutputDirectory = parameters.NugetRoot - }, - /////////////////////////////////////////////////////////////////////////////// - // Avalonia.Native - /////////////////////////////////////////////////////////////////////////////// - new NuGetPackSettings() - { - Id = "Avalonia.Native", - Dependencies = new [] - { - new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version } - }, - Files = new [] - { - new NuSpecContent { Source = "Avalonia.Native.dll", Target = "lib/netstandard2.0" } - }, - BasePath = context.Directory("./src/Avalonia.Native/bin/" + parameters.DirSuffix + "/netstandard2.0"), - OutputDirectory = parameters.NugetRoot - }, - }; - - var nuspecNuGetSettingInterop = new NuGetPackSettings() - { - Id = "Avalonia.Win32.Interoperability", - Dependencies = new [] - { - new NuSpecDependency() { Id = "Avalonia.Win32", Version = parameters.Version }, - new NuSpecDependency() { Id = "Avalonia.Direct2D1", Version = parameters.Version }, - new NuSpecDependency() { Id = "SharpDX.Direct3D9", Version = SharpDXDirect3D9Version }, - }, - Files = new [] - { - new NuSpecContent { Source = "Avalonia.Win32.Interop/bin/" + parameters.DirSuffix + "/net461/Avalonia.Win32.Interop.dll", Target = "lib/net461" } - }, - BasePath = context.Directory("./src/Windows"), - OutputDirectory = parameters.NugetRoot - }; - - NuspecNuGetSettings = new List(); - - NuspecNuGetSettings.AddRange(nuspecNuGetSettingsCore); - NuspecNuGetSettings.AddRange(nuspecNuGetSettingsDesktop); - - if (parameters.IsRunningOnWindows) { - NuspecNuGetSettings.Add(nuspecNuGetSettingInterop); - NuspecNuGetSettings.AddRange(nuspecNuGetSettingsMobile); - } - - NuspecNuGetSettings.ForEach((nuspec) => SetNuGetNuspecCommonProperties(nuspec)); - - NugetPackages = NuspecNuGetSettings.Select(nuspec => { - return nuspec.OutputDirectory.CombineWithFilePath(string.Concat(nuspec.Id, ".", nuspec.Version, ".nupkg")); - }).ToArray(); - - BinFiles = NuspecNuGetSettings.SelectMany(nuspec => { - return nuspec.Files.Select(file => { - return ((DirectoryPath)nuspec.BasePath).CombineWithFilePath(file.Source); - }); - }).GroupBy(f => f.FullPath).Select(g => g.First()).ToArray(); - } -} diff --git a/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj b/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj index 6754cdf9a9..7596e4cfe2 100644 --- a/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj +++ b/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj @@ -176,4 +176,5 @@ + diff --git a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj index d2de6cd27d..7337b96506 100644 --- a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj +++ b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj @@ -28,6 +28,7 @@ + From ee1833ff8f0d403a293417fcaaba5564a30f9e13 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sat, 15 Sep 2018 21:40:46 -0500 Subject: [PATCH 18/50] Merge Designer HostApps into a single project. Pack Designer hosts into the Avalonia package like before. --- packages/Avalonia/Avalonia.csproj | 23 +++++++++ .../Avalonia.Designer.HostApp.NetFX.csproj | 25 ---------- .../Program.cs | 42 ----------------- .../Properties/launchSettings.json | 8 ---- .../Avalonia.Designer.HostApp.csproj | 7 +-- .../Avalonia.Designer.HostApp/Program.cs | 47 +++++++++++++++++-- 6 files changed, 67 insertions(+), 85 deletions(-) delete mode 100644 src/tools/Avalonia.Designer.HostApp.NetFX/Avalonia.Designer.HostApp.NetFX.csproj delete mode 100644 src/tools/Avalonia.Designer.HostApp.NetFX/Program.cs delete mode 100644 src/tools/Avalonia.Designer.HostApp.NetFX/Properties/launchSettings.json diff --git a/packages/Avalonia/Avalonia.csproj b/packages/Avalonia/Avalonia.csproj index c075c317f3..ae209f085e 100644 --- a/packages/Avalonia/Avalonia.csproj +++ b/packages/Avalonia/Avalonia.csproj @@ -7,6 +7,29 @@ + + ../../src/tools + + + + + + + <_PackageFiles Include="$(DesignerHostAppPath)/Avalonia.Designer.HostApp/bin/$(Configuration)/netcoreapp2.0/Avalonia.Designer.HostApp.dll"> + tools/netcoreapp2.0/designer + false + None + + <_PackageFiles Include="$(DesignerHostAppPath)/Avalonia.Designer.HostApp/bin/$(Configuration)/net461/Avalonia.Designer.HostApp.exe"> + tools/net461/designer + false + None + + + + diff --git a/src/tools/Avalonia.Designer.HostApp.NetFX/Avalonia.Designer.HostApp.NetFX.csproj b/src/tools/Avalonia.Designer.HostApp.NetFX/Avalonia.Designer.HostApp.NetFX.csproj deleted file mode 100644 index b34c9891ad..0000000000 --- a/src/tools/Avalonia.Designer.HostApp.NetFX/Avalonia.Designer.HostApp.NetFX.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - Exe - net461 - Avalonia.Designer.HostApp - - - - - - - - - - - - - - - - - - - - diff --git a/src/tools/Avalonia.Designer.HostApp.NetFX/Program.cs b/src/tools/Avalonia.Designer.HostApp.NetFX/Program.cs deleted file mode 100644 index da1c5a1da3..0000000000 --- a/src/tools/Avalonia.Designer.HostApp.NetFX/Program.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.IO; -using System.Reflection; - -namespace Avalonia.Designer.HostApp.NetFX -{ - class Program - { - private static string s_appDir; - public static void Main(string[] args) - { - s_appDir = Directory.GetCurrentDirectory(); - AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; - foreach (var dll in Directory.GetFiles(s_appDir, "*.dll")) - { - try - { - Console.WriteLine("Loading " + dll); - Assembly.LoadFile(dll); - } - catch - { - - } - } - Exec(args); - } - - static void Exec(string[] args) - { - Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.Main(args); - } - - private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) - { - string assemblyPath = Path.Combine(s_appDir, new AssemblyName(args.Name).Name + ".dll"); - if (File.Exists(assemblyPath) == false) return null; - Assembly assembly = Assembly.LoadFrom(assemblyPath); - return assembly; - } - } -} diff --git a/src/tools/Avalonia.Designer.HostApp.NetFX/Properties/launchSettings.json b/src/tools/Avalonia.Designer.HostApp.NetFX/Properties/launchSettings.json deleted file mode 100644 index 493caa2693..0000000000 --- a/src/tools/Avalonia.Designer.HostApp.NetFX/Properties/launchSettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "profiles": { - "Avalonia.Designer.HostApp.NetFX": { - "commandName": "Project", - "commandLineArgs": "--transport tcp-bson://127.0.0.1:25000/ bin/Debug/net461/ControlCatalog.Desktop.exe" - } - } -} \ No newline at end of file diff --git a/src/tools/Avalonia.Designer.HostApp/Avalonia.Designer.HostApp.csproj b/src/tools/Avalonia.Designer.HostApp/Avalonia.Designer.HostApp.csproj index 6ef1e1315e..e01055cf05 100644 --- a/src/tools/Avalonia.Designer.HostApp/Avalonia.Designer.HostApp.csproj +++ b/src/tools/Avalonia.Designer.HostApp/Avalonia.Designer.HostApp.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp2.0 - + net461;netcoreapp2.0 @@ -15,10 +14,8 @@ - - - \ No newline at end of file + diff --git a/src/tools/Avalonia.Designer.HostApp/Program.cs b/src/tools/Avalonia.Designer.HostApp/Program.cs index 29640ffc6f..2079214b23 100644 --- a/src/tools/Avalonia.Designer.HostApp/Program.cs +++ b/src/tools/Avalonia.Designer.HostApp/Program.cs @@ -1,10 +1,47 @@ - +using System; +using System.IO; +using System.Reflection; -namespace Avalonia.Designer.HostApp +namespace Avalonia.Designer.HostApp.NetFX { class Program { - public static void Main(string[] args) - => Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.Main(args); +#if NET461 + private static string s_appDir; + + private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) + { + string assemblyPath = Path.Combine(s_appDir, new AssemblyName(args.Name).Name + ".dll"); + if (File.Exists(assemblyPath) == false) return null; + Assembly assembly = Assembly.LoadFrom(assemblyPath); + return assembly; + } + public static void Main(string[] args) + { + s_appDir = Directory.GetCurrentDirectory(); + AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; + foreach (var dll in Directory.GetFiles(s_appDir, "*.dll")) + { + try + { + Console.WriteLine("Loading " + dll); + Assembly.LoadFile(dll); + } + catch + { + + } + } + Exec(args); + } + + static void Exec(string[] args) +#elif NETCOREAPP2_0 + public static void Main(string[] args) +#endif + { + Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.Main(args); + } + } -} \ No newline at end of file +} From 3b9c7e47f069c29cad104bc2420aeac2d450c209 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sat, 15 Sep 2018 22:09:44 -0500 Subject: [PATCH 19/50] Update Avalonia.sln and legacy desktop projects. --- Avalonia.sln | 166 ++++++++++++------ .../WindowsInteropTest.csproj | 10 +- 2 files changed, 117 insertions(+), 59 deletions(-) diff --git a/Avalonia.sln b/Avalonia.sln index a95007bdc6..763d423ef9 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -116,14 +116,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Interop", "Interop", "{A0CC EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsInteropTest", "samples\interop\WindowsInteropTest\WindowsInteropTest.csproj", "{C7A69145-60B6-4882-97D6-A3921DD43978}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.DotNetFrameworkRuntime", "src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj", "{4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RenderDemo", "samples\RenderDemo\RenderDemo.csproj", "{F1FDC5B0-4654-416F-AE69-E3E9BBD87801}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog.Android", "samples\ControlCatalog.Android\ControlCatalog.Android.csproj", "{29132311-1848-4FD6-AE0C-4FF841151BD3}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.DotNetCoreRuntime", "src\Avalonia.DotNetCoreRuntime\Avalonia.DotNetCoreRuntime.csproj", "{7863EA94-F0FB-4386-BF8C-E5BFA761560A}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Skia", "src\Skia\Avalonia.Skia\Avalonia.Skia.csproj", "{7D2D3083-71DD-4CC9-8907-39A0D86FB322}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Gtk3", "src\Gtk\Avalonia.Gtk3\Avalonia.Gtk3.csproj", "{BB1F7BB5-6AD4-4776-94D9-C09D0A972658}" @@ -185,14 +181,25 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.OpenGL", "src\Avalonia.OpenGL\Avalonia.OpenGL.csproj", "{7CCAEFC4-135D-401D-BDDD-896B9B7D3569}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Native", "src\Avalonia.Native\Avalonia.Native.csproj", "{12A91A62-C064-42CA-9A8C-A1272F354388}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OSX", "OSX", "{A59C4C0A-64DF-4621-B450-2BA00D6F61E2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.MonoMac", "src\OSX\Avalonia.MonoMac\Avalonia.MonoMac.csproj", "{CBFD5788-567D-401B-9DFA-74E4224025A0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Skia.UnitTests", "tests\Avalonia.Skia.UnitTests\Avalonia.Skia.UnitTests.csproj", "{E1240B49-7B4B-4371-A00E-068778C5CF0B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.DesktopRuntime", "src\Avalonia.DesktopRuntime\Avalonia.DesktopRuntime.csproj", "{878FEFE0-CD14-41CB-90B0-DBCB163E8F15}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packages", "Packages", "{E870DCD7-F46A-498D-83FC-D0FD13E0A11C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia", "packages\Avalonia\Avalonia.csproj", "{D49233F8-F29C-47DD-9975-C4C9E4502720}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Desktop", "packages\Avalonia.Desktop\Avalonia.Desktop.csproj", "{3C471044-3640-45E3-B1B2-16D2FF8399EE}" EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution src\Shared\RenderHelpers\RenderHelpers.projitems*{3c4c0cb4-0c0f-4450-a37b-148c84ff905f}*SharedItemsImports = 13 src\Shared\RenderHelpers\RenderHelpers.projitems*{3e908f67-5543-4879-a1dc-08eace79b3cd}*SharedItemsImports = 4 src\Shared\PlatformSupport\PlatformSupport.projitems*{4488ad85-1495-4809-9aa4-ddfe0a48527e}*SharedItemsImports = 4 - src\Shared\PlatformSupport\PlatformSupport.projitems*{4a1abb09-9047-4bd5-a4ad-a055e52c5ee0}*SharedItemsImports = 4 - src\Shared\PlatformSupport\PlatformSupport.projitems*{7863ea94-f0fb-4386-bf8c-e5bfa761560a}*SharedItemsImports = 4 src\Shared\PlatformSupport\PlatformSupport.projitems*{7b92af71-6287-4693-9dcb-bd5b6e927e23}*SharedItemsImports = 4 src\Shared\RenderHelpers\RenderHelpers.projitems*{7d2d3083-71dd-4cc9-8907-39a0d86fb322}*SharedItemsImports = 4 tests\Avalonia.RenderTests\Avalonia.RenderTests.projitems*{dabfd304-d6a4-4752-8123-c2ccf7ac7831}*SharedItemsImports = 4 @@ -1219,30 +1226,6 @@ Global {C7A69145-60B6-4882-97D6-A3921DD43978}.Release|iPhone.Build.0 = Release|Any CPU {C7A69145-60B6-4882-97D6-A3921DD43978}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {C7A69145-60B6-4882-97D6-A3921DD43978}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.AppStore|Any CPU.Build.0 = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.AppStore|iPhone.Build.0 = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Debug|iPhone.Build.0 = Debug|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Release|Any CPU.Build.0 = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Release|iPhone.ActiveCfg = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Release|iPhone.Build.0 = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU @@ -1303,30 +1286,6 @@ Global {29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|Any CPU.Build.0 = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|iPhone.Build.0 = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|iPhone.Build.0 = Debug|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|Any CPU.Build.0 = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|iPhone.ActiveCfg = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|iPhone.Build.0 = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU @@ -1615,6 +1574,30 @@ Global {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Release|iPhone.Build.0 = Release|Any CPU {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.AppStore|iPhone.Build.0 = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Debug|iPhone.Build.0 = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Release|Any CPU.Build.0 = Release|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Release|iPhone.ActiveCfg = Release|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Release|iPhone.Build.0 = Release|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {CBFD5788-567D-401B-9DFA-74E4224025A0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU @@ -1687,6 +1670,78 @@ Global {12A91A62-C064-42CA-9A8C-A1272F354388}.Release|iPhone.Build.0 = Release|Any CPU {12A91A62-C064-42CA-9A8C-A1272F354388}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {12A91A62-C064-42CA-9A8C-A1272F354388}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.AppStore|iPhone.Build.0 = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Debug|Any CPU.Build.0 = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Debug|iPhone.Build.0 = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Release|Any CPU.ActiveCfg = Release|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Release|Any CPU.Build.0 = Release|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Release|iPhone.ActiveCfg = Release|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Release|iPhone.Build.0 = Release|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {878FEFE0-CD14-41CB-90B0-DBCB163E8F15}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.AppStore|iPhone.Build.0 = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Debug|iPhone.Build.0 = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Release|Any CPU.Build.0 = Release|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Release|iPhone.ActiveCfg = Release|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Release|iPhone.Build.0 = Release|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {D49233F8-F29C-47DD-9975-C4C9E4502720}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.AppStore|iPhone.Build.0 = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Debug|iPhone.Build.0 = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Release|Any CPU.Build.0 = Release|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Release|iPhone.ActiveCfg = Release|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Release|iPhone.Build.0 = Release|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1738,7 +1793,10 @@ Global {050CC912-FF49-4A8B-B534-9544017446DD} = {4ED8B739-6F4E-4CD4-B993-545E6B5CE637} {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE} = {9B9E3891-2366-4253-A952-D08BCEB71098} {4ADA61C8-D191-428D-9066-EF4F0D86520F} = {4ED8B739-6F4E-4CD4-B993-545E6B5CE637} + {CBFD5788-567D-401B-9DFA-74E4224025A0} = {A59C4C0A-64DF-4621-B450-2BA00D6F61E2} {E1240B49-7B4B-4371-A00E-068778C5CF0B} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} + {D49233F8-F29C-47DD-9975-C4C9E4502720} = {E870DCD7-F46A-498D-83FC-D0FD13E0A11C} + {3C471044-3640-45E3-B1B2-16D2FF8399EE} = {E870DCD7-F46A-498D-83FC-D0FD13E0A11C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {87366D66-1391-4D90-8999-95A620AD786A} diff --git a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj index 3ab30bd2b6..33c7b85f06 100644 --- a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj +++ b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj @@ -112,14 +112,14 @@ {799a7bb5-3c2c-48b6-85a7-406a12c420da} Avalonia.DesignerSupport + + {878fefe0-cd14-41cb-90b0-dbcb163e8f15} + Avalonia.DesktopRuntime + {7062ae20-5dcc-4442-9645-8195bdece63e} Avalonia.Diagnostics - - {4a1abb09-9047-4bd5-a4ad-a055e52c5ee0} - Avalonia.DesktopRuntime - {62024b2d-53eb-4638-b26b-85eeaa54866e} Avalonia.Input @@ -187,4 +187,4 @@ - + \ No newline at end of file From 05e0020f53050436c209d76e69e93fa771e476aa Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sat, 15 Sep 2018 23:11:07 -0500 Subject: [PATCH 20/50] Fix designer errors and .NET Framework on Unix errors. --- .../Avalonia.DesktopRuntime.csproj | 1 + .../Avalonia.Designer.HostApp.csproj | 2 ++ src/tools/Avalonia.Designer.HostApp/Program.cs | 10 +++------- .../DesignerSupportTests.cs | 3 ++- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Avalonia.DesktopRuntime/Avalonia.DesktopRuntime.csproj b/src/Avalonia.DesktopRuntime/Avalonia.DesktopRuntime.csproj index b681d2b1ae..42d0b880d9 100644 --- a/src/Avalonia.DesktopRuntime/Avalonia.DesktopRuntime.csproj +++ b/src/Avalonia.DesktopRuntime/Avalonia.DesktopRuntime.csproj @@ -16,5 +16,6 @@ + diff --git a/src/tools/Avalonia.Designer.HostApp/Avalonia.Designer.HostApp.csproj b/src/tools/Avalonia.Designer.HostApp/Avalonia.Designer.HostApp.csproj index e01055cf05..1c7077870a 100644 --- a/src/tools/Avalonia.Designer.HostApp/Avalonia.Designer.HostApp.csproj +++ b/src/tools/Avalonia.Designer.HostApp/Avalonia.Designer.HostApp.csproj @@ -18,4 +18,6 @@ + + diff --git a/src/tools/Avalonia.Designer.HostApp/Program.cs b/src/tools/Avalonia.Designer.HostApp/Program.cs index 2079214b23..a7c5e0915c 100644 --- a/src/tools/Avalonia.Designer.HostApp/Program.cs +++ b/src/tools/Avalonia.Designer.HostApp/Program.cs @@ -2,20 +2,19 @@ using System.IO; using System.Reflection; -namespace Avalonia.Designer.HostApp.NetFX +namespace Avalonia.Designer.HostApp { class Program { -#if NET461 private static string s_appDir; private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { string assemblyPath = Path.Combine(s_appDir, new AssemblyName(args.Name).Name + ".dll"); if (File.Exists(assemblyPath) == false) return null; - Assembly assembly = Assembly.LoadFrom(assemblyPath); - return assembly; + return Assembly.LoadFile(assemblyPath); } + public static void Main(string[] args) { s_appDir = Directory.GetCurrentDirectory(); @@ -36,9 +35,6 @@ namespace Avalonia.Designer.HostApp.NetFX } static void Exec(string[] args) -#elif NETCOREAPP2_0 - public static void Main(string[] args) -#endif { Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.Main(args); } diff --git a/tests/Avalonia.DesignerSupport.Tests/DesignerSupportTests.cs b/tests/Avalonia.DesignerSupport.Tests/DesignerSupportTests.cs index 5220d539d9..a01bbe0845 100644 --- a/tests/Avalonia.DesignerSupport.Tests/DesignerSupportTests.cs +++ b/tests/Avalonia.DesignerSupport.Tests/DesignerSupportTests.cs @@ -101,6 +101,7 @@ namespace Avalonia.DesignerSupport.Tests RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true, + WorkingDirectory = outputDir, }, EnableRaisingEvents = true }) @@ -117,7 +118,7 @@ namespace Avalonia.DesignerSupport.Tests cancelled = true; } - Assert.True(cancelled); + Assert.True(cancelled, $"Message Not Received."); Assert.NotEqual(0, handle); proc.Kill(); proc.WaitForExit(); From 0410d121c2eadd41e75cd09d147c227d267e287f Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Thu, 20 Sep 2018 21:42:55 -0500 Subject: [PATCH 21/50] Add windowing subsystem hookup for reflection UsePlatformDetect. --- src/Avalonia.Native/Properties/AssemblyInfo.cs | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/Avalonia.Native/Properties/AssemblyInfo.cs diff --git a/src/Avalonia.Native/Properties/AssemblyInfo.cs b/src/Avalonia.Native/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..7bbd7be747 --- /dev/null +++ b/src/Avalonia.Native/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using Avalonia.MonoMac; +using Avalonia.Platform; + +[assembly: ExportWindowingSubsystem(OperatingSystemType.OSX, 1, "MonoMac", typeof(MonoMacPlatform), nameof(MonoMacPlatform.Initialize))] From 237f01fb1a2bff09d67c4debf0bfdfa74d46ae5e Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sun, 30 Sep 2018 12:52:59 -0700 Subject: [PATCH 22/50] Move AppBuilder.UsePlatformDetect into Avalonia.Desktop and renamed the reflection-based one to a different name. Conditionalize the output-path loading like before. --- Avalonia.sln | 2 +- build/SampleApp.props | 2 +- .../ControlCatalog.NetCore.csproj | 2 +- .../AppBuilderDesktopExtensions.cs | 57 +++++++++++++++++++ .../Avalonia.Desktop/Avalonia.Desktop.csproj | 1 + src/Avalonia.DesktopRuntime/AppBuilder.cs | 2 +- .../Avalonia.Designer.HostApp/Program.cs | 4 ++ .../Avalonia.DesignerSupport.TestApp.csproj | 2 +- 8 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 src/Avalonia.Desktop/AppBuilderDesktopExtensions.cs rename {packages => src}/Avalonia.Desktop/Avalonia.Desktop.csproj (89%) diff --git a/Avalonia.sln b/Avalonia.sln index 763d423ef9..34daf3287c 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -193,7 +193,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packages", "Packages", "{E8 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia", "packages\Avalonia\Avalonia.csproj", "{D49233F8-F29C-47DD-9975-C4C9E4502720}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Desktop", "packages\Avalonia.Desktop\Avalonia.Desktop.csproj", "{3C471044-3640-45E3-B1B2-16D2FF8399EE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Desktop", "src\Avalonia.Desktop\Avalonia.Desktop.csproj", "{3C471044-3640-45E3-B1B2-16D2FF8399EE}" EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution diff --git a/build/SampleApp.props b/build/SampleApp.props index 4e03e8aec9..5580a4c2c9 100644 --- a/build/SampleApp.props +++ b/build/SampleApp.props @@ -3,6 +3,6 @@ WinExe - + diff --git a/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj index 57619b8a67..7e2c707e91 100644 --- a/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj +++ b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Avalonia.Desktop/AppBuilderDesktopExtensions.cs b/src/Avalonia.Desktop/AppBuilderDesktopExtensions.cs new file mode 100644 index 0000000000..710964f6e1 --- /dev/null +++ b/src/Avalonia.Desktop/AppBuilderDesktopExtensions.cs @@ -0,0 +1,57 @@ +using Avalonia.Controls; +using Avalonia.Platform; + +namespace Avalonia +{ + public static class AppBuilderDesktopExtensions + { + public static TAppBuilder UsePlatformDetect(this TAppBuilder builder) + where TAppBuilder : AppBuilderBase, new() + { + var os = builder.RuntimePlatform.GetRuntimeInfo().OperatingSystem; + + // We don't have the ability to load every assembly right now, so we are + // stuck with manual configuration here + // Helpers are extracted to separate methods to take the advantage of the fact + // that CLR doesn't try to load dependencies before referencing method is jitted + // Additionally, by having a hard reference to each assembly, + // we verify that the assemblies are in the final .deps.json file + // so .NET Core knows where to load the assemblies from,. + if (os == OperatingSystemType.WinNT) + { + LoadWin32(builder); + LoadDirect2D1(builder); + } + else if(os==OperatingSystemType.OSX) + { + LoadMonoMac(builder); + LoadSkia(builder); + } + else + { + LoadGtk3(builder); + LoadSkia(builder); + } + return builder; + } + + static void LoadMonoMac(TAppBuilder builder) + where TAppBuilder : AppBuilderBase, new() + => builder.UseMonoMac(); + static void LoadWin32(TAppBuilder builder) + where TAppBuilder : AppBuilderBase, new() + => builder.UseWin32(); + + static void LoadGtk3(TAppBuilder builder) + where TAppBuilder : AppBuilderBase, new() + => builder.UseGtk3(); + + static void LoadDirect2D1(TAppBuilder builder) + where TAppBuilder : AppBuilderBase, new() + => builder.UseDirect2D1(); + + static void LoadSkia(TAppBuilder builder) + where TAppBuilder : AppBuilderBase, new() + => builder.UseSkia(); + } +} diff --git a/packages/Avalonia.Desktop/Avalonia.Desktop.csproj b/src/Avalonia.Desktop/Avalonia.Desktop.csproj similarity index 89% rename from packages/Avalonia.Desktop/Avalonia.Desktop.csproj rename to src/Avalonia.Desktop/Avalonia.Desktop.csproj index 615237b162..4d1237f356 100644 --- a/packages/Avalonia.Desktop/Avalonia.Desktop.csproj +++ b/src/Avalonia.Desktop/Avalonia.Desktop.csproj @@ -9,5 +9,6 @@ + diff --git a/src/Avalonia.DesktopRuntime/AppBuilder.cs b/src/Avalonia.DesktopRuntime/AppBuilder.cs index fe791e156b..dbe3767df6 100644 --- a/src/Avalonia.DesktopRuntime/AppBuilder.cs +++ b/src/Avalonia.DesktopRuntime/AppBuilder.cs @@ -49,7 +49,7 @@ namespace Avalonia /// Instructs the to use the best settings for the platform. /// /// An instance. - public AppBuilder UsePlatformDetect() + public AppBuilder UseSubsystemsFromStartupDirectory() { var os = RuntimePlatform.GetRuntimeInfo().OperatingSystem; diff --git a/src/tools/Avalonia.Designer.HostApp/Program.cs b/src/tools/Avalonia.Designer.HostApp/Program.cs index a7c5e0915c..3163e1fbc3 100644 --- a/src/tools/Avalonia.Designer.HostApp/Program.cs +++ b/src/tools/Avalonia.Designer.HostApp/Program.cs @@ -6,6 +6,7 @@ namespace Avalonia.Designer.HostApp { class Program { +#if NET461 private static string s_appDir; private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) @@ -35,6 +36,9 @@ namespace Avalonia.Designer.HostApp } static void Exec(string[] args) +#else + public static void Main(string[] args) +#endif { Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.Main(args); } diff --git a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj index 7337b96506..85e7f69fbf 100644 --- a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj +++ b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj @@ -28,7 +28,7 @@ - + From 478541393806e533770be90ddf85ff6802e2548a Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sun, 21 Oct 2018 17:37:02 -0700 Subject: [PATCH 23/50] Clean up Avalonia.Native project. --- src/Avalonia.Native/.gitignore | 1 - src/Avalonia.Native/Avalonia.Native.csproj | 18 ++++++++++++++++-- src/Avalonia.Native/Mappings.xml | 4 ---- 3 files changed, 16 insertions(+), 7 deletions(-) delete mode 100644 src/Avalonia.Native/.gitignore diff --git a/src/Avalonia.Native/.gitignore b/src/Avalonia.Native/.gitignore deleted file mode 100644 index 876fdb5f40..0000000000 --- a/src/Avalonia.Native/.gitignore +++ /dev/null @@ -1 +0,0 @@ -Generated diff --git a/src/Avalonia.Native/Avalonia.Native.csproj b/src/Avalonia.Native/Avalonia.Native.csproj index 33463e27f6..64affc1314 100644 --- a/src/Avalonia.Native/Avalonia.Native.csproj +++ b/src/Avalonia.Native/Avalonia.Native.csproj @@ -1,12 +1,12 @@ + false + true netstandard2.0 /usr/bin/castxml /usr/local/bin/castxml - true - $(MSBuildThisFileDirectory)/Generated @@ -27,5 +27,19 @@ true PreserveNewest + + + + + + + + + + + runtimes/osx/native/libAvaloniaNative.dylib + true + PreserveNewest + diff --git a/src/Avalonia.Native/Mappings.xml b/src/Avalonia.Native/Mappings.xml index 9e6c6512c7..e870f7594e 100644 --- a/src/Avalonia.Native/Mappings.xml +++ b/src/Avalonia.Native/Mappings.xml @@ -12,10 +12,6 @@ namespace="Avalonia.Native.Interop" attach="true" pre="#define COM_GUIDS_MATERIALIZE\n"/> - - - - From f53d491bca9b80ce4400ebce13e86a46d4e56829 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 22 Oct 2018 00:03:32 -0700 Subject: [PATCH 24/50] Add C++11 override specifier to be explicit about overrides --- build-native.sh | 6 ++ src/Avalonia.Native.OSX/Screens.mm | 4 +- src/Avalonia.Native.OSX/SystemDialogs.mm | 6 +- src/Avalonia.Native.OSX/clipboard.mm | 6 +- src/Avalonia.Native.OSX/cursor.mm | 2 +- src/Avalonia.Native.OSX/gl.mm | 20 +++--- src/Avalonia.Native.OSX/main.mm | 22 +++--- src/Avalonia.Native.OSX/platformthreading.mm | 14 ++-- src/Avalonia.Native.OSX/window.mm | 74 ++++++++++---------- src/Avalonia.Native/headers/comimpl.h | 9 +-- 10 files changed, 85 insertions(+), 78 deletions(-) create mode 100644 build-native.sh diff --git a/build-native.sh b/build-native.sh new file mode 100644 index 0000000000..5983751dce --- /dev/null +++ b/build-native.sh @@ -0,0 +1,6 @@ +# /bin/sh + +mkdir native-build +cd native-build +cmake -DCMAKE_BUILD_TYPE=$1 ../native +cmake --build . --target install \ No newline at end of file diff --git a/src/Avalonia.Native.OSX/Screens.mm b/src/Avalonia.Native.OSX/Screens.mm index 229c598797..9d436b98c5 100644 --- a/src/Avalonia.Native.OSX/Screens.mm +++ b/src/Avalonia.Native.OSX/Screens.mm @@ -7,7 +7,7 @@ class Screens : public ComSingleObject { public: FORWARD_IUNKNOWN() - virtual HRESULT GetScreenCount (int* ret) + virtual HRESULT GetScreenCount (int* ret) override { @autoreleasepool { @@ -17,7 +17,7 @@ class Screens : public ComSingleObject } } - virtual HRESULT GetScreen (int index, AvnScreen* ret) + virtual HRESULT GetScreen (int index, AvnScreen* ret) override { @autoreleasepool { diff --git a/src/Avalonia.Native.OSX/SystemDialogs.mm b/src/Avalonia.Native.OSX/SystemDialogs.mm index 55b1abc720..7049f77d20 100644 --- a/src/Avalonia.Native.OSX/SystemDialogs.mm +++ b/src/Avalonia.Native.OSX/SystemDialogs.mm @@ -11,7 +11,7 @@ public: virtual void SelectFolderDialog (IAvnWindow* parentWindowHandle, IAvnSystemDialogEvents* events, const char* title, - const char* initialDirectory) + const char* initialDirectory) override { @autoreleasepool { @@ -88,7 +88,7 @@ public: const char* title, const char* initialDirectory, const char* initialFile, - const char* filters) + const char* filters) override { @autoreleasepool { @@ -179,7 +179,7 @@ public: const char* title, const char* initialDirectory, const char* initialFile, - const char* filters) + const char* filters) override { @autoreleasepool { diff --git a/src/Avalonia.Native.OSX/clipboard.mm b/src/Avalonia.Native.OSX/clipboard.mm index e39b78fc33..19e5c25801 100644 --- a/src/Avalonia.Native.OSX/clipboard.mm +++ b/src/Avalonia.Native.OSX/clipboard.mm @@ -7,7 +7,7 @@ class Clipboard : public ComSingleObject { public: FORWARD_IUNKNOWN() - virtual HRESULT GetText (void** retOut) + virtual HRESULT GetText (void** retOut) override { @autoreleasepool { @@ -18,7 +18,7 @@ public: return S_OK; } - virtual HRESULT SetText (char* text) + virtual HRESULT SetText (char* text) override { @autoreleasepool { @@ -30,7 +30,7 @@ public: return S_OK; } - virtual HRESULT Clear() + virtual HRESULT Clear() override { @autoreleasepool { diff --git a/src/Avalonia.Native.OSX/cursor.mm b/src/Avalonia.Native.OSX/cursor.mm index 6a06918527..bd2c94a4d8 100644 --- a/src/Avalonia.Native.OSX/cursor.mm +++ b/src/Avalonia.Native.OSX/cursor.mm @@ -51,7 +51,7 @@ class CursorFactory : public ComSingleObjectAddRef(); return S_OK; } - virtual HRESULT ObtainImmediateContext(IAvnGlContext**retOut) + virtual HRESULT ObtainImmediateContext(IAvnGlContext**retOut) override { *retOut = _immediate; _immediate->AddRef(); @@ -193,14 +193,14 @@ public: _view = view; } - virtual HRESULT GetPixelSize(AvnPixelSize* ret) + virtual HRESULT GetPixelSize(AvnPixelSize* ret) override { auto fsize = [_view convertSizeToBacking: [_view frame].size]; ret->Width = (int)fsize.width; ret->Height = (int)fsize.height; return S_OK; } - virtual HRESULT GetScaling(double* ret) + virtual HRESULT GetScaling(double* ret) override { *ret = [_window backingScaleFactor]; return S_OK; @@ -230,7 +230,7 @@ public: _context = GetFeature()->CreateContext(); } - virtual HRESULT BeginDrawing(IAvnGlSurfaceRenderingSession** ret) + virtual HRESULT BeginDrawing(IAvnGlSurfaceRenderingSession** ret) override { auto f = GetFeature(); if(f == NULL) diff --git a/src/Avalonia.Native.OSX/main.mm b/src/Avalonia.Native.OSX/main.mm index bb32c44918..4d6dcfed85 100644 --- a/src/Avalonia.Native.OSX/main.mm +++ b/src/Avalonia.Native.OSX/main.mm @@ -16,7 +16,7 @@ class MacOptions : public ComSingleObject { public: FORWARD_IUNKNOWN() - virtual HRESULT SetShowInDock(int show) + virtual HRESULT SetShowInDock(int show) override { ShowInDock = show; SetActivationPolicy(); @@ -64,7 +64,7 @@ class AvaloniaNative : public ComSingleObject(cancel); @@ -125,12 +125,12 @@ public: } } - virtual void Signal(int priority) + virtual void Signal(int priority) override { [_signaler signal:priority]; } - virtual IUnknown* StartTimer(int priority, int ms, IAvnActionCallback* callback) + virtual IUnknown* StartTimer(int priority, int ms, IAvnActionCallback* callback) override { @autoreleasepool { diff --git a/src/Avalonia.Native.OSX/window.mm b/src/Avalonia.Native.OSX/window.mm index 2e9f7503fb..76243493c4 100644 --- a/src/Avalonia.Native.OSX/window.mm +++ b/src/Avalonia.Native.OSX/window.mm @@ -81,12 +81,12 @@ public: [Window setContentView: View]; } - virtual AvnWindow* GetNSWindow() + virtual AvnWindow* GetNSWindow() override { return Window; } - virtual HRESULT Show() + virtual HRESULT Show() override { @autoreleasepool { @@ -102,7 +102,7 @@ public: } } - virtual HRESULT Hide () + virtual HRESULT Hide () override { @autoreleasepool { @@ -115,7 +115,7 @@ public: } } - virtual HRESULT Activate () + virtual HRESULT Activate () override { @autoreleasepool { @@ -128,7 +128,7 @@ public: return S_OK; } - virtual HRESULT SetTopMost (bool value) + virtual HRESULT SetTopMost (bool value) override { @autoreleasepool { @@ -138,7 +138,7 @@ public: } } - virtual HRESULT Close() + virtual HRESULT Close() override { @autoreleasepool { @@ -147,7 +147,7 @@ public: } } - virtual HRESULT GetClientSize(AvnSize* ret) + virtual HRESULT GetClientSize(AvnSize* ret) override { @autoreleasepool { @@ -160,7 +160,7 @@ public: } } - virtual HRESULT GetMaxClientSize(AvnSize* ret) + virtual HRESULT GetMaxClientSize(AvnSize* ret) override { @autoreleasepool { @@ -176,7 +176,7 @@ public: } } - virtual HRESULT GetScaling (double* ret) + virtual HRESULT GetScaling (double* ret) override { @autoreleasepool { @@ -194,7 +194,7 @@ public: } } - virtual HRESULT SetMinMaxSize (AvnSize minSize, AvnSize maxSize) + virtual HRESULT SetMinMaxSize (AvnSize minSize, AvnSize maxSize) override { @autoreleasepool { @@ -205,7 +205,7 @@ public: } } - virtual HRESULT Resize(double x, double y) + virtual HRESULT Resize(double x, double y) override { @autoreleasepool { @@ -215,7 +215,7 @@ public: } } - virtual HRESULT Invalidate (AvnRect rect) + virtual HRESULT Invalidate (AvnRect rect) override { @autoreleasepool { @@ -225,7 +225,7 @@ public: } } - virtual bool TryLock() + virtual bool TryLock() override { @autoreleasepool { @@ -233,7 +233,7 @@ public: } } - virtual void Unlock() + virtual void Unlock() override { @autoreleasepool { @@ -241,7 +241,7 @@ public: } } - virtual HRESULT BeginMoveDrag () + virtual HRESULT BeginMoveDrag () override { @autoreleasepool { @@ -258,12 +258,12 @@ public: } } - virtual HRESULT BeginResizeDrag (AvnWindowEdge edge) + virtual HRESULT BeginResizeDrag (AvnWindowEdge edge) override { return S_OK; } - virtual HRESULT GetPosition (AvnPoint* ret) + virtual HRESULT GetPosition (AvnPoint* ret) override { @autoreleasepool { @@ -283,7 +283,7 @@ public: } } - virtual HRESULT SetPosition (AvnPoint point) + virtual HRESULT SetPosition (AvnPoint point) override { @autoreleasepool { @@ -294,7 +294,7 @@ public: } } - virtual HRESULT PointToClient (AvnPoint point, AvnPoint* ret) + virtual HRESULT PointToClient (AvnPoint point, AvnPoint* ret) override { @autoreleasepool { @@ -312,7 +312,7 @@ public: } } - virtual HRESULT PointToScreen (AvnPoint point, AvnPoint* ret) + virtual HRESULT PointToScreen (AvnPoint point, AvnPoint* ret) override { @autoreleasepool { @@ -329,13 +329,13 @@ public: } } - virtual HRESULT ThreadSafeSetSwRenderedFrame(AvnFramebuffer* fb, IUnknown* dispose) + virtual HRESULT ThreadSafeSetSwRenderedFrame(AvnFramebuffer* fb, IUnknown* dispose) override { [View setSwRenderedFrame: fb dispose: dispose]; return S_OK; } - virtual HRESULT GetSoftwareFramebuffer(AvnFramebuffer*ret) + virtual HRESULT GetSoftwareFramebuffer(AvnFramebuffer*ret) override { if(![[NSThread currentThread] isMainThread]) return E_FAIL; @@ -345,7 +345,7 @@ public: return S_OK; } - virtual HRESULT SetCursor(IAvnCursor* cursor) + virtual HRESULT SetCursor(IAvnCursor* cursor) override { @autoreleasepool { @@ -367,7 +367,7 @@ public: } } - virtual HRESULT CreateGlRenderTarget(IAvnGlSurfaceRenderTarget** ppv) + virtual HRESULT CreateGlRenderTarget(IAvnGlSurfaceRenderTarget** ppv) override { if(View == NULL) return E_FAIL; @@ -440,7 +440,7 @@ private: [Window setCanBecomeKeyAndMain]; } - virtual HRESULT Show () + virtual HRESULT Show () override { @autoreleasepool { @@ -450,7 +450,7 @@ private: } } - virtual HRESULT ShowDialog (IUnknown**ppv) + virtual HRESULT ShowDialog (IUnknown**ppv) override { @autoreleasepool { @@ -475,7 +475,7 @@ private: } } - void WindowStateChanged () + void WindowStateChanged () override { AvnWindowState state; GetWindowState(&state); @@ -509,7 +509,7 @@ private: } } - virtual HRESULT SetCanResize(bool value) + virtual HRESULT SetCanResize(bool value) override { @autoreleasepool { @@ -519,7 +519,7 @@ private: } } - virtual HRESULT SetHasDecorations(bool value) + virtual HRESULT SetHasDecorations(bool value) override { @autoreleasepool { @@ -530,7 +530,7 @@ private: } } - virtual HRESULT SetTitle (const char* title) + virtual HRESULT SetTitle (const char* title) override { @autoreleasepool { @@ -542,7 +542,7 @@ private: } } - virtual HRESULT SetTitleBarColor(AvnColor color) + virtual HRESULT SetTitleBarColor(AvnColor color) override { @autoreleasepool { @@ -571,7 +571,7 @@ private: return S_OK; } - virtual HRESULT GetWindowState (AvnWindowState*ret) + virtual HRESULT GetWindowState (AvnWindowState*ret) override { @autoreleasepool { @@ -598,7 +598,7 @@ private: } } - virtual HRESULT SetWindowState (AvnWindowState state) + virtual HRESULT SetWindowState (AvnWindowState state) override { @autoreleasepool { @@ -642,7 +642,7 @@ private: } protected: - virtual void OnResized () + virtual void OnResized () override { auto windowState = [Window isMiniaturized] ? Minimized : (IsZoomed() ? Maximized : Normal); @@ -655,7 +655,7 @@ protected: } } - virtual NSWindowStyleMask GetStyle() + virtual NSWindowStyleMask GetStyle() override { unsigned long s = NSWindowStyleMaskBorderless; if(_hasDecorations) @@ -1192,12 +1192,12 @@ private: } protected: - virtual NSWindowStyleMask GetStyle() + virtual NSWindowStyleMask GetStyle() override { return NSWindowStyleMaskBorderless; } - virtual HRESULT Resize(double x, double y) + virtual HRESULT Resize(double x, double y) override { @autoreleasepool { diff --git a/src/Avalonia.Native/headers/comimpl.h b/src/Avalonia.Native/headers/comimpl.h index cea6d2207a..cf1aa4c735 100644 --- a/src/Avalonia.Native/headers/comimpl.h +++ b/src/Avalonia.Native/headers/comimpl.h @@ -63,19 +63,20 @@ public: #define FORWARD_IUNKNOWN() \ -virtual ULONG Release(){ \ +virtual ULONG Release() override \ +{ \ return ComObject::Release(); \ } \ -virtual ULONG AddRef() \ +virtual ULONG AddRef() override \ { \ return ComObject::AddRef(); \ } \ -virtual HRESULT QueryInterface(REFIID riid, void **ppvObject) \ +virtual HRESULT QueryInterface(REFIID riid, void **ppvObject) override \ { \ return ComObject::QueryInterface(riid, ppvObject); \ } -#define BEGIN_INTERFACE_MAP() public: virtual HRESULT STDMETHODCALLTYPE QueryInterfaceImpl(REFIID riid, void **ppvObject){ +#define BEGIN_INTERFACE_MAP() public: virtual HRESULT STDMETHODCALLTYPE QueryInterfaceImpl(REFIID riid, void **ppvObject) override { #define INTERFACE_MAP_ENTRY(TInterface, IID) if(0 == memcmp(riid, &IID, sizeof(GUID))) { TInterface* casted = this; *ppvObject = casted; return S_OK; } #define END_INTERFACE_MAP() return E_NOINTERFACE; } #define INHERIT_INTERFACE_MAP(TBase) if(TBase::QueryInterfaceImpl(riid, ppvObject) == S_OK) return S_OK; From dd91372b82440eb4d9d25df2c0e906d38a014dfd Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sat, 27 Oct 2018 17:54:30 -0700 Subject: [PATCH 25/50] Clean up Avalonia.Native.csproj after the rebase. --- src/Avalonia.Native/Avalonia.Native.csproj | 25 ++++++---------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/Avalonia.Native/Avalonia.Native.csproj b/src/Avalonia.Native/Avalonia.Native.csproj index 64affc1314..4f3d401065 100644 --- a/src/Avalonia.Native/Avalonia.Native.csproj +++ b/src/Avalonia.Native/Avalonia.Native.csproj @@ -8,25 +8,14 @@ /usr/local/bin/castxml true - - - - - - - - - - - - - - - runtimes/osx/native/libAvaloniaNative.dylib - true - PreserveNewest - + + + runtimes/osx/native/libAvaloniaNative.dylib + true + PreserveNewest + + From 74bbbbbec4d78ae76c78b7ba0a7b09da1b1d2fe9 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sat, 27 Oct 2018 18:18:44 -0700 Subject: [PATCH 26/50] Move Xcode files around. --- dirs.proj | 1 - .../Avalonia.Native/inc}/avalonia-native-guids.h | 0 .../Avalonia.Native/inc}/avalonia-native.h | 0 .../headers => native/Avalonia.Native/inc}/com.h | 0 .../headers => native/Avalonia.Native/inc}/comimpl.h | 0 .../headers => native/Avalonia.Native/inc}/key.h | 0 .../Avalonia.Native/src/OSX}/.gitignore | 0 .../OSX}/Avalonia.Native.OSX.xcodeproj/project.pbxproj | 6 +++--- .../project.xcworkspace/contents.xcworkspacedata | 0 .../xcshareddata/xcschemes/Avalonia.Native.OSX.xcscheme | 2 +- .../Avalonia.Native/src/OSX}/KeyTransform.h | 0 .../Avalonia.Native/src/OSX}/KeyTransform.mm | 0 .../Avalonia.Native/src/OSX}/Screens.mm | 0 .../Avalonia.Native/src/OSX}/SystemDialogs.mm | 0 .../Avalonia.Native/src/OSX}/clipboard.mm | 0 .../Avalonia.Native/src/OSX}/common.h | 0 .../Avalonia.Native/src/OSX}/cursor.h | 0 .../Avalonia.Native/src/OSX}/cursor.mm | 0 .../Avalonia.Native/src/OSX}/gl.mm | 0 .../Avalonia.Native/src/OSX}/main.mm | 0 .../Avalonia.Native/src/OSX}/platformthreading.mm | 0 .../Avalonia.Native/src/OSX}/window.h | 0 .../Avalonia.Native/src/OSX}/window.mm | 0 src/Avalonia.Native/Avalonia.Native.targets | 9 --------- src/Avalonia.Native/Mappings.xml | 2 +- 25 files changed, 5 insertions(+), 15 deletions(-) rename {src/Avalonia.Native/headers => native/Avalonia.Native/inc}/avalonia-native-guids.h (100%) rename {src/Avalonia.Native/headers => native/Avalonia.Native/inc}/avalonia-native.h (100%) rename {src/Avalonia.Native/headers => native/Avalonia.Native/inc}/com.h (100%) rename {src/Avalonia.Native/headers => native/Avalonia.Native/inc}/comimpl.h (100%) rename {src/Avalonia.Native/headers => native/Avalonia.Native/inc}/key.h (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/.gitignore (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/Avalonia.Native.OSX.xcodeproj/project.pbxproj (98%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/Avalonia.Native.OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/Avalonia.Native.OSX.xcodeproj/xcshareddata/xcschemes/Avalonia.Native.OSX.xcscheme (97%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/KeyTransform.h (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/KeyTransform.mm (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/Screens.mm (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/SystemDialogs.mm (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/clipboard.mm (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/common.h (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/cursor.h (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/cursor.mm (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/gl.mm (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/main.mm (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/platformthreading.mm (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/window.h (100%) rename {src/Avalonia.Native.OSX => native/Avalonia.Native/src/OSX}/window.mm (100%) delete mode 100644 src/Avalonia.Native/Avalonia.Native.targets diff --git a/dirs.proj b/dirs.proj index eac8e13870..cd3faf07a6 100644 --- a/dirs.proj +++ b/dirs.proj @@ -6,7 +6,6 @@ - diff --git a/src/Avalonia.Native/headers/avalonia-native-guids.h b/native/Avalonia.Native/inc/avalonia-native-guids.h similarity index 100% rename from src/Avalonia.Native/headers/avalonia-native-guids.h rename to native/Avalonia.Native/inc/avalonia-native-guids.h diff --git a/src/Avalonia.Native/headers/avalonia-native.h b/native/Avalonia.Native/inc/avalonia-native.h similarity index 100% rename from src/Avalonia.Native/headers/avalonia-native.h rename to native/Avalonia.Native/inc/avalonia-native.h diff --git a/src/Avalonia.Native/headers/com.h b/native/Avalonia.Native/inc/com.h similarity index 100% rename from src/Avalonia.Native/headers/com.h rename to native/Avalonia.Native/inc/com.h diff --git a/src/Avalonia.Native/headers/comimpl.h b/native/Avalonia.Native/inc/comimpl.h similarity index 100% rename from src/Avalonia.Native/headers/comimpl.h rename to native/Avalonia.Native/inc/comimpl.h diff --git a/src/Avalonia.Native/headers/key.h b/native/Avalonia.Native/inc/key.h similarity index 100% rename from src/Avalonia.Native/headers/key.h rename to native/Avalonia.Native/inc/key.h diff --git a/src/Avalonia.Native.OSX/.gitignore b/native/Avalonia.Native/src/OSX/.gitignore similarity index 100% rename from src/Avalonia.Native.OSX/.gitignore rename to native/Avalonia.Native/src/OSX/.gitignore diff --git a/src/Avalonia.Native.OSX/Avalonia.Native.OSX.xcodeproj/project.pbxproj b/native/Avalonia.Native/src/OSX/Avalonia.Native.OSX.xcodeproj/project.pbxproj similarity index 98% rename from src/Avalonia.Native.OSX/Avalonia.Native.OSX.xcodeproj/project.pbxproj rename to native/Avalonia.Native/src/OSX/Avalonia.Native.OSX.xcodeproj/project.pbxproj index 8d36bf3b8f..bd8ac481a8 100644 --- a/src/Avalonia.Native.OSX/Avalonia.Native.OSX.xcodeproj/project.pbxproj +++ b/native/Avalonia.Native/src/OSX/Avalonia.Native.OSX.xcodeproj/project.pbxproj @@ -22,7 +22,7 @@ /* Begin PBXFileReference section */ 379860FE214DA0C000CD0246 /* KeyTransform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyTransform.h; sourceTree = ""; }; - 37A4E71A2178846A00EACBCD /* headers */ = {isa = PBXFileReference; lastKnownFileType = folder; name = headers; path = ../Avalonia.Native/headers; sourceTree = ""; }; + 37A4E71A2178846A00EACBCD /* headers */ = {isa = PBXFileReference; lastKnownFileType = folder; name = headers; path = ../../inc; sourceTree = ""; }; 37A517B22159597E00FBA241 /* Screens.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = Screens.mm; sourceTree = ""; }; 37C09D8721580FE4006A6758 /* SystemDialogs.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SystemDialogs.mm; sourceTree = ""; }; 37C09D8A21581EF2006A6758 /* window.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = window.h; sourceTree = ""; }; @@ -285,7 +285,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; EXECUTABLE_PREFIX = lib; - HEADER_SEARCH_PATHS = ../Avalonia.Native/headers; + HEADER_SEARCH_PATHS = ../../inc; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -296,7 +296,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; EXECUTABLE_PREFIX = lib; - HEADER_SEARCH_PATHS = ../Avalonia.Native/headers; + HEADER_SEARCH_PATHS = ../../inc; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; diff --git a/src/Avalonia.Native.OSX/Avalonia.Native.OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/native/Avalonia.Native/src/OSX/Avalonia.Native.OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from src/Avalonia.Native.OSX/Avalonia.Native.OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to native/Avalonia.Native/src/OSX/Avalonia.Native.OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/src/Avalonia.Native.OSX/Avalonia.Native.OSX.xcodeproj/xcshareddata/xcschemes/Avalonia.Native.OSX.xcscheme b/native/Avalonia.Native/src/OSX/Avalonia.Native.OSX.xcodeproj/xcshareddata/xcschemes/Avalonia.Native.OSX.xcscheme similarity index 97% rename from src/Avalonia.Native.OSX/Avalonia.Native.OSX.xcodeproj/xcshareddata/xcschemes/Avalonia.Native.OSX.xcscheme rename to native/Avalonia.Native/src/OSX/Avalonia.Native.OSX.xcodeproj/xcshareddata/xcschemes/Avalonia.Native.OSX.xcscheme index 96588581bf..c1cc9b4887 100644 --- a/src/Avalonia.Native.OSX/Avalonia.Native.OSX.xcodeproj/xcshareddata/xcschemes/Avalonia.Native.OSX.xcscheme +++ b/native/Avalonia.Native/src/OSX/Avalonia.Native.OSX.xcodeproj/xcshareddata/xcschemes/Avalonia.Native.OSX.xcscheme @@ -38,7 +38,7 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle = "0" useCustomWorkingDirectory = "YES" - customWorkingDirectory = "$PROJECT_DIR/../../samples/ControlCatalog" + customWorkingDirectory = "$PROJECT_DIR/../../../../samples/ControlCatalog" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" diff --git a/src/Avalonia.Native.OSX/KeyTransform.h b/native/Avalonia.Native/src/OSX/KeyTransform.h similarity index 100% rename from src/Avalonia.Native.OSX/KeyTransform.h rename to native/Avalonia.Native/src/OSX/KeyTransform.h diff --git a/src/Avalonia.Native.OSX/KeyTransform.mm b/native/Avalonia.Native/src/OSX/KeyTransform.mm similarity index 100% rename from src/Avalonia.Native.OSX/KeyTransform.mm rename to native/Avalonia.Native/src/OSX/KeyTransform.mm diff --git a/src/Avalonia.Native.OSX/Screens.mm b/native/Avalonia.Native/src/OSX/Screens.mm similarity index 100% rename from src/Avalonia.Native.OSX/Screens.mm rename to native/Avalonia.Native/src/OSX/Screens.mm diff --git a/src/Avalonia.Native.OSX/SystemDialogs.mm b/native/Avalonia.Native/src/OSX/SystemDialogs.mm similarity index 100% rename from src/Avalonia.Native.OSX/SystemDialogs.mm rename to native/Avalonia.Native/src/OSX/SystemDialogs.mm diff --git a/src/Avalonia.Native.OSX/clipboard.mm b/native/Avalonia.Native/src/OSX/clipboard.mm similarity index 100% rename from src/Avalonia.Native.OSX/clipboard.mm rename to native/Avalonia.Native/src/OSX/clipboard.mm diff --git a/src/Avalonia.Native.OSX/common.h b/native/Avalonia.Native/src/OSX/common.h similarity index 100% rename from src/Avalonia.Native.OSX/common.h rename to native/Avalonia.Native/src/OSX/common.h diff --git a/src/Avalonia.Native.OSX/cursor.h b/native/Avalonia.Native/src/OSX/cursor.h similarity index 100% rename from src/Avalonia.Native.OSX/cursor.h rename to native/Avalonia.Native/src/OSX/cursor.h diff --git a/src/Avalonia.Native.OSX/cursor.mm b/native/Avalonia.Native/src/OSX/cursor.mm similarity index 100% rename from src/Avalonia.Native.OSX/cursor.mm rename to native/Avalonia.Native/src/OSX/cursor.mm diff --git a/src/Avalonia.Native.OSX/gl.mm b/native/Avalonia.Native/src/OSX/gl.mm similarity index 100% rename from src/Avalonia.Native.OSX/gl.mm rename to native/Avalonia.Native/src/OSX/gl.mm diff --git a/src/Avalonia.Native.OSX/main.mm b/native/Avalonia.Native/src/OSX/main.mm similarity index 100% rename from src/Avalonia.Native.OSX/main.mm rename to native/Avalonia.Native/src/OSX/main.mm diff --git a/src/Avalonia.Native.OSX/platformthreading.mm b/native/Avalonia.Native/src/OSX/platformthreading.mm similarity index 100% rename from src/Avalonia.Native.OSX/platformthreading.mm rename to native/Avalonia.Native/src/OSX/platformthreading.mm diff --git a/src/Avalonia.Native.OSX/window.h b/native/Avalonia.Native/src/OSX/window.h similarity index 100% rename from src/Avalonia.Native.OSX/window.h rename to native/Avalonia.Native/src/OSX/window.h diff --git a/src/Avalonia.Native.OSX/window.mm b/native/Avalonia.Native/src/OSX/window.mm similarity index 100% rename from src/Avalonia.Native.OSX/window.mm rename to native/Avalonia.Native/src/OSX/window.mm diff --git a/src/Avalonia.Native/Avalonia.Native.targets b/src/Avalonia.Native/Avalonia.Native.targets deleted file mode 100644 index 07c1e17c53..0000000000 --- a/src/Avalonia.Native/Avalonia.Native.targets +++ /dev/null @@ -1,9 +0,0 @@ - - - - - libAvalonia.Native.OSX.dylib - PreserveNewest - - - \ No newline at end of file diff --git a/src/Avalonia.Native/Mappings.xml b/src/Avalonia.Native/Mappings.xml index e870f7594e..7ac6377f78 100644 --- a/src/Avalonia.Native/Mappings.xml +++ b/src/Avalonia.Native/Mappings.xml @@ -3,7 +3,7 @@ Avalonia.Native Avalonia.Native.Interop SharpGen.Runtime.COM - $(THIS_CONFIG_PATH)/headers + $(THIS_CONFIG_PATH)/../../native/Avalonia.Native/inc Date: Sat, 27 Oct 2018 18:19:30 -0700 Subject: [PATCH 27/50] Clean up project files messed up in the rebase. --- Avalonia.sln | 3 --- build/CoreLibraries.props | 1 + src/Avalonia.Desktop/AppBuilderDesktopExtensions.cs | 8 ++++---- src/Avalonia.Desktop/Avalonia.Desktop.csproj | 2 +- src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj | 9 --------- src/Avalonia.Native/Properties/AssemblyInfo.cs | 4 ++-- src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj | 7 ------- src/Skia/Avalonia.Skia/Avalonia.Skia.csproj | 9 --------- src/Windows/Avalonia.Win32/Avalonia.Win32.csproj | 10 ---------- 9 files changed, 8 insertions(+), 45 deletions(-) diff --git a/Avalonia.sln b/Avalonia.sln index 34daf3287c..34132d92b5 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -181,9 +181,6 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.OpenGL", "src\Avalonia.OpenGL\Avalonia.OpenGL.csproj", "{7CCAEFC4-135D-401D-BDDD-896B9B7D3569}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Native", "src\Avalonia.Native\Avalonia.Native.csproj", "{12A91A62-C064-42CA-9A8C-A1272F354388}" -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OSX", "OSX", "{A59C4C0A-64DF-4621-B450-2BA00D6F61E2}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.MonoMac", "src\OSX\Avalonia.MonoMac\Avalonia.MonoMac.csproj", "{CBFD5788-567D-401B-9DFA-74E4224025A0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Skia.UnitTests", "tests\Avalonia.Skia.UnitTests\Avalonia.Skia.UnitTests.csproj", "{E1240B49-7B4B-4371-A00E-068778C5CF0B}" EndProject diff --git a/build/CoreLibraries.props b/build/CoreLibraries.props index 4a69998784..d989e643b8 100644 --- a/build/CoreLibraries.props +++ b/build/CoreLibraries.props @@ -12,6 +12,7 @@ + diff --git a/src/Avalonia.Desktop/AppBuilderDesktopExtensions.cs b/src/Avalonia.Desktop/AppBuilderDesktopExtensions.cs index 710964f6e1..4db6de353f 100644 --- a/src/Avalonia.Desktop/AppBuilderDesktopExtensions.cs +++ b/src/Avalonia.Desktop/AppBuilderDesktopExtensions.cs @@ -20,11 +20,11 @@ namespace Avalonia if (os == OperatingSystemType.WinNT) { LoadWin32(builder); - LoadDirect2D1(builder); + LoadSkia(builder); } else if(os==OperatingSystemType.OSX) { - LoadMonoMac(builder); + LoadAvaloniaNative(builder); LoadSkia(builder); } else @@ -35,9 +35,9 @@ namespace Avalonia return builder; } - static void LoadMonoMac(TAppBuilder builder) + static void LoadAvaloniaNative(TAppBuilder builder) where TAppBuilder : AppBuilderBase, new() - => builder.UseMonoMac(); + => builder.UseAvaloniaNative(); static void LoadWin32(TAppBuilder builder) where TAppBuilder : AppBuilderBase, new() => builder.UseWin32(); diff --git a/src/Avalonia.Desktop/Avalonia.Desktop.csproj b/src/Avalonia.Desktop/Avalonia.Desktop.csproj index 4d1237f356..3fc20150a7 100644 --- a/src/Avalonia.Desktop/Avalonia.Desktop.csproj +++ b/src/Avalonia.Desktop/Avalonia.Desktop.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj b/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj index a57cfdb714..a968ff03bf 100644 --- a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj +++ b/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj @@ -3,9 +3,6 @@ netstandard2.0 false - - - @@ -21,10 +18,4 @@ - - - MSBuild:Compile - - - diff --git a/src/Avalonia.Native/Properties/AssemblyInfo.cs b/src/Avalonia.Native/Properties/AssemblyInfo.cs index 7bbd7be747..d4766e45dc 100644 --- a/src/Avalonia.Native/Properties/AssemblyInfo.cs +++ b/src/Avalonia.Native/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using Avalonia.MonoMac; +using Avalonia.Native; using Avalonia.Platform; -[assembly: ExportWindowingSubsystem(OperatingSystemType.OSX, 1, "MonoMac", typeof(MonoMacPlatform), nameof(MonoMacPlatform.Initialize))] +[assembly: ExportWindowingSubsystem(OperatingSystemType.OSX, 1, "AvaloniaNative", typeof(AvaloniaNativePlatform), nameof(AvaloniaNativePlatform.Initialize))] diff --git a/src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj b/src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj index c4be3d4b45..0885ccccfa 100644 --- a/src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj +++ b/src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj @@ -5,13 +5,6 @@ $(DefineConstants);GTK3_PINVOKE - - - - - - - diff --git a/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj b/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj index e6f5b342ab..0479a74937 100644 --- a/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj +++ b/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj @@ -7,15 +7,6 @@ true - - - - - - - - - diff --git a/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj b/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj index c0ee8f1373..d1046c6133 100644 --- a/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj +++ b/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj @@ -4,16 +4,6 @@ true - - - - - - - - - - From f8dbaf13ec334c56e04bbd725a05eb41ed883e4f Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sat, 27 Oct 2018 18:25:20 -0700 Subject: [PATCH 28/50] Remove Copy-Files-Impl task references. --- build.cake | 3 --- 1 file changed, 3 deletions(-) diff --git a/build.cake b/build.cake index 0a54c0f0b5..5f7f324fe4 100644 --- a/build.cake +++ b/build.cake @@ -257,7 +257,6 @@ Task("Package") Task("AppVeyor") .IsDependentOn("Package") - .IsDependentOn("Copy-Files-Impl") .IsDependentOn("Zip-Files-Impl"); Task("Travis") @@ -268,12 +267,10 @@ Task("Azure-Linux") Task("Azure-OSX") .IsDependentOn("Run-Tests") - .IsDependentOn("Copy-Files-Impl") .IsDependentOn("Zip-Files-Impl"); Task("Azure-Windows") .IsDependentOn("Package") - .IsDependentOn("Copy-Files-Impl") .IsDependentOn("Zip-Files-Impl"); /////////////////////////////////////////////////////////////////////////////// From ae68c94943e615cbbe271e7baa39489f227b0c6a Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sat, 27 Oct 2018 18:59:47 -0700 Subject: [PATCH 29/50] Fix designer tests and clean up solution. --- Avalonia.sln | 54 ------------------- .../Avalonia.DesignerSupport.TestApp.csproj | 1 + 2 files changed, 1 insertion(+), 54 deletions(-) diff --git a/Avalonia.sln b/Avalonia.sln index 34132d92b5..7fa5f7736a 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -174,16 +174,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Designer.HostApp", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Previewer", "samples\Previewer\Previewer.csproj", "{F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Designer.HostApp.NetFX", "src\tools\Avalonia.Designer.HostApp.NetFX\Avalonia.Designer.HostApp.NetFX.csproj", "{4ADA61C8-D191-428D-9066-EF4F0D86520F}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Skia.UnitTests", "tests\Avalonia.Skia.UnitTests\Avalonia.Skia.UnitTests.csproj", "{E1240B49-7B4B-4371-A00E-068778C5CF0B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.OpenGL", "src\Avalonia.OpenGL\Avalonia.OpenGL.csproj", "{7CCAEFC4-135D-401D-BDDD-896B9B7D3569}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Native", "src\Avalonia.Native\Avalonia.Native.csproj", "{12A91A62-C064-42CA-9A8C-A1272F354388}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Skia.UnitTests", "tests\Avalonia.Skia.UnitTests\Avalonia.Skia.UnitTests.csproj", "{E1240B49-7B4B-4371-A00E-068778C5CF0B}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.DesktopRuntime", "src\Avalonia.DesktopRuntime\Avalonia.DesktopRuntime.csproj", "{878FEFE0-CD14-41CB-90B0-DBCB163E8F15}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packages", "Packages", "{E870DCD7-F46A-498D-83FC-D0FD13E0A11C}" @@ -1547,54 +1543,6 @@ Global {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Release|iPhone.Build.0 = Release|Any CPU {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.AppStore|Any CPU.Build.0 = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.AppStore|iPhone.Build.0 = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Debug|iPhone.Build.0 = Debug|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Release|Any CPU.Build.0 = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Release|iPhone.ActiveCfg = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Release|iPhone.Build.0 = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {4ADA61C8-D191-428D-9066-EF4F0D86520F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.AppStore|iPhone.Build.0 = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Debug|iPhone.Build.0 = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Release|Any CPU.Build.0 = Release|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Release|iPhone.ActiveCfg = Release|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Release|iPhone.Build.0 = Release|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {CBFD5788-567D-401B-9DFA-74E4224025A0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU @@ -1789,8 +1737,6 @@ Global {E2999E4A-9086-401F-898C-AEB0AD38E676} = {9B9E3891-2366-4253-A952-D08BCEB71098} {050CC912-FF49-4A8B-B534-9544017446DD} = {4ED8B739-6F4E-4CD4-B993-545E6B5CE637} {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE} = {9B9E3891-2366-4253-A952-D08BCEB71098} - {4ADA61C8-D191-428D-9066-EF4F0D86520F} = {4ED8B739-6F4E-4CD4-B993-545E6B5CE637} - {CBFD5788-567D-401B-9DFA-74E4224025A0} = {A59C4C0A-64DF-4621-B450-2BA00D6F61E2} {E1240B49-7B4B-4371-A00E-068778C5CF0B} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {D49233F8-F29C-47DD-9975-C4C9E4502720} = {E870DCD7-F46A-498D-83FC-D0FD13E0A11C} {3C471044-3640-45E3-B1B2-16D2FF8399EE} = {E870DCD7-F46A-498D-83FC-D0FD13E0A11C} diff --git a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj index 85e7f69fbf..ebe64b89ce 100644 --- a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj +++ b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj @@ -16,6 +16,7 @@ + From 054909de7806fe4591fc5ac773b937624aa8e709 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sat, 27 Oct 2018 20:06:04 -0700 Subject: [PATCH 30/50] Remove duplicate content block. --- src/Avalonia.Native/Avalonia.Native.csproj | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Avalonia.Native/Avalonia.Native.csproj b/src/Avalonia.Native/Avalonia.Native.csproj index 4f3d401065..9d6a82a2fb 100644 --- a/src/Avalonia.Native/Avalonia.Native.csproj +++ b/src/Avalonia.Native/Avalonia.Native.csproj @@ -23,12 +23,4 @@ - - - - runtimes/osx/native/libAvaloniaNative.dylib - true - PreserveNewest - - From f23b1a672d8cc33f3e8a73ab103901b5cbab1123 Mon Sep 17 00:00:00 2001 From: Tom Daffin Date: Wed, 24 Oct 2018 05:23:15 -0600 Subject: [PATCH 31/50] Fix a crash when pressing F10 on a window that has no main menu --- src/Avalonia.Input/AccessKeyHandler.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Input/AccessKeyHandler.cs b/src/Avalonia.Input/AccessKeyHandler.cs index b36e145d44..d80acbcd34 100644 --- a/src/Avalonia.Input/AccessKeyHandler.cs +++ b/src/Avalonia.Input/AccessKeyHandler.cs @@ -234,8 +234,10 @@ namespace Avalonia.Input case Key.F10: _owner.ShowAccessKeys = _showingAccessKeys = true; - MainMenu.Open(); - e.Handled = true; + if (MainMenu != null){ + MainMenu.Open(); + e.Handled = true; + } break; } } From 45ae6aac23e3f03d2584f30b4dfdc33398bb110c Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sun, 28 Oct 2018 13:35:37 -0700 Subject: [PATCH 32/50] Fix package versions. --- build.cake | 16 ++++++++++++++++ dirs.proj | 9 --------- global.json | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/build.cake b/build.cake index 5f7f324fe4..ef41ddff64 100644 --- a/build.cake +++ b/build.cake @@ -85,6 +85,13 @@ void DotNetCoreBuild(Parameters parameters) var settings = new DotNetCoreBuildSettings { Configuration = parameters.Configuration, + MSBuildSettings = new DotNetCoreMSBuildSettings + { + Properties = + { + { "PackageVersion", new [] { parameters.Version } } + } + } }; DotNetCoreBuild(parameters.MSBuildSolution, settings); @@ -99,6 +106,7 @@ Task("Build-Impl") settings.SetConfiguration(data.Configuration); settings.SetVerbosity(Verbosity.Minimal); settings.WithProperty("iOSRoslynPathHackRequired", "true"); + settings.WithProperty("PackageVersion", data.Version); settings.UseToolVersion(MSBuildToolVersion.VS2017); settings.WithRestore(); }); @@ -211,6 +219,13 @@ void DotNetCorePack(Parameters parameters) var settings = new DotNetCorePackSettings { Configuration = parameters.Configuration, + MSBuildSettings = new DotNetCoreMSBuildSettings + { + Properties = + { + { "PackageVersion", new [] { parameters.Version } } + } + } }; DotNetCorePack(parameters.MSBuildSolution, settings); @@ -225,6 +240,7 @@ Task("Create-NuGet-Packages-Impl") settings.SetConfiguration(data.Configuration); settings.SetVerbosity(Verbosity.Minimal); settings.WithProperty("iOSRoslynPathHackRequired", "true"); + settings.WithProperty("PackageVersion", data.Version); settings.UseToolVersion(MSBuildToolVersion.VS2017); settings.WithRestore(); settings.WithTarget("Pack"); diff --git a/dirs.proj b/dirs.proj index cd3faf07a6..0f24632b72 100644 --- a/dirs.proj +++ b/dirs.proj @@ -23,13 +23,4 @@ - - - - diff --git a/global.json b/global.json index 4c8e07c2cb..d11e78bd7f 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "msbuild-sdks": { - "Microsoft.Build.Traversal": "1.0.41", + "Microsoft.Build.Traversal": "1.0.43", "MSBuild.Sdk.Extras": "1.6.46", "AggregatePackage.NuGet.Sdk" : "0.1.12" } From 7745d3bd2126a342c908b9489c80c29229d03460 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sun, 28 Oct 2018 15:03:43 -0700 Subject: [PATCH 33/50] Update gitignore. --- .gitignore | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index c5f28a6c1a..6ee6057d5f 100644 --- a/.gitignore +++ b/.gitignore @@ -185,3 +185,13 @@ project.lock.json BenchmarkDotNet.Artifacts/ dirs.sln + + +################## +# XCode +################## +Index/ +Logs/ +ModuleCache.noindex/ +Build/Intermediates.noindex/ +info.plist From 1497549b16c47d3713fb5392cffb26aac027e8ab Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sun, 28 Oct 2018 15:05:14 -0700 Subject: [PATCH 34/50] Publish NuGet packages on OSX. --- azure-pipelines.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 480c49814d..7c306c77e3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -64,6 +64,11 @@ jobs: pathToPublish: '$(Build.SourcesDirectory)/artifacts/bin' artifactName: 'BinariesOSX' condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) + - task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: '$(Build.SourcesDirectory)/artifacts/nuget' + artifactName: 'NuGetOSX' + condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) - job: Windows pool: From 81d8f24939009e438c619e06ae82456ae4d37f18 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sun, 28 Oct 2018 15:18:14 -0700 Subject: [PATCH 35/50] Change cake script to build packages on OSX. --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index ef41ddff64..c074578f95 100644 --- a/build.cake +++ b/build.cake @@ -282,7 +282,7 @@ Task("Azure-Linux") .IsDependentOn("Run-Tests"); Task("Azure-OSX") - .IsDependentOn("Run-Tests") + .IsDependentOn("Package") .IsDependentOn("Zip-Files-Impl"); Task("Azure-Windows") From e71b6a1edff978cf3d86c45710eb82031a2ea13a Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sun, 28 Oct 2018 23:30:01 +0100 Subject: [PATCH 36/50] Compare IntPtrs with IntPtr.Zero instead of null D'oh. I wish C# would warn for this. --- src/Windows/Avalonia.Win32/Win32Platform.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Windows/Avalonia.Win32/Win32Platform.cs b/src/Windows/Avalonia.Win32/Win32Platform.cs index 06fe1ad058..103ca57cdb 100644 --- a/src/Windows/Avalonia.Win32/Win32Platform.cs +++ b/src/Windows/Avalonia.Win32/Win32Platform.cs @@ -247,7 +247,7 @@ namespace Avalonia.Win32 var user32 = LoadLibrary("user32.dll"); var method = GetProcAddress(user32, nameof(SetProcessDpiAwarenessContext)); - if (method != null) + if (method != IntPtr.Zero) { if (SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) || SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE)) @@ -259,7 +259,7 @@ namespace Avalonia.Win32 var shcore = LoadLibrary("shcore.dll"); method = GetProcAddress(shcore, nameof(SetProcessDpiAwareness)); - if (method != null) + if (method != IntPtr.Zero) { SetProcessDpiAwareness(PROCESS_DPI_AWARENESS.PROCESS_PER_MONITOR_DPI_AWARE); return; From c2b93c8f8f5afefd0ce39c4a5911e54d02a66b04 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sun, 28 Oct 2018 23:47:03 +0000 Subject: [PATCH 37/50] dont publish bin folders --- azure-pipelines.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7c306c77e3..00fe51534c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -58,12 +58,6 @@ jobs: 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)) - task: PublishBuildArtifacts@1 inputs: pathtoPublish: '$(Build.SourcesDirectory)/artifacts/nuget' @@ -93,8 +87,3 @@ jobs: 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)) From 1fff6937301d1f932d94ebe6c4d5631ee1b049a6 Mon Sep 17 00:00:00 2001 From: Tom Daffin Date: Sun, 28 Oct 2018 19:21:08 -0600 Subject: [PATCH 38/50] Fix brace style --- src/Avalonia.Input/AccessKeyHandler.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Input/AccessKeyHandler.cs b/src/Avalonia.Input/AccessKeyHandler.cs index d80acbcd34..29768513f3 100644 --- a/src/Avalonia.Input/AccessKeyHandler.cs +++ b/src/Avalonia.Input/AccessKeyHandler.cs @@ -234,7 +234,8 @@ namespace Avalonia.Input case Key.F10: _owner.ShowAccessKeys = _showingAccessKeys = true; - if (MainMenu != null){ + if (MainMenu != null) + { MainMenu.Open(); e.Handled = true; } From f5f8d1594c21ea35af4679215bf71497e13f0802 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sun, 28 Oct 2018 23:41:18 -0700 Subject: [PATCH 39/50] Publish test results and make task names more readable. --- azure-pipelines.yml | 66 ++++++++++++++++++++++++++++++++++----------- build.cake | 22 ++++++++++----- parameters.cake | 6 ++++- 3 files changed, 71 insertions(+), 23 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 00fe51534c..5156bac3b5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,20 +4,31 @@ jobs: vmImage: 'ubuntu-16.04' steps: - task: CmdLine@2 + displayName: 'Install CastXML' inputs: script: | sudo apt-get update sudo apt-get install castxml + - task: CmdLine@2 + displayName: 'Install Cake' inputs: script: | dotnet tool install -g Cake.Tool --version 0.30.0 - - script: | - export PATH="$PATH:$HOME/.dotnet/tools" - dotnet --info - printenv - dotnet cake build.cake -target="Azure-Linux" -configuration="Release" + - task: CmdLine@2 + displayName: 'Run Cake' + inputs: + script: | + export PATH="$PATH:$HOME/.dotnet/tools" + dotnet --info + printenv + dotnet cake build.cake -target="Azure-Linux" -configuration="Release" + + - task: PublishTestResults@2 + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '$(Build.SourcesDirectory)/artifacts/test-results/*.trx' - job: macOS pool: @@ -26,6 +37,7 @@ jobs: - task: DotNetCoreInstaller@0 inputs: version: '2.1.403' + - task: Xcode@5 inputs: actions: 'build' @@ -35,29 +47,43 @@ jobs: xcWorkspacePath: '**/*.xcodeproj/project.xcworkspace' xcodeVersion: 'default' # Options: 8, 9, default, specifyPath args: '-derivedDataPath ./' + - task: CmdLine@2 + displayName: 'Install CastXML' inputs: script: brew install castxml + - task: CmdLine@2 + displayName: 'Install Cake' inputs: script: | dotnet tool install -g Cake.Tool --version 0.30.0 - - script: | - export COREHOST_TRACE=0 - export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - export DOTNET_CLI_TELEMETRY_OPTOUT=1 - which dotnet - dotnet --info - export PATH="$PATH:$HOME/.dotnet/tools" - dotnet --info - printenv - dotnet cake build.cake -target="Azure-OSX" -configuration="Release" + + - task: CmdLine@2 + displayName: 'Run Cake' + inputs: + script: | + export COREHOST_TRACE=0 + export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + export DOTNET_CLI_TELEMETRY_OPTOUT=1 + which dotnet + dotnet --info + export PATH="$PATH:$HOME/.dotnet/tools" + dotnet --info + printenv + dotnet cake build.cake -target="Azure-OSX" -configuration="Release" + + - task: PublishTestResults@2 + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '$(Build.SourcesDirectory)/artifacts/test-results/*.trx' - task: PublishBuildArtifacts@1 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/nuget' @@ -69,19 +95,29 @@ jobs: vmImage: 'vs2017-win2016' steps: - task: CmdLine@2 + displayName: 'Install Cake' inputs: script: | dotnet tool install -g Cake.Tool --version 0.30.0 + - task: CmdLine@2 + displayName: 'Run Cake' inputs: script: | set PATH=%PATH%;%USERPROFILE%\.dotnet\tools dotnet cake build.cake -target="Azure-Windows" -configuration="Release" + + - task: PublishTestResults@2 + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '$(Build.SourcesDirectory)/artifacts/test-results/*.trx' + - task: PublishBuildArtifacts@1 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' diff --git a/build.cake b/build.cake index c074578f95..c781c0f2e5 100644 --- a/build.cake +++ b/build.cake @@ -78,6 +78,7 @@ Task("Clean-Impl") CleanDirectory(data.ArtifactsDir); CleanDirectory(data.NugetRoot); CleanDirectory(data.ZipRoot); + CleanDirectory(data.TestResultsRoot); }); void DotNetCoreBuild(Parameters parameters) @@ -129,13 +130,20 @@ void RunCoreTest(string project, Parameters parameters, bool coreOnly = false) continue; Information("Running for " + fw); - DotNetCoreTest(project, - new DotNetCoreTestSettings { - Configuration = parameters.Configuration, - Framework = fw, - NoBuild = true, - NoRestore = true - }); + var settings = new DotNetCoreTestSettings { + Configuration = parameters.Configuration, + Framework = fw, + NoBuild = true, + NoRestore = true + }; + + if (parameters.PublishTestResults) + { + settings.Logger = "trx"; + settings.ResultsDirectory = parameters.TestResultsRoot; + } + + DotNetCoreTest(project, settings); } } diff --git a/parameters.cake b/parameters.cake index 7db344c41c..8d813accbb 100644 --- a/parameters.cake +++ b/parameters.cake @@ -22,11 +22,13 @@ public class Parameters public bool IsReleasable { get; private set; } public bool IsMyGetRelease { get; private set; } public bool IsNuGetRelease { get; private set; } + public bool PublishTestResults { get; private set; } public string Version { get; private set; } public DirectoryPath ArtifactsDir { get; private set; } public DirectoryPath NugetRoot { get; private set; } public DirectoryPath ZipRoot { get; private set; } public DirectoryPath BinRoot { get; private set; } + public DirectoryPath TestResultsRoot { get; private set; } public string DirSuffix { get; private set; } public DirectoryPathCollection BuildDirs { get; private set; } public string FileZipSuffix { get; private set; } @@ -91,7 +93,8 @@ public class Parameters else if (IsRunningOnAzure) { // Use AssemblyVersion with Build as version - Version += "-build" + context.EnvironmentVariable("BUILD_BUILDID") + "-beta"; + Version += "-build" + context.EnvironmentVariable("BUILD_BUILDID") + "-beta"; + PublishTestResults = true; } // DIRECTORIES @@ -99,6 +102,7 @@ public class Parameters NugetRoot = ArtifactsDir.Combine("nuget"); ZipRoot = ArtifactsDir.Combine("zip"); BinRoot = ArtifactsDir.Combine("bin"); + TestResultsRoot = ArtifactsDir.Combine("test-results"); BuildDirs = context.GetDirectories("**/bin") + context.GetDirectories("**/obj"); DirSuffix = Configuration; FileZipSuffix = Version + ".zip"; From fd041c3af584ce6f45aea275c61d6b0bf82921a0 Mon Sep 17 00:00:00 2001 From: ahopper Date: Mon, 29 Oct 2018 08:47:08 +0000 Subject: [PATCH 40/50] allow annimation of structs without typeConverter --- src/Avalonia.Animation/AnimatorKeyFrame.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Avalonia.Animation/AnimatorKeyFrame.cs b/src/Avalonia.Animation/AnimatorKeyFrame.cs index 09f259e754..5749dd7388 100644 --- a/src/Avalonia.Animation/AnimatorKeyFrame.cs +++ b/src/Avalonia.Animation/AnimatorKeyFrame.cs @@ -61,6 +61,10 @@ namespace Avalonia.Animation { throw new ArgumentNullException($"KeyFrame value can't be null."); } + if(Value is T typedValue ) + { + return typedValue; + } if (!typeConv.CanConvertTo(Value.GetType())) { throw new InvalidCastException($"KeyFrame value doesnt match property type."); From 17a976c99be3640a7841484c944bcb3e0f8b9de0 Mon Sep 17 00:00:00 2001 From: ahopper Date: Mon, 29 Oct 2018 10:32:23 +0000 Subject: [PATCH 41/50] space removed --- src/Avalonia.Animation/AnimatorKeyFrame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Animation/AnimatorKeyFrame.cs b/src/Avalonia.Animation/AnimatorKeyFrame.cs index 5749dd7388..78a9a1e412 100644 --- a/src/Avalonia.Animation/AnimatorKeyFrame.cs +++ b/src/Avalonia.Animation/AnimatorKeyFrame.cs @@ -61,7 +61,7 @@ namespace Avalonia.Animation { throw new ArgumentNullException($"KeyFrame value can't be null."); } - if(Value is T typedValue ) + if(Value is T typedValue) { return typedValue; } From f2d126b9d2ee4cb47f7a80a4f580f8f09910c37a Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 29 Oct 2018 10:38:27 +0000 Subject: [PATCH 42/50] update avalonia.native to use PixelSize. --- src/Avalonia.Native/DeferredFramebuffer.cs | 9 ++++----- src/Avalonia.Native/WindowImplBase.cs | 6 ++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Avalonia.Native/DeferredFramebuffer.cs b/src/Avalonia.Native/DeferredFramebuffer.cs index 4bee59266c..adc721de42 100644 --- a/src/Avalonia.Native/DeferredFramebuffer.cs +++ b/src/Avalonia.Native/DeferredFramebuffer.cs @@ -18,15 +18,14 @@ namespace Avalonia.Native { _lockWindow = lockWindow; Address = Marshal.AllocHGlobal(width * height * 4); - Width = width; - Height = height; + Size = new PixelSize(width, height); RowBytes = width * 4; Dpi = dpi; Format = PixelFormat.Rgba8888; } public IntPtr Address { get; set; } - public int Width { get; set; } + public PixelSize Size { get; set; } public int Height { get; set; } public int RowBytes { get; set; } public Vector Dpi { get; set; } @@ -66,8 +65,8 @@ namespace Avalonia.Native X = Dpi.X, Y = Dpi.Y }, - Width = Width, - Height = Height, + Width = Size.Width, + Height = Size.Height, PixelFormat = (AvnPixelFormat)Format, Stride = RowBytes }; diff --git a/src/Avalonia.Native/WindowImplBase.cs b/src/Avalonia.Native/WindowImplBase.cs index e81e912a0a..aaaba44fff 100644 --- a/src/Avalonia.Native/WindowImplBase.cs +++ b/src/Avalonia.Native/WindowImplBase.cs @@ -100,15 +100,13 @@ namespace Avalonia.Native public FramebufferWrapper(AvnFramebuffer fb) { Address = fb.Data; - Width = fb.Width; - Height = fb.Height; + Size = new PixelSize(fb.Width, fb.Height); RowBytes = fb.Stride; Dpi = new Vector(fb.Dpi.X, fb.Dpi.Y); Format = (PixelFormat)fb.PixelFormat; } public IntPtr Address { get; set; } - public int Width { get; set; } - public int Height { get; set; } + public PixelSize Size { get; set; } public int RowBytes {get;set;} public Vector Dpi { get; set; } public PixelFormat Format { get; } From ef7a1f723db7f538bd18c6f829545f3efd0bd6d0 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Mon, 29 Oct 2018 18:53:36 +0800 Subject: [PATCH 43/50] Fix AnimationsPage crash, related to #1939 --- samples/RenderDemo/MainWindow.xaml | 18 ++++++++----- samples/RenderDemo/Pages/AnimationsPage.xaml | 28 ++++++++++---------- samples/RenderDemo/Pages/ClippingPage.xaml | 12 ++++----- samples/RenderDemo/Pages/DrawingPage.xaml | 4 +-- src/Avalonia.HtmlRenderer/external | 1 + 5 files changed, 35 insertions(+), 28 deletions(-) create mode 160000 src/Avalonia.HtmlRenderer/external diff --git a/samples/RenderDemo/MainWindow.xaml b/samples/RenderDemo/MainWindow.xaml index df2b221423..fc5b1ce94d 100644 --- a/samples/RenderDemo/MainWindow.xaml +++ b/samples/RenderDemo/MainWindow.xaml @@ -8,12 +8,13 @@ - - + - - - - + + + + + + + + + \ No newline at end of file diff --git a/samples/RenderDemo/Pages/AnimationsPage.xaml b/samples/RenderDemo/Pages/AnimationsPage.xaml index 473807ac50..1646708797 100644 --- a/samples/RenderDemo/Pages/AnimationsPage.xaml +++ b/samples/RenderDemo/Pages/AnimationsPage.xaml @@ -1,12 +1,12 @@ - +