only show warning when focused

This commit is contained in:
Jorolf
2017-08-25 16:39:49 +02:00
parent 26323caf6f
commit 9374bf925e

View File

@ -44,10 +44,24 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{ {
if (args.Key == OpenTK.Input.Key.CapsLock) if (args.Key == OpenTK.Input.Key.CapsLock)
warning.FadeTo(host.CapsLockEnabled ? 1 : 0, 250, Easing.OutQuint); updateCapsWarning(host.CapsLockEnabled);
return base.OnKeyDown(state, args); return base.OnKeyDown(state, args);
} }
protected override void OnFocus(InputState state)
{
updateCapsWarning(host.CapsLockEnabled);
base.OnFocus(state);
}
protected override void OnFocusLost(InputState state)
{
updateCapsWarning(false);
base.OnFocusLost(state);
}
private void updateCapsWarning(bool visible) => warning.FadeTo(visible ? 1 : 0, 250, Easing.OutQuint);
public class PasswordMaskChar : Container public class PasswordMaskChar : Container
{ {
private readonly CircularContainer circle; private readonly CircularContainer circle;