diff --git a/Source/OpenTK/Platform/Windows/WinRawKeyboard.cs b/Source/OpenTK/Platform/Windows/WinRawKeyboard.cs index 09d18742..bf4c607d 100644 --- a/Source/OpenTK/Platform/Windows/WinRawKeyboard.cs +++ b/Source/OpenTK/Platform/Windows/WinRawKeyboard.cs @@ -284,11 +284,15 @@ namespace OpenTK.Platform.Windows // came not from a physical keyboard device but from a code-generated input message - in // that case, the event goes to the default (first) keyboard. // TODO: Send the event to all keyboards instead of the default one. - int index = keyboards.FindIndex(delegate(KeyboardDevice kb) - { - return kb.DeviceID == rin.Header.Device; - }); - if (index == -1) index = 0; + // TODO: Optimize this! The predicate allocates way to much memory. + //int index = keyboards.FindIndex(delegate(KeyboardDevice kb) + //{ + // return kb.DeviceID == rin.Header.Device; + //}); + //if (index == -1) index = 0; + int index; + if (keyboards.Count > 0) index = 0; + else return false; // Generic control, shift, alt keys may be sent instead of left/right. // It seems you have to explicitly register left/right events. diff --git a/Source/OpenTK/Platform/Windows/WinRawMouse.cs b/Source/OpenTK/Platform/Windows/WinRawMouse.cs index 1d65b68c..9e4f40a5 100644 --- a/Source/OpenTK/Platform/Windows/WinRawMouse.cs +++ b/Source/OpenTK/Platform/Windows/WinRawMouse.cs @@ -167,11 +167,13 @@ namespace OpenTK.Platform.Windows /// internal bool ProcessEvent(RawInput rin) { - MouseDevice mouse = mice.Find(delegate(MouseDevice m) - { - return m.DeviceID == rin.Header.Device; - }); - if (mouse == null && mice.Count > 0) mouse = mice[0]; + //MouseDevice mouse = mice.Find(delegate(MouseDevice m) + //{ + // return m.DeviceID == rin.Header.Device; + //}); + MouseDevice mouse; + if (mice.Count > 0) mouse = mice[0]; + else return false; switch (rin.Header.Type) {