Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 2040bca523ca81739ab7f07ea26266f643406c03 1 parent e9ad198
Sebastian Gregor gregsn authored
1  vvvv45/src/nodes/plugins/String/ApplyModifiersNode.cs
View
@@ -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;
}
31 vvvv45/src/nodes/plugins/System/KeyboardNodes.cs
View
@@ -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();
}
Please sign in to comment.
Something went wrong with that request. Please try again.