|
|
|
@ -9,7 +9,7 @@ namespace Avalonia.X11 |
|
|
|
class X11CursorFactory : IStandardCursorFactory |
|
|
|
{ |
|
|
|
private static IntPtr _nullCursor; |
|
|
|
|
|
|
|
|
|
|
|
private readonly IntPtr _display; |
|
|
|
private Dictionary<CursorFontShape, IntPtr> _cursors; |
|
|
|
|
|
|
|
@ -48,10 +48,10 @@ namespace Avalonia.X11 |
|
|
|
_cursors = Enum.GetValues(typeof(CursorFontShape)).Cast<CursorFontShape>() |
|
|
|
.ToDictionary(id => id, id => XLib.XCreateFontCursor(_display, id)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public IPlatformHandle GetCursor(StandardCursorType cursorType) |
|
|
|
{ |
|
|
|
IntPtr handle; |
|
|
|
IntPtr handle; |
|
|
|
if (cursorType == StandardCursorType.None) |
|
|
|
{ |
|
|
|
handle = _nullCursor; |
|
|
|
@ -61,7 +61,7 @@ namespace Avalonia.X11 |
|
|
|
handle = s_mapping.TryGetValue(cursorType, out var shape) |
|
|
|
? _cursors[shape] |
|
|
|
: _cursors[CursorFontShape.XC_top_left_arrow]; |
|
|
|
} |
|
|
|
} |
|
|
|
return new PlatformHandle(handle, "XCURSOR"); |
|
|
|
} |
|
|
|
|
|
|
|
@ -71,7 +71,7 @@ namespace Avalonia.X11 |
|
|
|
byte[] data = new byte[] { 0 }; |
|
|
|
IntPtr window = XLib.XRootWindow(display, 0); |
|
|
|
IntPtr pixmap = XLib.XCreateBitmapFromData(display, window, data, 1, 1); |
|
|
|
return XLib.XCreatePixmapCursor(display, pixmap, pixmap, ref color, ref color, 0, 0); |
|
|
|
return XLib.XCreatePixmapCursor(display, pixmap, pixmap, ref color, ref color, 0, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|