mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 04:45:43 +00:00
Fix XIEventMask to work on any architecture
The mask part of an XIEventMask struct is actually not a pointer to an integer containing the mask, but rather to an array of bytes each holding 8 bits of the mask, with the first byte holding bit 0-7. Therefore the old code would only work on little endian arches.
This commit is contained in:
parent
bf3267c4a9
commit
f538b93ad3
|
@ -1811,7 +1811,7 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
public int deviceid; // 0 = XIAllDevices, 1 = XIAllMasterDevices
|
public int deviceid; // 0 = XIAllDevices, 1 = XIAllMasterDevices
|
||||||
int mask_len;
|
int mask_len;
|
||||||
unsafe XIEventMasks* mask;
|
unsafe byte* mask;
|
||||||
|
|
||||||
public XIEventMask(int id, XIEventMasks m)
|
public XIEventMask(int id, XIEventMasks m)
|
||||||
{
|
{
|
||||||
|
@ -1819,8 +1819,9 @@ namespace OpenTK.Platform.X11
|
||||||
mask_len = sizeof(XIEventMasks);
|
mask_len = sizeof(XIEventMasks);
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
mask = (XIEventMasks*)Marshal.AllocHGlobal(mask_len);
|
mask = (byte*)Marshal.AllocHGlobal(mask_len);
|
||||||
*mask = m;
|
for (int i = 0; i < mask_len; i++)
|
||||||
|
mask[i] = (byte)((uint)m >> i*8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue