Keyboard: better isolation of FR/ES/TR from EN base

dofile() wasn't enough to copy en_keyboard, as the references
to key popups would still be shared, and hacks to them (as
done by the FR keyboard) would be active on the EN keyboard.
Also, for the FR Keyboard:
- bring M key popup too when moving it to 2nd row.
- keep original ',' and '.' as on EN keyboard.
- add ';' instead of ',' as the added key, and let it have
  some key popup too, with keys helpful when CSS editing.
reviewable/pr6248/r1
poire-z 4 years ago
parent 9af693f84c
commit c1be488a11

@ -1,5 +1,5 @@
-- Start with the english keyboard layout
local es_keyboard = dofile("frontend/ui/data/keyboardlayouts/en_keyboard.lua")
-- Start with the english keyboard layout (deep copy, to not alter it)
local es_keyboard = require("util").tableDeepCopy(require("ui/data/keyboardlayouts/en_keyboard"))
local keys = es_keyboard.keys

@ -1,5 +1,5 @@
-- Start with the english keyboard layout
local fr_keyboard = dofile("frontend/ui/data/keyboardlayouts/en_keyboard.lua")
-- Start with the english keyboard layout (deep copy, to not alter it)
local fr_keyboard = require("util").tableDeepCopy(require("ui/data/keyboardlayouts/en_keyboard"))
-- Swap the four AZWQ keys (only in the lowercase and
-- uppercase letters layouts) to change it from QWERTY to AZERTY
@ -14,14 +14,30 @@ table.insert(keys[2],
-- 1 2 3 4 5 6 7 8
{ "M", "m", "§", "+", "Œ", "œ", "Ő", "ő", }
)
-- And swap the english M on the 3rd row to ','
keys[3][8][1] = ","
keys[3][8][2] = ","
-- And swap the english ',' on the 4th row (an extended key
-- including a popup) to ';'
local en_com = keys[4][5][1]
en_com[1] = ";"
en_com.north = "," -- and swap the ';' there to ','
-- But replace the alpha "M" and "m" with the original key+popup from english M/m
keys[2][10][1] = keys[3][8][1]
keys[2][10][2] = keys[3][8][2]
-- We have one more key than en_keyboard: replace that original M key
-- to show another char on alpha layouts: let's use ";", and a popup
-- helpful for CSS style tweaks editing.
local _semicolon = {
";",
-- north = "!",
north = { label = "!…", key = "!important;" },
northeast = "}",
northwest = "{",
west = "-",
east = ":",
south = "*",
southwest = "0",
southeast = ">",
"[",
'+',
"]",
}
keys[3][8][1] = _semicolon
keys[3][8][2] = _semicolon
-- Swap ê and ë (and the like) in the keyboard popups, so the
-- common french accentuated chars are all on the upper row.

@ -1,5 +1,5 @@
-- Start with the english keyboard layout
local tr_keyboard = dofile("frontend/ui/data/keyboardlayouts/en_keyboard.lua")
-- Start with the english keyboard layout (deep copy, to not alter it)
local tr_keyboard = require("util").tableDeepCopy(require("ui/data/keyboardlayouts/en_keyboard"))
local keys = tr_keyboard.keys
@ -68,4 +68,4 @@ keys[4][4].label = "boşluk"
--keys[4][1].width = 1
--keys[4][3].width = 1
return tr_keyboard
return tr_keyboard

@ -132,6 +132,9 @@ function VirtualKey:init()
local key_function = self.key_chars[ges.direction.."_func"]
if not key_function and key_string then
if type(key_string) == "table" and key_string.key then
key_string = key_string.key
end
self.keyboard:addChar(key_string)
elseif key_function then
key_function()

Loading…
Cancel
Save