Add F11 and F12

These keys are shown only when Fn is activated, "placeholder" keys are
placed in the layouts.
This commit is contained in:
Jules Aguillon 2022-03-19 16:27:57 +01:00
parent e872c58788
commit ba6d62dee2
13 changed files with 63 additions and 50 deletions

View File

@ -9,8 +9,8 @@
<key key0="y" key2="6" key3="-" key4="|"/>
<key key0="u" key2="7" key4="`"/>
<key key0="i" key2="8" key3="_" key4="\\"/>
<key key0="o" key2="9"/>
<key key0="p" key2="0" key4="\@"/>
<key key0="o" key2="9" key3="f11_placeholder"/>
<key key0="p" key2="0" key3="f12_placeholder" key4="\@"/>
</row>
<row>
<key key0="q" key1="tab"/>

View File

@ -2,8 +2,8 @@
<keyboard>
<row>
<key key0="shift" width="1.5" key1="esc" key2="tab"/>
<key key0="p" key1="accent_ring" key2="." key3="&lt;"/>
<key key0="y" key1="accent_grave" key2="," key3="&gt;"/>
<key key0="p" key1="accent_ring" key2="." key3="&lt;" key4="f11_placeholder"/>
<key key0="y" key1="accent_grave" key2="," key3="&gt;" key4="f12_placeholder"/>
<key key0="f" key4="€"/>
<key key0="g" key2="\\" key3="|"/>
<key key0="c" key1="accent_trema" key2="accent_circonflexe" key3="{" key4="}"/>

View File

@ -4,8 +4,8 @@
<key key0="я" key1="esc" key2="1" key3="ч" key4="!"/>
<key key0="в" key2="2" key3="\@"/>
<key key0="е" key2="3" key3="\#" key4="№"/>
<key key0="р" key2="4" key3="$"/>
<key key0="т" key2="5" key3="%"/>
<key key0="р" key2="4" key3="$" key4="f11_placeholder"/>
<key key0="т" key2="5" key3="%" key4="f12_placeholder"/>
<key key0="ъ" key2="6" key3="^" key4="€"/>
<key key0="у" key2="7" key3="&amp;" key4="§"/>
<key key0="и" key2="8" key3="*"/>

View File

@ -11,8 +11,8 @@
<key key0="ш" key2="8" key3="*"/>
<key key0="щ" key2="9" key3="(" key4=")"/>
<key key0="з" key2="0"/>
<key key0="х" key1="{" key2="}"/>
<key key0="ъ" key1="[" key2="]" />
<key key0="х" key1="{" key2="}" key4="f11_placeholder"/>
<key key0="ъ" key1="[" key2="]" key4="f12_placeholder"/>
</row>
<row>
<key shift="0.5" key0="ф" key1="tab" key2="`"/>

View File

@ -28,8 +28,8 @@
<row height="0.95">
<key width="1.5" key0="ctrl" key3="switch_text"/>
<key width="1.5" key0="0"/>
<key width="0.75" key0="." key1=":" key2=","/>
<key width="0.75" key0="space" key1="&quot;" key2="'" key4="_"/>
<key width="0.75" key0="." key1=":" key2="," key3="f11_placeholder"/>
<key width="0.75" key0="space" key1="&quot;" key2="'" key3="f12_placeholder" key4="_"/>
<key width="1.5" key0="enter" key1="±" key2="action" key3="="/>
</row>
</keyboard>

View File

@ -10,7 +10,7 @@
<key key0="u" key2="7" key3="&amp;"/>
<key key0="i" key2="8" key3="*"/>
<key key0="o" key1="accent_macron" key2="9" key3="(" key4=")"/>
<key key0="p" key2="0"/>
<key key0="p" key2="0" key3="f11_placeholder" key4="f12_placeholder"/>
</row>
<row>
<key shift="0.5" key0="a" key1="tab" key2="`"/>

View File

@ -10,7 +10,7 @@
<key key0="u" key2="7" key3="&amp;"/>
<key key0="i" key2="8" key3="*"/>
<key key0="o" key2="9" key3="(" key4=")"/>
<key key0="p" key2="0"/>
<key key0="p" key2="0" key3="f11_placeholder" key4="f12_placeholder"/>
</row>
<row>
<key key0="a" key2="`" key3="tab" key4="¡"/>

View File

@ -4,8 +4,8 @@
<key key0="q" key1="esc" key2="1" key3="~" key4="!"/>
<key key0="w" key2="2" key3="\@"/>
<key key0="e" key1="ē" key2="3" key3="\#" key4="€"/>
<key key0="r" key1="ŗ" key2="4" key3="$"/>
<key key0="t" key2="5" key3="%"/>
<key key0="r" key1="ŗ" key2="4" key3="$" key4="f11_placeholder"/>
<key key0="t" key2="5" key3="%" key4="f12_placeholder"/>
<key key0="y" key2="6" key3="^"/>
<key key0="u" key1="ū" key2="7" key3="&amp;"/>
<key key0="i" key1="ī" key2="8" key3="*"/>

View File

@ -4,8 +4,8 @@
<key key0="q" key1="esc" key2="1" key3="~" key4="!"/>
<key key0="w" key2="2" key3="\@"/>
<key key0="e" key1="£" key2="3" key3="\#" key4="€"/>
<key key0="r" key2="4" key3="$"/>
<key key0="t" key2="5" key3="%"/>
<key key0="r" key2="4" key3="$" key4="f11_placeholder"/>
<key key0="t" key2="5" key3="%" key4="f12_placeholder"/>
<key key0="y" key1="accent_caron" key2="6" key3="^" key4="accent_trema"/>
<key key0="u" key2="7" key3="&amp;"/>
<key key0="i" key2="8" key3="*"/>

View File

@ -5,38 +5,37 @@
<key key0="w" key2="2" key4="\@"/>
<key key0="e" key2="3" key4="\#" key3="€"/>
<key key0="r" key2="4" key4="$"/>
<key key0="t" key2="5" key3="&amp;" key4="|" />
<key key0="t" key2="5" key3="&amp;" key4="|"/>
<key key0="y" key2="6" key3="^" key4="%"/>
<key key0="u" key2="7" key3="~" key4="\\" />
<key key0="i" key2="8" key3="*" key4="/" />
<key key0="u" key2="7" key3="~" key4="\\"/>
<key key0="i" key2="8" key3="*" key4="/"/>
<key key0="o" key2="9" key3="+" key4="-"/>
<key key0="p" key2="0" key3="=" />
<key key0="å" key1="\?" key3="!" key2="`" />
<key key0="p" key2="0" key3="=" key4="f11_placeholder"/>
<key key0="å" key1="\?" key3="!" key2="`" key4="f12_placeholder"/>
</row>
<row>
<key key0="a" key1="tab" />
<key key0="a" key1="tab"/>
<key key0="s" key1="accent_ring" key2="accent_cedille" key3="ß" key4="accent_tilde"/>
<key key0="d" key1="accent_grave" key2="accent_caron" key3="accent_aigu"/>
<key key0="f" key1="accent_trema" key2="accent_circonflexe"/>
<key key0="g" />
<key key0="h" />
<key key0="j" key1="{" key4="}" />
<key key0="k" key1="[" key4="]" />
<key key0="l" key1="(" key4=")" />
<key key0="ö" key1="&lt;" key4="&gt;" />
<key key0="g"/>
<key key0="h"/>
<key key0="j" key1="{" key4="}"/>
<key key0="k" key1="[" key4="]"/>
<key key0="l" key1="(" key4=")"/>
<key key0="ö" key1="&lt;" key4="&gt;"/>
<key key0="ä" key1="'" key3="&quot;"/>
</row>
<row>
<key width="1.5" key0="shift"/>
<key key0="z" />
<key key0="x" />
<key key0="c" />
<key key0="v" />
<key key0="z"/>
<key key0="x"/>
<key key0="c"/>
<key key0="v"/>
<key key0="b" key2=";" key4=","/>
<key key0="n" key2=":" key4="."/>
<key key0="m" key2="-" key4="_"/>
<key width="1.0" key0="." key1="!" key2="\?" key3="'" key4="," />
<key width="1.0" key0="." key1="!" key2="\?" key3="'" key4=","/>
<key width="1.5" key0="backspace" key2="delete"/>
</row>
</keyboard>

View File

@ -4,8 +4,8 @@
<key key0="q" key1="esc" key2="1" key3="\@" key4="!"/>
<key key0="w" key1="^" key2="2" key3="&quot;"/>
<key key0="e" key1="§" key2="3" key4="€"/>
<key key0="r" key2="4" key3="$"/>
<key key0="t" key2="5" key3="%"/>
<key key0="r" key2="4" key3="$" key4="f11_placeholder"/>
<key key0="t" key2="5" key3="%" key4="f12_placeholder"/>
<key key0="z" key2="6" key3="&amp;" key4="{"/>
<key key0="u" key2="7" key3="ü" key4="}"/>
<key key0="i" key1="(" key2="8" key4="["/>

View File

@ -7,27 +7,29 @@ import java.util.HashMap;
class KeyModifier
{
/* Cache key is KeyValue's name */
/** Cache key is KeyValue's name */
private static HashMap<String, SparseArray<KeyValue>> _cache =
new HashMap<String, SparseArray<KeyValue>>();
/* Modify a key according to modifiers. */
/** Represents a removed key, because a cache entry can't be [null]. */
private static final KeyValue removed_key = KeyValue.getKeyByName("removed");
/** Modify a key according to modifiers. */
public static KeyValue handleFlags(KeyValue k, int flags)
{
if (k == null || flags == 0) // No modifier
return k;
if (k == null)
return null;
SparseArray<KeyValue> ks = cacheEntry(k);
KeyValue r = ks.get(flags);
if (r != null) // Found in cache
return r;
r = k;
r = handleFn(r, flags);
if (r != null)
if (r == null) // Cold cache
{
r = k;
r = handleFn(r, flags);
r = handleShift(r, flags);
if (r != null)
r = handleAccents(r, flags);
ks.put(flags, r);
return r;
ks.put(flags, r);
}
return (r == removed_key) ? null : r;
}
private static KeyValue handleAccents(KeyValue k, int flags)
@ -185,7 +187,15 @@ class KeyModifier
private static KeyValue handleFn(KeyValue k, int flags)
{
if ((flags & KeyValue.FLAG_FN) == 0)
return k;
{
switch (k.name)
{
// Remove some keys when Fn is *not* activated
case "f11_placeholder":
case "f12_placeholder": return removed_key;
default: return k;
}
}
String name;
switch (k.name)
{
@ -199,6 +209,8 @@ class KeyModifier
case "8": name = "f8"; break;
case "9": name = "f9"; break;
case "0": name = "f10"; break;
case "f11_placeholder": name = "f11"; break;
case "f12_placeholder": name = "f12"; break;
case "up": name = "page_up"; break;
case "down": name = "page_down"; break;
case "left": name = "home"; break;
@ -213,7 +225,7 @@ class KeyModifier
case "#": name = "£"; break;
case "*": name = "°"; break;
case "tab": name = "\\t"; break;
case "": case "£": return null; // Avoid showing these twice
case "": case "£": return removed_key; // Avoid showing these twice
default: return k;
}
return KeyValue.getKeyByName(name);

View File

@ -259,6 +259,8 @@ class KeyValue
addEventKey("f8", "F8", KeyEvent.KEYCODE_F8);
addEventKey("f9", "F9", KeyEvent.KEYCODE_F9);
addEventKey("f10", "F10", KeyEvent.KEYCODE_F10);
addEventKey("f11", "F11", KeyEvent.KEYCODE_F11, FLAG_SMALLER_FONT);
addEventKey("f12", "F12", KeyEvent.KEYCODE_F12, FLAG_SMALLER_FONT);
addEventKey("tab", "", KeyEvent.KEYCODE_TAB);
addKey("\\t", "\\t", '\t', EVENT_NONE, 0); // Send the tab character