Browse Source

Merge branch 'master' into fixes/10246-duplicate-itemscontrol-logical-children

pull/10338/head
Max Katz 4 years ago
committed by GitHub
parent
commit
3a25160655
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/Android/Avalonia.Android/AndroidInputMethod.cs
  2. 1
      src/Android/Avalonia.Android/Avalonia.Android.csproj
  3. 2
      src/Android/Avalonia.Android/Platform/Input/AndroidKeyboardDevice.cs
  4. 2
      src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs
  5. 4
      src/Android/Avalonia.Android/PlatformIconLoader.cs
  6. 6
      src/Android/Avalonia.Android/Stubs.cs
  7. 43
      src/Avalonia.Base/AvaloniaProperty.cs
  8. 4
      src/Avalonia.Base/StyledElement.cs
  9. 2
      src/Avalonia.FreeDesktop/DBusHelper.cs
  10. 2
      src/Avalonia.FreeDesktop/DBusIme/X11DBusImeHelper.cs
  11. 2
      src/Avalonia.FreeDesktop/DBusMenuExporter.cs
  12. 6
      src/Avalonia.FreeDesktop/IX11InputMethod.cs
  13. 2
      src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoProvider.cs
  14. 2
      src/Avalonia.Native/CallbackBase.cs
  15. 2
      src/Avalonia.Native/MacOSMountedVolumeInfoProvider.cs
  16. 2
      src/Avalonia.Native/MenuActionCallback.cs
  17. 2
      src/Avalonia.Native/PredicateCallback.cs
  18. 2
      src/Avalonia.Native/ScreenImpl.cs
  19. 2
      src/Avalonia.X11/Glx/Glx.cs
  20. 2
      src/Avalonia.X11/Glx/GlxConsts.cs
  21. 6
      src/Avalonia.X11/Glx/GlxContext.cs
  22. 8
      src/Avalonia.X11/Glx/GlxDisplay.cs
  23. 8
      src/Avalonia.X11/Glx/GlxGlPlatformSurface.cs
  24. 2
      src/Avalonia.X11/Glx/GlxPlatformFeature.cs
  25. 2
      src/Avalonia.X11/Keysyms.cs
  26. 29
      src/Avalonia.X11/NativeDialogs/Gtk.cs
  27. 2
      src/Avalonia.X11/TransparencyHelper.cs
  28. 16
      src/Avalonia.X11/X11Clipboard.cs
  29. 4
      src/Avalonia.X11/X11CursorFactory.cs
  30. 8
      src/Avalonia.X11/X11Enums.cs
  31. 2
      src/Avalonia.X11/X11Exception.cs
  32. 2
      src/Avalonia.X11/X11Framebuffer.cs
  33. 2
      src/Avalonia.X11/X11FramebufferSurface.cs
  34. 12
      src/Avalonia.X11/X11Globals.cs
  35. 8
      src/Avalonia.X11/X11IconLoader.cs
  36. 2
      src/Avalonia.X11/X11Info.cs
  37. 2
      src/Avalonia.X11/X11KeyTransform.cs
  38. 10
      src/Avalonia.X11/X11NativeControlHost.cs
  39. 8
      src/Avalonia.X11/X11Platform.cs
  40. 32
      src/Avalonia.X11/X11PlatformThreading.cs
  41. 20
      src/Avalonia.X11/X11Screens.cs
  42. 9
      src/Avalonia.X11/X11Structs.cs
  43. 32
      src/Avalonia.X11/X11Window.Ime.cs
  44. 4
      src/Avalonia.X11/X11Window.Xim.cs
  45. 46
      src/Avalonia.X11/X11Window.cs
  46. 5
      src/Avalonia.X11/XError.cs
  47. 16
      src/Avalonia.X11/XI2Manager.cs
  48. 54
      src/Avalonia.X11/XIStructs.cs
  49. 10
      src/Avalonia.X11/XLib.cs
  50. 2
      src/Browser/Avalonia.Browser/Skia/BrowserSkiaGpu.cs
  51. 4
      src/Shared/RawEventGrouping.cs
  52. 5
      src/Skia/Avalonia.Skia/GlyphRunImpl.cs
  53. 4
      src/Skia/Avalonia.Skia/GlyphTypefaceImpl.cs
  54. 2
      src/Skia/Avalonia.Skia/SKTypefaceCollection.cs
  55. 2
      src/Skia/Avalonia.Skia/SKTypefaceCollectionCache.cs
  56. 22
      src/Skia/Avalonia.Skia/readme.md
  57. 6
      src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj
  58. 2
      src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs
  59. 33
      src/Windows/Avalonia.Direct2D1/Disposable.cs
  60. 2
      src/Windows/Avalonia.Direct2D1/ILayerFactory.cs
  61. 4
      src/Windows/Avalonia.Direct2D1/Media/BrushImpl.cs
  62. 4
      src/Windows/Avalonia.Direct2D1/Media/DWriteResourceFontFileEnumerator.cs
  63. 2
      src/Windows/Avalonia.Direct2D1/Media/DWriteResourceFontFileStream.cs
  64. 4
      src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs
  65. 4
      src/Windows/Avalonia.Direct2D1/Media/GeometryImpl.cs
  66. 4
      src/Windows/Avalonia.Direct2D1/Media/GlyphTypefaceImpl.cs
  67. 4
      src/Windows/Avalonia.Direct2D1/Media/ImageBrushImpl.cs
  68. 4
      src/Windows/Avalonia.Direct2D1/Media/Imaging/BitmapImpl.cs
  69. 4
      src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DBitmapImpl.cs
  70. 4
      src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DRenderTargetBitmapImpl.cs
  71. 4
      src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs
  72. 4
      src/Windows/Avalonia.Direct2D1/Media/Imaging/WicRenderTargetBitmapImpl.cs
  73. 2
      src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs
  74. 4
      src/Windows/Avalonia.Direct2D1/Media/LinearGradientBrushImpl.cs
  75. 4
      src/Windows/Avalonia.Direct2D1/Media/RadialGradientBrushImpl.cs
  76. 4
      src/Windows/Avalonia.Direct2D1/Media/SolidColorBrushImpl.cs
  77. 3
      src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs
  78. 4
      src/Windows/Avalonia.Direct2D1/Media/StreamGeometryImpl.cs
  79. 4
      src/Windows/Avalonia.Direct2D1/Media/TransformedGeometryImpl.cs
  80. 2
      src/Windows/Avalonia.Direct2D1/OptionalDispose.cs
  81. 2
      src/Windows/Avalonia.Direct2D1/PrimitiveExtensions.cs
  82. 2
      src/Windows/Avalonia.Direct2D1/RenderTarget.cs
  83. 2
      src/Windows/Avalonia.Direct2D1/SwapChainRenderTarget.cs
  84. 1
      src/Windows/Avalonia.Win32/Avalonia.Win32.csproj
  85. 2
      src/Windows/Avalonia.Win32/DirectX/DirectXStructs.cs
  86. 2
      src/Windows/Avalonia.Win32/DirectX/DxgiConnection.cs
  87. 2
      src/Windows/Avalonia.Win32/DirectX/DxgiRenderTarget.cs
  88. 2
      src/Windows/Avalonia.Win32/DirectX/DxgiSwapchainWindow.cs
  89. 4
      src/Windows/Avalonia.Win32/PlatformConstants.cs
  90. 3
      src/Windows/Avalonia.Win32/ScreenImpl.cs
  91. 3
      src/Windows/Avalonia.Win32/TrayIconImpl.cs
  92. 2
      src/Windows/Avalonia.Win32/Win32Platform.cs
  93. 2
      src/Windows/Avalonia.Win32/WinRT/IBlurHost.cs
  94. 2
      src/Windows/Avalonia.Win32/WinRT/WinRTColor.cs
  95. 2
      src/Windows/Avalonia.Win32/WinScreen.cs
  96. 2
      src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs
  97. 2
      src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs
  98. 2
      src/Windows/Avalonia.Win32/WindowImpl.WndProc.cs
  99. 3
      src/Windows/Avalonia.Win32/WindowImpl.cs
  100. 2
      src/Windows/Avalonia.Win32/WindowsMountedVolumeInfoProvider.cs

4
src/Android/Avalonia.Android/AndroidInputMethod.cs

