mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 00:09:55 +09:00
Tidy up escape handling
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Input;
|
||||
using System;
|
||||
|
||||
@ -26,6 +25,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
focus = value;
|
||||
if (!focus && HasFocus)
|
||||
//todo: replace with KillInput after ppy/osu-framework#1656 is merged.
|
||||
GetContainingInputManager().ChangeFocus(null);
|
||||
}
|
||||
}
|
||||
@ -39,18 +39,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
BorderThickness = 0;
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
protected override void KillFocus()
|
||||
{
|
||||
if (!args.Repeat && args.Key == Key.Escape)
|
||||
{
|
||||
if (Text.Length > 0)
|
||||
Text = string.Empty;
|
||||
else
|
||||
Exit?.Invoke();
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnKeyDown(state, args);
|
||||
base.KillFocus();
|
||||
Exit?.Invoke();
|
||||
}
|
||||
|
||||
public override bool RequestsFocus => HoldFocus;
|
||||
|
Reference in New Issue
Block a user