Disabled support for multiple devices to minimize memory and CPU usage.

This commit is contained in:
the_fiddler 2007-10-15 11:02:14 +00:00
parent f71bb87fe1
commit 8cce2ac278
2 changed files with 16 additions and 10 deletions

View file

@ -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.

View file

@ -167,11 +167,13 @@ namespace OpenTK.Platform.Windows
/// <returns></returns>
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)
{