@ -32,7 +32,7 @@ namespace Avalonia.Android
ActionPrevious = 0x00000007, ActionPrevious = 0x00000007,
} }
class AndroidInputMethod<TView> : ITextInputMethodImpl, IAndroidInputMethod internal class AndroidInputMethod<TView> : ITextInputMethodImpl, IAndroidInputMethod
where TView : View, IInitEditorInfo where TView : View, IInitEditorInfo
{ {
private readonly TView _host; private readonly TView _host;
@ -167,7 +167,7 @@ namespace Avalonia.Android
} }
} }
public readonly record struct ComposingRegion internal readonly record struct ComposingRegion
{ {
private readonly int _start = -1; private readonly int _start = -1;
private readonly int _end = -1; private readonly int _end = -1;

1
src/Android/Avalonia.Android/Avalonia.Android.csproj

@ -5,6 +5,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<MSBuildEnableWorkloadResolver>true</MSBuildEnableWorkloadResolver> <MSBuildEnableWorkloadResolver>true</MSBuildEnableWorkloadResolver>
<DebugType>portable</DebugType> <DebugType>portable</DebugType>
<AndroidResgenNamespace>Avalonia.Android.Internal</AndroidResgenNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\packages\Avalonia\Avalonia.csproj" /> <ProjectReference Include="..\..\..\packages\Avalonia\Avalonia.csproj" />

2
src/Android/Avalonia.Android/Platform/Input/AndroidKeyboardDevice.cs

@ -5,7 +5,7 @@ using Avalonia.Input;
namespace Avalonia.Android.Platform.Input namespace Avalonia.Android.Platform.Input
{ {
public class AndroidKeyboardDevice : KeyboardDevice, IKeyboardDevice { internal class AndroidKeyboardDevice : KeyboardDevice, IKeyboardDevice {
private static readonly Dictionary<Keycode, Key> KeyDic = new Dictionary<Keycode, Key> private static readonly Dictionary<Keycode, Key> KeyDic = new Dictionary<Keycode, Key>
{ {
// { Keycode.Cancel?, Key.Cancel }, // { Keycode.Cancel?, Key.Cancel },

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

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

4
src/Android/Avalonia.Android/PlatformIconLoader.cs

@ -3,7 +3,7 @@ using Avalonia.Platform;
namespace Avalonia.Android namespace Avalonia.Android
{ {
class PlatformIconLoader : IPlatformIconLoader internal class PlatformIconLoader : IPlatformIconLoader
{ {
public IWindowIconImpl LoadIcon(IBitmapImpl bitmap) public IWindowIconImpl LoadIcon(IBitmapImpl bitmap)
{ {
@ -29,7 +29,7 @@ namespace Avalonia.Android
} }
// Stores the icon created as a stream to support saving even though an icon is never shown // Stores the icon created as a stream to support saving even though an icon is never shown
public class FakeIcon : IWindowIconImpl internal class FakeIcon : IWindowIconImpl
{ {
private Stream stream = new MemoryStream(); private Stream stream = new MemoryStream();

6
src/Android/Avalonia.Android/Stubs.cs

@ -4,7 +4,7 @@ using Avalonia.Platform;
namespace Avalonia.Android namespace Avalonia.Android
{ {
class WindowingPlatformStub : IWindowingPlatform internal class WindowingPlatformStub : IWindowingPlatform
{ {
public IWindowImpl CreateWindow() => throw new NotSupportedException(); public IWindowImpl CreateWindow() => throw new NotSupportedException();
@ -13,7 +13,7 @@ namespace Avalonia.Android
public ITrayIconImpl CreateTrayIcon() => null; public ITrayIconImpl CreateTrayIcon() => null;
} }
class PlatformIconLoaderStub : IPlatformIconLoader internal class PlatformIconLoaderStub : IPlatformIconLoader
{ {
public IWindowIconImpl LoadIcon(IBitmapImpl bitmap) public IWindowIconImpl LoadIcon(IBitmapImpl bitmap)
{ {
@ -38,7 +38,7 @@ namespace Avalonia.Android
} }
} }
public class IconStub : IWindowIconImpl internal class IconStub : IWindowIconImpl
{ {
private readonly MemoryStream _ms; private readonly MemoryStream _ms;

43
src/Avalonia.Base/AvaloniaProperty.cs

@ -225,13 +225,8 @@ namespace Avalonia
/// <param name="defaultValue">The default value of the property.</param> /// <param name="defaultValue">The default value of the property.</param>
/// <param name="inherits">Whether the property inherits its value.</param> /// <param name="inherits">Whether the property inherits its value.</param>
/// <param name="defaultBindingMode">The default binding mode for the property.</param> /// <param name="defaultBindingMode">The default binding mode for the property.</param>
/// <param name="validate">A value validation callback.</param> /// <param name="validate">A value validation callback.</param>
/// <param name="coerce">A value coercion callback.</param> /// <param name="coerce">A value coercion callback.</param>
/// <param name="notifying">
/// A method that gets called before and after the property starts being notified on an
/// object; the bool argument will be true before and false afterwards. This callback is
/// intended to support IsDataContextChanging.
/// </param>
/// <returns>A <see cref="StyledProperty{TValue}"/></returns> /// <returns>A <see cref="StyledProperty{TValue}"/></returns>
public static StyledProperty<TValue> Register<TOwner, TValue>( public static StyledProperty<TValue> Register<TOwner, TValue>(
string name, string name,
@ -239,8 +234,40 @@ namespace Avalonia
bool inherits = false, bool inherits = false,
BindingMode defaultBindingMode = BindingMode.OneWay, BindingMode defaultBindingMode = BindingMode.OneWay,
Func<TValue, bool>? validate = null, Func<TValue, bool>? validate = null,
Func<AvaloniaObject, TValue, TValue>? coerce = null, Func<AvaloniaObject, TValue, TValue>? coerce = null)
Action<AvaloniaObject, bool>? notifying = null) where TOwner : AvaloniaObject
{
_ = name ?? throw new ArgumentNullException(nameof(name));
var metadata = new StyledPropertyMetadata<TValue>(
defaultValue,
defaultBindingMode: defaultBindingMode,
coerce: coerce);
var result = new StyledProperty<TValue>(
name,
typeof(TOwner),
metadata,
inherits,
validate);
AvaloniaPropertyRegistry.Instance.Register(typeof(TOwner), result);
return result;
}
/// <inheritdoc cref="Register{TOwner, TValue}" />
/// <param name="notifying">
/// A method that gets called before and after the property starts being notified on an
/// object; the bool argument will be true before and false afterwards. This callback is
/// intended to support IsDataContextChanging.
/// </param>
internal static StyledProperty<TValue> Register<TOwner, TValue>(
string name,
TValue defaultValue,
bool inherits,
BindingMode defaultBindingMode,
Func<TValue, bool>? validate,
Func<AvaloniaObject, TValue, TValue>? coerce,
Action<AvaloniaObject, bool>? notifying)
where TOwner : AvaloniaObject where TOwner : AvaloniaObject
{ {
_ = name ?? throw new ArgumentNullException(nameof(name)); _ = name ?? throw new ArgumentNullException(nameof(name));

4
src/Avalonia.Base/StyledElement.cs

@ -41,7 +41,11 @@ namespace Avalonia
public static readonly StyledProperty<object?> DataContextProperty = public static readonly StyledProperty<object?> DataContextProperty =
AvaloniaProperty.Register<StyledElement, object?>( AvaloniaProperty.Register<StyledElement, object?>(
nameof(DataContext), nameof(DataContext),
defaultValue: null,
inherits: true, inherits: true,
defaultBindingMode: BindingMode.OneWay,
validate: null,
coerce: null,
notifying: DataContextNotifying); notifying: DataContextNotifying);
/// <summary> /// <summary>

2
src/Avalonia.FreeDesktop/DBusHelper.cs

@ -6,7 +6,7 @@ using Tmds.DBus;
namespace Avalonia.FreeDesktop namespace Avalonia.FreeDesktop
{ {
public static class DBusHelper internal static class DBusHelper
{ {
/// <summary> /// <summary>
/// This class uses synchronous execution at DBus connection establishment stage /// This class uses synchronous execution at DBus connection establishment stage

2
src/Avalonia.FreeDesktop/DBusIme/X11DBusImeHelper.cs

@ -6,7 +6,7 @@ using Tmds.DBus;
namespace Avalonia.FreeDesktop.DBusIme namespace Avalonia.FreeDesktop.DBusIme
{ {
public class X11DBusImeHelper internal class X11DBusImeHelper
{ {
private static readonly Dictionary<string, Func<Connection, IX11InputMethodFactory>> KnownMethods = private static readonly Dictionary<string, Func<Connection, IX11InputMethodFactory>> KnownMethods =
new Dictionary<string, Func<Connection, IX11InputMethodFactory>> new Dictionary<string, Func<Connection, IX11InputMethodFactory>>

2
src/Avalonia.FreeDesktop/DBusMenuExporter.cs

@ -15,7 +15,7 @@ using Tmds.DBus;
namespace Avalonia.FreeDesktop namespace Avalonia.FreeDesktop
{ {
public class DBusMenuExporter internal class DBusMenuExporter
{ {
public static ITopLevelNativeMenuExporter? TryCreateTopLevelNativeMenu(IntPtr xid) public static ITopLevelNativeMenuExporter? TryCreateTopLevelNativeMenu(IntPtr xid)
{ {

6
src/Avalonia.FreeDesktop/IX11InputMethod.cs

@ -6,13 +6,13 @@ using Avalonia.Input.TextInput;
namespace Avalonia.FreeDesktop namespace Avalonia.FreeDesktop
{ {
public interface IX11InputMethodFactory internal interface IX11InputMethodFactory
{ {
(ITextInputMethodImpl method, IX11InputMethodControl control) CreateClient(IntPtr xid); (ITextInputMethodImpl method, IX11InputMethodControl control) CreateClient(IntPtr xid);
} }
#pragma warning disable CA1815 // Override equals and operator equals on value types #pragma warning disable CA1815 // Override equals and operator equals on value types
public struct X11InputMethodForwardedKey internal struct X11InputMethodForwardedKey
#pragma warning restore CA1815 // Override equals and operator equals on value types #pragma warning restore CA1815 // Override equals and operator equals on value types
{ {
public int KeyVal { get; set; } public int KeyVal { get; set; }
@ -20,7 +20,7 @@ namespace Avalonia.FreeDesktop
public RawKeyEventType Type { get; set; } public RawKeyEventType Type { get; set; }
} }
public interface IX11InputMethodControl : IDisposable internal interface IX11InputMethodControl : IDisposable
{ {
void SetWindowActive(bool active); void SetWindowActive(bool active);
bool IsEnabled { get; } bool IsEnabled { get; }

2
src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoProvider.cs

@ -5,7 +5,7 @@ using Avalonia.Controls.Platform;
namespace Avalonia.FreeDesktop namespace Avalonia.FreeDesktop
{ {
public class LinuxMountedVolumeInfoProvider : IMountedVolumeInfoProvider internal class LinuxMountedVolumeInfoProvider : IMountedVolumeInfoProvider
{ {
public IDisposable Listen(ObservableCollection<MountedVolumeInfo> mountedDrives) public IDisposable Listen(ObservableCollection<MountedVolumeInfo> mountedDrives)
{ {

2
src/Avalonia.Native/CallbackBase.cs

@ -6,7 +6,7 @@ using MicroCom.Runtime;
namespace Avalonia.Native namespace Avalonia.Native
{ {
public abstract class NativeCallbackBase : CallbackBase, IMicroComExceptionCallback internal abstract class NativeCallbackBase : CallbackBase, IMicroComExceptionCallback
{ {
public void RaiseException(Exception e) public void RaiseException(Exception e)
{ {

2
src/Avalonia.Native/MacOSMountedVolumeInfoProvider.cs

@ -64,7 +64,7 @@ namespace Avalonia.Native
} }
} }
public class MacOSMountedVolumeInfoProvider : IMountedVolumeInfoProvider internal class MacOSMountedVolumeInfoProvider : IMountedVolumeInfoProvider
{ {
public IDisposable Listen(ObservableCollection<MountedVolumeInfo> mountedDrives) public IDisposable Listen(ObservableCollection<MountedVolumeInfo> mountedDrives)
{ {

2
src/Avalonia.Native/MenuActionCallback.cs

@ -3,7 +3,7 @@ using Avalonia.Native.Interop;
namespace Avalonia.Native namespace Avalonia.Native
{ {
public class MenuActionCallback : NativeCallbackBase, IAvnActionCallback internal class MenuActionCallback : NativeCallbackBase, IAvnActionCallback
{ {
private Action _action; private Action _action;

2
src/Avalonia.Native/PredicateCallback.cs

@ -3,7 +3,7 @@ using Avalonia.Native.Interop;
namespace Avalonia.Native namespace Avalonia.Native
{ {
public class PredicateCallback : NativeCallbackBase, IAvnPredicateCallback internal class PredicateCallback : NativeCallbackBase, IAvnPredicateCallback
{ {
private Func<bool> _predicate; private Func<bool> _predicate;

2
src/Avalonia.Native/ScreenImpl.cs

@ -5,7 +5,7 @@ using Avalonia.Platform;
namespace Avalonia.Native namespace Avalonia.Native
{ {
class ScreenImpl : IScreenImpl, IDisposable internal class ScreenImpl : IScreenImpl, IDisposable
{ {
private IAvnScreens _native; private IAvnScreens _native;

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

@ -10,7 +10,7 @@ using Avalonia.SourceGenerator;
namespace Avalonia.X11.Glx namespace Avalonia.X11.Glx
{ {
unsafe partial class GlxInterface internal unsafe partial class GlxInterface
{ {
private const string libGL = "libGL.so.1"; private const string libGL = "libGL.so.1";
[GetProcAddress("glXMakeContextCurrent")] [GetProcAddress("glXMakeContextCurrent")]

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

@ -4,7 +4,7 @@
#pragma warning disable 414 #pragma warning disable 414
namespace Avalonia.X11.Glx namespace Avalonia.X11.Glx
{ {
class GlxConsts internal class GlxConsts
{ {
public const int GLX_USE_GL = 1; public const int GLX_USE_GL = 1;
public const int GLX_BUFFER_SIZE = 2; public const int GLX_BUFFER_SIZE = 2;

6
src/Avalonia.X11/Glx/GlxContext.cs

@ -7,7 +7,7 @@ using Avalonia.Reactive;
namespace Avalonia.X11.Glx namespace Avalonia.X11.Glx
{ {
class GlxContext : IGlContext internal class GlxContext : IGlContext
{ {
public IntPtr Handle { get; } public IntPtr Handle { get; }
public GlxInterface Glx { get; } public GlxInterface Glx { get; }
@ -46,8 +46,8 @@ namespace Avalonia.X11.Glx
public GlInterface GlInterface { get; } public GlInterface GlInterface { get; }
public int SampleCount { get; } public int SampleCount { get; }
public int StencilSize { get; } public int StencilSize { get; }
class RestoreContext : IDisposable private class RestoreContext : IDisposable
{ {
private GlxInterface _glx; private GlxInterface _glx;
private IntPtr _defaultDisplay; private IntPtr _defaultDisplay;

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

@ -6,7 +6,7 @@ using static Avalonia.X11.Glx.GlxConsts;
namespace Avalonia.X11.Glx namespace Avalonia.X11.Glx
{ {
unsafe class GlxDisplay internal unsafe class GlxDisplay
{ {
private readonly X11Info _x11; private readonly X11Info _x11;
private readonly GlVersion[] _probeProfiles; private readonly GlVersion[] _probeProfiles;
@ -106,7 +106,7 @@ namespace Avalonia.X11.Glx
} }
} }
IntPtr CreatePBuffer() private IntPtr CreatePBuffer()
{ {
return Glx.CreatePbuffer(_x11.Display, _fbconfig, new[] { GLX_PBUFFER_WIDTH, 1, GLX_PBUFFER_HEIGHT, 1, 0 }); return Glx.CreatePbuffer(_x11.Display, _fbconfig, new[] { GLX_PBUFFER_WIDTH, 1, GLX_PBUFFER_HEIGHT, 1, 0 });
} }
@ -116,8 +116,8 @@ namespace Avalonia.X11.Glx
public GlxContext CreateContext(IGlContext share) => CreateContext(CreatePBuffer(), share, public GlxContext CreateContext(IGlContext share) => CreateContext(CreatePBuffer(), share,
share.SampleCount, share.StencilSize, true); share.SampleCount, share.StencilSize, true);
GlxContext CreateContext(IntPtr defaultXid, IGlContext share, private GlxContext CreateContext(IntPtr defaultXid, IGlContext share,
int sampleCount, int stencilSize, bool ownsPBuffer) int sampleCount, int stencilSize, bool ownsPBuffer)
{ {
var sharelist = ((GlxContext)share)?.Handle ?? IntPtr.Zero; var sharelist = ((GlxContext)share)?.Handle ?? IntPtr.Zero;

8
src/Avalonia.X11/Glx/GlxGlPlatformSurface.cs

@ -6,7 +6,7 @@ using static Avalonia.OpenGL.GlConsts;
namespace Avalonia.X11.Glx namespace Avalonia.X11.Glx
{ {
class GlxGlPlatformSurface: IGlPlatformSurface internal class GlxGlPlatformSurface: IGlPlatformSurface
{ {
private readonly EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo _info; private readonly EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo _info;
@ -21,7 +21,7 @@ namespace Avalonia.X11.Glx
return new RenderTarget((GlxContext)context, _info); return new RenderTarget((GlxContext)context, _info);
} }
class RenderTarget : IGlPlatformSurfaceRenderTarget private class RenderTarget : IGlPlatformSurfaceRenderTarget
{ {
private readonly GlxContext _context; private readonly GlxContext _context;
private readonly EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo _info; private readonly EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo _info;
@ -46,8 +46,8 @@ namespace Avalonia.X11.Glx
return new Session(_context, _info, oldContext); return new Session(_context, _info, oldContext);
} }
class Session : IGlPlatformSurfaceRenderingSession private class Session : IGlPlatformSurfaceRenderingSession
{ {
private readonly GlxContext _context; private readonly GlxContext _context;
private readonly EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo _info; private readonly EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo _info;

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

@ -6,7 +6,7 @@ using Avalonia.Platform;
namespace Avalonia.X11.Glx namespace Avalonia.X11.Glx
{ {
class GlxPlatformGraphics : IPlatformGraphics internal class GlxPlatformGraphics : IPlatformGraphics
{ {
public GlxDisplay Display { get; private set; } public GlxDisplay Display { get; private set; }
public bool CanCreateContexts => true; public bool CanCreateContexts => true;

2
src/Avalonia.X11/Keysyms.cs

@ -3,7 +3,7 @@
// ReSharper disable CommentTypo // ReSharper disable CommentTypo
namespace Avalonia.X11 namespace Avalonia.X11
{ {
enum X11Key internal enum X11Key
{ {
VoidSymbol = 0xffffff /* Void symbol */, VoidSymbol = 0xffffff /* Void symbol */,
BackSpace = 0xff08 /* Back space, back char */, BackSpace = 0xff08 /* Back space, back char */,

29
src/Avalonia.X11/NativeDialogs/Gtk.cs

@ -7,8 +7,7 @@ using Avalonia.Platform.Interop;
// ReSharper disable IdentifierTypo // ReSharper disable IdentifierTypo
namespace Avalonia.X11.NativeDialogs namespace Avalonia.X11.NativeDialogs
{ {
internal static unsafe class Glib
static unsafe class Glib
{ {
private const string GlibName = "libglib-2.0.so.0"; private const string GlibName = "libglib-2.0.so.0";
private const string GObjectName = "libgobject-2.0.so.0"; private const string GObjectName = "libgobject-2.0.so.0";
@ -36,7 +35,7 @@ namespace Avalonia.X11.NativeDialogs
IntPtr destroy); IntPtr destroy);
class ConnectedSignal : IDisposable private class ConnectedSignal : IDisposable
{ {
private readonly IntPtr _instance; private readonly IntPtr _instance;
private GCHandle _handle; private GCHandle _handle;
@ -75,7 +74,7 @@ namespace Avalonia.X11.NativeDialogs
} }
static bool TimeoutHandler(IntPtr data) private static bool TimeoutHandler(IntPtr data)
{ {
var handle = GCHandle.FromIntPtr(data); var handle = GCHandle.FromIntPtr(data);
var cb = (Func<bool>)handle.Target; var cb = (Func<bool>)handle.Target;
@ -95,7 +94,7 @@ namespace Avalonia.X11.NativeDialogs
s_pinnedHandler = TimeoutHandler; s_pinnedHandler = TimeoutHandler;
} }
static void AddTimeout(int priority, uint interval, Func<bool> callback) private static void AddTimeout(int priority, uint interval, Func<bool> callback)
{ {
var handle = GCHandle.Alloc(callback); var handle = GCHandle.Alloc(callback);
g_timeout_add_full(priority, interval, s_pinnedHandler, GCHandle.ToIntPtr(handle), IntPtr.Zero); g_timeout_add_full(priority, interval, s_pinnedHandler, GCHandle.ToIntPtr(handle), IntPtr.Zero);
@ -123,13 +122,13 @@ namespace Avalonia.X11.NativeDialogs
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
unsafe struct GSList internal unsafe struct GSList
{ {
public readonly IntPtr Data; public readonly IntPtr Data;
public readonly GSList* Next; public readonly GSList* Next;
} }
enum GtkFileChooserAction internal enum GtkFileChooserAction
{ {
Open, Open,
Save, Save,
@ -137,7 +136,7 @@ namespace Avalonia.X11.NativeDialogs
} }
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
enum GtkResponseType internal enum GtkResponseType
{ {
Help = -11, Help = -11,
Apply = -10, Apply = -10,
@ -153,14 +152,14 @@ namespace Avalonia.X11.NativeDialogs
} }
// ReSharper restore UnusedMember.Global // ReSharper restore UnusedMember.Global
static unsafe class Gtk internal static unsafe class Gtk
{ {
private static IntPtr s_display; private static IntPtr s_display;
private const string GdkName = "libgdk-3.so.0"; private const string GdkName = "libgdk-3.so.0";
private const string GtkName = "libgtk-3.so.0"; private const string GtkName = "libgtk-3.so.0";
[DllImport(GtkName)] [DllImport(GtkName)]
static extern void gtk_main_iteration(); private static extern void gtk_main_iteration();
[DllImport(GtkName)] [DllImport(GtkName)]
@ -231,10 +230,10 @@ namespace Avalonia.X11.NativeDialogs
public static extern void gtk_widget_hide(IntPtr gtkWidget); public static extern void gtk_widget_hide(IntPtr gtkWidget);
[DllImport(GtkName)] [DllImport(GtkName)]
static extern bool gtk_init_check(int argc, IntPtr argv); private static extern bool gtk_init_check(int argc, IntPtr argv);
[DllImport(GdkName)] [DllImport(GdkName)]
static extern IntPtr gdk_x11_window_foreign_new_for_display(IntPtr display, IntPtr xid); private static extern IntPtr gdk_x11_window_foreign_new_for_display(IntPtr display, IntPtr xid);
[DllImport(GdkName)] [DllImport(GdkName)]
public static extern IntPtr gdk_x11_window_get_xid(IntPtr window); public static extern IntPtr gdk_x11_window_get_xid(IntPtr window);
@ -244,13 +243,13 @@ namespace Avalonia.X11.NativeDialogs
public static extern IntPtr gtk_container_add(IntPtr container, IntPtr widget); public static extern IntPtr gtk_container_add(IntPtr container, IntPtr widget);
[DllImport(GdkName)] [DllImport(GdkName)]
static extern IntPtr gdk_set_allowed_backends(Utf8Buffer backends); private static extern IntPtr gdk_set_allowed_backends(Utf8Buffer backends);
[DllImport(GdkName)] [DllImport(GdkName)]
static extern IntPtr gdk_display_get_default(); private static extern IntPtr gdk_display_get_default();
[DllImport(GtkName)] [DllImport(GtkName)]
static extern IntPtr gtk_application_new(Utf8Buffer appId, int flags); private static extern IntPtr gtk_application_new(Utf8Buffer appId, int flags);
[DllImport(GdkName)] [DllImport(GdkName)]
public static extern void gdk_window_set_transient_for(IntPtr window, IntPtr parent); public static extern void gdk_window_set_transient_for(IntPtr window, IntPtr parent);

2
src/Avalonia.X11/TransparencyHelper.cs

@ -3,7 +3,7 @@ using Avalonia.Controls;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
class TransparencyHelper : IDisposable, X11Globals.IGlobalsSubscriber internal class TransparencyHelper : IDisposable, X11Globals.IGlobalsSubscriber
{ {
private readonly X11Info _x11; private readonly X11Info _x11;
private readonly IntPtr _window; private readonly IntPtr _window;

16
src/Avalonia.X11/X11Clipboard.cs

@ -9,7 +9,7 @@ using Avalonia.Input.Platform;
using static Avalonia.X11.XLib; using static Avalonia.X11.XLib;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
class X11Clipboard : IClipboard internal class X11Clipboard : IClipboard
{ {
private readonly X11Info _x11; private readonly X11Info _x11;
private IDataObject _storedDataObject; private IDataObject _storedDataObject;
@ -33,12 +33,12 @@ namespace Avalonia.X11
}.Where(a => a != IntPtr.Zero).ToArray(); }.Where(a => a != IntPtr.Zero).ToArray();
} }
bool IsStringAtom(IntPtr atom) private bool IsStringAtom(IntPtr atom)
{ {
return _textAtoms.Contains(atom); return _textAtoms.Contains(atom);
} }
Encoding GetStringEncoding(IntPtr atom) private Encoding GetStringEncoding(IntPtr atom)
{ {
return (atom == _x11.Atoms.XA_STRING return (atom == _x11.Atoms.XA_STRING
|| atom == _x11.Atoms.OEMTEXT) || atom == _x11.Atoms.OEMTEXT)
@ -213,7 +213,7 @@ namespace Avalonia.X11
} }
} }
Task<IntPtr[]> SendFormatRequest() private Task<IntPtr[]> SendFormatRequest()
{ {
if (_requestedFormatsTcs == null || _requestedFormatsTcs.Task.IsCompleted) if (_requestedFormatsTcs == null || _requestedFormatsTcs.Task.IsCompleted)
_requestedFormatsTcs = new TaskCompletionSource<IntPtr[]>(); _requestedFormatsTcs = new TaskCompletionSource<IntPtr[]>();
@ -222,7 +222,7 @@ namespace Avalonia.X11
return _requestedFormatsTcs.Task; return _requestedFormatsTcs.Task;
} }
Task<object> SendDataRequest(IntPtr format) private Task<object> SendDataRequest(IntPtr format)
{ {
if (_requestedDataTcs == null || _requestedFormatsTcs.Task.IsCompleted) if (_requestedDataTcs == null || _requestedFormatsTcs.Task.IsCompleted)
_requestedDataTcs = new TaskCompletionSource<object>(); _requestedDataTcs = new TaskCompletionSource<object>();
@ -230,7 +230,7 @@ namespace Avalonia.X11
return _requestedDataTcs.Task; return _requestedDataTcs.Task;
} }
bool HasOwner => XGetSelectionOwner(_x11.Display, _x11.Atoms.CLIPBOARD) != IntPtr.Zero; private bool HasOwner => XGetSelectionOwner(_x11.Display, _x11.Atoms.CLIPBOARD) != IntPtr.Zero;
public async Task<string> GetTextAsync() public async Task<string> GetTextAsync()
{ {
@ -252,7 +252,7 @@ namespace Avalonia.X11
return (string)await SendDataRequest(target); return (string)await SendDataRequest(target);
} }
void StoreAtomsInClipboardManager(IntPtr[] atoms) private void StoreAtomsInClipboardManager(IntPtr[] atoms)
{ {
if (_x11.Atoms.CLIPBOARD_MANAGER != IntPtr.Zero && _x11.Atoms.SAVE_TARGETS != IntPtr.Zero) if (_x11.Atoms.CLIPBOARD_MANAGER != IntPtr.Zero && _x11.Atoms.SAVE_TARGETS != IntPtr.Zero)
{ {

4
src/Avalonia.X11/X11CursorFactory.cs

@ -12,7 +12,7 @@ using Avalonia.Utilities;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
partial class X11CursorFactory : ICursorFactory internal partial class X11CursorFactory : ICursorFactory
{ {
private static readonly byte[] NullCursorData = new byte[] { 0 }; private static readonly byte[] NullCursorData = new byte[] { 0 };
@ -142,7 +142,7 @@ namespace Avalonia.X11
} }
} }
class CursorImpl : ICursorImpl internal class CursorImpl : ICursorImpl
{ {
public CursorImpl() { } public CursorImpl() { }
public CursorImpl(IntPtr handle) => Handle = handle; public CursorImpl(IntPtr handle) => Handle = handle;

8
src/Avalonia.X11/X11Enums.cs

@ -3,7 +3,7 @@ using System;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
public enum Status internal enum Status
{ {
Success = 0, /* everything's okay */ Success = 0, /* everything's okay */
BadRequest = 1, /* bad request code */ BadRequest = 1, /* bad request code */
@ -38,7 +38,7 @@ namespace Avalonia.X11
} }
[Flags] [Flags]
public enum XEventMask : int internal enum XEventMask : int
{ {
NoEventMask = 0, NoEventMask = 0,
KeyPressMask = (1 << 0), KeyPressMask = (1 << 0),
@ -69,7 +69,7 @@ namespace Avalonia.X11
} }
[Flags] [Flags]
public enum XModifierMask internal enum XModifierMask
{ {
ShiftMask = (1 << 0), ShiftMask = (1 << 0),
LockMask = (1 << 1), LockMask = (1 << 1),
@ -89,7 +89,7 @@ namespace Avalonia.X11
} }
[Flags] [Flags]
public enum XCreateWindowFlags internal enum XCreateWindowFlags
{ {
CWBackPixmap = (1 << 0), CWBackPixmap = (1 << 0),
CWBackPixel = (1 << 1), CWBackPixel = (1 << 1),

2
src/Avalonia.X11/X11Exception.cs

@ -2,7 +2,7 @@ using System;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
public class X11Exception : Exception internal class X11Exception : Exception
{ {
public X11Exception(string message) : base(message) public X11Exception(string message) : base(message)
{ {

2
src/Avalonia.X11/X11Framebuffer.cs

@ -5,7 +5,7 @@ using SkiaSharp;
using static Avalonia.X11.XLib; using static Avalonia.X11.XLib;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
class X11Framebuffer : ILockedFramebuffer internal class X11Framebuffer : ILockedFramebuffer
{ {
private readonly IntPtr _display; private readonly IntPtr _display;
private readonly IntPtr _xid; private readonly IntPtr _xid;

2
src/Avalonia.X11/X11FramebufferSurface.cs

@ -4,7 +4,7 @@ using Avalonia.Platform;
using static Avalonia.X11.XLib; using static Avalonia.X11.XLib;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
public class X11FramebufferSurface : IFramebufferPlatformSurface internal class X11FramebufferSurface : IFramebufferPlatformSurface
{ {
private readonly IntPtr _display; private readonly IntPtr _display;
private readonly IntPtr _xid; private readonly IntPtr _xid;

12
src/Avalonia.X11/X11Globals.cs

@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using static Avalonia.X11.XLib; using static Avalonia.X11.XLib;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
unsafe class X11Globals internal unsafe class X11Globals
{ {
private readonly AvaloniaX11Platform _plat; private readonly AvaloniaX11Platform _plat;
private readonly int _screenNumber; private readonly int _screenNumber;
@ -75,7 +75,7 @@ namespace Avalonia.X11
} }
} }
IntPtr GetSupportingWmCheck(IntPtr window) private IntPtr GetSupportingWmCheck(IntPtr window)
{ {
XGetWindowProperty(_x11.Display, _rootWindow, _x11.Atoms._NET_SUPPORTING_WM_CHECK, XGetWindowProperty(_x11.Display, _rootWindow, _x11.Atoms._NET_SUPPORTING_WM_CHECK,
IntPtr.Zero, new IntPtr(IntPtr.Size), false, IntPtr.Zero, new IntPtr(IntPtr.Size), false,
@ -95,7 +95,7 @@ namespace Avalonia.X11
} }
} }
void UpdateCompositingAtomOwner() private void UpdateCompositingAtomOwner()
{ {
// This procedure is described in https://tronche.com/gui/x/icccm/sec-2.html#s-2.8 // This procedure is described in https://tronche.com/gui/x/icccm/sec-2.html#s-2.8
@ -128,10 +128,10 @@ namespace Avalonia.X11
if(ev.type == XEventName.DestroyNotify) if(ev.type == XEventName.DestroyNotify)
UpdateCompositingAtomOwner(); UpdateCompositingAtomOwner();
} }
void UpdateWmName() => WmName = GetWmName();
string GetWmName() private void UpdateWmName() => WmName = GetWmName();
private string GetWmName()
{ {
var wm = GetSupportingWmCheck(_rootWindow); var wm = GetSupportingWmCheck(_rootWindow);
if (wm == IntPtr.Zero || wm != GetSupportingWmCheck(wm)) if (wm == IntPtr.Zero || wm != GetSupportingWmCheck(wm))

8
src/Avalonia.X11/X11IconLoader.cs

@ -7,9 +7,9 @@ using Avalonia.Platform;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
class X11IconLoader : IPlatformIconLoader internal class X11IconLoader : IPlatformIconLoader
{ {
static IWindowIconImpl LoadIcon(Bitmap bitmap) private static IWindowIconImpl LoadIcon(Bitmap bitmap)
{ {
var rv = new X11IconData(bitmap); var rv = new X11IconData(bitmap);
bitmap.Dispose(); bitmap.Dispose();
@ -28,8 +28,8 @@ namespace Avalonia.X11
return LoadIcon(ms); return LoadIcon(ms);
} }
} }
unsafe class X11IconData : IWindowIconImpl, IFramebufferPlatformSurface internal unsafe class X11IconData : IWindowIconImpl, IFramebufferPlatformSurface
{ {
private int _width; private int _width;
private int _height; private int _height;

2
src/Avalonia.X11/X11Info.cs

@ -6,7 +6,7 @@ using static Avalonia.X11.XLib;
// ReSharper disable UnusedAutoPropertyAccessor.Local // ReSharper disable UnusedAutoPropertyAccessor.Local
namespace Avalonia.X11 namespace Avalonia.X11
{ {
unsafe class X11Info internal unsafe class X11Info
{ {
public IntPtr Display { get; } public IntPtr Display { get; }
public IntPtr DeferredDisplay { get; } public IntPtr DeferredDisplay { get; }

2
src/Avalonia.X11/X11KeyTransform.cs

@ -4,7 +4,7 @@ using Avalonia.Input;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
static class X11KeyTransform internal static class X11KeyTransform
{ {
private static readonly Dictionary<X11Key, Key> KeyDic = new Dictionary<X11Key, Key> private static readonly Dictionary<X11Key, Key> KeyDic = new Dictionary<X11Key, Key>
{ {

10
src/Avalonia.X11/X11NativeControlHost.cs

@ -6,7 +6,7 @@ using static Avalonia.X11.XLib;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
// TODO: Actually implement XEmbed instead of simply using XReparentWindow // TODO: Actually implement XEmbed instead of simply using XReparentWindow
class X11NativeControlHost : INativeControlHostImpl internal class X11NativeControlHost : INativeControlHostImpl
{ {
private readonly AvaloniaX11Platform _platform; private readonly AvaloniaX11Platform _platform;
public X11Window Window { get; } public X11Window Window { get; }
@ -57,7 +57,7 @@ namespace Avalonia.X11
public bool IsCompatibleWith(IPlatformHandle handle) => handle.HandleDescriptor == "XID"; public bool IsCompatibleWith(IPlatformHandle handle) => handle.HandleDescriptor == "XID";
class DumbWindow : INativeControlHostDestroyableControlHandle private class DumbWindow : INativeControlHostDestroyableControlHandle
{ {
private readonly IntPtr _display; private readonly IntPtr _display;
@ -96,8 +96,8 @@ namespace Avalonia.X11
} }
} }
} }
class Attachment : INativeControlHostControlTopLevelAttachment private class Attachment : INativeControlHostControlTopLevelAttachment
{ {
private readonly IntPtr _display; private readonly IntPtr _display;
private readonly IntPtr _orphanedWindow; private readonly IntPtr _orphanedWindow;
@ -129,7 +129,7 @@ namespace Avalonia.X11
_attachedTo = null; _attachedTo = null;
} }
void CheckDisposed() private void CheckDisposed()
{ {
if (_child == null) if (_child == null)
throw new ObjectDisposedException("X11 INativeControlHostControlTopLevelAttachment"); throw new ObjectDisposedException("X11 INativeControlHostControlTopLevelAttachment");

8
src/Avalonia.X11/X11Platform.cs

@ -20,7 +20,7 @@ using static Avalonia.X11.XLib;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
class AvaloniaX11Platform : IWindowingPlatform internal class AvaloniaX11Platform : IWindowingPlatform
{ {
private Lazy<KeyboardDevice> _keyboardDevice = new Lazy<KeyboardDevice>(() => new KeyboardDevice()); private Lazy<KeyboardDevice> _keyboardDevice = new Lazy<KeyboardDevice>(() => new KeyboardDevice());
public KeyboardDevice KeyboardDevice => _keyboardDevice.Value; public KeyboardDevice KeyboardDevice => _keyboardDevice.Value;
@ -35,7 +35,7 @@ namespace Avalonia.X11
public IntPtr OrphanedWindow { get; private set; } public IntPtr OrphanedWindow { get; private set; }
public X11Globals Globals { get; private set; } public X11Globals Globals { get; private set; }
[DllImport("libc")] [DllImport("libc")]
static extern void setlocale(int type, string s); private static extern void setlocale(int type, string s);
public void Initialize(X11PlatformOptions options) public void Initialize(X11PlatformOptions options)
{ {
Options = options; Options = options;
@ -138,7 +138,7 @@ namespace Avalonia.X11
throw new NotSupportedException(); throw new NotSupportedException();
} }
static bool EnableIme(X11PlatformOptions options) private static bool EnableIme(X11PlatformOptions options)
{ {
// Disable if explicitly asked by user // Disable if explicitly asked by user
var avaloniaImModule = Environment.GetEnvironmentVariable("AVALONIA_IM_MODULE"); var avaloniaImModule = Environment.GetEnvironmentVariable("AVALONIA_IM_MODULE");
@ -160,7 +160,7 @@ namespace Avalonia.X11
return isCjkLocale; return isCjkLocale;
} }
static bool ShouldUseXim() private static bool ShouldUseXim()
{ {
// Check if we are forbidden from using IME // Check if we are forbidden from using IME
if (Environment.GetEnvironmentVariable("AVALONIA_IM_MODULE") == "none" if (Environment.GetEnvironmentVariable("AVALONIA_IM_MODULE") == "none"

32
src/Avalonia.X11/X11PlatformThreading.cs

@ -9,7 +9,7 @@ using static Avalonia.X11.XLib;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
unsafe class X11PlatformThreading : IPlatformThreadingInterface internal unsafe class X11PlatformThreading : IPlatformThreadingInterface
{ {
private readonly AvaloniaX11Platform _platform; private readonly AvaloniaX11Platform _platform;
private readonly IntPtr _display; private readonly IntPtr _display;
@ -19,7 +19,7 @@ namespace Avalonia.X11
private Thread _mainThread; private Thread _mainThread;
[StructLayout(LayoutKind.Explicit)] [StructLayout(LayoutKind.Explicit)]
struct epoll_data private struct epoll_data
{ {
[FieldOffset(0)] [FieldOffset(0)]
public IntPtr ptr; public IntPtr ptr;
@ -36,30 +36,30 @@ namespace Avalonia.X11
private const int O_NONBLOCK = 2048; private const int O_NONBLOCK = 2048;
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct epoll_event private struct epoll_event
{ {
public uint events; public uint events;
public epoll_data data; public epoll_data data;
} }
[DllImport("libc")] [DllImport("libc")]
extern static int epoll_create1(int size); private extern static int epoll_create1(int size);
[DllImport("libc")] [DllImport("libc")]
extern static int epoll_ctl(int epfd, int op, int fd, ref epoll_event __event); private extern static int epoll_ctl(int epfd, int op, int fd, ref epoll_event __event);
[DllImport("libc")] [DllImport("libc")]
extern static int epoll_wait(int epfd, epoll_event* events, int maxevents, int timeout); private extern static int epoll_wait(int epfd, epoll_event* events, int maxevents, int timeout);
[DllImport("libc")] [DllImport("libc")]
extern static int pipe2(int* fds, int flags); private extern static int pipe2(int* fds, int flags);
[DllImport("libc")] [DllImport("libc")]
extern static IntPtr write(int fd, void* buf, IntPtr count); private extern static IntPtr write(int fd, void* buf, IntPtr count);
[DllImport("libc")] [DllImport("libc")]
extern static IntPtr read(int fd, void* buf, IntPtr count); private extern static IntPtr read(int fd, void* buf, IntPtr count);
enum EventCodes private enum EventCodes
{ {
X11 = 1, X11 = 1,
Signal =2 Signal =2
@ -72,7 +72,7 @@ namespace Avalonia.X11
private int _epoll; private int _epoll;
private Stopwatch _clock = Stopwatch.StartNew(); private Stopwatch _clock = Stopwatch.StartNew();
class X11Timer : IDisposable private class X11Timer : IDisposable
{ {
private readonly X11PlatformThreading _parent; private readonly X11PlatformThreading _parent;
@ -104,7 +104,7 @@ namespace Avalonia.X11
} }
} }
List<X11Timer> _timers = new List<X11Timer>(); private List<X11Timer> _timers = new List<X11Timer>();
public X11PlatformThreading(AvaloniaX11Platform platform) public X11PlatformThreading(AvaloniaX11Platform platform)
{ {
@ -139,12 +139,12 @@ namespace Avalonia.X11
throw new X11Exception("Unable to attach signal pipe to epoll"); throw new X11Exception("Unable to attach signal pipe to epoll");
} }
int TimerComparer(X11Timer t1, X11Timer t2) private int TimerComparer(X11Timer t1, X11Timer t2)
{ {
return t2.Priority - t1.Priority; return t2.Priority - t1.Priority;
} }
void CheckSignaled() private void CheckSignaled()
{ {
int buf = 0; int buf = 0;
while (read(_sigread, &buf, new IntPtr(4)).ToInt64() > 0) while (read(_sigread, &buf, new IntPtr(4)).ToInt64() > 0)
@ -164,7 +164,7 @@ namespace Avalonia.X11
Signaled?.Invoke(prio); Signaled?.Invoke(prio);
} }
unsafe void HandleX11(CancellationToken cancellationToken) private unsafe void HandleX11(CancellationToken cancellationToken)
{ {
while (XPending(_display) != 0) while (XPending(_display) != 0)
{ {

20
src/Avalonia.X11/X11Screens.cs

@ -8,7 +8,7 @@ using static Avalonia.X11.XLib;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
class X11Screens : IScreenImpl internal class X11Screens : IScreenImpl
{ {
private IX11Screens _impl; private IX11Screens _impl;
@ -17,7 +17,7 @@ namespace Avalonia.X11
_impl = impl; _impl = impl;
} }
static unsafe X11Screen[] UpdateWorkArea(X11Info info, X11Screen[] screens) private static unsafe X11Screen[] UpdateWorkArea(X11Info info, X11Screen[] screens)
{ {
var rect = default(PixelRect); var rect = default(PixelRect);
foreach (var s in screens) foreach (var s in screens)
@ -58,14 +58,14 @@ namespace Avalonia.X11
XFree(prop); XFree(prop);
return screens; return screens;
} }
class Randr15ScreensImpl : IX11Screens private class Randr15ScreensImpl : IX11Screens
{ {
private readonly X11ScreensUserSettings _settings; private readonly X11ScreensUserSettings _settings;
private X11Screen[] _cache; private X11Screen[] _cache;
private X11Info _x11; private X11Info _x11;
private IntPtr _window; private IntPtr _window;
const int EDIDStructureLength = 32; // Length of a EDID-Block-Length(128 bytes), XRRGetOutputProperty multiplies offset and length by 4 private const int EDIDStructureLength = 32; // Length of a EDID-Block-Length(128 bytes), XRRGetOutputProperty multiplies offset and length by 4
public Randr15ScreensImpl(AvaloniaX11Platform platform, X11ScreensUserSettings settings) public Randr15ScreensImpl(AvaloniaX11Platform platform, X11ScreensUserSettings settings)
{ {
@ -160,7 +160,7 @@ namespace Avalonia.X11
} }
} }
class FallbackScreensImpl : IX11Screens private class FallbackScreensImpl : IX11Screens
{ {
public FallbackScreensImpl(X11Info info, X11ScreensUserSettings settings) public FallbackScreensImpl(X11Info info, X11ScreensUserSettings settings)
{ {
@ -220,17 +220,17 @@ namespace Avalonia.X11
_impl.Screens.Select(s => new Screen(s.Scaling, s.Bounds, s.WorkingArea, s.IsPrimary)).ToArray(); _impl.Screens.Select(s => new Screen(s.Scaling, s.Bounds, s.WorkingArea, s.IsPrimary)).ToArray();
} }
interface IX11Screens internal interface IX11Screens
{ {
X11Screen[] Screens { get; } X11Screen[] Screens { get; }
} }
class X11ScreensUserSettings internal class X11ScreensUserSettings
{ {
public double GlobalScaleFactor { get; set; } = 1; public double GlobalScaleFactor { get; set; } = 1;
public Dictionary<string, double> NamedScaleFactors { get; set; } public Dictionary<string, double> NamedScaleFactors { get; set; }
static double? TryParse(string s) private static double? TryParse(string s)
{ {
if (s == null) if (s == null)
return null; return null;
@ -276,7 +276,7 @@ namespace Avalonia.X11
} }
} }
class X11Screen internal class X11Screen
{ {
private const int FullHDWidth = 1920; private const int FullHDWidth = 1920;
private const int FullHDHeight = 1080; private const int FullHDHeight = 1080;

9
src/Avalonia.X11/X11Structs.cs

@ -1751,8 +1751,7 @@ namespace Avalonia.X11 {
{ {
public IntPtr client_data; public IntPtr client_data;
public XIMProc callback; public XIMProc callback;
[NonSerialized] [NonSerialized] private GCHandle gch;
GCHandle gch;
public XIMCallback (IntPtr clientData, XIMProc proc) public XIMCallback (IntPtr clientData, XIMProc proc)
{ {
@ -1769,7 +1768,7 @@ namespace Avalonia.X11 {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
#pragma warning disable CA1815 // Override equals and operator equals on value types #pragma warning disable CA1815 // Override equals and operator equals on value types
public unsafe struct XImage internal unsafe struct XImage
#pragma warning restore CA1815 // Override equals and operator equals on value types #pragma warning restore CA1815 // Override equals and operator equals on value types
{ {
public int width, height; /* size of image */ public int width, height; /* size of image */
@ -1896,8 +1895,8 @@ namespace Avalonia.X11 {
public const string XNSpotLocation = "spotLocation"; public const string XNSpotLocation = "spotLocation";
public const string XNFontSet = "fontSet"; public const string XNFontSet = "fontSet";
} }
unsafe struct XRRMonitorInfo { internal unsafe struct XRRMonitorInfo {
public IntPtr Name; public IntPtr Name;
public int Primary; public int Primary;
public int Automatic; public int Automatic;

32
src/Avalonia.X11/X11Window.Ime.cs

@ -11,7 +11,7 @@ using static Avalonia.X11.XLib;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
partial class X11Window internal partial class X11Window
{ {
private ITextInputMethodImpl _ime; private ITextInputMethodImpl _ime;
private IX11InputMethodControl _imeControl; private IX11InputMethodControl _imeControl;
@ -20,7 +20,7 @@ namespace Avalonia.X11
private Queue<(RawKeyEventArgs args, XEvent xev, int keyval, int keycode)> _imeQueue = private Queue<(RawKeyEventArgs args, XEvent xev, int keyval, int keycode)> _imeQueue =
new Queue<(RawKeyEventArgs args, XEvent xev, int keyVal, int keyCode)>(); new Queue<(RawKeyEventArgs args, XEvent xev, int keyVal, int keyCode)>();
unsafe void CreateIC() private unsafe void CreateIC()
{ {
if (_x11.HasXim) if (_x11.HasXim)
{ {
@ -65,8 +65,8 @@ namespace Avalonia.X11
new IntPtr((int)(XIMProperties.XIMPreeditNothing | XIMProperties.XIMStatusNothing)), new IntPtr((int)(XIMProperties.XIMPreeditNothing | XIMProperties.XIMStatusNothing)),
XNames.XNClientWindow, _handle, XNames.XNFocusWindow, _handle, IntPtr.Zero); XNames.XNClientWindow, _handle, XNames.XNFocusWindow, _handle, IntPtr.Zero);
} }
void InitializeIme() private void InitializeIme()
{ {
var ime = AvaloniaLocator.Current.GetService<IX11InputMethodFactory>()?.CreateClient(_handle); var ime = AvaloniaLocator.Current.GetService<IX11InputMethodFactory>()?.CreateClient(_handle);
if (ime == null && _x11.HasXim) if (ime == null && _x11.HasXim)
@ -89,9 +89,9 @@ namespace Avalonia.X11
} }
} }
void UpdateImePosition() => _imeControl?.UpdateWindowInfo(Position, RenderScaling); private void UpdateImePosition() => _imeControl?.UpdateWindowInfo(Position, RenderScaling);
void HandleKeyEvent(ref XEvent ev) private void HandleKeyEvent(ref XEvent ev)
{ {
var index = ev.KeyEvent.state.HasAllFlags(XModifierMask.ShiftMask); var index = ev.KeyEvent.state.HasAllFlags(XModifierMask.ShiftMask);
@ -117,7 +117,7 @@ namespace Avalonia.X11
ScheduleKeyInput(args, ref ev, (int)key, ev.KeyEvent.keycode); ScheduleKeyInput(args, ref ev, (int)key, ev.KeyEvent.keycode);
} }
void TriggerClassicTextInputEvent(ref XEvent ev) private void TriggerClassicTextInputEvent(ref XEvent ev)
{ {
var text = TranslateEventToString(ref ev); var text = TranslateEventToString(ref ev);
if (text != null) if (text != null)
@ -128,8 +128,8 @@ namespace Avalonia.X11
private const int ImeBufferSize = 64 * 1024; private const int ImeBufferSize = 64 * 1024;
[ThreadStatic] private static IntPtr ImeBuffer; [ThreadStatic] private static IntPtr ImeBuffer;
unsafe string TranslateEventToString(ref XEvent ev) private unsafe string TranslateEventToString(ref XEvent ev)
{ {
if (ImeBuffer == IntPtr.Zero) if (ImeBuffer == IntPtr.Zero)
ImeBuffer = Marshal.AllocHGlobal(ImeBufferSize); ImeBuffer = Marshal.AllocHGlobal(ImeBufferSize);
@ -158,9 +158,9 @@ namespace Avalonia.X11
return text; return text;
} }
void ScheduleKeyInput(RawKeyEventArgs args, ref XEvent xev, int keyval, int keycode) private void ScheduleKeyInput(RawKeyEventArgs args, ref XEvent xev, int keyval, int keycode)
{ {
_x11.LastActivityTimestamp = xev.ButtonEvent.time; _x11.LastActivityTimestamp = xev.ButtonEvent.time;
@ -170,8 +170,8 @@ namespace Avalonia.X11
ScheduleInput(args); ScheduleInput(args);
} }
bool FilterIme(RawKeyEventArgs args, XEvent xev, int keyval, int keycode) private bool FilterIme(RawKeyEventArgs args, XEvent xev, int keyval, int keycode)
{ {
if (_ime == null) if (_ime == null)
return false; return false;
@ -182,7 +182,7 @@ namespace Avalonia.X11
return true; return true;
} }
async void ProcessNextImeEvent() private async void ProcessNextImeEvent()
{ {
if(_processingIme) if(_processingIme)
return; return;
@ -203,7 +203,7 @@ namespace Avalonia.X11
} }
// This class is used to attach the text value of the key to an asynchronously dispatched KeyDown event // This class is used to attach the text value of the key to an asynchronously dispatched KeyDown event
class RawKeyEventArgsWithText : RawKeyEventArgs private class RawKeyEventArgsWithText : RawKeyEventArgs
{ {
public RawKeyEventArgsWithText(IKeyboardDevice device, ulong timestamp, IInputRoot root, public RawKeyEventArgsWithText(IKeyboardDevice device, ulong timestamp, IInputRoot root,
RawKeyEventType type, Key key, RawInputModifiers modifiers, string text) : RawKeyEventType type, Key key, RawInputModifiers modifiers, string text) :

4
src/Avalonia.X11/X11Window.Xim.cs

@ -8,9 +8,9 @@ using Avalonia.Threading;
using static Avalonia.X11.XLib; using static Avalonia.X11.XLib;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
partial class X11Window internal partial class X11Window
{ {
class XimInputMethod : ITextInputMethodImpl, IX11InputMethodControl private class XimInputMethod : ITextInputMethodImpl, IX11InputMethodControl
{ {
private readonly X11Window _parent; private readonly X11Window _parent;
private bool _windowActive, _imeActive; private bool _windowActive, _imeActive;

46
src/Avalonia.X11/X11Window.cs

@ -27,7 +27,7 @@ using static Avalonia.X11.XLib;
// ReSharper disable StringLiteralTypo // ReSharper disable StringLiteralTypo
namespace Avalonia.X11 namespace Avalonia.X11
{ {
unsafe partial class X11Window : IWindowImpl, IPopupImpl, IXI2Client internal unsafe partial class X11Window : IWindowImpl, IPopupImpl, IXI2Client
{ {
private readonly AvaloniaX11Platform _platform; private readonly AvaloniaX11Platform _platform;
private readonly bool _popup; private readonly bool _popup;
@ -59,7 +59,7 @@ namespace Avalonia.X11
private bool _useRenderWindow = false; private bool _useRenderWindow = false;
private bool _usePositioningFlags = false; private bool _usePositioningFlags = false;
enum XSyncState private enum XSyncState
{ {
None, None,
WaitConfigure, WaitConfigure,
@ -219,7 +219,7 @@ namespace Avalonia.X11
}); });
} }
class SurfaceInfo : EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo private class SurfaceInfo : EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo
{ {
private readonly X11Window _window; private readonly X11Window _window;
private readonly IntPtr _display; private readonly IntPtr _display;
@ -249,7 +249,7 @@ namespace Avalonia.X11
public double Scaling => _window.RenderScaling; public double Scaling => _window.RenderScaling;
} }
void UpdateMotifHints() private void UpdateMotifHints()
{ {
var functions = MotifFunctions.Move | MotifFunctions.Close | MotifFunctions.Resize | var functions = MotifFunctions.Move | MotifFunctions.Close | MotifFunctions.Resize |
MotifFunctions.Minimize | MotifFunctions.Maximize; MotifFunctions.Minimize | MotifFunctions.Maximize;
@ -278,7 +278,7 @@ namespace Avalonia.X11
PropertyMode.Replace, ref hints, 5); PropertyMode.Replace, ref hints, 5);
} }
void UpdateSizeHints(PixelSize? preResize) private void UpdateSizeHints(PixelSize? preResize)
{ {
var min = _minMaxSize.minSize; var min = _minMaxSize.minSize;
var max = _minMaxSize.maxSize; var max = _minMaxSize.maxSize;
@ -386,7 +386,7 @@ namespace Avalonia.X11
public IRenderer CreateRenderer(IRenderRoot root) => public IRenderer CreateRenderer(IRenderRoot root) =>
new CompositingRenderer(root, _platform.Compositor, () => Surfaces); new CompositingRenderer(root, _platform.Compositor, () => Surfaces);
void OnEvent(ref XEvent ev) private void OnEvent(ref XEvent ev)
{ {
if (ev.type == XEventName.MapNotify) if (ev.type == XEventName.MapNotify)
{ {
@ -668,7 +668,7 @@ namespace Avalonia.X11
} }
static RawInputModifiers TranslateModifiers(XModifierMask state) private static RawInputModifiers TranslateModifiers(XModifierMask state)
{ {
var rv = default(RawInputModifiers); var rv = default(RawInputModifiers);
if (state.HasAllFlags(XModifierMask.Button1Mask)) if (state.HasAllFlags(XModifierMask.Button1Mask))
@ -704,13 +704,13 @@ namespace Avalonia.X11
private double _scaling = 1; private double _scaling = 1;
void ScheduleInput(RawInputEventArgs args, ref XEvent xev) private void ScheduleInput(RawInputEventArgs args, ref XEvent xev)
{ {
_x11.LastActivityTimestamp = xev.ButtonEvent.time; _x11.LastActivityTimestamp = xev.ButtonEvent.time;
ScheduleInput(args); ScheduleInput(args);
} }
void DispatchInput(RawInputEventArgs args) private void DispatchInput(RawInputEventArgs args)
{ {
Input?.Invoke(args); Input?.Invoke(args);
if (!args.Handled && args is RawKeyEventArgsWithText text && !string.IsNullOrEmpty(text.Text)) if (!args.Handled && args is RawKeyEventArgsWithText text && !string.IsNullOrEmpty(text.Text))
@ -746,8 +746,8 @@ namespace Avalonia.X11
_rawEventGrouper.HandleEvent(args); _rawEventGrouper.HandleEvent(args);
} }
void MouseEvent(RawPointerEventType type, ref XEvent ev, XModifierMask mods) private void MouseEvent(RawPointerEventType type, ref XEvent ev, XModifierMask mods)
{ {
var mev = new RawPointerEventArgs( var mev = new RawPointerEventArgs(
_mouse, (ulong)ev.ButtonEvent.time.ToInt64(), _inputRoot, _mouse, (ulong)ev.ButtonEvent.time.ToInt64(), _inputRoot,
@ -755,7 +755,7 @@ namespace Avalonia.X11
ScheduleInput(mev, ref ev); ScheduleInput(mev, ref ev);
} }
void EnqueuePaint() private void EnqueuePaint()
{ {
if (!_triggeredExpose) if (!_triggeredExpose)
{ {
@ -767,8 +767,8 @@ namespace Avalonia.X11
}, DispatcherPriority.Render); }, DispatcherPriority.Render);
} }
} }
void DoPaint() private void DoPaint()
{ {
Paint?.Invoke(new Rect()); Paint?.Invoke(new Rect());
if (_xSyncCounter != IntPtr.Zero && _xSyncState == XSyncState.WaitPaint) if (_xSyncCounter != IntPtr.Zero && _xSyncState == XSyncState.WaitPaint)
@ -819,8 +819,8 @@ namespace Avalonia.X11
return null; return null;
} }
void Cleanup() private void Cleanup()
{ {
if (_rawEventGrouper != null) if (_rawEventGrouper != null)
{ {
@ -871,7 +871,7 @@ namespace Avalonia.X11
} }
} }
bool ActivateTransientChildIfNeeded() private bool ActivateTransientChildIfNeeded()
{ {
if (_disabled) if (_disabled)
{ {
@ -923,9 +923,9 @@ namespace Avalonia.X11
Resize(size, true, PlatformResizeReason.Layout); Resize(size, true, PlatformResizeReason.Layout);
} }
PixelSize ToPixelSize(Size size) => new PixelSize((int)(size.Width * RenderScaling), (int)(size.Height * RenderScaling)); private PixelSize ToPixelSize(Size size) => new PixelSize((int)(size.Width * RenderScaling), (int)(size.Height * RenderScaling));
void Resize(Size clientSize, bool force, PlatformResizeReason reason) private void Resize(Size clientSize, bool force, PlatformResizeReason reason)
{ {
if (!force && clientSize == ClientSize) if (!force && clientSize == ClientSize)
return; return;
@ -1020,7 +1020,7 @@ namespace Avalonia.X11
.OrderByDescending(x => x.Width + x.Height).FirstOrDefault(); .OrderByDescending(x => x.Width + x.Height).FirstOrDefault();
void SendNetWMMessage(IntPtr message_type, IntPtr l0, private void SendNetWMMessage(IntPtr message_type, IntPtr l0,
IntPtr? l1 = null, IntPtr? l2 = null, IntPtr? l3 = null, IntPtr? l4 = null) IntPtr? l1 = null, IntPtr? l2 = null, IntPtr? l3 = null, IntPtr? l4 = null)
{ {
var xev = new XEvent var xev = new XEvent
@ -1044,7 +1044,7 @@ namespace Avalonia.X11
} }
void BeginMoveResize(NetWmMoveResize side, PointerPressedEventArgs e) private void BeginMoveResize(NetWmMoveResize side, PointerPressedEventArgs e)
{ {
var pos = GetCursorPos(_x11); var pos = GetCursorPos(_x11);
XUngrabPointer(_x11.Display, new IntPtr(0)); XUngrabPointer(_x11.Display, new IntPtr(0));
@ -1184,7 +1184,7 @@ namespace Avalonia.X11
ChangeWMAtoms(!value, _x11.Atoms._NET_WM_STATE_SKIP_TASKBAR); ChangeWMAtoms(!value, _x11.Atoms._NET_WM_STATE_SKIP_TASKBAR);
} }
void ChangeWMAtoms(bool enable, params IntPtr[] atoms) private void ChangeWMAtoms(bool enable, params IntPtr[] atoms)
{ {
if (atoms.Length != 1 && atoms.Length != 2) if (atoms.Length != 1 && atoms.Length != 2)
throw new ArgumentException(); throw new ArgumentException();

5
src/Avalonia.X11/XError.cs

@ -2,11 +2,12 @@ using System;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
static class XError internal static class XError
{ {
private static readonly XErrorHandler s_errorHandlerDelegate = Handler; private static readonly XErrorHandler s_errorHandlerDelegate = Handler;
public static XErrorEvent LastError; public static XErrorEvent LastError;
static int Handler(IntPtr display, ref XErrorEvent error)
private static int Handler(IntPtr display, ref XErrorEvent error)
{ {
LastError = error; LastError = error;
return 0; return 0;

16
src/Avalonia.X11/XI2Manager.cs

@ -7,7 +7,7 @@ using static Avalonia.X11.XLib;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
unsafe class XI2Manager internal unsafe class XI2Manager
{ {
private static readonly XiEventType[] DefaultEventTypes = new XiEventType[] private static readonly XiEventType[] DefaultEventTypes = new XiEventType[]
{ {
@ -30,7 +30,7 @@ namespace Avalonia.X11
private bool _multitouch; private bool _multitouch;
private Dictionary<IntPtr, IXI2Client> _clients = new Dictionary<IntPtr, IXI2Client>(); private Dictionary<IntPtr, IXI2Client> _clients = new Dictionary<IntPtr, IXI2Client>();
class DeviceInfo private class DeviceInfo
{ {
public int Id { get; } public int Id { get; }
public XIValuatorClassInfo[] Valuators { get; private set; } public XIValuatorClassInfo[] Valuators { get; private set; }
@ -67,7 +67,7 @@ namespace Avalonia.X11
} }
} }
class PointerDeviceInfo : DeviceInfo private class PointerDeviceInfo : DeviceInfo
{ {
public PointerDeviceInfo(XIDeviceInfo info) : base(info) public PointerDeviceInfo(XIDeviceInfo info) : base(info)
{ {
@ -197,7 +197,7 @@ namespace Avalonia.X11
} }
} }
void OnEnterLeaveEvent(IXI2Client client, ref XIEnterLeaveEvent ev) private void OnEnterLeaveEvent(IXI2Client client, ref XIEnterLeaveEvent ev)
{ {
if (ev.evtype == XiEventType.XI_Leave) if (ev.evtype == XiEventType.XI_Leave)
{ {
@ -215,7 +215,7 @@ namespace Avalonia.X11
} }
} }
void OnDeviceEvent(IXI2Client client, ParsedDeviceEvent ev) private void OnDeviceEvent(IXI2Client client, ParsedDeviceEvent ev)
{ {
if (ev.Type == XiEventType.XI_TouchBegin if (ev.Type == XiEventType.XI_TouchBegin
|| ev.Type == XiEventType.XI_TouchUpdate || ev.Type == XiEventType.XI_TouchUpdate
@ -304,7 +304,7 @@ namespace Avalonia.X11
} }
} }
unsafe class ParsedDeviceEvent internal unsafe class ParsedDeviceEvent
{ {
public XiEventType Type { get; } public XiEventType Type { get; }
public RawInputModifiers Modifiers { get; } public RawInputModifiers Modifiers { get; }
@ -367,8 +367,8 @@ namespace Avalonia.X11
Emulated = ev->flags.HasAllFlags(XiDeviceEventFlags.XIPointerEmulated); Emulated = ev->flags.HasAllFlags(XiDeviceEventFlags.XIPointerEmulated);
} }
} }
interface IXI2Client internal interface IXI2Client
{ {
IInputRoot InputRoot { get; } IInputRoot InputRoot { get; }
void ScheduleXI2Input(RawInputEventArgs args); void ScheduleXI2Input(RawInputEventArgs args);

54
src/Avalonia.X11/XIStructs.cs

@ -10,7 +10,7 @@ using Atom = System.IntPtr;
namespace Avalonia.X11 namespace Avalonia.X11
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct XIAddMasterInfo internal struct XIAddMasterInfo
{ {
public int Type; public int Type;
public IntPtr Name; public IntPtr Name;
@ -19,7 +19,7 @@ namespace Avalonia.X11
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct XIRemoveMasterInfo internal struct XIRemoveMasterInfo
{ {
public int Type; public int Type;
public int Deviceid; public int Deviceid;
@ -29,7 +29,7 @@ namespace Avalonia.X11
}; };
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct XIAttachSlaveInfo internal struct XIAttachSlaveInfo
{ {
public int Type; public int Type;
public int Deviceid; public int Deviceid;
@ -37,14 +37,14 @@ namespace Avalonia.X11
}; };
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct XIDetachSlaveInfo internal struct XIDetachSlaveInfo
{ {
public int Type; public int Type;
public int Deviceid; public int Deviceid;
}; };
[StructLayout(LayoutKind.Explicit)] [StructLayout(LayoutKind.Explicit)]
struct XIAnyHierarchyChangeInfo internal struct XIAnyHierarchyChangeInfo
{ {
[FieldOffset(0)] [FieldOffset(0)]
public int type; /* must be first element */ public int type; /* must be first element */
@ -59,7 +59,7 @@ namespace Avalonia.X11
}; };
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct XIModifierState internal struct XIModifierState
{ {
public int Base; public int Base;
public int Latched; public int Latched;
@ -68,14 +68,14 @@ namespace Avalonia.X11
}; };
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
unsafe struct XIButtonState internal unsafe struct XIButtonState
{ {
public int MaskLen; public int MaskLen;
public byte* Mask; public byte* Mask;
}; };
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
unsafe struct XIValuatorState internal unsafe struct XIValuatorState
{ {
public int MaskLen; public int MaskLen;
public byte* Mask; public byte* Mask;
@ -83,7 +83,7 @@ namespace Avalonia.X11
}; };
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
unsafe struct XIEventMask internal unsafe struct XIEventMask
{ {
public int Deviceid; public int Deviceid;
public int MaskLen; public int MaskLen;
@ -91,14 +91,14 @@ namespace Avalonia.X11
}; };
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct XIAnyClassInfo internal struct XIAnyClassInfo
{ {
public XiDeviceClass Type; public XiDeviceClass Type;
public int Sourceid; public int Sourceid;
}; };
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
unsafe struct XIButtonClassInfo internal unsafe struct XIButtonClassInfo
{ {
public int Type; public int Type;
public int Sourceid; public int Sourceid;
@ -108,7 +108,7 @@ namespace Avalonia.X11
}; };
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
unsafe struct XIKeyClassInfo internal unsafe struct XIKeyClassInfo
{ {
public int Type; public int Type;
public int Sourceid; public int Sourceid;
@ -117,7 +117,7 @@ namespace Avalonia.X11
}; };
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct XIValuatorClassInfo internal struct XIValuatorClassInfo
{ {
public int Type; public int Type;
public int Sourceid; public int Sourceid;
@ -132,7 +132,7 @@ namespace Avalonia.X11
/* new in XI 2.1 */ /* new in XI 2.1 */
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct XIScrollClassInfo internal struct XIScrollClassInfo
{ {
public int Type; public int Type;
public int Sourceid; public int Sourceid;
@ -142,14 +142,14 @@ namespace Avalonia.X11
public int Flags; public int Flags;
}; };
enum XiScrollType internal enum XiScrollType
{ {
Vertical = 1, Vertical = 1,
Horizontal = 2 Horizontal = 2
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct XITouchClassInfo internal struct XITouchClassInfo
{ {
public int Type; public int Type;
public int Sourceid; public int Sourceid;
@ -158,7 +158,7 @@ namespace Avalonia.X11
}; };
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
unsafe struct XIDeviceInfo internal unsafe struct XIDeviceInfo
{ {
public int Deviceid; public int Deviceid;
public IntPtr Name; public IntPtr Name;
@ -169,7 +169,7 @@ namespace Avalonia.X11
public XIAnyClassInfo** Classes; public XIAnyClassInfo** Classes;
} }
enum XiDeviceType internal enum XiDeviceType
{ {
XIMasterPointer = 1, XIMasterPointer = 1,
XIMasterKeyboard = 2, XIMasterKeyboard = 2,
@ -178,13 +178,13 @@ namespace Avalonia.X11
XIFloatingSlave = 5 XIFloatingSlave = 5
} }
enum XiPredefinedDeviceId : int internal enum XiPredefinedDeviceId : int
{ {
XIAllDevices = 0, XIAllDevices = 0,
XIAllMasterDevices = 1 XIAllMasterDevices = 1
} }
enum XiDeviceClass internal enum XiDeviceClass
{ {
XIKeyClass = 0, XIKeyClass = 0,
XIButtonClass = 1, XIButtonClass = 1,
@ -194,7 +194,7 @@ namespace Avalonia.X11
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
unsafe struct XIDeviceChangedEvent internal unsafe struct XIDeviceChangedEvent
{ {
public int Type; /* GenericEvent */ public int Type; /* GenericEvent */
public UIntPtr Serial; /* # of last request processed by server */ public UIntPtr Serial; /* # of last request processed by server */
@ -211,7 +211,7 @@ namespace Avalonia.X11
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct XIDeviceEvent internal struct XIDeviceEvent
{ {
public XEventName type; /* GenericEvent */ public XEventName type; /* GenericEvent */
public UIntPtr serial; /* # of last request processed by server */ public UIntPtr serial; /* # of last request processed by server */
@ -238,7 +238,7 @@ namespace Avalonia.X11
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
unsafe struct XIEnterLeaveEvent internal unsafe struct XIEnterLeaveEvent
{ {
public XEventName type; /* GenericEvent */ public XEventName type; /* GenericEvent */
public UIntPtr serial; /* # of last request processed by server */ public UIntPtr serial; /* # of last request processed by server */
@ -266,14 +266,14 @@ namespace Avalonia.X11
} }
[Flags] [Flags]
public enum XiDeviceEventFlags : int internal enum XiDeviceEventFlags : int
{ {
None = 0, None = 0,
XIPointerEmulated = (1 << 16) XIPointerEmulated = (1 << 16)
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
unsafe struct XIEvent internal unsafe struct XIEvent
{ {
public int type; /* GenericEvent */ public int type; /* GenericEvent */
public UIntPtr serial; /* # of last request processed by server */ public UIntPtr serial; /* # of last request processed by server */
@ -284,7 +284,7 @@ namespace Avalonia.X11
public IntPtr time; public IntPtr time;
} }
enum XiEventType internal enum XiEventType
{ {
XI_DeviceChanged = 1, XI_DeviceChanged = 1,
XI_KeyPress = 2, XI_KeyPress = 2,
@ -315,7 +315,7 @@ namespace Avalonia.X11
XI_LASTEVENT = XI_BarrierLeave, XI_LASTEVENT = XI_BarrierLeave,
} }
enum XiEnterLeaveDetail internal enum XiEnterLeaveDetail
{ {
XINotifyAncestor = 0, XINotifyAncestor = 0,
XINotifyVirtual = 1, XINotifyVirtual = 1,

10
src/Avalonia.X11/XLib.cs

@ -16,11 +16,11 @@ namespace Avalonia.X11
{ {
internal unsafe static class XLib internal unsafe static class XLib
{ {
const string libX11 = "libX11.so.6"; private const string libX11 = "libX11.so.6";
const string libX11Randr = "libXrandr.so.2"; private const string libX11Randr = "libXrandr.so.2";
const string libX11Ext = "libXext.so.6"; private const string libX11Ext = "libXext.so.6";
const string libXInput = "libXi.so.6"; private const string libXInput = "libXi.so.6";
const string libXCursor = "libXcursor.so.1"; private const string libXCursor = "libXcursor.so.1";
[DllImport(libX11)] [DllImport(libX11)]
public static extern IntPtr XOpenDisplay(IntPtr display); public static extern IntPtr XOpenDisplay(IntPtr display);

2
src/Browser/Avalonia.Browser/Skia/BrowserSkiaGpu.cs

@ -6,7 +6,7 @@ using Avalonia.Reactive;
namespace Avalonia.Browser.Skia namespace Avalonia.Browser.Skia
{ {
public class BrowserSkiaGpu : ISkiaGpu internal class BrowserSkiaGpu : ISkiaGpu
{ {
public ISkiaGpuRenderTarget? TryCreateRenderTarget(IEnumerable<object> surfaces) public ISkiaGpuRenderTarget? TryCreateRenderTarget(IEnumerable<object> surfaces)
{ {

4
src/Shared/RawEventGrouping.cs

@ -17,8 +17,8 @@ internal class RawEventGrouper : IDisposable
private readonly Action<RawInputEventArgs> _eventCallback; private readonly Action<RawInputEventArgs> _eventCallback;
private readonly Queue<RawInputEventArgs> _inputQueue = new(); private readonly Queue<RawInputEventArgs> _inputQueue = new();
private readonly Action _dispatchFromQueue; private readonly Action _dispatchFromQueue;
readonly Dictionary<long, RawPointerEventArgs> _lastTouchPoints = new(); private readonly Dictionary<long, RawPointerEventArgs> _lastTouchPoints = new();
RawInputEventArgs? _lastEvent; private RawInputEventArgs? _lastEvent;
public RawEventGrouper(Action<RawInputEventArgs> eventCallback) public RawEventGrouper(Action<RawInputEventArgs> eventCallback)
{ {

5
src/Skia/Avalonia.Skia/GlyphRunImpl.cs

@ -1,15 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Avalonia.Metadata;
using Avalonia.Platform; using Avalonia.Platform;
using SkiaSharp; using SkiaSharp;
#nullable enable #nullable enable
namespace Avalonia.Skia namespace Avalonia.Skia
{ {
/// <inheritdoc /> internal class GlyphRunImpl : IGlyphRunImpl
[Unstable]
public class GlyphRunImpl : IGlyphRunImpl
{ {
public GlyphRunImpl(SKTextBlob textBlob, Size size, Point baselineOrigin) public GlyphRunImpl(SKTextBlob textBlob, Size size, Point baselineOrigin)
{ {

4
src/Skia/Avalonia.Skia/GlyphTypefaceImpl.cs

@ -1,14 +1,12 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Metadata;
using HarfBuzzSharp; using HarfBuzzSharp;
using SkiaSharp; using SkiaSharp;
namespace Avalonia.Skia namespace Avalonia.Skia
{ {
[Unstable] internal class GlyphTypefaceImpl : IGlyphTypeface
public class GlyphTypefaceImpl : IGlyphTypeface
{ {
private bool _isDisposed; private bool _isDisposed;

2
src/Skia/Avalonia.Skia/SKTypefaceCollection.cs

@ -4,7 +4,7 @@ using SkiaSharp;
namespace Avalonia.Skia namespace Avalonia.Skia
{ {
public class SKTypefaceCollection internal class SKTypefaceCollection
{ {
private readonly ConcurrentDictionary<Typeface, SKTypeface> _typefaces = private readonly ConcurrentDictionary<Typeface, SKTypeface> _typefaces =
new ConcurrentDictionary<Typeface, SKTypeface>(); new ConcurrentDictionary<Typeface, SKTypeface>();

2
src/Skia/Avalonia.Skia/SKTypefaceCollectionCache.cs

@ -7,7 +7,7 @@ using SkiaSharp;
namespace Avalonia.Skia namespace Avalonia.Skia
{ {
public static class SKTypefaceCollectionCache internal static class SKTypefaceCollectionCache
{ {
private static readonly ConcurrentDictionary<FontFamily, SKTypefaceCollection> s_cachedCollections; private static readonly ConcurrentDictionary<FontFamily, SKTypefaceCollection> s_cachedCollections;

22
src/Skia/Avalonia.Skia/readme.md

@ -1,22 +0,0 @@
DrawingContextImpl
- Alpha support missing as SkiaSharp does not expose this
- Gradient Shader caching?
- Pen Dash styles
Formatted Text Rendering
- Minor polish
Linux
- Need gpu platform implementation
macOS
- Need gpu platform implementation
Android
- Not tested at all yet
iOS
- Not tested at all yet
General
- Get Skia Unit Tests passing (most of the issues are related to antialiasing)

6
src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj

@ -5,11 +5,6 @@
<PackageId>Avalonia.Direct2D1</PackageId> <PackageId>Avalonia.Direct2D1</PackageId>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Include="..\Avalonia.Win32\Interop\UnmanagedMethods.cs">
<Link>UnmanagedMethods.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\packages\Avalonia\Avalonia.csproj" /> <ProjectReference Include="..\..\..\packages\Avalonia\Avalonia.csproj" />
<ProjectReference Include="..\Avalonia.Win32\Avalonia.Win32.csproj" /> <ProjectReference Include="..\Avalonia.Win32\Avalonia.Win32.csproj" />
@ -22,6 +17,7 @@
<ItemGroup Label="InternalsVisibleTo"> <ItemGroup Label="InternalsVisibleTo">
<InternalsVisibleTo Include="Avalonia.Direct2D1.RenderTests, PublicKey=$(AvaloniaPublicKey)" /> <InternalsVisibleTo Include="Avalonia.Direct2D1.RenderTests, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.Direct2D1.UnitTests, PublicKey=$(AvaloniaPublicKey)" /> <InternalsVisibleTo Include="Avalonia.Direct2D1.UnitTests, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.Win32.Interop, PublicKey=$(AvaloniaPublicKey)"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs

@ -27,7 +27,7 @@ namespace Avalonia
namespace Avalonia.Direct2D1 namespace Avalonia.Direct2D1
{ {
public class Direct2D1Platform : IPlatformRenderInterface internal class Direct2D1Platform : IPlatformRenderInterface
{ {
private static readonly Direct2D1Platform s_instance = new Direct2D1Platform(); private static readonly Direct2D1Platform s_instance = new Direct2D1Platform();

33
src/Windows/Avalonia.Direct2D1/Disposable.cs

@ -1,33 +0,0 @@
using System;
namespace Avalonia.Direct2D1
{
public class Disposable<T> : IDisposable where T : IDisposable
{
private readonly IDisposable _extra;
public Disposable(T inner)
{
Inner = inner;
}
public Disposable(T inner, IDisposable extra)
{
Inner = inner;
_extra = extra;
}
public T Inner { get; }
public static implicit operator T(Disposable<T> i)
{
return i.Inner;
}
public void Dispose()
{
Inner.Dispose();
_extra?.Dispose();
}
}
}

2
src/Windows/Avalonia.Direct2D1/ILayerFactory.cs

@ -2,7 +2,7 @@
namespace Avalonia.Direct2D1 namespace Avalonia.Direct2D1
{ {
public interface ILayerFactory internal interface ILayerFactory
{ {
IDrawingContextLayerImpl CreateLayer(Size size); IDrawingContextLayerImpl CreateLayer(Size size);
} }

4
src/Windows/Avalonia.Direct2D1/Media/BrushImpl.cs

@ -1,10 +1,8 @@
using System; using System;
using Avalonia.Metadata;
namespace Avalonia.Direct2D1.Media namespace Avalonia.Direct2D1.Media
{ {
[Unstable] internal abstract class BrushImpl : IDisposable
public abstract class BrushImpl : IDisposable
{ {
public SharpDX.Direct2D1.Brush PlatformBrush { get; set; } public SharpDX.Direct2D1.Brush PlatformBrush { get; set; }

4
src/Windows/Avalonia.Direct2D1/Media/DWriteResourceFontFileEnumerator.cs

@ -6,7 +6,7 @@ namespace Avalonia.Direct2D1.Media
/// <summary> /// <summary>
/// Resource FontFileEnumerator. /// Resource FontFileEnumerator.
/// </summary> /// </summary>
public class DWriteResourceFontFileEnumerator : CallbackBase, FontFileEnumerator internal class DWriteResourceFontFileEnumerator : CallbackBase, FontFileEnumerator
{ {
private readonly Factory _factory; private readonly Factory _factory;
private readonly FontFileLoader _loader; private readonly FontFileLoader _loader;
@ -64,4 +64,4 @@ namespace Avalonia.Direct2D1.Media
} }
} }
} }
} }

2
src/Windows/Avalonia.Direct2D1/Media/DWriteResourceFontFileStream.cs

@ -7,7 +7,7 @@ namespace Avalonia.Direct2D1.Media
/// <summary> /// <summary>
/// This FontFileStream implementation is reading data from a <see cref="DataStream"/>. /// This FontFileStream implementation is reading data from a <see cref="DataStream"/>.
/// </summary> /// </summary>
public class DWriteResourceFontFileStream : CallbackBase, FontFileStream internal class DWriteResourceFontFileStream : CallbackBase, FontFileStream
{ {
private readonly DataStream _stream; private readonly DataStream _stream;

4
src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs

@ -11,15 +11,13 @@ using SharpDX;
using SharpDX.Direct2D1; using SharpDX.Direct2D1;
using SharpDX.Mathematics.Interop; using SharpDX.Mathematics.Interop;
using BitmapInterpolationMode = Avalonia.Media.Imaging.BitmapInterpolationMode; using BitmapInterpolationMode = Avalonia.Media.Imaging.BitmapInterpolationMode;
using Avalonia.Metadata;
namespace Avalonia.Direct2D1.Media namespace Avalonia.Direct2D1.Media
{ {
/// <summary> /// <summary>
/// Draws using Direct2D1. /// Draws using Direct2D1.
/// </summary> /// </summary>
[Unstable] internal class DrawingContextImpl : IDrawingContextImpl
public class DrawingContextImpl : IDrawingContextImpl
{ {
private readonly IVisualBrushRenderer _visualBrushRenderer; private readonly IVisualBrushRenderer _visualBrushRenderer;
private readonly ILayerFactory _layerFactory; private readonly ILayerFactory _layerFactory;

4
src/Windows/Avalonia.Direct2D1/Media/GeometryImpl.cs

@ -1,5 +1,4 @@
using Avalonia.Logging; using Avalonia.Logging;
using Avalonia.Metadata;
using Avalonia.Platform; using Avalonia.Platform;
using SharpDX.Direct2D1; using SharpDX.Direct2D1;
@ -8,8 +7,7 @@ namespace Avalonia.Direct2D1.Media
/// <summary> /// <summary>
/// The platform-specific interface for <see cref="Avalonia.Media.Geometry"/>. /// The platform-specific interface for <see cref="Avalonia.Media.Geometry"/>.
/// </summary> /// </summary>
[Unstable] internal abstract class GeometryImpl : IGeometryImpl
public abstract class GeometryImpl : IGeometryImpl
{ {
private const float ContourApproximation = 0.0001f; private const float ContourApproximation = 0.0001f;

4
src/Windows/Avalonia.Direct2D1/Media/GlyphTypefaceImpl.cs

@ -1,6 +1,5 @@
using System; using System;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Metadata;
using HarfBuzzSharp; using HarfBuzzSharp;
using SharpDX.DirectWrite; using SharpDX.DirectWrite;
using FontMetrics = Avalonia.Media.FontMetrics; using FontMetrics = Avalonia.Media.FontMetrics;
@ -9,8 +8,7 @@ using GlyphMetrics = Avalonia.Media.GlyphMetrics;
namespace Avalonia.Direct2D1.Media namespace Avalonia.Direct2D1.Media
{ {
[Unstable] internal class GlyphTypefaceImpl : IGlyphTypeface
public class GlyphTypefaceImpl : IGlyphTypeface
{ {
private bool _isDisposed; private bool _isDisposed;

4
src/Windows/Avalonia.Direct2D1/Media/ImageBrushImpl.cs

@ -1,13 +1,11 @@
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Metadata;
using Avalonia.Rendering.Utilities; using Avalonia.Rendering.Utilities;
using Avalonia.Utilities; using Avalonia.Utilities;
using SharpDX.Direct2D1; using SharpDX.Direct2D1;
namespace Avalonia.Direct2D1.Media namespace Avalonia.Direct2D1.Media
{ {
[Unstable] internal sealed class ImageBrushImpl : BrushImpl
public sealed class ImageBrushImpl : BrushImpl
{ {
private readonly OptionalDispose<Bitmap> _bitmap; private readonly OptionalDispose<Bitmap> _bitmap;

4
src/Windows/Avalonia.Direct2D1/Media/Imaging/BitmapImpl.cs

@ -1,13 +1,11 @@
using System; using System;
using System.IO; using System.IO;
using Avalonia.Metadata;
using Avalonia.Platform; using Avalonia.Platform;
using D2DBitmap = SharpDX.Direct2D1.Bitmap; using D2DBitmap = SharpDX.Direct2D1.Bitmap;
namespace Avalonia.Direct2D1.Media namespace Avalonia.Direct2D1.Media
{ {
[Unstable] internal abstract class BitmapImpl : IBitmapImpl, IDisposable
public abstract class BitmapImpl : IBitmapImpl, IDisposable
{ {
public abstract Vector Dpi { get; } public abstract Vector Dpi { get; }
public abstract PixelSize PixelSize { get; } public abstract PixelSize PixelSize { get; }

4
src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DBitmapImpl.cs

@ -1,6 +1,5 @@
using System; using System;
using System.IO; using System.IO;
using Avalonia.Metadata;
using SharpDX.WIC; using SharpDX.WIC;
using Bitmap = SharpDX.Direct2D1.Bitmap; using Bitmap = SharpDX.Direct2D1.Bitmap;
@ -9,8 +8,7 @@ namespace Avalonia.Direct2D1.Media
/// <summary> /// <summary>
/// A Direct2D Bitmap implementation that uses a GPU memory bitmap as its image. /// A Direct2D Bitmap implementation that uses a GPU memory bitmap as its image.
/// </summary> /// </summary>
[Unstable] internal class D2DBitmapImpl : BitmapImpl
public class D2DBitmapImpl : BitmapImpl
{ {
private readonly Bitmap _direct2DBitmap; private readonly Bitmap _direct2DBitmap;

4
src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DRenderTargetBitmapImpl.cs

@ -1,6 +1,5 @@
using System; using System;
using System.IO; using System.IO;
using Avalonia.Metadata;
using Avalonia.Platform; using Avalonia.Platform;
using Avalonia.Rendering; using Avalonia.Rendering;
using Avalonia.Utilities; using Avalonia.Utilities;
@ -10,8 +9,7 @@ using D2DBitmap = SharpDX.Direct2D1.Bitmap;
namespace Avalonia.Direct2D1.Media.Imaging namespace Avalonia.Direct2D1.Media.Imaging
{ {
[Unstable] internal class D2DRenderTargetBitmapImpl : D2DBitmapImpl, IDrawingContextLayerImpl, ILayerFactory
public class D2DRenderTargetBitmapImpl : D2DBitmapImpl, IDrawingContextLayerImpl, ILayerFactory
{ {
private readonly BitmapRenderTarget _renderTarget; private readonly BitmapRenderTarget _renderTarget;

4
src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs

@ -6,7 +6,6 @@ using SharpDX.WIC;
using APixelFormat = Avalonia.Platform.PixelFormat; using APixelFormat = Avalonia.Platform.PixelFormat;
using AlphaFormat = Avalonia.Platform.AlphaFormat; using AlphaFormat = Avalonia.Platform.AlphaFormat;
using D2DBitmap = SharpDX.Direct2D1.Bitmap; using D2DBitmap = SharpDX.Direct2D1.Bitmap;
using Avalonia.Metadata;
using Avalonia.Platform; using Avalonia.Platform;
using PixelFormat = SharpDX.WIC.PixelFormat; using PixelFormat = SharpDX.WIC.PixelFormat;
@ -15,8 +14,7 @@ namespace Avalonia.Direct2D1.Media
/// <summary> /// <summary>
/// A WIC implementation of a <see cref="Avalonia.Media.Imaging.Bitmap"/>. /// A WIC implementation of a <see cref="Avalonia.Media.Imaging.Bitmap"/>.
/// </summary> /// </summary>
[Unstable] internal class WicBitmapImpl : BitmapImpl, IReadableBitmapImpl
public class WicBitmapImpl : BitmapImpl, IReadableBitmapImpl
{ {
private readonly BitmapDecoder _decoder; private readonly BitmapDecoder _decoder;

4
src/Windows/Avalonia.Direct2D1/Media/Imaging/WicRenderTargetBitmapImpl.cs

@ -1,13 +1,11 @@
using System; using System;
using Avalonia.Metadata;
using Avalonia.Platform; using Avalonia.Platform;
using Avalonia.Rendering; using Avalonia.Rendering;
using SharpDX.Direct2D1; using SharpDX.Direct2D1;
namespace Avalonia.Direct2D1.Media namespace Avalonia.Direct2D1.Media
{ {
[Unstable] internal class WicRenderTargetBitmapImpl : WicBitmapImpl, IDrawingContextLayerImpl
public class WicRenderTargetBitmapImpl : WicBitmapImpl, IDrawingContextLayerImpl
{ {
private readonly WicRenderTarget _renderTarget; private readonly WicRenderTarget _renderTarget;

2
src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs

@ -6,7 +6,7 @@ using PixelFormat = Avalonia.Platform.PixelFormat;
namespace Avalonia.Direct2D1.Media.Imaging namespace Avalonia.Direct2D1.Media.Imaging
{ {
class WriteableWicBitmapImpl : WicBitmapImpl, IWriteableBitmapImpl internal class WriteableWicBitmapImpl : WicBitmapImpl, IWriteableBitmapImpl
{ {
public WriteableWicBitmapImpl(Stream stream, int decodeSize, bool horizontal, public WriteableWicBitmapImpl(Stream stream, int decodeSize, bool horizontal,
Avalonia.Media.Imaging.BitmapInterpolationMode interpolationMode) Avalonia.Media.Imaging.BitmapInterpolationMode interpolationMode)

4
src/Windows/Avalonia.Direct2D1/Media/LinearGradientBrushImpl.cs

@ -1,11 +1,9 @@
using System.Linq; using System.Linq;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Metadata;
namespace Avalonia.Direct2D1.Media namespace Avalonia.Direct2D1.Media
{ {
[Unstable] internal class LinearGradientBrushImpl : BrushImpl
public class LinearGradientBrushImpl : BrushImpl
{ {
public LinearGradientBrushImpl( public LinearGradientBrushImpl(
ILinearGradientBrush brush, ILinearGradientBrush brush,

4
src/Windows/Avalonia.Direct2D1/Media/RadialGradientBrushImpl.cs

@ -1,11 +1,9 @@
using System.Linq; using System.Linq;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Metadata;
namespace Avalonia.Direct2D1.Media namespace Avalonia.Direct2D1.Media
{ {
[Unstable] internal class RadialGradientBrushImpl : BrushImpl
public class RadialGradientBrushImpl : BrushImpl
{ {
public RadialGradientBrushImpl( public RadialGradientBrushImpl(
IRadialGradientBrush brush, IRadialGradientBrush brush,

4
src/Windows/Avalonia.Direct2D1/Media/SolidColorBrushImpl.cs

@ -1,10 +1,8 @@
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Metadata;
namespace Avalonia.Direct2D1.Media namespace Avalonia.Direct2D1.Media
{ {
[Unstable] internal class SolidColorBrushImpl : BrushImpl
public class SolidColorBrushImpl : BrushImpl
{ {
public SolidColorBrushImpl(ISolidColorBrush brush, SharpDX.Direct2D1.RenderTarget target) public SolidColorBrushImpl(ISolidColorBrush brush, SharpDX.Direct2D1.RenderTarget target)
{ {

3
src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs

@ -9,8 +9,7 @@ using SweepDirection = SharpDX.Direct2D1.SweepDirection;
namespace Avalonia.Direct2D1.Media namespace Avalonia.Direct2D1.Media
{ {
[Unstable] internal class StreamGeometryContextImpl : IStreamGeometryContextImpl
public class StreamGeometryContextImpl : IStreamGeometryContextImpl
{ {
private readonly GeometrySink _sink; private readonly GeometrySink _sink;

4
src/Windows/Avalonia.Direct2D1/Media/StreamGeometryImpl.cs

@ -1,4 +1,3 @@
using Avalonia.Metadata;
using Avalonia.Platform; using Avalonia.Platform;
using SharpDX.Direct2D1; using SharpDX.Direct2D1;
@ -7,8 +6,7 @@ namespace Avalonia.Direct2D1.Media
/// <summary> /// <summary>
/// A Direct2D implementation of a <see cref="Avalonia.Media.StreamGeometry"/>. /// A Direct2D implementation of a <see cref="Avalonia.Media.StreamGeometry"/>.
/// </summary> /// </summary>
[Unstable] internal class StreamGeometryImpl : GeometryImpl, IStreamGeometryImpl
public class StreamGeometryImpl : GeometryImpl, IStreamGeometryImpl
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="StreamGeometryImpl"/> class. /// Initializes a new instance of the <see cref="StreamGeometryImpl"/> class.

4
src/Windows/Avalonia.Direct2D1/Media/TransformedGeometryImpl.cs

@ -1,11 +1,9 @@
using Avalonia.Metadata;
using Avalonia.Platform; using Avalonia.Platform;
using SharpDX.Direct2D1; using SharpDX.Direct2D1;
namespace Avalonia.Direct2D1.Media namespace Avalonia.Direct2D1.Media
{ {
[Unstable] internal class TransformedGeometryImpl : GeometryImpl, ITransformedGeometryImpl
public class TransformedGeometryImpl : GeometryImpl, ITransformedGeometryImpl
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="StreamGeometryImpl"/> class. /// Initializes a new instance of the <see cref="StreamGeometryImpl"/> class.

2
src/Windows/Avalonia.Direct2D1/OptionalDispose.cs

@ -2,7 +2,7 @@
namespace Avalonia.Direct2D1 namespace Avalonia.Direct2D1
{ {
public readonly record struct OptionalDispose<T> : IDisposable where T : IDisposable internal readonly record struct OptionalDispose<T> : IDisposable where T : IDisposable
{ {
private readonly bool _dispose; private readonly bool _dispose;

2
src/Windows/Avalonia.Direct2D1/PrimitiveExtensions.cs

@ -8,7 +8,7 @@ using DWrite = SharpDX.DirectWrite;
namespace Avalonia.Direct2D1 namespace Avalonia.Direct2D1
{ {
public static class PrimitiveExtensions internal static class PrimitiveExtensions
{ {
/// <summary> /// <summary>
/// The value for which all absolute numbers smaller than are considered equal to zero. /// The value for which all absolute numbers smaller than are considered equal to zero.

2
src/Windows/Avalonia.Direct2D1/RenderTarget.cs

@ -5,7 +5,7 @@ using Avalonia.Rendering;
namespace Avalonia.Direct2D1 namespace Avalonia.Direct2D1
{ {
public class RenderTarget : IRenderTarget, ILayerFactory internal class RenderTarget : IRenderTarget, ILayerFactory
{ {
/// <summary> /// <summary>
/// The render target. /// The render target.

2
src/Windows/Avalonia.Direct2D1/SwapChainRenderTarget.cs

@ -8,7 +8,7 @@ using SharpDX.DXGI;
namespace Avalonia.Direct2D1 namespace Avalonia.Direct2D1
{ {
public abstract class SwapChainRenderTarget : IRenderTarget, ILayerFactory internal abstract class SwapChainRenderTarget : IRenderTarget, ILayerFactory
{ {
private Size2 _savedSize; private Size2 _savedSize;
private Size2F _savedDpi; private Size2F _savedDpi;

1
src/Windows/Avalonia.Win32/Avalonia.Win32.csproj

@ -29,5 +29,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<InternalsVisibleTo Include="Avalonia.Win32.Interop, PublicKey=$(AvaloniaPublicKey)"/> <InternalsVisibleTo Include="Avalonia.Win32.Interop, PublicKey=$(AvaloniaPublicKey)"/>
<InternalsVisibleTo Include="Avalonia.Direct2D1, PublicKey=$(AvaloniaPublicKey)"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

2
src/Windows/Avalonia.Win32/DirectX/DirectXStructs.cs

@ -5,7 +5,7 @@ using static Avalonia.Win32.Interop.UnmanagedMethods;
namespace Avalonia.Win32.DirectX namespace Avalonia.Win32.DirectX
{ {
public unsafe struct HANDLE internal unsafe struct HANDLE
{ {
public readonly void* Value; public readonly void* Value;

2
src/Windows/Avalonia.Win32/DirectX/DxgiConnection.cs

@ -9,7 +9,7 @@ using MicroCom.Runtime;
namespace Avalonia.Win32.DirectX namespace Avalonia.Win32.DirectX
{ {
public unsafe class DxgiConnection : IRenderTimer internal unsafe class DxgiConnection : IRenderTimer
{ {
public const uint ENUM_CURRENT_SETTINGS = unchecked((uint)(-1)); public const uint ENUM_CURRENT_SETTINGS = unchecked((uint)(-1));

2
src/Windows/Avalonia.Win32/DirectX/DxgiRenderTarget.cs

@ -7,7 +7,7 @@ using static Avalonia.Win32.Interop.UnmanagedMethods;
namespace Avalonia.Win32.DirectX namespace Avalonia.Win32.DirectX
{ {
public unsafe class DxgiRenderTarget : EglPlatformSurfaceRenderTargetBase internal unsafe class DxgiRenderTarget : EglPlatformSurfaceRenderTargetBase
{ {
// DXGI_FORMAT_B8G8R8A8_UNORM is target texture format as per ANGLE documentation // DXGI_FORMAT_B8G8R8A8_UNORM is target texture format as per ANGLE documentation

2
src/Windows/Avalonia.Win32/DirectX/DxgiSwapchainWindow.cs

@ -9,7 +9,7 @@ using Avalonia.OpenGL.Surfaces;
namespace Avalonia.Win32.DirectX namespace Avalonia.Win32.DirectX
{ {
public class DxgiSwapchainWindow : EglGlPlatformSurfaceBase internal class DxgiSwapchainWindow : EglGlPlatformSurfaceBase
{ {
private DxgiConnection _connection; private DxgiConnection _connection;
private EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo _window; private EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo _window;

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

@ -7,7 +7,7 @@ namespace Avalonia.Win32
public const string WindowHandleType = "HWND"; public const string WindowHandleType = "HWND";
public const string CursorHandleType = "HCURSOR"; public const string CursorHandleType = "HCURSOR";
public static readonly Version Windows8 = new Version(6, 2); internal static readonly Version Windows8 = new Version(6, 2);
public static readonly Version Windows7 = new Version(6, 1); internal static readonly Version Windows7 = new Version(6, 1);
} }
} }

3
src/Windows/Avalonia.Win32/ScreenImpl.cs

@ -7,8 +7,7 @@ using static Avalonia.Win32.Interop.UnmanagedMethods;
namespace Avalonia.Win32 namespace Avalonia.Win32
{ {
[Unstable] internal class ScreenImpl : IScreenImpl
public class ScreenImpl : IScreenImpl
{ {
private Screen[]? _allScreens; private Screen[]? _allScreens;

3
src/Windows/Avalonia.Win32/TrayIconImpl.cs

@ -13,8 +13,7 @@ using static Avalonia.Win32.Interop.UnmanagedMethods;
namespace Avalonia.Win32 namespace Avalonia.Win32
{ {
[Unstable] internal class TrayIconImpl : ITrayIconImpl
public class TrayIconImpl : ITrayIconImpl
{ {
private static readonly IntPtr s_emptyIcon = new System.Drawing.Bitmap(32, 32).GetHicon(); private static readonly IntPtr s_emptyIcon = new System.Drawing.Bitmap(32, 32).GetHicon();
private readonly int _uniqueId; private readonly int _uniqueId;

2
src/Windows/Avalonia.Win32/Win32Platform.cs

@ -107,7 +107,7 @@ namespace Avalonia
namespace Avalonia.Win32 namespace Avalonia.Win32
{ {
public class Win32Platform : IPlatformThreadingInterface, IWindowingPlatform, IPlatformIconLoader, IPlatformLifetimeEventsImpl internal class Win32Platform : IPlatformThreadingInterface, IWindowingPlatform, IPlatformIconLoader, IPlatformLifetimeEventsImpl
{ {
private static readonly Win32Platform s_instance = new(); private static readonly Win32Platform s_instance = new();
private static Thread? s_uiThread; private static Thread? s_uiThread;

2
src/Windows/Avalonia.Win32/WinRT/IBlurHost.cs

@ -1,6 +1,6 @@
namespace Avalonia.Win32.WinRT namespace Avalonia.Win32.WinRT
{ {
public enum BlurEffect internal enum BlurEffect
{ {
None, None,
Acrylic, Acrylic,

2
src/Windows/Avalonia.Win32/WinRT/WinRTColor.cs

@ -4,7 +4,7 @@ using Avalonia.Media;
namespace Avalonia.Win32.WinRT namespace Avalonia.Win32.WinRT
{ {
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
public record struct WinRTColor internal record struct WinRTColor
{ {
public byte A; public byte A;
public byte R; public byte R;

2
src/Windows/Avalonia.Win32/WinScreen.cs

@ -3,7 +3,7 @@ using Avalonia.Platform;
namespace Avalonia.Win32 namespace Avalonia.Win32
{ {
public class WinScreen : Screen internal class WinScreen : Screen
{ {
private readonly IntPtr _hMonitor; private readonly IntPtr _hMonitor;

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

@ -15,7 +15,7 @@ using static Avalonia.Win32.Interop.UnmanagedMethods;
namespace Avalonia.Win32 namespace Avalonia.Win32
{ {
public partial class WindowImpl internal partial class WindowImpl
{ {
[SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation", [SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation",
Justification = "Using Win32 naming for consistency.")] Justification = "Using Win32 naming for consistency.")]

2
src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs

@ -5,7 +5,7 @@ using static Avalonia.Win32.Interop.UnmanagedMethods;
namespace Avalonia.Win32 namespace Avalonia.Win32
{ {
public partial class WindowImpl internal partial class WindowImpl
{ {
// Hit test the frame for resizing and moving. // Hit test the frame for resizing and moving.
private HitTestValues HitTestNCA(IntPtr hWnd, IntPtr wParam, IntPtr lParam) private HitTestValues HitTestNCA(IntPtr hWnd, IntPtr wParam, IntPtr lParam)

2
src/Windows/Avalonia.Win32/WindowImpl.WndProc.cs

@ -6,7 +6,7 @@ using Avalonia.Controls.Platform;
namespace Avalonia.Win32 namespace Avalonia.Win32
{ {
public partial class WindowImpl internal partial class WindowImpl
{ {
protected virtual unsafe IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam) protected virtual unsafe IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
{ {

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

@ -30,8 +30,7 @@ namespace Avalonia.Win32
/// <summary> /// <summary>
/// Window implementation for Win32 platform. /// Window implementation for Win32 platform.
/// </summary> /// </summary>
[Unstable] internal partial class WindowImpl : IWindowImpl, EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo
public partial class WindowImpl : IWindowImpl, EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo
{ {
private static readonly List<WindowImpl> s_instances = new(); private static readonly List<WindowImpl> s_instances = new();

2
src/Windows/Avalonia.Win32/WindowsMountedVolumeInfoProvider.cs

@ -4,7 +4,7 @@ using Avalonia.Controls.Platform;
namespace Avalonia.Win32 namespace Avalonia.Win32
{ {
public class WindowsMountedVolumeInfoProvider : IMountedVolumeInfoProvider internal class WindowsMountedVolumeInfoProvider : IMountedVolumeInfoProvider
{ {
public IDisposable Listen(ObservableCollection<MountedVolumeInfo> mountedDrives) public IDisposable Listen(ObservableCollection<MountedVolumeInfo> mountedDrives)
{ {

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save