Skip to content
Snippets Groups Projects
Unverified Commit 9395f246 authored by Oliver Smith's avatar Oliver Smith
Browse files

src/keyboard.cpp: same layout as squeekboard (MR 86)

Layers 2 and 3 had several duplicate keys, and the '}' key was missing.
Let's just use the same layout as squeekboard. Notably, this adds a
period key (".") next to the space key.

This layout has all the keys from both previous layouts, except for:

	∑, ∞, ≈

I think it's fine to make this change, since postmarketOS is still in
beta. If somebody happens to use these in their passwords, they could
install the telnet initramfs hook and change their password, if
necessary.
parent f0e8a825
No related branches found
No related tags found
No related merge requests found
......@@ -273,9 +273,13 @@ SDL_Surface *Keyboard::makeKeyboard(KeyboardLayer *layer) {
}
char space[] = " ";
drawKey(surface, &layer->keyList, colw*5, y, colw*10, rowHeight,
drawKey(surface, &layer->keyList, colw*5, y, colw*8, rowHeight,
space, &KEYCAP_SPACE, this->keyboardWidth / 100, font);
char period[] = ".";
drawKey(surface, &layer->keyList, colw*13, y, colw*2, rowHeight,
period, &KEYCAP_PERIOD, this->keyboardWidth / 100, font);
char enter[] = "OK";
drawKey(surface, &layer->keyList, colw*15, y, colw*5, rowHeight,
enter, &KEYCAP_RETURN, this->keyboardWidth / 100, font);
......@@ -304,6 +308,14 @@ int Keyboard::getActiveLayer() {
* This function is not actually parsing any external keymaps, it's currently
* filling in the keyboardKeymap object with a US/QWERTY layout until parsing
* from a file is implemented
*
* Be careful when changing the layout, you could lock somebody out who is
* using these symbols in their password!
*
* If the symbols are changed, then the check for allowed characters in
* postmarketos-ondev#14 needs to be adjusted too. This has the same layout as
* squeekboard now:
* https://source.puri.sm/Librem5/squeekboard/-/blob/master/data/keyboards/us.yaml
*/
void Keyboard::loadKeymap() {
KeyboardLayer layer0, layer1, layer2, layer3;
......@@ -320,13 +332,13 @@ void Keyboard::loadKeymap() {
layer1.layerNum = 1;
layer2.rows[0] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"};
layer2.rows[1] = {"@", "#", "$", "%", "&", "-", "_", "(", ")"};
layer2.rows[2] = {KEYCAP_SHIFT, ",", "\"", "'", ":", "!", "?", "+", KEYCAP_BACKSPACE};
layer2.rows[1] = {"@", "#", "$", "%", "&", "-", "_", "+", "(", ")"};
layer2.rows[2] = {KEYCAP_SHIFT, ",", "\"", "'", ":", ";", "!", "?", KEYCAP_BACKSPACE};
layer2.layerNum = 2;
layer3.rows[0] = {"~", "`", "=", "[", "]", "^", "/", "\\", "(", ")"};
layer3.rows[1] = {";", ":", "'", "\"", ",", ".", "<", ">", "{"};
layer3.rows[2] = {KEYCAP_SHIFT, "|", "\u20a4", "\u20ac", "\u2211", "\u221e", "\u221a", "\u2248", KEYCAP_BACKSPACE};
layer3.rows[0] = {"~", "`", "|", "·", "", "π", "τ", "÷", "×", ""};
layer3.rows[1] = {"©", "®", "£", "", "¥", "^", "°", "*", "{", "}"};
layer3.rows[2] = {KEYCAP_SHIFT, "\\", "/", "<", ">", "=", "[", "]", KEYCAP_BACKSPACE};
layer3.layerNum = 3;
this->keyboard.push_back(layer0);
......
......@@ -35,6 +35,7 @@ const string KEYCAP_SYMBOLS = "SYM";
const string KEYCAP_ABC = "abc";
const string KEYCAP_SPACE = " ";
const string KEYCAP_RETURN = "\n";
const string KEYCAP_PERIOD = ".";
struct touchArea {
string keyChar;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment