Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public GameControllerDirectInput(InputSourceWindowsDirectInput source, DirectInp
Id = instance.InstanceGuid;
ProductId = instance.ProductGuid;
joystick = new DirectInputJoystick(directInput, instance.InstanceGuid);
joystick.SetCooperativeLevel(IntPtr.Zero, CooperativeLevel.NonExclusive | CooperativeLevel.Foreground);
var descriptor = RawInput.Win32.GetForegroundWindow();
joystick.SetCooperativeLevel(descriptor, CooperativeLevel.NonExclusive | CooperativeLevel.Background);
var objects = joystick.GetObjects();

int sliderCount = 0;
Expand Down
3 changes: 3 additions & 0 deletions sources/engine/Stride.Input/Windows/RawInput/Win32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ internal static class Win32

[DllImport("user32.dll")]
public static extern void ClipCursor(IntPtr rect);

[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
}
}
#endif