Browse Source

Fix `XcursorImageDestroy` interop signature (#14843)

* Fix `XcursorImageDestroy` interop signature

The C API return type is `void`, per https://www.x.org/releases/current/doc/man/man3/Xcursor.3.xhtml#heading6

```c
void XcursorImageDestroy (XcursorImage *image)
```

Update the C# interop method to match.

May help with  https://github.com/AvaloniaUI/Avalonia/issues/10425

* Use `XFreeCursor` instead of `XcursorImageDestroy`

Ref. https://github.com/AvaloniaUI/Avalonia/issues/10425#issuecomment-1981363971
pull/14851/head
nil4 2 years ago
committed by GitHub
parent
commit
9ce0680c4b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      src/Avalonia.X11/X11CursorFactory.cs
  2. 3
      src/Avalonia.X11/XLib.cs

4
src/Avalonia.X11/X11CursorFactory.cs

@ -92,6 +92,7 @@ namespace Avalonia.X11
private unsafe class XImageCursor : CursorImpl, IFramebufferPlatformSurface, IPlatformHandle
{
private readonly IntPtr _display;
private readonly PixelSize _pixelSize;
private readonly UnmanagedBlob _blob;
@ -101,6 +102,7 @@ namespace Avalonia.X11
(bitmap.PixelSize.Width * bitmap.PixelSize.Height * 4);
var platformRenderInterface = AvaloniaLocator.Current.GetRequiredService<IPlatformRenderInterface>();
_display = display;
_pixelSize = bitmap.PixelSize;
_blob = new UnmanagedBlob(size);
@ -128,7 +130,7 @@ namespace Avalonia.X11
public override void Dispose()
{
XLib.XcursorImageDestroy(Handle);
XLib.XFreeCursor(_display, Handle);
_blob.Dispose();
}

3
src/Avalonia.X11/XLib.cs

@ -603,9 +603,6 @@ namespace Avalonia.X11
[DllImport(libXCursor)]
public static extern IntPtr XcursorImageLoadCursor(IntPtr display, IntPtr image);
[DllImport(libXCursor)]
public static extern IntPtr XcursorImageDestroy(IntPtr image);
public static void XISetMask(ref int mask, XiEventType ev)
{
mask |= (1 << (int)ev);

Loading…
Cancel
Save