Try fixing pointer barriers harder (still doesn't work :( ), also fix XI2 raw motion polling (IsNormal was always returning false for whatever reason, seems to work fine with just simple Inf/NaN checks). XI2 raw motion polling however seems to use a far larger scale compared to Windows (seemingly in the hundred thousands??? although this is in a VM so this might just be a quirk of such)
This commit is contained in:
parent
778c880d54
commit
2f2c3e4f68
|
@ -184,19 +184,10 @@ namespace BizHawk.Bizware.Input
|
|||
{
|
||||
var rawValueIndex = 0;
|
||||
|
||||
// not implemented until netcore / netstandard2.1
|
||||
// copied from modern runtime
|
||||
static bool IsNormal(double d)
|
||||
{
|
||||
var bits = BitConverter.DoubleToInt64Bits(d);
|
||||
bits &= 0x7FFF_FFFF_FFFF_FFFF;
|
||||
return (bits < 0x7FF0_0000_0000_0000) && (bits != 0) && ((bits & 0x7FF0_0000_0000_0000) == 0);
|
||||
}
|
||||
|
||||
if (XIMaskIsSet(valuatorsMask, 0))
|
||||
{
|
||||
var deltaX = xiRawEvent->raw_values[rawValueIndex];
|
||||
if (IsNormal(deltaX))
|
||||
if (!double.IsInfinity(deltaX) && !double.IsNaN(deltaX))
|
||||
{
|
||||
mouseDeltaX += deltaX;
|
||||
}
|
||||
|
@ -207,7 +198,7 @@ namespace BizHawk.Bizware.Input
|
|||
if (XIMaskIsSet(valuatorsMask, 1))
|
||||
{
|
||||
var deltaY = xiRawEvent->raw_values[rawValueIndex];
|
||||
if (IsNormal(deltaY))
|
||||
if (!double.IsInfinity(deltaY) && !double.IsNaN(deltaY))
|
||||
{
|
||||
mouseDeltaY += deltaY;
|
||||
}
|
||||
|
|
|
@ -4899,23 +4899,27 @@ namespace BizHawk.Client.EmuHawk
|
|||
fbLocation.Offset(_presentationPanel.Control.Location);
|
||||
var barrierRect = new Rectangle(fbLocation, _presentationPanel.Control.Size);
|
||||
|
||||
// each line of the barrier rect must be a separate barrier object
|
||||
// each line of the barrier rect must be a separate barrier object
|
||||
// also, the lines should span the entire screen, to avoid the cursor escaping at the corner
|
||||
|
||||
var mfScreen = Screen.FromControl(this);
|
||||
var screenRect = mfScreen.Bounds;
|
||||
|
||||
// left barrier
|
||||
_pointerBarriers[0] = XfixesImports.XFixesCreatePointerBarrier(
|
||||
_x11Display, Handle, barrierRect.X, barrierRect.Y, barrierRect.X, barrierRect.Bottom,
|
||||
_x11Display, Handle, barrierRect.X, screenRect.Y, barrierRect.X, screenRect.Bottom,
|
||||
XfixesImports.BarrierDirection.BarrierPositiveX, 0, IntPtr.Zero);
|
||||
// top barrier
|
||||
_pointerBarriers[1] = XfixesImports.XFixesCreatePointerBarrier(
|
||||
_x11Display, Handle, barrierRect.X, barrierRect.Y, barrierRect.Right, barrierRect.Y,
|
||||
_x11Display, Handle, screenRect.X, barrierRect.Y, screenRect.Right, barrierRect.Y,
|
||||
XfixesImports.BarrierDirection.BarrierPositiveY, 0, IntPtr.Zero);
|
||||
// right barrier
|
||||
_pointerBarriers[2] = XfixesImports.XFixesCreatePointerBarrier(
|
||||
_x11Display, Handle, barrierRect.Right, barrierRect.Y, barrierRect.Right, barrierRect.Bottom,
|
||||
_x11Display, Handle, barrierRect.Right, screenRect.Y, barrierRect.Right, screenRect.Bottom,
|
||||
XfixesImports.BarrierDirection.BarrierNegativeX, 0, IntPtr.Zero);
|
||||
// bottom barrier
|
||||
_pointerBarriers[3] = XfixesImports.XFixesCreatePointerBarrier(
|
||||
_x11Display, Handle, barrierRect.X, barrierRect.Bottom, barrierRect.Right, barrierRect.Bottom,
|
||||
_x11Display, Handle, screenRect.X, barrierRect.Bottom, screenRect.Right, barrierRect.Bottom,
|
||||
XfixesImports.BarrierDirection.BarrierNegativeY, 0, IntPtr.Zero);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue