mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-06-05 20:09:15 +00:00
Copilot key fix
This commit is contained in:
@@ -33,11 +33,11 @@ namespace Ryujinx.Input.Assigner
|
|||||||
|
|
||||||
public Button? GetPressedButton()
|
public Button? GetPressedButton()
|
||||||
{
|
{
|
||||||
// On some layouts (for example AltGr on Windows), Right Alt is reported as Ctrl+Alt.
|
Key aliasedKey = GetAliasedPressedKey();
|
||||||
// Prefer AltRight in that case so the binding reflects the physical key used.
|
|
||||||
if (_keyboardState.IsPressed(Key.ControlLeft) && _keyboardState.IsPressed(Key.AltRight))
|
if (aliasedKey != Key.Unknown)
|
||||||
{
|
{
|
||||||
return !ShouldCancel() ? new Button(Key.AltRight) : null;
|
return !ShouldCancel() ? new Button(aliasedKey) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Button? keyPressed = null;
|
Button? keyPressed = null;
|
||||||
@@ -53,5 +53,26 @@ namespace Ryujinx.Input.Assigner
|
|||||||
|
|
||||||
return !ShouldCancel() ? keyPressed : null;
|
return !ShouldCancel() ? keyPressed : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Key GetAliasedPressedKey()
|
||||||
|
{
|
||||||
|
// On some layouts (for example AltGr on Windows), Right Alt is reported as Ctrl+Alt.
|
||||||
|
// Prefer AltRight in that case so the binding reflects the physical key used.
|
||||||
|
if (_keyboardState.IsPressed(Key.ControlLeft) && _keyboardState.IsPressed(Key.AltRight))
|
||||||
|
{
|
||||||
|
return Key.AltRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// On some Copilot keyboards, the key in the right-control position is reported as
|
||||||
|
// ShiftLeft+Win+F23. Prefer ControlRight so the binding reflects that physical key.
|
||||||
|
if (_keyboardState.IsPressed(Key.ShiftLeft) &&
|
||||||
|
_keyboardState.IsPressed(Key.F23) &&
|
||||||
|
(_keyboardState.IsPressed(Key.WinLeft) || _keyboardState.IsPressed(Key.WinRight)))
|
||||||
|
{
|
||||||
|
return Key.ControlRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Key.Unknown;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user