diff --git a/samples/BindingDemo/App.xaml b/samples/BindingDemo/App.xaml
index 9260dd280f..3e312c8685 100644
--- a/samples/BindingDemo/App.xaml
+++ b/samples/BindingDemo/App.xaml
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="BindingDemo.App">
-
+
-
\ No newline at end of file
+
diff --git a/samples/BindingDemo/BindingDemo.csproj b/samples/BindingDemo/BindingDemo.csproj
index bd6054327f..056d3bf552 100644
--- a/samples/BindingDemo/BindingDemo.csproj
+++ b/samples/BindingDemo/BindingDemo.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/samples/ControlCatalog.Android/ControlCatalog.Android.csproj b/samples/ControlCatalog.Android/ControlCatalog.Android.csproj
index 54acdd9114..a43ea4539a 100644
--- a/samples/ControlCatalog.Android/ControlCatalog.Android.csproj
+++ b/samples/ControlCatalog.Android/ControlCatalog.Android.csproj
@@ -9,7 +9,6 @@
1.0
apk
true
- android-arm64;android-x64
diff --git a/samples/ControlCatalog/App.xaml b/samples/ControlCatalog/App.xaml
index fab4622303..b228e72f72 100644
--- a/samples/ControlCatalog/App.xaml
+++ b/samples/ControlCatalog/App.xaml
@@ -5,6 +5,13 @@
x:CompileBindings="True"
Name="Avalonia ControlCatalog"
x:Class="ControlCatalog.App">
+
+
+
+
+
+
+
-
diff --git a/samples/ControlCatalog/Pages/ExpanderPage.xaml b/samples/ControlCatalog/Pages/ExpanderPage.xaml
index cef473af04..f9ae1c7a3c 100644
--- a/samples/ControlCatalog/Pages/ExpanderPage.xaml
+++ b/samples/ControlCatalog/Pages/ExpanderPage.xaml
@@ -8,26 +8,31 @@
Margin="0,16,0,0"
HorizontalAlignment="Center"
Spacing="16">
-
+
Expanded content
-
+
Expanded content
-
+
Expanded content
-
+
Expanded content
-
+ Rounded
+
diff --git a/samples/ControlCatalog/Pages/ExpanderPage.xaml.cs b/samples/ControlCatalog/Pages/ExpanderPage.xaml.cs
index 52166d1a5f..e8a080899a 100644
--- a/samples/ControlCatalog/Pages/ExpanderPage.xaml.cs
+++ b/samples/ControlCatalog/Pages/ExpanderPage.xaml.cs
@@ -1,5 +1,6 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
+using ControlCatalog.ViewModels;
namespace ControlCatalog.Pages
{
@@ -8,6 +9,7 @@ namespace ControlCatalog.Pages
public ExpanderPage()
{
this.InitializeComponent();
+ DataContext = new ExpanderPageViewModel();
}
private void InitializeComponent()
diff --git a/samples/ControlCatalog/Pages/OpenGlPage.xaml.cs b/samples/ControlCatalog/Pages/OpenGlPage.xaml.cs
index cb79bf219a..f37e0f8701 100644
--- a/samples/ControlCatalog/Pages/OpenGlPage.xaml.cs
+++ b/samples/ControlCatalog/Pages/OpenGlPage.xaml.cs
@@ -90,7 +90,6 @@ namespace ControlCatalog.Pages
private int _vertexBufferObject;
private int _indexBufferObject;
private int _vertexArrayObject;
- private GlExtrasInterface _glExt;
private string GetShader(bool fragment, string shader)
{
@@ -258,7 +257,6 @@ namespace ControlCatalog.Pages
protected unsafe override void OnOpenGlInit(GlInterface GL, int fb)
{
CheckError(GL);
- _glExt = new GlExtrasInterface(GL);
Info = $"Renderer: {GL.GetString(GL_RENDERER)} Version: {GL.GetString(GL_VERSION)}";
@@ -298,8 +296,8 @@ namespace ControlCatalog.Pages
GL.BufferData(GL_ELEMENT_ARRAY_BUFFER, new IntPtr(_indices.Length * sizeof(ushort)), new IntPtr(pdata),
GL_STATIC_DRAW);
CheckError(GL);
- _vertexArrayObject = _glExt.GenVertexArray();
- _glExt.BindVertexArray(_vertexArrayObject);
+ _vertexArrayObject = GL.GenVertexArray();
+ GL.BindVertexArray(_vertexArrayObject);
CheckError(GL);
GL.VertexAttribPointer(positionLocation, 3, GL_FLOAT,
0, vertexSize, IntPtr.Zero);
@@ -316,12 +314,13 @@ namespace ControlCatalog.Pages
// Unbind everything
GL.BindBuffer(GL_ARRAY_BUFFER, 0);
GL.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
- _glExt.BindVertexArray(0);
+ GL.BindVertexArray(0);
GL.UseProgram(0);
// Delete all resources.
- GL.DeleteBuffers(2, new[] { _vertexBufferObject, _indexBufferObject });
- _glExt.DeleteVertexArrays(1, new[] { _vertexArrayObject });
+ GL.DeleteBuffer(_vertexBufferObject);
+ GL.DeleteBuffer(_indexBufferObject);
+ GL.DeleteVertexArray(_vertexArrayObject);
GL.DeleteProgram(_shaderProgram);
GL.DeleteShader(_fragmentShader);
GL.DeleteShader(_vertexShader);
@@ -338,7 +337,7 @@ namespace ControlCatalog.Pages
GL.BindBuffer(GL_ARRAY_BUFFER, _vertexBufferObject);
GL.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBufferObject);
- _glExt.BindVertexArray(_vertexArrayObject);
+ GL.BindVertexArray(_vertexArrayObject);
GL.UseProgram(_shaderProgram);
CheckError(GL);
var projection =
@@ -369,34 +368,5 @@ namespace ControlCatalog.Pages
if (_disco > 0.01)
Dispatcher.UIThread.Post(InvalidateVisual, DispatcherPriority.Background);
}
-
- class GlExtrasInterface : GlInterfaceBase
- {
- public GlExtrasInterface(GlInterface gl) : base(gl.GetProcAddress, gl.ContextInfo)
- {
- }
-
- public delegate void GlDeleteVertexArrays(int count, int[] buffers);
- [GlMinVersionEntryPoint("glDeleteVertexArrays", 3,0)]
- [GlExtensionEntryPoint("glDeleteVertexArraysOES", "GL_OES_vertex_array_object")]
- public GlDeleteVertexArrays DeleteVertexArrays { get; }
-
- public delegate void GlBindVertexArray(int array);
- [GlMinVersionEntryPoint("glBindVertexArray", 3,0)]
- [GlExtensionEntryPoint("glBindVertexArrayOES", "GL_OES_vertex_array_object")]
- public GlBindVertexArray BindVertexArray { get; }
- public delegate void GlGenVertexArrays(int n, int[] rv);
-
- [GlMinVersionEntryPoint("glGenVertexArrays",3,0)]
- [GlExtensionEntryPoint("glGenVertexArraysOES", "GL_OES_vertex_array_object")]
- public GlGenVertexArrays GenVertexArrays { get; }
-
- public int GenVertexArray()
- {
- var rv = new int[1];
- GenVertexArrays(1, rv);
- return rv[0];
- }
- }
}
}
diff --git a/samples/ControlCatalog/ViewModels/ExpanderPageViewModel.cs b/samples/ControlCatalog/ViewModels/ExpanderPageViewModel.cs
new file mode 100644
index 0000000000..aa7f710ee0
--- /dev/null
+++ b/samples/ControlCatalog/ViewModels/ExpanderPageViewModel.cs
@@ -0,0 +1,27 @@
+using Avalonia;
+using MiniMvvm;
+
+namespace ControlCatalog.ViewModels
+{
+ public class ExpanderPageViewModel : ViewModelBase
+ {
+ private object _cornerRadius = AvaloniaProperty.UnsetValue;
+ private bool _rounded;
+
+ public object CornerRadius
+ {
+ get => _cornerRadius;
+ private set => RaiseAndSetIfChanged(ref _cornerRadius, value);
+ }
+
+ public bool Rounded
+ {
+ get => _rounded;
+ set
+ {
+ if (RaiseAndSetIfChanged(ref _rounded, value))
+ CornerRadius = _rounded ? new CornerRadius(25) : AvaloniaProperty.UnsetValue;
+ }
+ }
+ }
+}
diff --git a/samples/RenderDemo/App.xaml b/samples/RenderDemo/App.xaml
index 66d97a6444..8ea792de19 100644
--- a/samples/RenderDemo/App.xaml
+++ b/samples/RenderDemo/App.xaml
@@ -3,6 +3,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
+
+
+
+
+
+
+
diff --git a/samples/SampleControls/HamburgerMenu/HamburgerMenu.xaml b/samples/SampleControls/HamburgerMenu/HamburgerMenu.xaml
index 1d58c465a0..fbc51414e3 100644
--- a/samples/SampleControls/HamburgerMenu/HamburgerMenu.xaml
+++ b/samples/SampleControls/HamburgerMenu/HamburgerMenu.xaml
@@ -1,6 +1,6 @@
-
+
@@ -20,25 +20,136 @@
-
- 40
- 220
- 36
- 36
- 32
- 12,0,0,0
- 52,0,0,0
- 212,0,0,0
- 1 1 1 1 #2000, 0 0 1 1 #2fff
- 0 0 1 1 #2000
-
+ 40
+ 220
+ 36
+ 36
+ 32
+ 12,0,0,0
+ 52,0,0,0
+ 212,0,0,0
+ 1 1 1 1 #2000, 0 0 1 1 #2fff
+ 0 0 1 1 #2000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/Avalonia.Base/Input/Cursor.cs b/src/Avalonia.Base/Input/Cursor.cs
index 122838f682..98c4258a90 100644
--- a/src/Avalonia.Base/Input/Cursor.cs
+++ b/src/Avalonia.Base/Input/Cursor.cs
@@ -32,10 +32,7 @@ namespace Avalonia.Input
DragCopy,
DragLink,
None,
-
- [Obsolete("Use BottomSide")]
- BottomSize = BottomSide
-
+
// Not available in GTK directly, see http://www.pixelbeat.org/programming/x_cursors/
// We might enable them later, preferably, by loading pixmax directly from theme with fallback image
// SizeNorthWestSouthEast,
diff --git a/src/Avalonia.Base/Input/DragEventArgs.cs b/src/Avalonia.Base/Input/DragEventArgs.cs
index 22ca8358ff..0e613c0f21 100644
--- a/src/Avalonia.Base/Input/DragEventArgs.cs
+++ b/src/Avalonia.Base/Input/DragEventArgs.cs
@@ -13,9 +13,6 @@ namespace Avalonia.Input
public IDataObject Data { get; private set; }
- [Obsolete("Use KeyModifiers")]
- public InputModifiers Modifiers { get; private set; }
-
public KeyModifiers KeyModifiers { get; private set; }
public Point GetPosition(IVisual relativeTo)
@@ -35,17 +32,6 @@ namespace Avalonia.Input
return point;
}
- [Obsolete("Use constructor taking KeyModifiers")]
- public DragEventArgs(RoutedEvent routedEvent, IDataObject data, Interactive target, Point targetLocation, InputModifiers modifiers)
- : base(routedEvent)
- {
- Data = data;
- _target = target;
- _targetLocation = targetLocation;
- Modifiers = modifiers;
- KeyModifiers = (KeyModifiers)(((int)modifiers) & 0xF);
- }
-
public DragEventArgs(RoutedEvent routedEvent, IDataObject data, Interactive target, Point targetLocation, KeyModifiers keyModifiers)
: base(routedEvent)
{
@@ -53,10 +39,6 @@ namespace Avalonia.Input
_target = target;
_targetLocation = targetLocation;
KeyModifiers = keyModifiers;
-#pragma warning disable CS0618 // Type or member is obsolete
- Modifiers = (InputModifiers)keyModifiers;
-#pragma warning restore CS0618 // Type or member is obsolete
}
-
}
}
diff --git a/src/Avalonia.Base/Input/GotFocusEventArgs.cs b/src/Avalonia.Base/Input/GotFocusEventArgs.cs
index 9d958823fe..5cce138ee0 100644
--- a/src/Avalonia.Base/Input/GotFocusEventArgs.cs
+++ b/src/Avalonia.Base/Input/GotFocusEventArgs.cs
@@ -1,4 +1,3 @@
-using System;
using Avalonia.Interactivity;
namespace Avalonia.Input
@@ -13,16 +12,6 @@ namespace Avalonia.Input
///
public NavigationMethod NavigationMethod { get; set; }
- ///
- /// Gets or sets any input modifiers active at the time of focus.
- ///
- [Obsolete("Use KeyModifiers")]
- public InputModifiers InputModifiers
- {
- get => (InputModifiers)KeyModifiers;
- set => KeyModifiers = (KeyModifiers)((int)value & 0xF);
- }
-
///
/// Gets or sets any key modifiers active at the time of focus.
///
diff --git a/src/Avalonia.Base/Input/IInputRoot.cs b/src/Avalonia.Base/Input/IInputRoot.cs
index 7edc69df52..344a4eefd7 100644
--- a/src/Avalonia.Base/Input/IInputRoot.cs
+++ b/src/Avalonia.Base/Input/IInputRoot.cs
@@ -27,10 +27,5 @@ namespace Avalonia.Input
/// Gets or sets a value indicating whether access keys are shown in the window.
///
bool ShowAccessKeys { get; set; }
-
- ///
- /// Gets associated mouse device
- ///
- IMouseDevice? MouseDevice { get; }
}
}
diff --git a/src/Avalonia.Base/Input/IKeyboardDevice.cs b/src/Avalonia.Base/Input/IKeyboardDevice.cs
index 80aebc02bc..0b7b5aaecc 100644
--- a/src/Avalonia.Base/Input/IKeyboardDevice.cs
+++ b/src/Avalonia.Base/Input/IKeyboardDevice.cs
@@ -4,19 +4,6 @@ using Avalonia.Metadata;
namespace Avalonia.Input
{
- [Flags, Obsolete("Use KeyModifiers and PointerPointProperties")]
- public enum InputModifiers
- {
- None = 0,
- Alt = 1,
- Control = 2,
- Shift = 4,
- Windows = 8,
- LeftMouseButton = 16,
- RightMouseButton = 32,
- MiddleMouseButton = 64
- }
-
[Flags]
public enum KeyModifiers
{
diff --git a/src/Avalonia.Base/Input/IMouseDevice.cs b/src/Avalonia.Base/Input/IMouseDevice.cs
index 2d66397d63..00c436bf21 100644
--- a/src/Avalonia.Base/Input/IMouseDevice.cs
+++ b/src/Avalonia.Base/Input/IMouseDevice.cs
@@ -1,4 +1,3 @@
-using System;
using Avalonia.Metadata;
namespace Avalonia.Input
@@ -9,16 +8,5 @@ namespace Avalonia.Input
[NotClientImplementable]
public interface IMouseDevice : IPointerDevice
{
- ///
- /// Gets the mouse position, in screen coordinates.
- ///
- [Obsolete("Use PointerEventArgs.GetPosition")]
- PixelPoint Position { get; }
-
- [Obsolete]
- void TopLevelClosed(IInputRoot root);
-
- [Obsolete]
- void SceneInvalidated(IInputRoot root, Rect rect);
}
}
diff --git a/src/Avalonia.Base/Input/IPointerDevice.cs b/src/Avalonia.Base/Input/IPointerDevice.cs
index 0993835feb..e0aebda9c5 100644
--- a/src/Avalonia.Base/Input/IPointerDevice.cs
+++ b/src/Avalonia.Base/Input/IPointerDevice.cs
@@ -1,5 +1,3 @@
-using System;
-using Avalonia.VisualTree;
using Avalonia.Input.Raw;
using Avalonia.Metadata;
@@ -8,18 +6,6 @@ namespace Avalonia.Input
[NotClientImplementable]
public interface IPointerDevice : IInputDevice
{
- ///
- [Obsolete("Use IPointer")]
- IInputElement? Captured { get; }
-
- ///
- [Obsolete("Use IPointer")]
- void Capture(IInputElement? control);
-
- ///
- [Obsolete("Use PointerEventArgs.GetPosition")]
- Point GetPosition(IVisual relativeTo);
-
///
/// Gets a pointer for specific event args.
///
diff --git a/src/Avalonia.Base/Input/KeyEventArgs.cs b/src/Avalonia.Base/Input/KeyEventArgs.cs
index 67cd5a520a..b8291e9096 100644
--- a/src/Avalonia.Base/Input/KeyEventArgs.cs
+++ b/src/Avalonia.Base/Input/KeyEventArgs.cs
@@ -9,8 +9,6 @@ namespace Avalonia.Input
public Key Key { get; set; }
- [Obsolete("Use KeyModifiers")]
- public InputModifiers Modifiers => (InputModifiers)KeyModifiers;
public KeyModifiers KeyModifiers { get; set; }
}
}
diff --git a/src/Avalonia.Base/Input/KeyGesture.cs b/src/Avalonia.Base/Input/KeyGesture.cs
index 3b7a828b86..e79e9341a9 100644
--- a/src/Avalonia.Base/Input/KeyGesture.cs
+++ b/src/Avalonia.Base/Input/KeyGesture.cs
@@ -15,13 +15,6 @@ namespace Avalonia.Input
{ "+", Key.OemPlus }, { "-", Key.OemMinus }, { ".", Key.OemPeriod }, { ",", Key.OemComma }
};
- [Obsolete("Use constructor taking KeyModifiers")]
- public KeyGesture(Key key, InputModifiers modifiers)
- {
- Key = key;
- KeyModifiers = (KeyModifiers)(((int)modifiers) & 0xf);
- }
-
public KeyGesture(Key key, KeyModifiers modifiers = KeyModifiers.None)
{
Key = key;
@@ -63,10 +56,7 @@ namespace Avalonia.Input
}
public Key Key { get; }
-
- [Obsolete("Use KeyModifiers")]
- public InputModifiers Modifiers => (InputModifiers)KeyModifiers;
-
+
public KeyModifiers KeyModifiers { get; }
public static KeyGesture Parse(string gesture)
diff --git a/src/Avalonia.Base/Input/MouseDevice.cs b/src/Avalonia.Base/Input/MouseDevice.cs
index 5f8ab24b79..055c9cf1fd 100644
--- a/src/Avalonia.Base/Input/MouseDevice.cs
+++ b/src/Avalonia.Base/Input/MouseDevice.cs
@@ -21,7 +21,6 @@ namespace Avalonia.Input
private readonly Pointer _pointer;
private bool _disposed;
- private PixelPoint? _position;
private MouseButton _lastMouseDownButton;
public MouseDevice(Pointer? pointer = null)
@@ -29,43 +28,6 @@ namespace Avalonia.Input
_pointer = pointer ?? new Pointer(Pointer.GetNextFreeId(), PointerType.Mouse, true);
}
- [Obsolete("Use IPointer instead")]
- public IInputElement? Captured => _pointer.Captured;
-
- [Obsolete("Use events instead")]
- public PixelPoint Position
- {
- get => _position ?? new PixelPoint(-1, -1);
- protected set => _position = value;
- }
-
- [Obsolete("Use IPointer instead")]
- public void Capture(IInputElement? control)
- {
- _pointer.Capture(control);
- }
-
- ///
- /// Gets the mouse position relative to a control.
- ///
- /// The control.
- /// The mouse position in the control's coordinates.
- public Point GetPosition(IVisual relativeTo)
- {
- relativeTo = relativeTo ?? throw new ArgumentNullException(nameof(relativeTo));
-
- if (relativeTo.VisualRoot == null)
- {
- throw new InvalidOperationException("Control is not attached to visual tree.");
- }
-
-#pragma warning disable CS0618 // Type or member is obsolete
- var rootPoint = relativeTo.VisualRoot.PointToClient(Position);
-#pragma warning restore CS0618 // Type or member is obsolete
- var transform = relativeTo.VisualRoot.TransformToVisual(relativeTo);
- return rootPoint * transform!.Value;
- }
-
public void ProcessRawEvent(RawInputEventArgs e)
{
if (!e.Handled && e is RawPointerEventArgs margs)
@@ -96,7 +58,6 @@ namespace Avalonia.Input
if(mouse._disposed)
return;
- _position = e.Root.PointToScreen(e.Position);
var props = CreateProperties(e);
var keyModifiers = e.InputModifiers.ToKeyModifiers();
switch (e.Type)
@@ -145,7 +106,6 @@ namespace Avalonia.Input
private void LeaveWindow()
{
- _position = null;
}
PointerPointProperties CreateProperties(RawPointerEventArgs args)
@@ -324,19 +284,7 @@ namespace Avalonia.Input
_disposed = true;
_pointer?.Dispose();
}
-
- [Obsolete]
- public void TopLevelClosed(IInputRoot root)
- {
- // no-op
- }
-
- [Obsolete]
- public void SceneInvalidated(IInputRoot root, Rect rect)
- {
- // no-op
- }
-
+
public IPointer? TryGetPointer(RawPointerEventArgs ev)
{
return _pointer;
diff --git a/src/Avalonia.Base/Input/PenDevice.cs b/src/Avalonia.Base/Input/PenDevice.cs
index d22b48562c..f5f0e90a45 100644
--- a/src/Avalonia.Base/Input/PenDevice.cs
+++ b/src/Avalonia.Base/Input/PenDevice.cs
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Reactive.Linq;
using Avalonia.Input.Raw;
using Avalonia.Platform;
-using Avalonia.VisualTree;
namespace Avalonia.Input
{
@@ -14,7 +12,6 @@ namespace Avalonia.Input
public class PenDevice : IPenDevice, IDisposable
{
private readonly Dictionary _pointers = new();
- private readonly Dictionary _lastPositions = new();
private int _clickCount;
private Rect _lastClickRect;
private ulong _lastClickTime;
@@ -41,9 +38,7 @@ namespace Avalonia.Input
_pointers[e.RawPointerId] = pointer = new Pointer(Pointer.GetNextFreeId(),
PointerType.Pen, _pointers.Count == 0);
}
-
- _lastPositions[e.RawPointerId] = e.Root.PointToScreen(e.Position);
-
+
var props = new PointerPointProperties(e.InputModifiers, e.Type.ToUpdateKind(),
e.Point.Twist, e.Point.Pressure, e.Point.XTilt, e.Point.YTilt);
var keyModifiers = e.InputModifiers.ToKeyModifiers();
@@ -69,7 +64,6 @@ namespace Avalonia.Input
{
pointer.Dispose();
_pointers.Remove(e.RawPointerId);
- _lastPositions.Remove(e.RawPointerId);
}
}
@@ -153,17 +147,6 @@ namespace Avalonia.Input
p.Dispose();
}
- [Obsolete]
- IInputElement? IPointerDevice.Captured => _pointers.Values
- .FirstOrDefault(p => p.IsPrimary)?.Captured;
-
- [Obsolete]
- void IPointerDevice.Capture(IInputElement? control) => _pointers.Values
- .FirstOrDefault(p => p.IsPrimary)?.Capture(control);
-
- [Obsolete]
- Point IPointerDevice.GetPosition(IVisual relativeTo) => new Point(-1, -1);
-
public IPointer? TryGetPointer(RawPointerEventArgs ev)
{
return _pointers.TryGetValue(ev.RawPointerId, out var pointer)
diff --git a/src/Avalonia.Base/Input/PointerEventArgs.cs b/src/Avalonia.Base/Input/PointerEventArgs.cs
index 058c2f9cc1..1f3c726e7b 100644
--- a/src/Avalonia.Base/Input/PointerEventArgs.cs
+++ b/src/Avalonia.Base/Input/PointerEventArgs.cs
@@ -11,7 +11,7 @@ namespace Avalonia.Input
private readonly IVisual? _rootVisual;
private readonly Point _rootVisualPosition;
private readonly PointerPointProperties _properties;
- private Lazy?>? _previousPoints;
+ private readonly Lazy?>? _previousPoints;
public PointerEventArgs(RoutedEvent routedEvent,
IInteractive? source,
@@ -43,29 +43,6 @@ namespace Avalonia.Input
{
_previousPoints = previousPoints;
}
-
-
- class EmulatedDevice : IPointerDevice
- {
- private readonly PointerEventArgs _ev;
-
- public EmulatedDevice(PointerEventArgs ev)
- {
- _ev = ev;
- }
-
- public void ProcessRawEvent(RawInputEventArgs ev) => throw new NotSupportedException();
-
- public IInputElement? Captured => _ev.Pointer.Captured;
- public void Capture(IInputElement? control)
- {
- _ev.Pointer.Capture(control);
- }
-
- public Point GetPosition(IVisual relativeTo) => _ev.GetPosition(relativeTo);
-
- public IPointer? TryGetPointer(RawPointerEventArgs ev) => _ev.Pointer;
- }
///
/// Gets specific pointer generated by input device.
@@ -77,28 +54,6 @@ namespace Avalonia.Input
///
public ulong Timestamp { get; }
- private IPointerDevice? _device;
-
- [Obsolete("Use Pointer to get pointer-specific information")]
- public IPointerDevice Device => _device ?? (_device = new EmulatedDevice(this));
-
- [Obsolete("Use KeyModifiers and PointerPointProperties")]
- public InputModifiers InputModifiers
- {
- get
- {
- var mods = (InputModifiers)KeyModifiers;
- if (_properties.IsLeftButtonPressed)
- mods |= InputModifiers.LeftMouseButton;
- if (_properties.IsMiddleButtonPressed)
- mods |= InputModifiers.MiddleMouseButton;
- if (_properties.IsRightButtonPressed)
- mods |= InputModifiers.RightMouseButton;
-
- return mods;
- }
- }
-
///
/// Gets a value that indicates which key modifiers were active at the time that the pointer event was initiated.
///
@@ -120,9 +75,6 @@ namespace Avalonia.Input
/// The pointer position in the control's coordinates.
public Point GetPosition(IVisual? relativeTo) => GetPosition(_rootVisualPosition, relativeTo);
- [Obsolete("Use GetCurrentPoint")]
- public PointerPoint GetPointerPoint(IVisual? relativeTo) => GetCurrentPoint(relativeTo);
-
///
/// Returns the PointerPoint associated with the current event
///
@@ -171,8 +123,6 @@ namespace Avalonia.Input
public class PointerPressedEventArgs : PointerEventArgs
{
- private readonly int _clickCount;
-
public PointerPressedEventArgs(
IInteractive source,
IPointer pointer,
@@ -184,13 +134,10 @@ namespace Avalonia.Input
: base(InputElement.PointerPressedEvent, source, pointer, rootVisual, rootVisualPosition,
timestamp, properties, modifiers)
{
- _clickCount = clickCount;
+ ClickCount = clickCount;
}
- public int ClickCount => _clickCount;
-
- [Obsolete("Use PointerPressedEventArgs.GetCurrentPoint(this).Properties")]
- public MouseButton MouseButton => Properties.PointerUpdateKind.GetMouseButton();
+ public int ClickCount { get; }
}
public class PointerReleasedEventArgs : PointerEventArgs
@@ -210,9 +157,6 @@ namespace Avalonia.Input
/// Gets the mouse button that triggered the corresponding PointerPressed event
///
public MouseButton InitialPressMouseButton { get; }
-
- [Obsolete("Use InitialPressMouseButton")]
- public MouseButton MouseButton => InitialPressMouseButton;
}
public class PointerCaptureLostEventArgs : RoutedEventArgs
diff --git a/src/Avalonia.Base/Input/PointerOverPreProcessor.cs b/src/Avalonia.Base/Input/PointerOverPreProcessor.cs
index 67d1eea7e3..a95d66346a 100644
--- a/src/Avalonia.Base/Input/PointerOverPreProcessor.cs
+++ b/src/Avalonia.Base/Input/PointerOverPreProcessor.cs
@@ -15,6 +15,8 @@ namespace Avalonia.Input
_inputRoot = inputRoot ?? throw new ArgumentNullException(nameof(inputRoot));
}
+ public PixelPoint? LastPosition => _lastPointer?.position;
+
public void OnCompleted()
{
ClearPointerOver();
diff --git a/src/Avalonia.Base/Input/Raw/RawDragEvent.cs b/src/Avalonia.Base/Input/Raw/RawDragEvent.cs
index 652bad7115..c903aad684 100644
--- a/src/Avalonia.Base/Input/Raw/RawDragEvent.cs
+++ b/src/Avalonia.Base/Input/Raw/RawDragEvent.cs
@@ -8,8 +8,6 @@ namespace Avalonia.Input.Raw
public IDataObject Data { get; }
public DragDropEffects Effects { get; set; }
public RawDragEventType Type { get; }
- [Obsolete("Use KeyModifiers")]
- public InputModifiers Modifiers { get; }
public KeyModifiers KeyModifiers { get; }
public RawDragEvent(IDragDropDevice inputDevice, RawDragEventType type,
@@ -21,9 +19,6 @@ namespace Avalonia.Input.Raw
Data = data;
Effects = effects;
KeyModifiers = modifiers.ToKeyModifiers();
-#pragma warning disable CS0618 // Type or member is obsolete
- Modifiers = (InputModifiers)modifiers;
-#pragma warning restore CS0618 // Type or member is obsolete
}
}
}
diff --git a/src/Avalonia.Base/Input/Raw/RawTouchEventArgs.cs b/src/Avalonia.Base/Input/Raw/RawTouchEventArgs.cs
index 6706a45f48..3e842e6e3f 100644
--- a/src/Avalonia.Base/Input/Raw/RawTouchEventArgs.cs
+++ b/src/Avalonia.Base/Input/Raw/RawTouchEventArgs.cs
@@ -19,8 +19,5 @@ namespace Avalonia.Input.Raw
{
RawPointerId = rawPointerId;
}
-
- [Obsolete("Use RawPointerId")]
- public long TouchPointId { get => RawPointerId; set => RawPointerId = value; }
}
}
diff --git a/src/Avalonia.Base/Input/TouchDevice.cs b/src/Avalonia.Base/Input/TouchDevice.cs
index e914d860fd..1d5b1d6bbf 100644
--- a/src/Avalonia.Base/Input/TouchDevice.cs
+++ b/src/Avalonia.Base/Input/TouchDevice.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using Avalonia.Input.Raw;
using Avalonia.Platform;
-using Avalonia.VisualTree;
namespace Avalonia.Input
{
@@ -20,9 +19,6 @@ namespace Avalonia.Input
private int _clickCount;
private Rect _lastClickRect;
private ulong _lastClickTime;
- private Pointer? _lastPointer;
-
- IInputElement? IPointerDevice.Captured => _lastPointer?.Captured;
RawInputModifiers GetModifiers(RawInputModifiers modifiers, bool isLeftButtonDown)
{
@@ -32,10 +28,6 @@ namespace Avalonia.Input
return rv;
}
- void IPointerDevice.Capture(IInputElement? control) => _lastPointer?.Capture(control);
-
- Point IPointerDevice.GetPosition(IVisual relativeTo) => default;
-
public void ProcessRawEvent(RawInputEventArgs ev)
{
if (ev.Handled || _disposed)
@@ -51,7 +43,6 @@ namespace Avalonia.Input
PointerType.Touch, _pointers.Count == 0);
pointer.Capture(hit);
}
- _lastPointer = pointer;
var target = pointer.Captured ?? args.Root;
var updateKind = args.Type.ToUpdateKind();
@@ -96,7 +87,6 @@ namespace Avalonia.Input
new PointerPointProperties(GetModifiers(args.InputModifiers, false), updateKind),
keyModifier, MouseButton.Left));
}
- _lastPointer = null;
}
if (args.Type == RawPointerEventType.TouchCancel)
@@ -104,7 +94,6 @@ namespace Avalonia.Input
_pointers.Remove(args.RawPointerId);
using (pointer)
pointer.Capture(null);
- _lastPointer = null;
}
if (args.Type == RawPointerEventType.TouchUpdate)
diff --git a/src/Avalonia.Base/StyledElement.cs b/src/Avalonia.Base/StyledElement.cs
index ecf5d95ffc..3a42e9bdfe 100644
--- a/src/Avalonia.Base/StyledElement.cs
+++ b/src/Avalonia.Base/StyledElement.cs
@@ -873,9 +873,12 @@ namespace Avalonia
if (applied.Source == styles[i])
{
- applied.Dispose();
_appliedStyles.RemoveAt(j);
+ applied.Dispose();
}
+
+ if (j > _appliedStyles.Count)
+ j = _appliedStyles.Count;
}
}
}
diff --git a/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj b/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj
index a801d338c3..dc9064b262 100644
--- a/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj
+++ b/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj
@@ -95,6 +95,9 @@
Markup/%(RecursiveDir)%(FileName)%(Extension)
+
+ Markup/%(RecursiveDir)%(FileName)%(Extension)
+
Markup/%(RecursiveDir)%(FileName)%(Extension)
diff --git a/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs b/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs
index b39ceab1b6..39a83c00c4 100644
--- a/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs
+++ b/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs
@@ -251,7 +251,8 @@ namespace Avalonia.Build.Tasks
var populateBuilder = classTypeDefinition == null ?
builder :
typeSystem.CreateTypeBuilder(classTypeDefinition);
- compiler.Compile(parsed, contextClass,
+ compiler.Compile(parsed,
+ contextClass,
compiler.DefinePopulateMethod(populateBuilder, parsed, populateName,
classTypeDefinition == null),
buildName == null ? null : compiler.DefineBuildMethod(builder, parsed, buildName, true),
diff --git a/src/Avalonia.Controls/Chrome/CaptionButtons.cs b/src/Avalonia.Controls/Chrome/CaptionButtons.cs
index d5923a8b37..6d7e542bb2 100644
--- a/src/Avalonia.Controls/Chrome/CaptionButtons.cs
+++ b/src/Avalonia.Controls/Chrome/CaptionButtons.cs
@@ -8,10 +8,10 @@ namespace Avalonia.Controls.Chrome
///
/// Draws window minimize / maximize / close buttons in a when managed client decorations are enabled.
///
- [TemplatePart("PART_CloseButton", typeof(Panel))]
- [TemplatePart("PART_RestoreButton", typeof(Panel))]
- [TemplatePart("PART_MinimiseButton", typeof(Panel))]
- [TemplatePart("PART_FullScreenButton", typeof(Panel))]
+ [TemplatePart("PART_CloseButton", typeof(Button))]
+ [TemplatePart("PART_RestoreButton", typeof(Button))]
+ [TemplatePart("PART_MinimiseButton", typeof(Button))]
+ [TemplatePart("PART_FullScreenButton", typeof(Button))]
[PseudoClasses(":minimized", ":normal", ":maximized", ":fullscreen")]
public class CaptionButtons : TemplatedControl
{
@@ -88,18 +88,15 @@ namespace Avalonia.Controls.Chrome
{
base.OnApplyTemplate(e);
- var closeButton = e.NameScope.Get("PART_CloseButton");
- var restoreButton = e.NameScope.Get("PART_RestoreButton");
- var minimiseButton = e.NameScope.Get("PART_MinimiseButton");
- var fullScreenButton = e.NameScope.Get("PART_FullScreenButton");
+ var closeButton = e.NameScope.Get
+
diff --git a/src/Avalonia.OpenGL/Controls/OpenGlControlBase.cs b/src/Avalonia.OpenGL/Controls/OpenGlControlBase.cs
index b3469c212b..68442c1fd3 100644
--- a/src/Avalonia.OpenGL/Controls/OpenGlControlBase.cs
+++ b/src/Avalonia.OpenGL/Controls/OpenGlControlBase.cs
@@ -66,11 +66,9 @@ namespace Avalonia.OpenGL.Controls
return;
gl.GetIntegerv(GL_RENDERBUFFER_BINDING, out var oldRenderBuffer);
- if (_depthBuffer != 0) gl.DeleteRenderbuffers(1, new[] { _depthBuffer });
+ if (_depthBuffer != 0) gl.DeleteRenderbuffer(_depthBuffer);
- var oneArr = new int[1];
- gl.GenRenderbuffers(1, oneArr);
- _depthBuffer = oneArr[0];
+ _depthBuffer = gl.GenRenderbuffer();
gl.BindRenderbuffer(GL_RENDERBUFFER, _depthBuffer);
gl.RenderbufferStorage(GL_RENDERBUFFER,
GlVersion.Type == GlProfileType.OpenGLES ? GL_DEPTH_COMPONENT16 : GL_DEPTH_COMPONENT,
@@ -88,9 +86,9 @@ namespace Avalonia.OpenGL.Controls
var gl = _context.GlInterface;
gl.BindTexture(GL_TEXTURE_2D, 0);
gl.BindFramebuffer(GL_FRAMEBUFFER, 0);
- gl.DeleteFramebuffers(1, new[] { _fb });
+ gl.DeleteFramebuffer(_fb);
_fb = 0;
- gl.DeleteRenderbuffers(1, new[] { _depthBuffer });
+ gl.DeleteRenderbuffer(_depthBuffer);
_depthBuffer = 0;
_attachment?.Dispose();
_attachment = null;
@@ -174,9 +172,7 @@ namespace Avalonia.OpenGL.Controls
{
_depthBufferSize = GetPixelSize();
var gl = _context.GlInterface;
- var oneArr = new int[1];
- gl.GenFramebuffers(1, oneArr);
- _fb = oneArr[0];
+ _fb = gl.GenFramebuffer();
gl.BindFramebuffer(GL_FRAMEBUFFER, _fb);
EnsureDepthBufferAttachment(gl);
diff --git a/src/Avalonia.OpenGL/Egl/EglConsts.cs b/src/Avalonia.OpenGL/Egl/EglConsts.cs
index 530d3401f6..1268845f0f 100644
--- a/src/Avalonia.OpenGL/Egl/EglConsts.cs
+++ b/src/Avalonia.OpenGL/Egl/EglConsts.cs
@@ -4,212 +4,212 @@ namespace Avalonia.OpenGL.Egl
{
public static class EglConsts
{
- public const int EGL_ALPHA_SIZE = 0x3021;
- public const int EGL_BAD_ACCESS = 0x3002;
- public const int EGL_BAD_ALLOC = 0x3003;
- public const int EGL_BAD_ATTRIBUTE = 0x3004;
- public const int EGL_BAD_CONFIG = 0x3005;
- public const int EGL_BAD_CONTEXT = 0x3006;
- public const int EGL_BAD_CURRENT_SURFACE = 0x3007;
- public const int EGL_BAD_DISPLAY = 0x3008;
- public const int EGL_BAD_MATCH = 0x3009;
- public const int EGL_BAD_NATIVE_PIXMAP = 0x300A;
- public const int EGL_BAD_NATIVE_WINDOW = 0x300B;
- public const int EGL_BAD_PARAMETER = 0x300C;
- public const int EGL_BAD_SURFACE = 0x300D;
- public const int EGL_BLUE_SIZE = 0x3022;
- public const int EGL_BUFFER_SIZE = 0x3020;
- public const int EGL_CONFIG_CAVEAT = 0x3027;
- public const int EGL_CONFIG_ID = 0x3028;
- public const int EGL_CORE_NATIVE_ENGINE = 0x305B;
- public const int EGL_DEPTH_SIZE = 0x3025;
- public const int EGL_DONT_CARE = -1;
- public const int EGL_DRAW = 0x3059;
- public const int EGL_EXTENSIONS = 0x3055;
- public const int EGL_FALSE = 0;
- public const int EGL_GREEN_SIZE = 0x3023;
- public const int EGL_HEIGHT = 0x3056;
- public const int EGL_LARGEST_PBUFFER = 0x3058;
- public const int EGL_LEVEL = 0x3029;
- public const int EGL_MAX_PBUFFER_HEIGHT = 0x302A;
- public const int EGL_MAX_PBUFFER_PIXELS = 0x302B;
- public const int EGL_MAX_PBUFFER_WIDTH = 0x302C;
- public const int EGL_NATIVE_RENDERABLE = 0x302D;
- public const int EGL_NATIVE_VISUAL_ID = 0x302E;
- public const int EGL_NATIVE_VISUAL_TYPE = 0x302F;
- public const int EGL_NONE = 0x3038;
- public const int EGL_NON_CONFORMANT_CONFIG = 0x3051;
- public const int EGL_NOT_INITIALIZED = 0x3001;
- public const int EGL_NO_CONTEXT = 0;
- public const int EGL_NO_DISPLAY = 0;
- public const int EGL_NO_SURFACE = 0;
- public const int EGL_PBUFFER_BIT = 0x0001;
- public const int EGL_PIXMAP_BIT = 0x0002;
- public const int EGL_READ = 0x305A;
- public const int EGL_RED_SIZE = 0x3024;
- public const int EGL_SAMPLES = 0x3031;
- public const int EGL_SAMPLE_BUFFERS = 0x3032;
- public const int EGL_SLOW_CONFIG = 0x3050;
- public const int EGL_STENCIL_SIZE = 0x3026;
- public const int EGL_SUCCESS = 0x3000;
- public const int EGL_SURFACE_TYPE = 0x3033;
- public const int EGL_TRANSPARENT_BLUE_VALUE = 0x3035;
- public const int EGL_TRANSPARENT_GREEN_VALUE = 0x3036;
- public const int EGL_TRANSPARENT_RED_VALUE = 0x3037;
- public const int EGL_TRANSPARENT_RGB = 0x3052;
- public const int EGL_TRANSPARENT_TYPE = 0x3034;
- public const int EGL_TRUE = 1;
- public const int EGL_VENDOR = 0x3053;
- public const int EGL_VERSION = 0x3054;
- public const int EGL_WIDTH = 0x3057;
- public const int EGL_WINDOW_BIT = 0x0004;
+ public const int EGL_ALPHA_SIZE = 0x3021;
+ public const int EGL_BAD_ACCESS = 0x3002;
+ public const int EGL_BAD_ALLOC = 0x3003;
+ public const int EGL_BAD_ATTRIBUTE = 0x3004;
+ public const int EGL_BAD_CONFIG = 0x3005;
+ public const int EGL_BAD_CONTEXT = 0x3006;
+ public const int EGL_BAD_CURRENT_SURFACE = 0x3007;
+ public const int EGL_BAD_DISPLAY = 0x3008;
+ public const int EGL_BAD_MATCH = 0x3009;
+ public const int EGL_BAD_NATIVE_PIXMAP = 0x300A;
+ public const int EGL_BAD_NATIVE_WINDOW = 0x300B;
+ public const int EGL_BAD_PARAMETER = 0x300C;
+ public const int EGL_BAD_SURFACE = 0x300D;
+ public const int EGL_BLUE_SIZE = 0x3022;
+// public const int EGL_BUFFER_SIZE = 0x3020;
+// public const int EGL_CONFIG_CAVEAT = 0x3027;
+// public const int EGL_CONFIG_ID = 0x3028;
+ public const int EGL_CORE_NATIVE_ENGINE = 0x305B;
+ public const int EGL_DEPTH_SIZE = 0x3025;
+// public const int EGL_DONT_CARE = -1;
+ public const int EGL_DRAW = 0x3059;
+ public const int EGL_EXTENSIONS = 0x3055;
+ public const int EGL_FALSE = 0;
+ public const int EGL_GREEN_SIZE = 0x3023;
+ public const int EGL_HEIGHT = 0x3056;
+// public const int EGL_LARGEST_PBUFFER = 0x3058;
+// public const int EGL_LEVEL = 0x3029;
+// public const int EGL_MAX_PBUFFER_HEIGHT = 0x302A;
+// public const int EGL_MAX_PBUFFER_PIXELS = 0x302B;
+// public const int EGL_MAX_PBUFFER_WIDTH = 0x302C;
+// public const int EGL_NATIVE_RENDERABLE = 0x302D;
+// public const int EGL_NATIVE_VISUAL_ID = 0x302E;
+// public const int EGL_NATIVE_VISUAL_TYPE = 0x302F;
+ public const int EGL_NONE = 0x3038;
+// public const int EGL_NON_CONFORMANT_CONFIG = 0x3051;
+ public const int EGL_NOT_INITIALIZED = 0x3001;
+ public const int EGL_NO_CONTEXT = 0;
+ public const int EGL_NO_DISPLAY = 0;
+ public const int EGL_NO_SURFACE = 0;
+ public const int EGL_PBUFFER_BIT = 0x0001;
+// public const int EGL_PIXMAP_BIT = 0x0002;
+ public const int EGL_READ = 0x305A;
+ public const int EGL_RED_SIZE = 0x3024;
+ public const int EGL_SAMPLES = 0x3031;
+// public const int EGL_SAMPLE_BUFFERS = 0x3032;
+// public const int EGL_SLOW_CONFIG = 0x3050;
+ public const int EGL_STENCIL_SIZE = 0x3026;
+ public const int EGL_SUCCESS = 0x3000;
+ public const int EGL_SURFACE_TYPE = 0x3033;
+// public const int EGL_TRANSPARENT_BLUE_VALUE = 0x3035;
+// public const int EGL_TRANSPARENT_GREEN_VALUE = 0x3036;
+// public const int EGL_TRANSPARENT_RED_VALUE = 0x3037;
+// public const int EGL_TRANSPARENT_RGB = 0x3052;
+// public const int EGL_TRANSPARENT_TYPE = 0x3034;
+ public const int EGL_TRUE = 1;
+// public const int EGL_VENDOR = 0x3053;
+// public const int EGL_VERSION = 0x3054;
+ public const int EGL_WIDTH = 0x3057;
+ public const int EGL_WINDOW_BIT = 0x0004;
- public const int EGL_BACK_BUFFER = 0x3084;
- public const int EGL_BIND_TO_TEXTURE_RGB = 0x3039;
- public const int EGL_BIND_TO_TEXTURE_RGBA = 0x303A;
- public const int EGL_CONTEXT_LOST = 0x300E;
- public const int EGL_MIN_SWAP_INTERVAL = 0x303B;
- public const int EGL_MAX_SWAP_INTERVAL = 0x303C;
- public const int EGL_MIPMAP_TEXTURE = 0x3082;
- public const int EGL_MIPMAP_LEVEL = 0x3083;
- public const int EGL_NO_TEXTURE = 0x305C;
- public const int EGL_TEXTURE_2D = 0x305F;
- public const int EGL_TEXTURE_FORMAT = 0x3080;
- public const int EGL_TEXTURE_RGB = 0x305D;
- public const int EGL_TEXTURE_RGBA = 0x305E;
- public const int EGL_TEXTURE_TARGET = 0x3081;
+// public const int EGL_BACK_BUFFER = 0x3084;
+// public const int EGL_BIND_TO_TEXTURE_RGB = 0x3039;
+// public const int EGL_BIND_TO_TEXTURE_RGBA = 0x303A;
+ public const int EGL_CONTEXT_LOST = 0x300E;
+// public const int EGL_MIN_SWAP_INTERVAL = 0x303B;
+// public const int EGL_MAX_SWAP_INTERVAL = 0x303C;
+// public const int EGL_MIPMAP_TEXTURE = 0x3082;
+// public const int EGL_MIPMAP_LEVEL = 0x3083;
+// public const int EGL_NO_TEXTURE = 0x305C;
+// public const int EGL_TEXTURE_2D = 0x305F;
+// public const int EGL_TEXTURE_FORMAT = 0x3080;
+// public const int EGL_TEXTURE_RGB = 0x305D;
+// public const int EGL_TEXTURE_RGBA = 0x305E;
+// public const int EGL_TEXTURE_TARGET = 0x3081;
- public const int EGL_ALPHA_FORMAT = 0x3088;
- public const int EGL_ALPHA_FORMAT_NONPRE = 0x308B;
- public const int EGL_ALPHA_FORMAT_PRE = 0x308C;
- public const int EGL_ALPHA_MASK_SIZE = 0x303E;
- public const int EGL_BUFFER_PRESERVED = 0x3094;
- public const int EGL_BUFFER_DESTROYED = 0x3095;
- public const int EGL_CLIENT_APIS = 0x308D;
- public const int EGL_COLORSPACE = 0x3087;
- public const int EGL_COLORSPACE_sRGB = 0x3089;
- public const int EGL_COLORSPACE_LINEAR = 0x308A;
- public const int EGL_COLOR_BUFFER_TYPE = 0x303F;
- public const int EGL_CONTEXT_CLIENT_TYPE = 0x3097;
- public const int EGL_DISPLAY_SCALING = 10000;
- public const int EGL_HORIZONTAL_RESOLUTION = 0x3090;
- public const int EGL_LUMINANCE_BUFFER = 0x308F;
- public const int EGL_LUMINANCE_SIZE = 0x303D;
- public const int EGL_OPENGL_ES_BIT = 0x0001;
- public const int EGL_OPENVG_BIT = 0x0002;
- public const int EGL_OPENGL_ES_API = 0x30A0;
- public const int EGL_OPENVG_API = 0x30A1;
- public const int EGL_OPENVG_IMAGE = 0x3096;
- public const int EGL_PIXEL_ASPECT_RATIO = 0x3092;
- public const int EGL_RENDERABLE_TYPE = 0x3040;
- public const int EGL_RENDER_BUFFER = 0x3086;
- public const int EGL_RGB_BUFFER = 0x308E;
- public const int EGL_SINGLE_BUFFER = 0x3085;
- public const int EGL_SWAP_BEHAVIOR = 0x3093;
- public const int EGL_UNKNOWN = -1;
- public const int EGL_VERTICAL_RESOLUTION = 0x3091;
- public const int EGL_CONFORMANT = 0x3042;
- public const int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
- public const int EGL_MATCH_NATIVE_PIXMAP = 0x3041;
- public const int EGL_OPENGL_ES2_BIT = 0x0004;
- public const int EGL_VG_ALPHA_FORMAT = 0x3088;
- public const int EGL_VG_ALPHA_FORMAT_NONPRE = 0x308B;
- public const int EGL_VG_ALPHA_FORMAT_PRE = 0x308C;
- public const int EGL_VG_ALPHA_FORMAT_PRE_BIT = 0x0040;
- public const int EGL_VG_COLORSPACE = 0x3087;
- public const int EGL_VG_COLORSPACE_sRGB = 0x3089;
- public const int EGL_VG_COLORSPACE_LINEAR = 0x308A;
- public const int EGL_VG_COLORSPACE_LINEAR_BIT = 0x0020;
- public const int EGL_DEFAULT_DISPLAY = 0;
- public const int EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 0x0200;
- public const int EGL_MULTISAMPLE_RESOLVE = 0x3099;
- public const int EGL_MULTISAMPLE_RESOLVE_DEFAULT = 0x309A;
- public const int EGL_MULTISAMPLE_RESOLVE_BOX = 0x309B;
- public const int EGL_OPENGL_API = 0x30A2;
- public const int EGL_OPENGL_BIT = 0x0008;
- public const int EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400;
- public const int EGL_CONTEXT_MAJOR_VERSION = 0x3098;
- public const int EGL_CONTEXT_MINOR_VERSION = 0x30FB;
- public const int EGL_CONTEXT_OPENGL_PROFILE_MASK = 0x30FD;
- public const int EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY = 0x31BD;
- public const int EGL_NO_RESET_NOTIFICATION = 0x31BE;
- public const int EGL_LOSE_CONTEXT_ON_RESET = 0x31BF;
- public const int EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT = 0x00000001;
- public const int EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT = 0x00000002;
- public const int EGL_CONTEXT_OPENGL_DEBUG = 0x31B0;
- public const int EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE = 0x31B1;
- public const int EGL_CONTEXT_OPENGL_ROBUST_ACCESS = 0x31B2;
- public const int EGL_OPENGL_ES3_BIT = 0x00000040;
- public const int EGL_CL_EVENT_HANDLE = 0x309C;
- public const int EGL_SYNC_CL_EVENT = 0x30FE;
- public const int EGL_SYNC_CL_EVENT_COMPLETE = 0x30FF;
- public const int EGL_SYNC_PRIOR_COMMANDS_COMPLETE = 0x30F0;
- public const int EGL_SYNC_TYPE = 0x30F7;
- public const int EGL_SYNC_STATUS = 0x30F1;
- public const int EGL_SYNC_CONDITION = 0x30F8;
- public const int EGL_SIGNALED = 0x30F2;
- public const int EGL_UNSIGNALED = 0x30F3;
+// public const int EGL_ALPHA_FORMAT = 0x3088;
+// public const int EGL_ALPHA_FORMAT_NONPRE = 0x308B;
+// public const int EGL_ALPHA_FORMAT_PRE = 0x308C;
+// public const int EGL_ALPHA_MASK_SIZE = 0x303E;
+// public const int EGL_BUFFER_PRESERVED = 0x3094;
+// public const int EGL_BUFFER_DESTROYED = 0x3095;
+// public const int EGL_CLIENT_APIS = 0x308D;
+// public const int EGL_COLORSPACE = 0x3087;
+// public const int EGL_COLORSPACE_sRGB = 0x3089;
+// public const int EGL_COLORSPACE_LINEAR = 0x308A;
+// public const int EGL_COLOR_BUFFER_TYPE = 0x303F;
+// public const int EGL_CONTEXT_CLIENT_TYPE = 0x3097;
+// public const int EGL_DISPLAY_SCALING = 10000;
+// public const int EGL_HORIZONTAL_RESOLUTION = 0x3090;
+// public const int EGL_LUMINANCE_BUFFER = 0x308F;
+// public const int EGL_LUMINANCE_SIZE = 0x303D;
+ public const int EGL_OPENGL_ES_BIT = 0x0001;
+// public const int EGL_OPENVG_BIT = 0x0002;
+ public const int EGL_OPENGL_ES_API = 0x30A0;
+// public const int EGL_OPENVG_API = 0x30A1;
+// public const int EGL_OPENVG_IMAGE = 0x3096;
+// public const int EGL_PIXEL_ASPECT_RATIO = 0x3092;
+ public const int EGL_RENDERABLE_TYPE = 0x3040;
+// public const int EGL_RENDER_BUFFER = 0x3086;
+// public const int EGL_RGB_BUFFER = 0x308E;
+// public const int EGL_SINGLE_BUFFER = 0x3085;
+// public const int EGL_SWAP_BEHAVIOR = 0x3093;
+// public const int EGL_UNKNOWN = -1;
+// public const int EGL_VERTICAL_RESOLUTION = 0x3091;
+// public const int EGL_CONFORMANT = 0x3042;
+// public const int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
+// public const int EGL_MATCH_NATIVE_PIXMAP = 0x3041;
+ public const int EGL_OPENGL_ES2_BIT = 0x0004;
+// public const int EGL_VG_ALPHA_FORMAT = 0x3088;
+// public const int EGL_VG_ALPHA_FORMAT_NONPRE = 0x308B;
+// public const int EGL_VG_ALPHA_FORMAT_PRE = 0x308C;
+// public const int EGL_VG_ALPHA_FORMAT_PRE_BIT = 0x0040;
+// public const int EGL_VG_COLORSPACE = 0x3087;
+// public const int EGL_VG_COLORSPACE_sRGB = 0x3089;
+// public const int EGL_VG_COLORSPACE_LINEAR = 0x308A;
+// public const int EGL_VG_COLORSPACE_LINEAR_BIT = 0x0020;
+// public const int EGL_DEFAULT_DISPLAY = 0;
+// public const int EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 0x0200;
+// public const int EGL_MULTISAMPLE_RESOLVE = 0x3099;
+// public const int EGL_MULTISAMPLE_RESOLVE_DEFAULT = 0x309A;
+// public const int EGL_MULTISAMPLE_RESOLVE_BOX = 0x309B;
+// public const int EGL_OPENGL_API = 0x30A2;
+// public const int EGL_OPENGL_BIT = 0x0008;
+// public const int EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400;
+ public const int EGL_CONTEXT_MAJOR_VERSION = 0x3098;
+ public const int EGL_CONTEXT_MINOR_VERSION = 0x30FB;
+// public const int EGL_CONTEXT_OPENGL_PROFILE_MASK = 0x30FD;
+// public const int EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY = 0x31BD;
+// public const int EGL_NO_RESET_NOTIFICATION = 0x31BE;
+// public const int EGL_LOSE_CONTEXT_ON_RESET = 0x31BF;
+// public const int EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT = 0x00000001;
+// public const int EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT = 0x00000002;
+// public const int EGL_CONTEXT_OPENGL_DEBUG = 0x31B0;
+// public const int EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE = 0x31B1;
+// public const int EGL_CONTEXT_OPENGL_ROBUST_ACCESS = 0x31B2;
+ public const int EGL_OPENGL_ES3_BIT = 0x00000040;
+// public const int EGL_CL_EVENT_HANDLE = 0x309C;
+// public const int EGL_SYNC_CL_EVENT = 0x30FE;
+// public const int EGL_SYNC_CL_EVENT_COMPLETE = 0x30FF;
+// public const int EGL_SYNC_PRIOR_COMMANDS_COMPLETE = 0x30F0;
+// public const int EGL_SYNC_TYPE = 0x30F7;
+// public const int EGL_SYNC_STATUS = 0x30F1;
+// public const int EGL_SYNC_CONDITION = 0x30F8;
+// public const int EGL_SIGNALED = 0x30F2;
+// public const int EGL_UNSIGNALED = 0x30F3;
- public const int EGL_SYNC_FLUSH_COMMANDS_BIT = 0x0001;
+// public const int EGL_SYNC_FLUSH_COMMANDS_BIT = 0x0001;
- public const int EGL_TIMEOUT_EXPIRED = 0x30F5;
- public const int EGL_CONDITION_SATISFIED = 0x30F6;
- public const int EGL_NO_SYNC = 0;
- public const int EGL_SYNC_FENCE = 0x30F9;
- public const int EGL_GL_COLORSPACE = 0x309D;
- public const int EGL_GL_COLORSPACE_SRGB = 0x3089;
- public const int EGL_GL_COLORSPACE_LINEAR = 0x308A;
- public const int EGL_GL_RENDERBUFFER = 0x30B9;
- public const int EGL_GL_TEXTURE_2D = 0x30B1;
- public const int EGL_GL_TEXTURE_LEVEL = 0x30BC;
- public const int EGL_GL_TEXTURE_3D = 0x30B2;
- public const int EGL_GL_TEXTURE_ZOFFSET = 0x30BD;
- public const int EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x30B3;
- public const int EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x30B4;
- public const int EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x30B5;
- public const int EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x30B6;
- public const int EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x30B7;
- public const int EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x30B8;
- public const int EGL_IMAGE_PRESERVED = 0x30D2;
- public const int EGL_NO_IMAGE = 0;
+// public const int EGL_TIMEOUT_EXPIRED = 0x30F5;
+// public const int EGL_CONDITION_SATISFIED = 0x30F6;
+// public const int EGL_NO_SYNC = 0;
+// public const int EGL_SYNC_FENCE = 0x30F9;
+// public const int EGL_GL_COLORSPACE = 0x309D;
+// public const int EGL_GL_COLORSPACE_SRGB = 0x3089;
+// public const int EGL_GL_COLORSPACE_LINEAR = 0x308A;
+// public const int EGL_GL_RENDERBUFFER = 0x30B9;
+// public const int EGL_GL_TEXTURE_2D = 0x30B1;
+// public const int EGL_GL_TEXTURE_LEVEL = 0x30BC;
+// public const int EGL_GL_TEXTURE_3D = 0x30B2;
+// public const int EGL_GL_TEXTURE_ZOFFSET = 0x30BD;
+// public const int EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x30B3;
+// public const int EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x30B4;
+// public const int EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x30B5;
+// public const int EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x30B6;
+// public const int EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x30B7;
+// public const int EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x30B8;
+// public const int EGL_IMAGE_PRESERVED = 0x30D2;
+// public const int EGL_NO_IMAGE = 0;
- public const int EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE = 0x3207;
- public const int EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE = 0x3208;
+ public const int EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE = 0x3207;
+ public const int EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE = 0x3208;
//EGL_ANGLE_platform_angle
- public const int EGL_PLATFORM_ANGLE_ANGLE = 0x3202;
- public const int EGL_PLATFORM_ANGLE_TYPE_ANGLE = 0x3203;
- public const int EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE = 0x3204;
- public const int EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE = 0x3205;
- public const int EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED = 0x3451;
- public const int EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE = 0x3206;
- public const int EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE = 0x320A;
- public const int EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE = 0x345E;
+ public const int EGL_PLATFORM_ANGLE_ANGLE = 0x3202;
+ public const int EGL_PLATFORM_ANGLE_TYPE_ANGLE = 0x3203;
+// public const int EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE = 0x3204;
+// public const int EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE = 0x3205;
+// public const int EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED = 0x3451;
+// public const int EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE = 0x3206;
+// public const int EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE = 0x320A;
+// public const int EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE = 0x345E;
- public const int EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE = 0x320D;
- public const int EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE = 0x320E;
+// public const int EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE = 0x320D;
+// public const int EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE = 0x320E;
//EGL_ANGLE_platform_angle_d3d
- public const int EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE = 0x3209;
- public const int EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE = 0x320F;
- public const int EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE = 0x320B;
- public const int EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE = 0x320C;
+// public const int EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE = 0x3209;
+// public const int EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE = 0x320F;
+// public const int EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE = 0x320B;
+// public const int EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE = 0x320C;
//EXT_device_query
- public const int EGL_DEVICE_EXT = 0x322C;
+ public const int EGL_DEVICE_EXT = 0x322C;
//ANGLE_device_d3d
- public const int EGL_D3D9_DEVICE_ANGLE = 0x33A0;
- public const int EGL_D3D11_DEVICE_ANGLE = 0x33A1;
+ public const int EGL_D3D9_DEVICE_ANGLE = 0x33A0;
+ public const int EGL_D3D11_DEVICE_ANGLE = 0x33A1;
- public const int EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE = 0x3200;
- public const int EGL_D3D_TEXTURE_ANGLE = 0x33A3;
+ public const int EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE = 0x3200;
+ public const int EGL_D3D_TEXTURE_ANGLE = 0x33A3;
- public const int EGL_TEXTURE_OFFSET_X_ANGLE = 0x3490;
- public const int EGL_TEXTURE_OFFSET_Y_ANGLE = 0x3491;
+ public const int EGL_TEXTURE_OFFSET_X_ANGLE = 0x3490;
+ public const int EGL_TEXTURE_OFFSET_Y_ANGLE = 0x3491;
- public const int EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE = 0x33A6;
+ public const int EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE = 0x33A6;
}
}
diff --git a/src/Avalonia.OpenGL/Egl/EglContext.cs b/src/Avalonia.OpenGL/Egl/EglContext.cs
index bc517c3e27..e7b5dc7c83 100644
--- a/src/Avalonia.OpenGL/Egl/EglContext.cs
+++ b/src/Avalonia.OpenGL/Egl/EglContext.cs
@@ -24,7 +24,7 @@ namespace Avalonia.OpenGL.Egl
SampleCount = sampleCount;
StencilSize = stencilSize;
using (MakeCurrent())
- GlInterface = GlInterface.FromNativeUtf8GetProcAddress(version, b => _egl.GetProcAddress(b));
+ GlInterface = GlInterface.FromNativeUtf8GetProcAddress(version, _egl.GetProcAddress);
}
public IntPtr Context { get; }
diff --git a/src/Avalonia.OpenGL/Egl/EglDisplay.cs b/src/Avalonia.OpenGL/Egl/EglDisplay.cs
index 623364866b..d3d85e8c83 100644
--- a/src/Avalonia.OpenGL/Egl/EglDisplay.cs
+++ b/src/Avalonia.OpenGL/Egl/EglDisplay.cs
@@ -34,9 +34,9 @@ namespace Avalonia.OpenGL.Egl
}
else
{
- if (egl.GetPlatformDisplayEXT == null)
+ if (!egl.IsGetPlatformDisplayExtAvailable)
throw new OpenGlException("eglGetPlatformDisplayEXT is not supported by libegl");
- display = egl.GetPlatformDisplayEXT(platformType, platformDisplay, attrs);
+ display = egl.GetPlatformDisplayExt(platformType, platformDisplay, attrs);
}
if (display == IntPtr.Zero)
diff --git a/src/Avalonia.OpenGL/Egl/EglInterface.cs b/src/Avalonia.OpenGL/Egl/EglInterface.cs
index 6148e58440..4fec8e5356 100644
--- a/src/Avalonia.OpenGL/Egl/EglInterface.cs
+++ b/src/Avalonia.OpenGL/Egl/EglInterface.cs
@@ -2,31 +2,26 @@
using System.Runtime.InteropServices;
using Avalonia.Platform;
using Avalonia.Platform.Interop;
+using Avalonia.SourceGenerator;
namespace Avalonia.OpenGL.Egl
{
- public class EglInterface : GlInterfaceBase
+ public unsafe partial class EglInterface
{
- public EglInterface() : base(Load())
+ public EglInterface(Func getProcAddress)
{
-
- }
-
- public EglInterface(Func getProcAddress) : base(getProcAddress)
- {
-
+ Initialize(getProcAddress);
}
- public EglInterface(Func getProcAddress) : base(getProcAddress)
+ public EglInterface(string library) : this(Load(library))
{
-
}
-
- public EglInterface(string library) : base(Load(library))
+
+ public EglInterface() : this(Load())
{
+
}
-
static Func Load()
{
var os = AvaloniaLocator.Current.GetService().GetRuntimeInfo().OperatingSystem;
@@ -46,119 +41,75 @@ namespace Avalonia.OpenGL.Egl
}
// ReSharper disable UnassignedGetOnlyAutoProperty
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate int EglGetError();
- [GlEntryPoint("eglGetError")]
- public EglGetError GetError { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate IntPtr EglGetDisplay(IntPtr nativeDisplay);
- [GlEntryPoint("eglGetDisplay")]
- public EglGetDisplay GetDisplay { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate IntPtr EglGetPlatformDisplayEXT(int platform, IntPtr nativeDisplay, int[] attrs);
- [GlEntryPoint("eglGetPlatformDisplayEXT")]
- [GlOptionalEntryPoint]
- public EglGetPlatformDisplayEXT GetPlatformDisplayEXT { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate bool EglInitialize(IntPtr display, out int major, out int minor);
- [GlEntryPoint("eglInitialize")]
- public EglInitialize Initialize { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate IntPtr EglGetProcAddress(Utf8Buffer proc);
- [GlEntryPoint("eglGetProcAddress")]
- public EglGetProcAddress GetProcAddress { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate bool EglBindApi(int api);
- [GlEntryPoint("eglBindAPI")]
- public EglBindApi BindApi { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate bool EglChooseConfig(IntPtr display, int[] attribs,
- out IntPtr surfaceConfig, int numConfigs, out int choosenConfig);
- [GlEntryPoint("eglChooseConfig")]
- public EglChooseConfig ChooseConfig { get; }
+
+ [GetProcAddress("eglGetError")]
+ public partial int GetError();
+
+ [GetProcAddress("eglGetDisplay")]
+ public partial IntPtr GetDisplay(IntPtr nativeDisplay);
+
+ [GetProcAddress("eglGetPlatformDisplayEXT", true)]
+ public partial IntPtr GetPlatformDisplayExt(int platform, IntPtr nativeDisplay, int[] attrs);
+
+ [GetProcAddress("eglInitialize")]
+ public partial bool Initialize(IntPtr display, out int major, out int minor);
+
+ [GetProcAddress("eglGetProcAddress")]
+ public partial IntPtr GetProcAddress(IntPtr proc);
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate IntPtr EglCreateContext(IntPtr display, IntPtr config,
+ [GetProcAddress("eglBindAPI")]
+ public partial bool BindApi(int api);
+
+ [GetProcAddress("eglChooseConfig")]
+ public partial bool ChooseConfig(IntPtr display, int[] attribs,
+ out IntPtr surfaceConfig, int numConfigs, out int choosenConfig);
+
+ [GetProcAddress("eglCreateContext")]
+ public partial IntPtr CreateContext(IntPtr display, IntPtr config,
IntPtr share, int[] attrs);
- [GlEntryPoint("eglCreateContext")]
- public EglCreateContext CreateContext { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate bool EglDestroyContext(IntPtr display, IntPtr context);
- [GlEntryPoint("eglDestroyContext")]
- public EglDestroyContext DestroyContext { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate IntPtr EglCreatePBufferSurface(IntPtr display, IntPtr config, int[] attrs);
- [GlEntryPoint("eglCreatePbufferSurface")]
- public EglCreatePBufferSurface CreatePBufferSurface { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate bool EglMakeCurrent(IntPtr display, IntPtr draw, IntPtr read, IntPtr context);
- [GlEntryPoint("eglMakeCurrent")]
- public EglMakeCurrent MakeCurrent { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate IntPtr EglGetCurrentContext();
- [GlEntryPoint("eglGetCurrentContext")]
- public EglGetCurrentContext GetCurrentContext { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate IntPtr EglGetCurrentDisplay();
- [GlEntryPoint("eglGetCurrentDisplay")]
- public EglGetCurrentContext GetCurrentDisplay { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate IntPtr EglGetCurrentSurface(int readDraw);
- [GlEntryPoint("eglGetCurrentSurface")]
- public EglGetCurrentSurface GetCurrentSurface { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate void EglDisplaySurfaceVoidDelegate(IntPtr display, IntPtr surface);
- [GlEntryPoint("eglDestroySurface")]
- public EglDisplaySurfaceVoidDelegate DestroySurface { get; }
-
- [GlEntryPoint("eglSwapBuffers")]
- public EglDisplaySurfaceVoidDelegate SwapBuffers { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate IntPtr
- EglCreateWindowSurface(IntPtr display, IntPtr config, IntPtr window, int[] attrs);
- [GlEntryPoint("eglCreateWindowSurface")]
- public EglCreateWindowSurface CreateWindowSurface { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate bool EglGetConfigAttrib(IntPtr display, IntPtr config, int attr, out int rv);
- [GlEntryPoint("eglGetConfigAttrib")]
- public EglGetConfigAttrib GetConfigAttrib { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate bool EglWaitGL();
- [GlEntryPoint("eglWaitGL")]
- public EglWaitGL WaitGL { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate bool EglWaitClient();
- [GlEntryPoint("eglWaitClient")]
- public EglWaitGL WaitClient { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate bool EglWaitNative(int engine);
- [GlEntryPoint("eglWaitNative")]
- public EglWaitNative WaitNative { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate IntPtr EglQueryString(IntPtr display, int i);
-
- [GlEntryPoint("eglQueryString")]
- public EglQueryString QueryStringNative { get; }
+
+ [GetProcAddress("eglDestroyContext")]
+ public partial bool DestroyContext(IntPtr display, IntPtr context);
+
+ [GetProcAddress("eglCreatePbufferSurface")]
+ public partial IntPtr CreatePBufferSurface(IntPtr display, IntPtr config, int[] attrs);
+ [GetProcAddress("eglMakeCurrent")]
+ public partial bool MakeCurrent(IntPtr display, IntPtr draw, IntPtr read, IntPtr context);
+
+ [GetProcAddress("eglGetCurrentContext")]
+ public partial IntPtr GetCurrentContext();
+
+ [GetProcAddress("eglGetCurrentDisplay")]
+ public partial IntPtr GetCurrentDisplay();
+
+ [GetProcAddress("eglGetCurrentSurface")]
+ public partial IntPtr GetCurrentSurface(int readDraw);
+
+ [GetProcAddress("eglDestroySurface")]
+ public partial void DestroySurface(IntPtr display, IntPtr surface);
+
+ [GetProcAddress("eglSwapBuffers")]
+ public partial void SwapBuffers(IntPtr display, IntPtr surface);
+
+ [GetProcAddress("eglCreateWindowSurface")]
+ public partial IntPtr CreateWindowSurface(IntPtr display, IntPtr config, IntPtr window, int[] attrs);
+
+ [GetProcAddress("eglGetConfigAttrib")]
+ public partial bool GetConfigAttrib(IntPtr display, IntPtr config, int attr, out int rv);
+
+ [GetProcAddress("eglWaitGL")]
+ public partial bool WaitGL();
+
+ [GetProcAddress("eglWaitClient")]
+ public partial bool WaitClient();
+
+ [GetProcAddress("eglWaitNative")]
+ public partial bool WaitNative(int engine);
+
+ [GetProcAddress("eglQueryString")]
+ public partial IntPtr QueryStringNative(IntPtr display, int i);
+
public string QueryString(IntPtr display, int i)
{
var rv = QueryStringNative(display, i);
@@ -166,25 +117,15 @@ namespace Avalonia.OpenGL.Egl
return null;
return Marshal.PtrToStringAnsi(rv);
}
+
+ [GetProcAddress("eglCreatePbufferFromClientBuffer")]
+ public partial IntPtr CreatePbufferFromClientBuffer(IntPtr display, int buftype, IntPtr buffer, IntPtr config, int[] attrib_list);
+
+ [GetProcAddress("eglQueryDisplayAttribEXT", true)]
+ public partial bool QueryDisplayAttribExt(IntPtr display, int attr, out IntPtr res);
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate IntPtr EglCreatePbufferFromClientBuffer(IntPtr display, int buftype, IntPtr buffer, IntPtr config, int[] attrib_list);
- [GlEntryPoint("eglCreatePbufferFromClientBuffer")]
-
- public EglCreatePbufferFromClientBuffer CreatePbufferFromClientBuffer { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate bool EglQueryDisplayAttribEXT(IntPtr display, int attr, out IntPtr res);
-
- [GlEntryPoint("eglQueryDisplayAttribEXT"), GlOptionalEntryPoint]
- public EglQueryDisplayAttribEXT QueryDisplayAttribExt { get; }
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- public delegate bool EglQueryDeviceAttribEXT(IntPtr display, int attr, out IntPtr res);
-
- [GlEntryPoint("eglQueryDeviceAttribEXT"), GlOptionalEntryPoint]
- public EglQueryDisplayAttribEXT QueryDeviceAttribExt { get; }
-
- // ReSharper restore UnassignedGetOnlyAutoProperty
+
+ [GetProcAddress("eglQueryDeviceAttribEXT", true)]
+ public partial bool QueryDeviceAttribExt(IntPtr display, int attr, out IntPtr res);
}
}
diff --git a/src/Avalonia.OpenGL/GlBasicInfoInterface.cs b/src/Avalonia.OpenGL/GlBasicInfoInterface.cs
index aaba2ec09c..7a7110f15b 100644
--- a/src/Avalonia.OpenGL/GlBasicInfoInterface.cs
+++ b/src/Avalonia.OpenGL/GlBasicInfoInterface.cs
@@ -3,46 +3,24 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using Avalonia.Platform.Interop;
+using Avalonia.SourceGenerator;
namespace Avalonia.OpenGL
{
- public class GlBasicInfoInterface : GlBasicInfoInterface