mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-03-29 18:06:52 +00:00
Fix a bug in X11 CursorVisble with custom cursors.
CursorVisible reset to the default cursor when showing the cursor, it should instead show the custom cursor if it's defined (else the default cursor).
This commit is contained in:
parent
9ed32e4445
commit
2207144aec
|
@ -117,6 +117,7 @@ namespace OpenTK.Platform.X11
|
||||||
bool _decorations_hidden = false;
|
bool _decorations_hidden = false;
|
||||||
|
|
||||||
MouseCursor cursor = MouseCursor.Default;
|
MouseCursor cursor = MouseCursor.Default;
|
||||||
|
IntPtr cursorHandle;
|
||||||
bool cursor_visible = true;
|
bool cursor_visible = true;
|
||||||
int mouse_rel_x, mouse_rel_y;
|
int mouse_rel_x, mouse_rel_y;
|
||||||
|
|
||||||
|
@ -1476,16 +1477,23 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
fixed(byte* pixels = value.Rgba)
|
if (value == MouseCursor.Default)
|
||||||
{
|
{
|
||||||
var xcursorimage = Functions.XcursorImageCreate(32, 32);
|
Functions.XUndefineCursor(window.Display, window.Handle);
|
||||||
xcursorimage->xhot = (uint)value.X;
|
}
|
||||||
xcursorimage->yhot = (uint)value.Y;
|
else
|
||||||
xcursorimage->pixels = (uint*)pixels;
|
{
|
||||||
xcursorimage->delay = 0;
|
fixed(byte* pixels = value.Rgba)
|
||||||
var xcursor = Functions.XcursorImageLoadCursor(window.Display, xcursorimage);
|
{
|
||||||
Functions.XDefineCursor(window.Display, window.Handle, xcursor);
|
var xcursorimage = Functions.XcursorImageCreate(32, 32);
|
||||||
Functions.XcursorImageDestroy(xcursorimage);
|
xcursorimage->xhot = (uint)value.X;
|
||||||
|
xcursorimage->yhot = (uint)value.Y;
|
||||||
|
xcursorimage->pixels = (uint*)pixels;
|
||||||
|
xcursorimage->delay = 0;
|
||||||
|
cursorHandle = Functions.XcursorImageLoadCursor(window.Display, xcursorimage);
|
||||||
|
Functions.XDefineCursor(window.Display, window.Handle, cursorHandle);
|
||||||
|
Functions.XcursorImageDestroy(xcursorimage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1505,7 +1513,7 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XUndefineCursor(window.Display, window.Handle);
|
Functions.XDefineCursor(window.Display, window.Handle, cursorHandle);
|
||||||
cursor_visible = true;
|
cursor_visible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1742,6 +1750,10 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
|
if(cursorHandle != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Functions.XFreeCursor(window.Display, cursorHandle);
|
||||||
|
}
|
||||||
Functions.XFreeCursor(window.Display, EmptyCursor);
|
Functions.XFreeCursor(window.Display, EmptyCursor);
|
||||||
Functions.XDestroyWindow(window.Display, window.Handle);
|
Functions.XDestroyWindow(window.Display, window.Handle);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue