Browse Source

Borking changes

pull/11557/head
Nikita Tsukanov 3 years ago
committed by Dan Walmsley
parent
commit
b445ea9d68
  1. 10
      nukebuild/RefAssemblyGenerator.cs
  2. 1
      samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj
  3. 2
      src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs
  4. 4
      src/Avalonia.Base/AvaloniaLocator.cs
  5. 2
      src/Avalonia.Base/Input/DragDropDevice.cs
  6. 2
      src/Avalonia.Base/Input/IInputDevice.cs
  7. 2
      src/Avalonia.Base/Input/IInputManager.cs
  8. 1
      src/Avalonia.Base/Input/IKeyboardNavigationHandler.cs
  9. 2
      src/Avalonia.Base/Input/InputManager.cs
  10. 5
      src/Avalonia.Base/Input/KeyboardNavigationHandler.cs
  11. 2
      src/Avalonia.Base/Input/Raw/RawDragEvent.cs
  12. 2
      src/Avalonia.Base/Input/Raw/RawInputEventArgs.cs
  13. 3
      src/Avalonia.Base/Input/Raw/RawKeyEventArgs.cs
  14. 3
      src/Avalonia.Base/Input/Raw/RawMouseWheelEventArgs.cs
  15. 3
      src/Avalonia.Base/Input/Raw/RawPointerEventArgs.cs
  16. 3
      src/Avalonia.Base/Input/Raw/RawPointerGestureEventArgs.cs
  17. 2
      src/Avalonia.Base/Input/Raw/RawSizeEventArgs.cs
  18. 3
      src/Avalonia.Base/Input/Raw/RawTextInputEventArgs.cs
  19. 2
      src/Avalonia.Base/Input/Raw/RawTouchEventArgs.cs
  20. 2
      src/Avalonia.Base/Media/Brush.cs
  21. 2
      src/Avalonia.Base/Media/DrawingBrush.cs
  22. 2
      src/Avalonia.Base/Media/VisualBrush.cs
  23. 2
      src/Avalonia.Base/Metadata/PrivateApiAttribute.cs
  24. 7
      src/Avalonia.Base/Platform/IModuleEnvironmentChecker.cs
  25. 2
      src/Avalonia.Base/Platform/IPlatformThreadingInterface.cs
  26. 2
      src/Avalonia.Base/Platform/IRenderTarget.cs
  27. 1
      src/Avalonia.Base/Platform/Interop/IDynamicLibraryLoader.cs
  28. 2
      src/Avalonia.Base/Platform/Interop/Utf8Buffer.cs
  29. 2
      src/Avalonia.Base/Rendering/DefaultRenderTimer.cs
  30. 87
      src/Avalonia.Base/Rendering/DirtyRects.cs
  31. 104
      src/Avalonia.Base/Rendering/DirtyVisuals.cs
  32. 51
      src/Avalonia.Base/Rendering/DisplayDirtyRect.cs
  33. 62
      src/Avalonia.Base/Rendering/DisplayDirtyRects.cs
  34. 11
      src/Avalonia.Base/Rendering/IDeferredRendererLock.cs
  35. 2
      src/Avalonia.Base/Rendering/IRenderTimer.cs
  36. 2
      src/Avalonia.Base/Rendering/IVisualBrushInitialize.cs
  37. 11
      src/Avalonia.Base/Rendering/ManagedDeferredRendererLock.cs
  38. 2
      src/Avalonia.Base/Rendering/SceneInvalidatedEventArgs.cs
  39. 2
      src/Avalonia.Base/Rendering/SleepLoopRenderTimer.cs
  40. 2
      src/Avalonia.Base/Rendering/UiThreadRenderTimer.cs
  41. 5
      src/Avalonia.Base/VisualTree/IVisualWithRoundRectClip.cs
  42. 18
      src/Avalonia.Controls/Application.cs
  43. 2
      src/Avalonia.Controls/Platform/INativeApplicationCommands.cs
  44. 2
      src/Avalonia.Controls/Platform/IPlatformNativeSurfaceHandle.cs
  45. 4
      src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs
  46. 2
      src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositionerPopupImplHelper.cs
  47. 9
      src/Avalonia.Diagnostics/Diagnostics/Controls/Application.cs
  48. 2
      src/Avalonia.X11/X11Window.cs
  49. 2
      src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs
  50. 1
      src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs
  51. 2
      src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj
  52. 24
      src/Windows/Avalonia.Direct2D1/Direct2DChecker.cs
  53. 14
      src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs
  54. 4
      src/Windows/Avalonia.Win32/WindowImpl.cs
  55. 7
      tests/Avalonia.UnitTests/NullRenderer.cs

10
nukebuild/RefAssemblyGenerator.cs

