Permalink
Browse files

keyboard device lost bug fixes. checked all occurences of KeyNotifica…

…tionKind in vvvv45 and addonpack to make sure KeyNotificationKind.DeviceLost is handled correctly
  • Loading branch information...
gregsn committed Feb 26, 2014
1 parent e9ad198 commit 2040bca523ca81739ab7f07ea26266f643406c03
@@ -50,6 +50,7 @@ public void Evaluate(int spreadMax)
Output[slice] = new string(keyPress.KeyChar, 1);
break;
case KeyNotificationKind.KeyUp:
+ case KeyNotificationKind.DeviceLost:
Output[slice] = string.Empty;
break;
}
@@ -204,6 +204,9 @@ public void Evaluate(int spreadMax)
case KeyNotificationKind.KeyUp:
notification = new KeyUpNotification((Keys)KeyCodeIn[bin][i]);
break;
+ case KeyNotificationKind.DeviceLost:
+ notification = new KeyboardLostNotification();
+ break;
default:
throw new NotImplementedException();
}
@@ -227,17 +230,21 @@ public bool Equals(KeyNotification x, KeyNotification y)
{
if (x.Kind == y.Kind)
{
- if (x.Kind == KeyNotificationKind.KeyPress)
- {
- var xPress = x as KeyPressNotification;
- var yPress = y as KeyPressNotification;
- return xPress.KeyChar == yPress.KeyChar;
- }
- else
+ switch (x.Kind)
{
- var xCode = x as KeyCodeNotification;
- var yCode = y as KeyCodeNotification;
- return xCode.KeyCode == yCode.KeyCode;
+ case KeyNotificationKind.KeyDown:
+ case KeyNotificationKind.KeyUp:
+ var xCode = x as KeyCodeNotification;
+ var yCode = y as KeyCodeNotification;
+ return xCode.KeyCode == yCode.KeyCode;
+ case KeyNotificationKind.KeyPress:
+ var xPress = x as KeyPressNotification;
+ var yPress = y as KeyPressNotification;
+ return xPress.KeyChar == yPress.KeyChar;
+ case KeyNotificationKind.DeviceLost:
+ return true;
+ default:
+ break;
}
}
return false;
@@ -443,6 +450,10 @@ public void Evaluate(int spreadMax)
KeyCodeOut[bin][i] = (int)keyUp.KeyCode;
KeyCharOut[bin][i] = null;
break;
+ case KeyNotificationKind.DeviceLost:
+ KeyCodeOut[bin][i] = 0;
+ KeyCharOut[bin][i] = null;
+ break;
default:
throw new NotImplementedException();
}

0 comments on commit 2040bca

Please sign in to comment.