Skip to content

Commit

Permalink
Trying to fix KeyboardManager.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
jp2masa authored Oct 24, 2016
1 parent 4f71752 commit da7e340
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion source/Cosmos.System/Keyboard/KeyboardManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ private static void HandleScanCode(byte aScanCode, bool aReleased)
if (!aReleased)
{
KeyEvent keyInfo;

if (GetKey(key, out keyInfo))
{
Enqueue(keyInfo);
Expand All @@ -133,7 +134,9 @@ public static bool GetKey(byte aScancode, out KeyEvent keyInfo)
{
Debugger.DoSend("No KeyLayout");
}

keyInfo = _scanMap.ConvertScanCode(aScancode, ControlPressed, ShiftPressed, AltPressed, NumLock, CapsLock, ScrollLock);

return keyInfo != null;
}

Expand All @@ -144,7 +147,9 @@ public static bool TryReadKey(out KeyEvent oKey)
oKey = mQueuedKeys.Dequeue();
return true;
}

oKey = default(KeyEvent);

return false;
}

Expand All @@ -154,6 +159,7 @@ public static KeyEvent ReadKey()
{
KeyboardBase.WaitForKey();
}

return mQueuedKeys.Dequeue();
}

Expand All @@ -174,7 +180,7 @@ public static void AddKeyboard(KeyboardBase Keyboard)
{
if (!KeyboardExists(Keyboard.GetType()))
{
Keyboard.OnKeyPressed += new KeyboardBase.KeyPressedEventHandler(HandleScanCode);
Keyboard.OnKeyPressed = new KeyboardBase.KeyPressedEventHandler(HandleScanCode);
Keyboards.Add(Keyboard);
}
}
Expand Down

0 comments on commit da7e340

Please sign in to comment.