@ -123,6 +123,16 @@ public class RefAssemblyGenerator
}
}
foreach (var cl in type.NestedTypes)
{
ProcessType(cl, obsoleteCtor);
if (hideMembers)
{
var dflags = TypeAttributes.Public;
cl.Attributes = ((cl.Attributes | dflags) ^ dflags) | TypeAttributes.NotPublic;
}
}
foreach (var m in type.Properties)
MarkAsUnstable(m, obsoleteCtor, forceUnstable);
foreach (var m in type.Events)

1
samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj

@ -16,6 +16,7 @@
<ItemGroup>
<Compile Include="..\..\src\Avalonia.X11\NativeDialogs\Gtk.cs" Link="NativeControls\Gtk\Gtk.cs" />
<Compile Include="..\..\src\Avalonia.Base\Platform\Interop\Utf8Buffer.cs" Link="NativeControls\Utf8Buffer.cs" />
</ItemGroup>
<ItemGroup>

2
src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs

@ -10,7 +10,7 @@ using Avalonia.Platform;
namespace Avalonia.Android
{
internal abstract class InvalidationAwareSurfaceView : SurfaceView, ISurfaceHolderCallback, IPlatformNativeSurfaceHandle
internal abstract class InvalidationAwareSurfaceView : SurfaceView, ISurfaceHolderCallback, INativePlatformHandleSurface
{
bool _invalidateQueued;
readonly object _lock = new object();

4
src/Avalonia.Base/AvaloniaLocator.cs

@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using Avalonia.Metadata;
#pragma warning disable CS1591 // Enable me later
namespace Avalonia
{
[PrivateApi]
public class AvaloniaLocator : IAvaloniaDependencyResolver
{
private readonly IAvaloniaDependencyResolver? _parentScope;
@ -114,11 +116,13 @@ namespace Avalonia
}
}
[PrivateApi]
public interface IAvaloniaDependencyResolver
{
object? GetService(Type t);
}
[PrivateApi]
public static class LocatorExtensions
{
public static T? GetService<T>(this IAvaloniaDependencyResolver resolver)

2
src/Avalonia.Base/Input/DragDropDevice.cs

@ -2,9 +2,11 @@
using Avalonia.VisualTree;
using System.Linq;
using Avalonia.Input.Raw;
using Avalonia.Metadata;
namespace Avalonia.Input
{
[PrivateApi]
public class DragDropDevice : IDragDropDevice
{
public static readonly DragDropDevice Instance = new DragDropDevice();

2
src/Avalonia.Base/Input/IInputDevice.cs

@ -3,7 +3,7 @@ using Avalonia.Metadata;
namespace Avalonia.Input
{
[NotClientImplementable]
[NotClientImplementable, PrivateApi]
public interface IInputDevice
{
/// <summary>

2
src/Avalonia.Base/Input/IInputManager.cs

@ -8,7 +8,7 @@ namespace Avalonia.Input
/// Receives input from the windowing subsystem and dispatches it to interested parties
/// for processing.
/// </summary>
[NotClientImplementable]
[NotClientImplementable, PrivateApi]
public interface IInputManager
{
/// <summary>

1
src/Avalonia.Base/Input/IKeyboardNavigationHandler.cs

@ -15,6 +15,7 @@ namespace Avalonia.Input
/// <remarks>
/// This method can only be called once, typically by the owner itself on creation.
/// </remarks>
[PrivateApi]
void SetOwner(IInputRoot owner);
/// <summary>

2
src/Avalonia.Base/Input/InputManager.cs

@ -8,7 +8,7 @@ namespace Avalonia.Input
/// Receives input from the windowing subsystem and dispatches it to interested parties
/// for processing.
/// </summary>
public class InputManager : IInputManager
internal class InputManager : IInputManager
{
private readonly LightweightSubject<RawInputEventArgs> _preProcess = new();
private readonly LightweightSubject<RawInputEventArgs> _process = new();

5
src/Avalonia.Base/Input/KeyboardNavigationHandler.cs

@ -10,7 +10,7 @@ namespace Avalonia.Input
/// Handles keyboard navigation for a window.
/// </summary>
[Unstable]
public class KeyboardNavigationHandler : IKeyboardNavigationHandler
public sealed class KeyboardNavigationHandler : IKeyboardNavigationHandler
{
/// <summary>
/// The window to which the handler belongs.
@ -24,6 +24,7 @@ namespace Avalonia.Input
/// <remarks>
/// This method can only be called once, typically by the owner itself on creation.
/// </remarks>
[PrivateApi]
public void SetOwner(IInputRoot owner)
{
if (_owner != null)
@ -102,7 +103,7 @@ namespace Avalonia.Input
/// </summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event args.</param>
protected virtual void OnKeyDown(object? sender, KeyEventArgs e)
void OnKeyDown(object? sender, KeyEventArgs e)
{
if (e.Key == Key.Tab)
{

2
src/Avalonia.Base/Input/Raw/RawDragEvent.cs

@ -1,7 +1,9 @@
using System;
using Avalonia.Metadata;
namespace Avalonia.Input.Raw
{
[PrivateApi]
public class RawDragEvent : RawInputEventArgs
{
public Point Location { get; set; }

2
src/Avalonia.Base/Input/Raw/RawInputEventArgs.cs

@ -1,4 +1,5 @@
using System;
using Avalonia.Metadata;
namespace Avalonia.Input.Raw
{
@ -11,6 +12,7 @@ namespace Avalonia.Input.Raw
/// pre-processing they are consumed by the relevant <see cref="Device"/> and turned into
/// standard Avalonia events.
/// </remarks>
[PrivateApi]
public class RawInputEventArgs : EventArgs
{
/// <summary>

3
src/Avalonia.Base/Input/Raw/RawKeyEventArgs.cs

@ -1,3 +1,5 @@
using Avalonia.Metadata;
namespace Avalonia.Input.Raw
{
public enum RawKeyEventType
@ -6,6 +8,7 @@ namespace Avalonia.Input.Raw
KeyUp
}
[PrivateApi]
public class RawKeyEventArgs : RawInputEventArgs
{
public RawKeyEventArgs(

3
src/Avalonia.Base/Input/Raw/RawMouseWheelEventArgs.cs

@ -1,6 +1,9 @@
using Avalonia.Metadata;
namespace Avalonia.Input.Raw
{
[PrivateApi]
public class RawMouseWheelEventArgs : RawPointerEventArgs
{
public RawMouseWheelEventArgs(

3
src/Avalonia.Base/Input/Raw/RawPointerEventArgs.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Avalonia.Metadata;
namespace Avalonia.Input.Raw
{
@ -31,6 +32,7 @@ namespace Avalonia.Input.Raw
/// <summary>
/// A raw mouse event.
/// </summary>
[PrivateApi]
public class RawPointerEventArgs : RawInputEventArgs
{
private RawPointerPoint _point;
@ -124,6 +126,7 @@ namespace Avalonia.Input.Raw
internal IInputElement? InputHitTestResult { get; set; }
}
[PrivateApi]
public record struct RawPointerPoint
{
/// <summary>

3
src/Avalonia.Base/Input/Raw/RawPointerGestureEventArgs.cs

@ -1,5 +1,8 @@
using Avalonia.Metadata;
namespace Avalonia.Input.Raw
{
[PrivateApi]
public class RawPointerGestureEventArgs : RawPointerEventArgs
{
public RawPointerGestureEventArgs(

2
src/Avalonia.Base/Input/Raw/RawSizeEventArgs.cs

@ -1,7 +1,9 @@
using System;
using Avalonia.Metadata;
namespace Avalonia.Input.Raw
{
[PrivateApi]
public class RawSizeEventArgs : EventArgs
{
public RawSizeEventArgs(Size size)

3
src/Avalonia.Base/Input/Raw/RawTextInputEventArgs.cs

@ -1,5 +1,8 @@
using Avalonia.Metadata;
namespace Avalonia.Input.Raw
{
[PrivateApi]
public class RawTextInputEventArgs : RawInputEventArgs
{
public RawTextInputEventArgs(

2
src/Avalonia.Base/Input/Raw/RawTouchEventArgs.cs

@ -1,7 +1,9 @@
using System;
using Avalonia.Metadata;
namespace Avalonia.Input.Raw
{
[PrivateApi]
public class RawTouchEventArgs : RawPointerEventArgs
{
public RawTouchEventArgs(IInputDevice device, ulong timestamp, IInputRoot root,

2
src/Avalonia.Base/Media/Brush.cs

@ -118,7 +118,7 @@ namespace Avalonia.Media
OnReferencedFromCompositor(c);
}
protected virtual void OnReferencedFromCompositor(Compositor c)
private protected virtual void OnReferencedFromCompositor(Compositor c)
{
if (Transform is ICompositionRenderResource<ITransform> resource)
resource.AddRefOnCompositor(c);

2
src/Avalonia.Base/Media/DrawingBrush.cs

@ -60,7 +60,7 @@ namespace Avalonia.Media
private InlineDictionary<Compositor, CompositionRenderDataSceneBrushContent?> _renderDataDictionary;
protected override void OnReferencedFromCompositor(Compositor c)
private protected override void OnReferencedFromCompositor(Compositor c)
{
_renderDataDictionary.Add(c, CreateServerContent(c));
base.OnReferencedFromCompositor(c);

2
src/Avalonia.Base/Media/VisualBrush.cs

@ -64,7 +64,7 @@ namespace Avalonia.Media
private InlineDictionary<Compositor, CompositionRenderDataSceneBrushContent?> _renderDataDictionary;
protected override void OnReferencedFromCompositor(Compositor c)
private protected override void OnReferencedFromCompositor(Compositor c)
{
_renderDataDictionary.Add(c, CreateServerContent(c));
base.OnReferencedFromCompositor(c);

2
src/Avalonia.Base/Metadata/PrivateApiAttribute.cs

@ -3,7 +3,7 @@ using System;
namespace Avalonia.Metadata;
[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Constructor
| AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field)]
| AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Struct)]
public sealed class PrivateApiAttribute : Attribute
{

7
src/Avalonia.Base/Platform/IModuleEnvironmentChecker.cs

@ -1,7 +0,0 @@
namespace Avalonia.Platform
{
public interface IModuleEnvironmentChecker
{
bool IsCompatible { get; }
}
}

2
src/Avalonia.Base/Platform/IPlatformThreadingInterface.cs

@ -8,7 +8,7 @@ namespace Avalonia.Platform
/// <summary>
/// Provides platform-specific services relating to threading.
/// </summary>
[Unstable]
[PrivateApi]
public interface IPlatformThreadingInterface
{
/// <summary>

2
src/Avalonia.Base/Platform/IRenderTarget.cs

@ -1,4 +1,5 @@
using System;
using Avalonia.Metadata;
using Avalonia.Rendering;
namespace Avalonia.Platform
@ -9,6 +10,7 @@ namespace Avalonia.Platform
/// <remarks>
/// The interface used for obtaining drawing context from surfaces you can render on.
/// </remarks>
[PrivateApi]
public interface IRenderTarget : IDisposable
{
/// <summary>

1
src/Avalonia.Base/Platform/Interop/IDynamicLibraryLoader.cs

@ -3,7 +3,6 @@ using Avalonia.Metadata;
namespace Avalonia.Platform.Interop
{
[Unstable]
public interface IDynamicLibraryLoader
{
IntPtr LoadLibrary(string dll);

2
src/Avalonia.Base/Platform/Interop/Utf8Buffer.cs

@ -5,7 +5,7 @@ using System.Text;
namespace Avalonia.Platform.Interop
{
public class Utf8Buffer : SafeHandle
internal class Utf8Buffer : SafeHandle
{
private GCHandle _gcHandle;
private byte[]? _data;

2
src/Avalonia.Base/Rendering/DefaultRenderTimer.cs

@ -1,4 +1,5 @@
using System;
using Avalonia.Metadata;
using Avalonia.Platform;
namespace Avalonia.Rendering
@ -10,6 +11,7 @@ namespace Avalonia.Rendering
/// This class may be overridden by platform implementations to use a specialized timer
/// implementation.
/// </remarks>
[PrivateApi]
public class DefaultRenderTimer : IRenderTimer
{
private IRuntimePlatform? _runtime;

87
src/Avalonia.Base/Rendering/DirtyRects.cs

@ -1,87 +0,0 @@
using System.Collections;
using System.Collections.Generic;
namespace Avalonia.Rendering
{
/// <summary>
/// Tracks dirty rectangles.
/// </summary>
internal class DirtyRects : IEnumerable<Rect>
{
private List<Rect> _rects = new List<Rect>();
/// <summary>
/// Gets a value indicating whether the collection of dirty rectangles is empty.
/// </summary>
public bool IsEmpty => _rects.Count == 0;
/// <summary>
/// Adds a dirty rectangle, extending an existing dirty rectangle if it intersects.
/// </summary>
/// <param name="rect">The dirt rectangle.</param>
/// <remarks>
/// We probably want to do this more intelligently because:
/// - Adding e.g. the top left quarter of a scene and the bottom left quarter of a scene
/// will cause the whole scene to be invalidated if they overlap by a single pixel
/// - Adding two adjacent rectangles that don't overlap will not cause them to be
/// coalesced
/// - It only coalesces the first intersecting rectangle found - one needs to
/// call <see cref="Coalesce"/> at the end of the draw cycle to coalesce the rest.
/// </remarks>
public void Add(Rect rect)
{
if (rect.Width != 0 || rect.Height != 0)
{
for (var i = 0; i < _rects.Count; ++i)
{
var r = _rects[i];
if (r.Intersects(rect))
{
_rects[i] = r.Union(rect);
return;
}
}
_rects.Add(rect);
}
}
/// <summary>
/// Works around our flimsy dirt-rect coalescing algorithm.
/// </summary>
/// <remarks>
/// See the comments in <see cref="Add(Rect)"/>.
/// </remarks>
public void Coalesce()
{
for (var i = _rects.Count - 1; i >= 0; --i)
{
var a = _rects[i];
for (var j = 0; j < i; ++j)
{
var b = _rects[j];
if (i < _rects.Count && a.Intersects(b))
{
_rects[i] = _rects[i].Union(b);
_rects.RemoveAt(i);
}
}
}
}
/// <summary>
/// Gets the dirty rectangles.
/// </summary>
/// <returns>A collection of dirty rectangles</returns>
public IEnumerator<Rect> GetEnumerator() => _rects.GetEnumerator();
/// <summary>
/// Gets the dirty rectangles.
/// </summary>
/// <returns>A collection of dirty rectangles</returns>
IEnumerator IEnumerable.GetEnumerator() => _rects.GetEnumerator();
}
}

104
src/Avalonia.Base/Rendering/DirtyVisuals.cs

@ -1,104 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Avalonia.VisualTree;
namespace Avalonia.Rendering
{
/// <summary>
/// Stores a list of dirty visuals for an <see cref="IRenderer"/>.
/// </summary>
/// <remarks>
/// This class stores the dirty visuals for a scene, ordered by their distance to the root
/// visual. TODO: We probably want to put an upper limit on the number of visuals that can be
/// stored and if we reach that limit, assume all visuals are dirty.
/// </remarks>
internal class DirtyVisuals : IEnumerable<Visual>
{
private SortedDictionary<int, List<Visual>> _inner = new SortedDictionary<int, List<Visual>>();
private Dictionary<Visual, int> _index = new Dictionary<Visual, int>();
private int _enumerating;
/// <summary>
/// Gets the number of dirty visuals.
/// </summary>
public int Count => _index.Count;
/// <summary>
/// Adds a visual to the dirty list.
/// </summary>
/// <param name="visual">The dirty visual.</param>
public void Add(Visual visual)
{
if (_enumerating > 0)
{
throw new InvalidOperationException("Visual was invalidated during a render pass");
}
var distance = visual.CalculateDistanceFromAncestor((Visual?)visual.GetVisualRoot());
if (_index.TryGetValue(visual, out var existingDistance))
{
if (distance == existingDistance)
{
return;
}
_inner[existingDistance].Remove(visual);
_index.Remove(visual);
}
if (!_inner.TryGetValue(distance, out var list))
{
list = new List<Visual>();
_inner.Add(distance, list);
}
list.Add(visual);
_index.Add(visual, distance);
}
/// <summary>
/// Clears the list.
/// </summary>
public void Clear()
{
if (_enumerating > 0)
{
throw new InvalidOperationException("Cannot clear while enumerating");
}
_inner.Clear();
_index.Clear();
}
/// <summary>
/// Gets the dirty visuals, in ascending order of distance to their root.
/// </summary>
/// <returns>A collection of visuals.</returns>
public IEnumerator<Visual> GetEnumerator()
{
_enumerating++;
try
{
foreach (var i in _inner)
{
foreach (var j in i.Value)
{
yield return j;
}
}
}
finally
{
_enumerating--;
}
}
/// <summary>
/// Gets the dirty visuals, in ascending order of distance to their root.
/// </summary>
/// <returns>A collection of visuals.</returns>
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}

51
src/Avalonia.Base/Rendering/DisplayDirtyRect.cs

@ -1,51 +0,0 @@
using System;
namespace Avalonia.Rendering
{
/// <summary>
/// Holds the state for a dirty rect rendered when <see cref="IRenderer.SceneInvalidated"/> is set.
/// </summary>
internal class DisplayDirtyRect
{
public static readonly TimeSpan TimeToLive = TimeSpan.FromMilliseconds(250);
/// <summary>
/// Initializes a new instance of the <see cref="DisplayDirtyRect"/> class.
/// </summary>
/// <param name="rect">The dirt rect.</param>
public DisplayDirtyRect(Rect rect)
{
Rect = rect;
ResetLifetime();
}
/// <summary>
/// Gets the bounds of the dirty rectangle.
/// </summary>
public Rect Rect { get; }
/// <summary>
/// Gets the time at which the rectangle was made dirty.
/// </summary>
public DateTimeOffset Born { get; private set; }
/// <summary>
/// Gets the time at which the rectangle should no longer be displayed.
/// </summary>
public DateTimeOffset Dies { get; private set; }
/// <summary>
/// Gets the opacity at which to display the dirty rectangle.
/// </summary>
public double Opacity => (Dies - DateTimeOffset.UtcNow).TotalMilliseconds / TimeToLive.TotalMilliseconds;
/// <summary>
/// Resets the rectangle's lifetime.
/// </summary>
public void ResetLifetime()
{
Born = DateTimeOffset.UtcNow;
Dies = Born + TimeToLive;
}
}
}

62
src/Avalonia.Base/Rendering/DisplayDirtyRects.cs

@ -1,62 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Avalonia.Rendering
{
/// <summary>
/// Holds a collection of <see cref="DisplayDirtyRect"/> objects and manages their aging.
/// </summary>
internal class DisplayDirtyRects : IEnumerable<DisplayDirtyRect>
{
private List<DisplayDirtyRect> _inner = new List<DisplayDirtyRect>();
/// <summary>
/// Adds new new dirty rect to the collection.
/// </summary>
/// <param name="rect"></param>
public void Add(Rect rect)
{
foreach (var r in _inner)
{
if (r.Rect == rect)
{
r.ResetLifetime();
return;
}
}
_inner.Add(new DisplayDirtyRect(rect));
}
/// <summary>
/// Removes dirty rects one they are no longer active.
/// </summary>
public void Tick()
{
var now = DateTimeOffset.UtcNow;
for (var i = _inner.Count - 1; i >= 0; --i)
{
var r = _inner[i];
if (now > r.Dies)
{
_inner.RemoveAt(i);
}
}
}
/// <summary>
/// Gets the dirty rects.
/// </summary>
/// <returns>A collection of <see cref="DisplayDirtyRect"/> objects.</returns>
public IEnumerator<DisplayDirtyRect> GetEnumerator() => _inner.GetEnumerator();
/// <summary>
/// Gets the dirty rects.
/// </summary>
/// <returns>A collection of <see cref="DisplayDirtyRect"/> objects.</returns>
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}

11
src/Avalonia.Base/Rendering/IDeferredRendererLock.cs

@ -1,11 +0,0 @@
using System;
using Avalonia.Metadata;
namespace Avalonia.Rendering
{
[Unstable]
public interface IDeferredRendererLock
{
IDisposable? TryLock();
}
}

2
src/Avalonia.Base/Rendering/IRenderTimer.cs

@ -6,7 +6,7 @@ namespace Avalonia.Rendering
/// <summary>
/// Defines the interface implemented by an application render timer.
/// </summary>
[NotClientImplementable]
[PrivateApi]
public interface IRenderTimer
{
/// <summary>

2
src/Avalonia.Base/Rendering/IVisualBrushInitialize.cs

@ -8,7 +8,7 @@ namespace Avalonia.Rendering
/// <see cref="VisualBrush"/>.
/// </summary>
[Unstable]
public interface IVisualBrushInitialize
internal interface IVisualBrushInitialize
{
/// <summary>
/// Ensures that the control is ready to use as the visual in a visual brush.

11
src/Avalonia.Base/Rendering/ManagedDeferredRendererLock.cs

@ -1,11 +0,0 @@
using System;
using System.Threading;
using Avalonia.Utilities;
namespace Avalonia.Rendering
{
internal class ManagedDeferredRendererLock : DisposableLock, IDeferredRendererLock
{
}
}

2
src/Avalonia.Base/Rendering/SceneInvalidatedEventArgs.cs

@ -5,7 +5,7 @@ namespace Avalonia.Rendering
/// <summary>
/// Provides data for the <see cref="IRenderer.SceneInvalidated"/> event.
/// </summary>
public class SceneInvalidatedEventArgs : EventArgs
internal class SceneInvalidatedEventArgs : EventArgs
{
/// <summary>
/// Initializes a new instance of the <see cref="SceneInvalidatedEventArgs"/> class.

2
src/Avalonia.Base/Rendering/SleepLoopRenderTimer.cs

@ -1,9 +1,11 @@
using System;
using System.Diagnostics;
using System.Threading;
using Avalonia.Metadata;
namespace Avalonia.Rendering
{
[PrivateApi]
public class SleepLoopRenderTimer : IRenderTimer
{
private Action<TimeSpan>? _tick;

2
src/Avalonia.Base/Rendering/UiThreadRenderTimer.cs

@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
using Avalonia.Metadata;
using Avalonia.Reactive;
using Avalonia.Threading;
@ -8,6 +9,7 @@ namespace Avalonia.Rendering
/// <summary>
/// Render timer that ticks on UI thread. Useful for debugging or bootstrapping on new platforms
/// </summary>
[PrivateApi]
public class UiThreadRenderTimer : DefaultRenderTimer
{
/// <summary>

5
src/Avalonia.Base/VisualTree/IVisualWithRoundRectClip.cs

@ -3,14 +3,11 @@ using System.ComponentModel;
namespace Avalonia.VisualTree
{
[Obsolete("Internal API, will be removed in future versions, you've been warned"), EditorBrowsable(EditorBrowsableState.Never)]
public interface IVisualWithRoundRectClip
internal interface IVisualWithRoundRectClip
{
/// <summary>
/// Gets a value indicating the corner radius of control's clip bounds
/// </summary>
[Obsolete("Internal API, will be removed in future versions, you've been warned"), EditorBrowsable(EditorBrowsableState.Never)]
CornerRadius ClipToBoundsRadius { get; }
}
}

18
src/Avalonia.Controls/Application.cs

@ -118,25 +118,13 @@ namespace Avalonia
/// </value>
public DataTemplates DataTemplates => _dataTemplates ?? (_dataTemplates = new DataTemplates());
/// <summary>
/// Gets the application's focus manager.
/// </summary>
/// <value>
/// The application's focus manager.
/// </value>
public IFocusManager? FocusManager
{
get;
private set;
}
/// <summary>
/// Gets the application's input manager.
/// </summary>
/// <value>
/// The application's input manager.
/// </value>
public InputManager? InputManager
internal InputManager? InputManager
{
get;
private set;
@ -238,7 +226,7 @@ namespace Avalonia
public virtual void RegisterServices()
{
AvaloniaSynchronizationContext.InstallIfNeeded();
FocusManager = new FocusManager();
var focusManager = new FocusManager();
InputManager = new InputManager();
var settings = AvaloniaLocator.Current.GetRequiredService<IPlatformSettings>();
@ -250,7 +238,7 @@ namespace Avalonia
.Bind<IGlobalDataTemplates>().ToConstant(this)
.Bind<IGlobalStyles>().ToConstant(this)
.Bind<IThemeVariantHost>().ToConstant(this)
.Bind<IFocusManager>().ToConstant(FocusManager)
.Bind<IFocusManager>().ToConstant(focusManager)
.Bind<IInputManager>().ToConstant(InputManager)
.Bind<IKeyboardNavigationHandler>().ToTransient<KeyboardNavigationHandler>()
.Bind<IDragDropDevice>().ToConstant(DragDropDevice.Instance);

2
src/Avalonia.Controls/Platform/INativeApplicationCommands.cs

@ -3,7 +3,7 @@ namespace Avalonia.Controls.Platform
/// <summary>
/// Native Menu Default Application Commands
/// </summary>
public interface INativeApplicationCommands
internal interface INativeApplicationCommands
{
void HideApp();
void ShowAll();

2
src/Avalonia.Controls/Platform/IPlatformNativeSurfaceHandle.cs

@ -4,7 +4,7 @@ using Avalonia.Metadata;
namespace Avalonia.Platform
{
[Unstable]
public interface IPlatformNativeSurfaceHandle : IPlatformHandle
public interface INativePlatformHandleSurface : IPlatformHandle
{
PixelSize Size { get; }
double Scaling { get; }

4
src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs

@ -2,9 +2,11 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Transactions;
using Avalonia.Metadata;
namespace Avalonia.Controls.Primitives.PopupPositioning
{
[PrivateApi]
public interface IManagedPopupPositionerPopup
{
IReadOnlyList<ManagedPopupPositionerScreenInfo> Screens { get; }
@ -13,6 +15,7 @@ namespace Avalonia.Controls.Primitives.PopupPositioning
void MoveAndResize(Point devicePoint, Size virtualSize);
}
[PrivateApi]
public class ManagedPopupPositionerScreenInfo
{
public Rect Bounds { get; }
@ -29,6 +32,7 @@ namespace Avalonia.Controls.Primitives.PopupPositioning
/// An <see cref="IPopupPositioner"/> implementation for platforms on which a popup can be
/// arbitrarily positioned.
/// </summary>
[PrivateApi]
public class ManagedPopupPositioner : IPopupPositioner
{
private readonly IManagedPopupPositionerPopup _popup;

2
src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositionerPopupImplHelper.cs

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Metadata;
using Avalonia.Platform;
namespace Avalonia.Controls.Primitives.PopupPositioning
@ -8,6 +9,7 @@ namespace Avalonia.Controls.Primitives.PopupPositioning
/// <summary>
/// This class is used to simplify integration of IPopupImpl implementations with popup positioner
/// </summary>
[PrivateApi]
public class ManagedPopupPositionerPopupImplHelper : IManagedPopupPositionerPopup
{
private readonly IWindowBaseImpl _parent;

9
src/Avalonia.Diagnostics/Diagnostics/Controls/Application.cs

@ -59,15 +59,6 @@ namespace Avalonia.Diagnostics.Controls
public Avalonia.Controls.Templates.DataTemplates DataTemplates =>
_application.DataTemplates;
/// <summary>
/// Gets the application's focus manager.
/// </summary>
/// <value>
/// The application's focus manager.
/// </value>
public Input.IFocusManager? FocusManager =>
_application.FocusManager;
/// <summary>
/// Gets the application's input manager.
/// </summary>

2
src/Avalonia.X11/X11Window.cs

@ -1324,7 +1324,7 @@ namespace Avalonia.X11
public bool IsEnabled => !_disabled;
public class SurfacePlatformHandle : IPlatformNativeSurfaceHandle
public class SurfacePlatformHandle : INativePlatformHandleSurface
{
private readonly X11Window _owner;

2
src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs

@ -115,7 +115,7 @@ namespace Avalonia.LinuxFramebuffer.Output
}
public void Dump()
internal void Dump()
{
void Print(int off, string s)
{

1
src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs

@ -49,6 +49,7 @@ namespace Avalonia.LinuxFramebuffer.Output
_outputOptions = options;
Init(card, resources, connector, modeInfo);
}
public DrmOutput(string path = null, bool connectorsForceProbe = false, DrmOutputOptions options = null)
{
if(options != null)

2
src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj

@ -17,7 +17,7 @@
<ItemGroup Label="InternalsVisibleTo">
<InternalsVisibleTo Include="Avalonia.Direct2D1.RenderTests, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.Direct2D1.UnitTests, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.Win32.Interop, PublicKey=$(AvaloniaPublicKey)"/>
<InternalsVisibleTo Include="Avalonia.Win32.Interop, PublicKey=$(AvaloniaPublicKey)" />
</ItemGroup>
<ItemGroup>

24
src/Windows/Avalonia.Direct2D1/Direct2DChecker.cs

@ -1,24 +0,0 @@
using Avalonia.Platform;
namespace Avalonia.Direct2D1
{
class Direct2DChecker : IModuleEnvironmentChecker
{
//Direct2D backend doesn't work on some machines anymore
public bool IsCompatible
{
get
{
try
{
Direct2D1Platform.InitializeDirect2D();
return true;
}
catch
{
return false;
}
}
}
}
}

14
src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs

@ -594,7 +594,6 @@ namespace Avalonia.Win32
case WindowsMessage.WM_PAINT:
{
using (NonPumpingSyncContext.Use(NonPumpingWaitHelperImpl.Instance))
using (_rendererLock.Lock())
{
if (BeginPaint(_hwnd, out PAINTSTRUCT ps) != IntPtr.Zero)
{
@ -616,12 +615,6 @@ namespace Avalonia.Win32
case WindowsMessage.WM_SIZE:
{
using (NonPumpingSyncContext.Use(NonPumpingWaitHelperImpl.Instance))
using (_rendererLock.Lock())
{
// Do nothing here, just block until the pending frame render is completed on the render thread
}
var size = (SizeCommand)wParam;
if (Resized != null &&
@ -837,11 +830,8 @@ namespace Avalonia.Win32
return IntPtr.Zero;
}
}
using (_rendererLock.Lock())
{
return DefWindowProc(hWnd, msg, wParam, lParam);
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}
private Lazy<IReadOnlyList<RawPointerPoint>?>? CreateLazyIntermediatePoints(POINTER_INFO info)

4
src/Windows/Avalonia.Win32/WindowImpl.cs

@ -70,7 +70,6 @@ namespace Avalonia.Win32
private readonly TouchDevice _touchDevice;
private readonly WindowsMouseDevice _mouseDevice;
private readonly PenDevice _penDevice;
private readonly ManagedDeferredRendererLock _rendererLock;
private readonly FramebufferManager _framebuffer;
private readonly object? _gl;
private readonly bool _wmPointerEnabled;
@ -128,7 +127,6 @@ namespace Avalonia.Win32
IsResizable = true,
Decorations = SystemDecorations.Full
};
_rendererLock = new ManagedDeferredRendererLock();
var glPlatform = AvaloniaLocator.Current.GetService<IPlatformGraphics>();
@ -1497,7 +1495,7 @@ namespace Avalonia.Win32
public void Dispose() => _owner._resizeReason = _restore;
}
private class WindowImplPlatformHandle : IPlatformNativeSurfaceHandle
private class WindowImplPlatformHandle : INativePlatformHandleSurface
{
private readonly WindowImpl _owner;
public WindowImplPlatformHandle(WindowImpl owner) => _owner = owner;

7
tests/Avalonia.UnitTests/NullRenderer.cs

@ -12,7 +12,12 @@ public sealed class NullRenderer : IRenderer
{
public RendererDiagnostics Diagnostics { get; } = new();
public event EventHandler<SceneInvalidatedEventArgs>? SceneInvalidated;
event EventHandler<SceneInvalidatedEventArgs>? IRenderer.SceneInvalidated
{
add { }
remove { }
}
public NullRenderer()
{

Loading…
Cancel
Save