forked from Mirror/Ryujinx
Skipped over the last "Count" key explicitly, instead of relying on an exception. (#3595)
This commit is contained in:
parent
80a879cb44
commit
eb6430f103
1 changed files with 4 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using GtkKey = Gdk.Key;
|
using GtkKey = Gdk.Key;
|
||||||
|
|
||||||
|
@ -150,22 +151,15 @@ namespace Ryujinx.Input.GTK3
|
||||||
|
|
||||||
static GTK3MappingHelper()
|
static GTK3MappingHelper()
|
||||||
{
|
{
|
||||||
var inputKeys = Enum.GetValues<Key>();
|
var inputKeys = Enum.GetValues<Key>().SkipLast(1);
|
||||||
|
|
||||||
// GtkKey is not contiguous and quite large, so use a dictionary instead of an array.
|
// GtkKey is not contiguous and quite large, so use a dictionary instead of an array.
|
||||||
_gtkKeyMapping = new Dictionary<GtkKey, Key>();
|
_gtkKeyMapping = new Dictionary<GtkKey, Key>();
|
||||||
|
|
||||||
foreach (var key in inputKeys)
|
foreach (var key in inputKeys)
|
||||||
{
|
{
|
||||||
try
|
var index = ToGtkKey(key);
|
||||||
{
|
_gtkKeyMapping[index] = key;
|
||||||
var index = ToGtkKey((Key)key);
|
|
||||||
_gtkKeyMapping[index] = (Key)key;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Skip invalid mappings.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue