Repo created
This commit is contained in:
parent
f2d952b743
commit
3ecd57d1b2
475 changed files with 37130 additions and 2 deletions
33
srcs/juloo.keyboard2/Modmap.java
Normal file
33
srcs/juloo.keyboard2/Modmap.java
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
package juloo.keyboard2;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/** Stores key combinations that are applied by [KeyModifier]. */
|
||||
public final class Modmap
|
||||
{
|
||||
public enum M { Shift, Fn, Ctrl }
|
||||
|
||||
Map<KeyValue, KeyValue>[] _map;
|
||||
|
||||
public Modmap()
|
||||
{
|
||||
_map = (Map<KeyValue, KeyValue>[])Array.newInstance(TreeMap.class,
|
||||
M.values().length);
|
||||
}
|
||||
|
||||
public void add(M m, KeyValue a, KeyValue b)
|
||||
{
|
||||
int i = m.ordinal();
|
||||
if (_map[i] == null)
|
||||
_map[i] = new TreeMap<KeyValue, KeyValue>();
|
||||
_map[i].put(a, b);
|
||||
}
|
||||
|
||||
public KeyValue get(M m, KeyValue a)
|
||||
{
|
||||
Map<KeyValue, KeyValue> mm = _map[m.ordinal()];
|
||||
return (mm == null) ? null : mm.get(a);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue