Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
f5b5f1c
Start work on documenting the API
Perksey Feb 15, 2025
4888320
Finish documenting API & split out files
Perksey Feb 22, 2025
2585ede
Add InputMarshal and InputContextDeviceList, lay out SDL implementation
Perksey Mar 15, 2025
2080e1b
Start on SdlInputBackend
Perksey Apr 5, 2025
f1880f0
Push latest work on SDL backend
Perksey May 25, 2025
1d16317
Remove types I didn't use in the end
Perksey May 25, 2025
e497dde
begin mucking about input event processing
domportera Jun 22, 2025
f129ae9
refine internal device creation abstractions
domportera Jun 24, 2025
fcf49f6
continued - move name back where it belongs
domportera Jun 24, 2025
33cc20d
cont'd
domportera Jun 29, 2025
e72bf55
comments/clarity + enum helper class
domportera Jul 4, 2025
3e4e168
simplify enum assistant and provide guaranteed sorted enum values
domportera Jul 4, 2025
bce7136
simpler indexing
domportera Jul 4, 2025
8f00a4b
add support for enums with multiple names for the same value
domportera Jul 4, 2025
bf382bc
optimize enum performance for larger enums
domportera Jul 5, 2025
555275b
clarifying comment
domportera Jul 5, 2025
fb889c6
documentation/cleanup enum class
domportera Jul 5, 2025
021a8c9
begin constructing gamepads via the joystick API
domportera Jul 6, 2025
8e7eda4
some experimentation/progress re: axis/button indexing
domportera Aug 9, 2025
e637ba7
joystick/gamepad abstraction progress, expand rumble system
domportera Aug 28, 2025
d0f05aa
cont'd
domportera Aug 29, 2025
7942c92
start attempting to guarantee unique ids
domportera Sep 1, 2025
7e84c15
move backendextensions to its own file, begin keyboard
domportera Sep 6, 2025
8c5f3da
start key conversions
domportera Sep 6, 2025
e20d640
tweak device id abstraction
domportera Sep 6, 2025
4387adb
begin keyboard text handling
domportera Sep 7, 2025
35677b0
improve text retrieval functions
domportera Sep 7, 2025
e0abc15
continue text recorder
domportera Sep 7, 2025
c7159ad
begin integration with sdl native text entry
domportera Sep 12, 2025
436aa72
add span utility
domportera Sep 14, 2025
a35120a
text entry continued
domportera Sep 14, 2025
67df00f
additional modifier utility methods
domportera Sep 14, 2025
dd81078
create world's weakest fallback key -> character converter
domportera Sep 14, 2025
0ba7c09
add joystick interface to gamepad, invoke id refresh
domportera Sep 14, 2025
ec0e48b
increase number of characters supported
domportera Sep 14, 2025
7983462
organization
domportera Sep 14, 2025
e263b9b
constrained usage of special enum-as-indexes functionality via attrib…
domportera Sep 14, 2025
4d77d20
mark method static
domportera Sep 14, 2025
116ec2d
begin pointer logic - mouse
domportera Sep 21, 2025
0503cca
Merge remote-tracking branch 'origin/develop/3.0' into feature/input-3.0
domportera Nov 21, 2025
09fa974
reintegrate Input into solution, upgrade dotnet, make input compileab…
domportera Nov 22, 2025
0eacca1
the s....
domportera Nov 22, 2025
f7e2354
namespace cleanup, begin custom cursor support
domportera Nov 23, 2025
f8f1ab1
Merge remote-tracking branch 'origin/develop/3.0' into feature/input-3.0
domportera Nov 30, 2025
19f7c7c
add method to analyzer
domportera Nov 30, 2025
c509002
cursor api "complete" (untested)
domportera Dec 5, 2025
42e8391
pointer & target work
domportera Dec 5, 2025
a1e793c
organization, pointer type consolidation
domportera Dec 5, 2025
20b50cc
generic target creation and updating
domportera Dec 6, 2025
e4ce82b
more pointer implementation logic
domportera Dec 21, 2025
f5dd29f
begin pen and touch
domportera Dec 28, 2025
a82556d
remove redundant switch cases
domportera Dec 28, 2025
e4deb68
continued handling of pointer device creation
domportera Jan 4, 2026
573240f
cleanup stuff
domportera Jan 9, 2026
4a2cc72
Merge remote-tracking branch 'origin/develop/3.0' into feature/input-3.0
domportera Jan 18, 2026
41290bf
remove unnecessary handle extensions
domportera Jan 18, 2026
de26f77
begin event finalization/dispatch
domportera Jan 23, 2026
6fc626f
correct IInputHandler signature for pointers
domportera Jan 25, 2026
bbc9874
continued
domportera Feb 1, 2026
3701591
continue fleshing out pointer events
domportera Feb 8, 2026
7eaf84b
continue iterating on pointers, continue populating events as they occur
domportera Feb 14, 2026
c04161f
flesh out and streamline gamepad axis updates
domportera Feb 23, 2026
7564d23
key event populatioon
domportera Feb 24, 2026
5279e9d
organize input handlers
domportera Mar 1, 2026
8bf18d1
begin test environment
domportera Mar 1, 2026
4d81309
remove unused Initialize method, fix index out of bounds on cursor in…
domportera Mar 1, 2026
2ed3fd2
implement missing events, improve fallback ID implementation, etc
domportera Mar 20, 2026
6c24e1a
begin precision timing
domportera Mar 22, 2026
564d0b1
continued
domportera Mar 23, 2026
9abcba2
fix mouse scrolling
domportera Mar 29, 2026
09a8deb
lots of stuff
domportera Mar 29, 2026
d7027f7
use stable sort for event ordering
domportera Mar 29, 2026
e4d9055
ensure propagation of device creation events, fix enum-based button i…
domportera Apr 17, 2026
60ba38c
move unsafe value conversions to their own experimental public class
domportera Apr 17, 2026
030a583
add new experimental IDs to NoWarn property of input csproj
domportera Apr 17, 2026
a273d3b
begin correcting joystick/gamepad implementation
domportera May 16, 2026
b270577
gamepad fixes continued
domportera May 23, 2026
c199d9d
complete xbone gamepad implementation
domportera Jun 15, 2026
e6eb8c5
forgot to commit this using statement
domportera Jun 20, 2026
f5baa1f
optimize/correct hot indexing paths, remove unnecessary comment warni…
domportera Jun 25, 2026
c01ddc6
micro-optimization
domportera Jun 25, 2026
57c6fe4
updates for pen devices
domportera Jun 28, 2026
499634c
re-commit previously yeeted method that was used in debug builds
domportera Jun 28, 2026
3655ebe
do some to-dos, cleanup code / todos
domportera Jul 10, 2026
1907a7d
formatting and documentation
domportera Jul 13, 2026
336571d
cleanup, usings reduction, begin gamepad-touchpad input
domportera Jul 18, 2026
8f60d7d
naming clarity with simulated pointer targets
domportera Aug 28, 2026
3621ed6
clean up usage of event pointer
domportera Aug 28, 2026
326c671
correctness, performance, clarity in naming
domportera Aug 29, 2026
5bc141b
remove secondary sorted collection for SDL events
domportera Aug 30, 2026
43ca6f2
use enum discriminator for input event dispatch
domportera Aug 30, 2026
95f91f5
properly dispose of native memory for event queues
domportera Aug 30, 2026
ec2a906
tweaked input event loop for correctness
domportera Aug 30, 2026
eb1a53a
lil code hygeine, remove redundant pre-sort checks
domportera Aug 30, 2026
29ae7cd
replace now-redundant event queue class with NativeMemory<T>
domportera Sep 5, 2026
ea3c5b9
cleanup
domportera Sep 5, 2026
ab910fa
further pointer/target work and organization
domportera Sep 22, 2026
2098777
pointer target point mapping, generic event flow refactor
domportera Sep 22, 2026
5106245
fix some oopsies
domportera Sep 23, 2026
da69dc7
remove unused code, micro-optimizations
domportera Sep 23, 2026
b130d29
fix release compilation, further micro-optimizations & enumerator usa…
domportera Sep 23, 2026
4c87bc3
reduce capacity checks & collections marshall calls
domportera Sep 23, 2026
8524c36
gamepad axis correction & logging
domportera Sep 23, 2026
81bc3a5
flip y-axis so +Y is up
domportera Sep 23, 2026
0a5b2b9
front-load timestamp calculations and perform no sorting on inputs
domportera Sep 23, 2026
c472a02
dispose native memory on exit (oops)
domportera Sep 23, 2026
a79d710
improve mouse/cursor spec compliance
domportera Sep 25, 2026
48d64fe
various fixes:
domportera Sep 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix some oopsies
  • Loading branch information
domportera committed Sep 23, 2026
commit 510624596301f9f4caf4426f672feeff12a17b59
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}


private SdlJoystick(ulong sdlDeviceId, nint uniqueId, SdlInputBackend backend) : base(backend, uniqueId,

Check warning on line 70 in sources/Input/Input/Implementations/SDL3/Devices/Joysticks/SdlJoystick.cs

View workflow job for this annotation

GitHub Actions / Test (linux-x64, ubuntu-22.04, linux-x64)

Non-nullable field '_rawHatState' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 70 in sources/Input/Input/Implementations/SDL3/Devices/Joysticks/SdlJoystick.cs

View workflow job for this annotation

GitHub Actions / Test (linux-x64, ubuntu-22.04, linux-x64)

Non-nullable field '_rawAxisState' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 70 in sources/Input/Input/Implementations/SDL3/Devices/Joysticks/SdlJoystick.cs

View workflow job for this annotation

GitHub Actions / Test (linux-x64, ubuntu-22.04, linux-x64)

Non-nullable field '_rawButtonState' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 70 in sources/Input/Input/Implementations/SDL3/Devices/Joysticks/SdlJoystick.cs

View workflow job for this annotation

GitHub Actions / Test (linux-x64, ubuntu-22.04, linux-x64)

Non-nullable property 'State' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 70 in sources/Input/Input/Implementations/SDL3/Devices/Joysticks/SdlJoystick.cs

View workflow job for this annotation

GitHub Actions / Test (osx-arm64, macos-latest, osx-arm64)

Non-nullable field '_rawHatState' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 70 in sources/Input/Input/Implementations/SDL3/Devices/Joysticks/SdlJoystick.cs

View workflow job for this annotation

GitHub Actions / Test (osx-arm64, macos-latest, osx-arm64)

Non-nullable field '_rawAxisState' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 70 in sources/Input/Input/Implementations/SDL3/Devices/Joysticks/SdlJoystick.cs

View workflow job for this annotation

GitHub Actions / Test (osx-arm64, macos-latest, osx-arm64)

Non-nullable field '_rawButtonState' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 70 in sources/Input/Input/Implementations/SDL3/Devices/Joysticks/SdlJoystick.cs

View workflow job for this annotation

GitHub Actions / Test (osx-arm64, macos-latest, osx-arm64)

Non-nullable property 'State' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 70 in sources/Input/Input/Implementations/SDL3/Devices/Joysticks/SdlJoystick.cs

View workflow job for this annotation

GitHub Actions / Test (win-x64, windows-latest, win-x64)

Non-nullable field '_rawHatState' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 70 in sources/Input/Input/Implementations/SDL3/Devices/Joysticks/SdlJoystick.cs

View workflow job for this annotation

GitHub Actions / Test (win-x64, windows-latest, win-x64)

Non-nullable field '_rawAxisState' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 70 in sources/Input/Input/Implementations/SDL3/Devices/Joysticks/SdlJoystick.cs

View workflow job for this annotation

GitHub Actions / Test (win-x64, windows-latest, win-x64)

Non-nullable field '_rawButtonState' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 70 in sources/Input/Input/Implementations/SDL3/Devices/Joysticks/SdlJoystick.cs

View workflow job for this annotation

GitHub Actions / Test (win-x64, windows-latest, win-x64)

Non-nullable property 'State' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
sdlDeviceId)
{
_sdlDeviceId = sdlDeviceId;
Expand Down Expand Up @@ -212,16 +212,18 @@

for (byte i = 0; i < buttonCount; i++)
{
var joystickInput = NativeBackend.GetJoystickButtonRaw(JoystickHandle, i);
var joystickInput = NativeBackend.GetJoystickButtonRaw(joystickHandle, i);
AddButtonEvent(i, joystickInput, nowSdlTimestamp, nowTimestamp);
}

for (var i = 0; i < axisCount; i++)
{
var joystickInput = NativeBackend.GetJoystickAxis(JoystickHandle, i);
// Sdl docs on GetJoystickAxis:
// "Returns a 16-bit signed integer representing the current position of the axis or 0 on failure;
// call SDL_GetError() for more information."
var joystickInput = NativeBackend.GetJoystickAxis(joystickHandle, i);
if (joystickInput == 0)
{
// this indicates an sdl error, so just set our internal axis to 0
joystickInput = short.MinValue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected override void Release()
{
}

public void UpDownEvent(in PenTouchEvent evt, IPointerTarget target, long timestamp)
public void UpDownEvent(ref readonly PenTouchEvent evt, IPointerTarget target, long timestamp)
{
MotionEvent(target, evt.X, evt.Y, evt.Timestamp, timestamp);

Expand All @@ -101,7 +101,7 @@ public void UpDownEvent(in PenTouchEvent evt, IPointerTarget target, long timest


[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MotionEvent(in PenMotionEvent evt, IPointerTarget target, long timestamp) => MotionEvent(target, evt.X, evt.Y, evt.Timestamp, timestamp);
public void MotionEvent(ref readonly PenMotionEvent evt, IPointerTarget target, long timestamp) => MotionEvent(target, evt.X, evt.Y, evt.Timestamp, timestamp);

private void MotionEvent(IPointerTarget target, float x, float y, ulong sdlTimestamp, long timestamp)
{
Expand All @@ -116,7 +116,7 @@ private void MotionEvent(IPointerTarget target, float x, float y, ulong sdlTimes
timestamp: timestamp);
}

public void ButtonEvent(in PenButtonEvent evt, long timestamp)
public void ButtonEvent(ref readonly PenButtonEvent evt, long timestamp)
{
var button = (SdlPenButton)evt.Button;
var pointerButton = button switch {
Expand All @@ -140,7 +140,7 @@ private enum SdlPenButton : byte
Button5,
}

public void AxisEvent(in PenAxisEvent evt, IPointerTarget target, long timestamp)
public void AxisEvent(ref readonly PenAxisEvent evt, IPointerTarget target, long timestamp)
{
switch (evt.Axis)
{
Expand Down Expand Up @@ -188,7 +188,7 @@ public void AxisEvent(in PenAxisEvent evt, IPointerTarget target, long timestamp
}

// ReSharper disable once ArrangeMethodOrOperatorBody
public void ProximityEvent(in PenProximityEvent evt, IPointerTarget target, bool proximityIn)
public void ProximityEvent(ref readonly PenProximityEvent evt, IPointerTarget target, bool proximityIn, long timestamp)
{
// quoting the documentation:

Expand All @@ -204,8 +204,8 @@ public void ProximityEvent(in PenProximityEvent evt, IPointerTarget target, bool
// a pen device to handle subsequent input events

// however, we will store the proximity state of this device for future reference / debugging purposes
IsNear = proximityIn;
}

public bool IsNear { get; private set; }
// update my latest point to be not-looking-at
SetPointLookAtTarget(null, target, proximityIn, evt.Timestamp, timestamp);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ internal abstract partial class SdlPointerDevice
private ISimulatedPointerTarget? _falseTarget;
private readonly List<IPointerTarget> _myPointerTargets = new();

private unsafe ref TargetPoint CreateOrUpdateTargetPoint(IPointerTarget target, long timestamp, ulong sdlTimestamp, uint touchId,
private unsafe ref TargetPoint CreateOrUpdateTargetPoint(IPointerTarget target, long timestamp, ulong sdlTimestamp,
uint touchId,
in Vector3? positionOnTarget, Ray3D<float>? ray, float? pressure, out TargetPoint? oldPoint)
{
if (touchId != 0 && OnePointOnly)
Expand Down Expand Up @@ -108,7 +109,7 @@ private static TargetPoint ToTargetPoint(in Vector3 posOnTarget, float pressure,
{
var bounds = target.Bounds;
var min = bounds.Min.ToSystem();
var max = bounds.Max.ToSystem();
var max = bounds.Max.ToSystem();
var diff3 = max - min;
var normalizedPosition = (posOnTarget - min) / diff3;

Expand All @@ -117,12 +118,12 @@ private static TargetPoint ToTargetPoint(in Vector3 posOnTarget, float pressure,
normalizedPosition.X = 0;
}

if(!float.IsFinite(normalizedPosition.Y))
if (!float.IsFinite(normalizedPosition.Y))
{
normalizedPosition.Y = 0;
}

if(!float.IsFinite(normalizedPosition.Z))
if (!float.IsFinite(normalizedPosition.Z))
{
normalizedPosition.Z = 0;
}
Expand All @@ -137,6 +138,24 @@ private static TargetPoint ToTargetPoint(in Vector3 posOnTarget, float pressure,
);
}

protected void SetPointLookAtTarget(uint? touchId, IPointerTarget target, bool lookAt, ulong sdlTimestamp,
long timestamp)
{
touchId = ValidateTouchId(touchId);
ref var point = ref CreateOrUpdateTargetPoint(
target: target,
timestamp: timestamp,
sdlTimestamp: sdlTimestamp,
touchId: touchId.Value,
positionOnTarget: null,
ray: null,
pressure: null,
oldPoint: out _);
point = point with {
Flags = lookAt ? TargetPointFlags.PointingAtTarget : TargetPointFlags.NotPointingAtTarget
};
}

/// <summary>
/// Adds or updates a point.
/// </summary>
Expand Down Expand Up @@ -263,7 +282,8 @@ public void TargetDestroyed(IPointerTarget target, long timestamp, ulong sdlTime
if (_myPointerTargets.Remove(target))
{
var bounds = target.Bounds;
TargetEvents.Enqueue(new PointerTargetChangedEvent(this, timestamp, target, false, bounds, bounds), sdlTimestamp);
TargetEvents.Enqueue(new PointerTargetChangedEvent(this, timestamp, target, false, bounds, bounds),
sdlTimestamp);
}
}

Expand Down
14 changes: 7 additions & 7 deletions sources/Input/Input/Implementations/SDL3/SdlInputBackend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@

return;

static void DebugTiming(in TimedRawSdlEvent evt, [NotNull] ref TimedRawSdlEvent? previous)

Check warning on line 197 in sources/Input/Input/Implementations/SDL3/SdlInputBackend.cs

View workflow job for this annotation

GitHub Actions / Test (linux-x64, ubuntu-22.04, linux-x64)

The local function 'DebugTiming' is declared but never used

Check warning on line 197 in sources/Input/Input/Implementations/SDL3/SdlInputBackend.cs

View workflow job for this annotation

GitHub Actions / Test (osx-arm64, macos-latest, osx-arm64)

The local function 'DebugTiming' is declared but never used

Check warning on line 197 in sources/Input/Input/Implementations/SDL3/SdlInputBackend.cs

View workflow job for this annotation

GitHub Actions / Test (win-x64, windows-latest, win-x64)

The local function 'DebugTiming' is declared but never used
{
const string fmt =
"Needs pre-sort by {0} timestamp. Please alert maintainer.\nPrevious:{1}\nCurrent:{2}\nDifference: SDL {3} Stopwatch {4}";
Expand All @@ -202,14 +202,14 @@
{
if (prev.Event.Common.Timestamp > evt.Event.Common.Timestamp)
{
evt.TimeMinus(prev, out var stopwatchDiff, out var sdlDiff);

Check failure on line 205 in sources/Input/Input/Implementations/SDL3/SdlInputBackend.cs

View workflow job for this annotation

GitHub Actions / Test (linux-x64, ubuntu-22.04, linux-x64)

'SdlInputBackend.TimedRawSdlEvent' does not contain a definition for 'TimeMinus' and no accessible extension method 'TimeMinus' accepting a first argument of type 'SdlInputBackend.TimedRawSdlEvent' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 205 in sources/Input/Input/Implementations/SDL3/SdlInputBackend.cs

View workflow job for this annotation

GitHub Actions / Test (osx-arm64, macos-latest, osx-arm64)

'SdlInputBackend.TimedRawSdlEvent' does not contain a definition for 'TimeMinus' and no accessible extension method 'TimeMinus' accepting a first argument of type 'SdlInputBackend.TimedRawSdlEvent' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 205 in sources/Input/Input/Implementations/SDL3/SdlInputBackend.cs

View workflow job for this annotation

GitHub Actions / Test (win-x64, windows-latest, win-x64)

'SdlInputBackend.TimedRawSdlEvent' does not contain a definition for 'TimeMinus' and no accessible extension method 'TimeMinus' accepting a first argument of type 'SdlInputBackend.TimedRawSdlEvent' could be found (are you missing a using directive or an assembly reference?)
InputLog.Error(string.Format(fmt, "SDL", previous.ToString(), evt.ToString(), sdlDiff,
stopwatchDiff));
}

if (prev.StopwatchTimestamp > evt.StopwatchTimestamp)
{
evt.TimeMinus(prev, out var stopwatchDiff, out var sdlDiff);

Check failure on line 212 in sources/Input/Input/Implementations/SDL3/SdlInputBackend.cs

View workflow job for this annotation

GitHub Actions / Test (linux-x64, ubuntu-22.04, linux-x64)

'SdlInputBackend.TimedRawSdlEvent' does not contain a definition for 'TimeMinus' and no accessible extension method 'TimeMinus' accepting a first argument of type 'SdlInputBackend.TimedRawSdlEvent' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 212 in sources/Input/Input/Implementations/SDL3/SdlInputBackend.cs

View workflow job for this annotation

GitHub Actions / Test (osx-arm64, macos-latest, osx-arm64)

'SdlInputBackend.TimedRawSdlEvent' does not contain a definition for 'TimeMinus' and no accessible extension method 'TimeMinus' accepting a first argument of type 'SdlInputBackend.TimedRawSdlEvent' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 212 in sources/Input/Input/Implementations/SDL3/SdlInputBackend.cs

View workflow job for this annotation

GitHub Actions / Test (win-x64, windows-latest, win-x64)

'SdlInputBackend.TimedRawSdlEvent' does not contain a definition for 'TimeMinus' and no accessible extension method 'TimeMinus' accepting a first argument of type 'SdlInputBackend.TimedRawSdlEvent' could be found (are you missing a using directive or an assembly reference?)
InputLog.Error(string.Format(fmt, "SDL", previous.ToString(), evt.ToString(), sdlDiff,
stopwatchDiff));
}
Expand Down Expand Up @@ -421,7 +421,7 @@
}
case EventType.MouseWheel:
{
if (backend.TryGetOrCreatePointerTargetForWindow(evt.Motion.WindowID, out var windowTarget))
if (backend.TryGetOrCreatePointerTargetForWindow(evt.Wheel.WindowID, out var windowTarget))
{
mouse.AddWheelEvent(evt.Wheel, windowTarget, timestamp);
}
Expand All @@ -439,7 +439,7 @@
case EventType.PenProximityOut:
case >= EventType.PenProximityIn and <= EventType.PenAxis:
{
if (!backend.TryGetOrCreateDevice<SdlPen>(evt.Ptouch.Which, timestamp, evt.Common.Timestamp,
if (!backend.TryGetOrCreateDevice<SdlPen>(evt.Pproximity.Which, timestamp, evt.Common.Timestamp,
out var penDevice))
{
return;
Expand All @@ -452,7 +452,7 @@
{
if (backend.TryGetOrCreatePointerTargetForWindow(evt.Pproximity.WindowID, out var windowTarget))
{
penDevice.ProximityEvent(evt: evt.Pproximity, target: windowTarget, proximityIn: type == EventType.PenProximityIn);
penDevice.ProximityEvent(in evt.Pproximity, windowTarget, type == EventType.PenProximityIn, timestamp);
}

break;
Expand All @@ -462,29 +462,29 @@
{
if(backend.TryGetOrCreatePointerTargetForWindow(evt.Ptouch.WindowID, out var windowTarget))
{
penDevice.UpDownEvent(evt.Ptouch, windowTarget, timestamp);
penDevice.UpDownEvent(in evt.Ptouch, windowTarget, timestamp);
}
break;
}
case EventType.PenButtonDown:
case EventType.PenButtonUp:
{
penDevice.ButtonEvent(evt.Pbutton, timestamp);
penDevice.ButtonEvent(in evt.Pbutton, timestamp);
break;
}
case EventType.PenMotion:
{
if(backend.TryGetOrCreatePointerTargetForWindow(evt.Pmotion.WindowID, out var windowTarget))
{
penDevice.MotionEvent(evt.Pmotion, windowTarget, timestamp);
penDevice.MotionEvent(in evt.Pmotion, windowTarget, timestamp);
}
break;
}
case EventType.PenAxis:
{
if (backend.TryGetOrCreatePointerTargetForWindow(evt.Paxis.WindowID, out var windowTarget))
{
penDevice.AxisEvent(evt.Paxis, windowTarget, timestamp);
penDevice.AxisEvent(in evt.Paxis, windowTarget, timestamp);
}

break;
Expand Down
2 changes: 1 addition & 1 deletion sources/Input/Input/PinnedGcMemory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private void EnsureCapacity(int desiredCount)

var newSize = Math.Max(_capacity * 2, desiredCount);

var newArray = GC.AllocateUninitializedArray<T>(Unsafe.SizeOf<T>() * newSize, pinned: true);
var newArray = GC.AllocateUninitializedArray<T>(newSize, pinned: true);
_array?.CopyTo(newArray.AsSpan(0, _array.Length));

_array = newArray;
Expand Down
Loading