Merge remote-tracking branch 'upstream/master' into latch

This commit is contained in:
Dorota Czaplejewicz
2021-03-31 09:48:29 +00:00
57 changed files with 2175 additions and 292 deletions

44
Cargo.lock generated
View File

@ -59,9 +59,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.65" version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95752358c8f7552394baf48cd82695b345628ad3f170d607de3ca03b8dacca15" checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
[[package]] [[package]]
name = "clap" name = "clap"
@ -76,9 +76,9 @@ dependencies = [
[[package]] [[package]]
name = "dtoa" name = "dtoa"
version = "0.4.6" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e"
[[package]] [[package]]
name = "fragile" name = "fragile"
@ -265,15 +265,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.80" version = "0.2.82"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614" checksum = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929"
[[package]] [[package]]
name = "linked-hash-map" name = "linked-hash-map"
version = "0.5.3" version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
[[package]] [[package]]
name = "maplit" name = "maplit"
@ -335,9 +335,9 @@ dependencies = [
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.7" version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -353,9 +353,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.6.21" version = "0.6.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
[[package]] [[package]]
name = "rs" name = "rs"
@ -380,18 +380,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.117" version = "1.0.118"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a" checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.117" version = "1.0.118"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -400,9 +400,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_yaml" name = "serde_yaml"
version = "0.8.14" version = "0.8.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7baae0a99f1a324984bcdc5f0718384c1f69775f1c7eec8b859b71b443e3fd7" checksum = "971be8f6e4d4a47163b405a3df70d14359186f9ab0f3a3ec37df144ca1ce089f"
dependencies = [ dependencies = [
"dtoa", "dtoa",
"linked-hash-map", "linked-hash-map",
@ -412,9 +412,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.48" version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" checksum = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -476,9 +476,9 @@ dependencies = [
[[package]] [[package]]
name = "yaml-rust" name = "yaml-rust"
version = "0.4.4" version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d" checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
dependencies = [ dependencies = [
"linked-hash-map", "linked-hash-map",
] ]

49
cargo_build.py Normal file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env python3
"""This script manages Cargo builds
while keeping the artifact directory within the build tree
instead of the source tree.
"""
from pathlib import Path
import shlex
import subprocess
import sys
source_dir = Path(__file__).absolute().parent
args = sys.argv[1:]
binary_dir = "debug"
if '--release' in args:
binary_dir = "release"
# The file produced by Cargo will have a special name
try:
i = args.index('--rename')
except ValueError:
filename = None
else:
args.pop(i)
filename = args.pop(i)
# The target destination of the produced file is a positional argument
out_path = [arg for arg in args if not arg.startswith('--')]
if out_path:
out_path = out_path[0]
i = args.index(out_path)
args.pop(i)
subprocess.run(['sh', "{}/cargo.sh".format(shlex.quote(source_dir.as_posix())), 'build']
+ args,
check=True)
if out_path:
out_path = Path(out_path).absolute()
out_basename = out_path.name
filename = filename or out_basename
subprocess.run(['cp', '-a',
'./{}/{}'.format(shlex.quote(binary_dir), shlex.quote(filename)),
out_path],
check=True)

View File

@ -1,34 +0,0 @@
#!/bin/sh
# This script manages Cargo builds
# while keeping the artifact directory within the build tree
# instead of the source tree
set -e
SCRIPT_PATH="$(realpath "$0")"
SOURCE_DIR="$(dirname "$SCRIPT_PATH")"
RELEASE=""
BINARY_DIR="debug"
if [ "${1}" = "--release" ]; then
shift
BINARY_DIR="release"
RELEASE="--release"
fi
if [ "${1}" = "--rename" ]; then
shift
FILENAME="${1}"
shift
fi
OUT_PATH="$(realpath "${1}")"
shift
OUT_BASENAME="$(basename "${OUT_PATH}")"
FILENAME="${FILENAME:-"${OUT_BASENAME}"}"
sh "$SOURCE_DIR"/cargo.sh build $RELEASE "$@"
if [ -n "${OUT_PATH}" ]; then
cp -a ./"${BINARY_DIR}"/"${FILENAME}" "${OUT_PATH}"
fi

78
data/keyboards/bg.yaml Normal file
View File

@ -0,0 +1,78 @@
---
outlines:
default: { width: 32.72, height: 52 }
altline: { width: 47, height: 52 }
wide: { width: 49.09, height: 52 }
spaceline: { width: 185, height: 52 }
special: { width: 44, height: 52 }
views:
base:
- "я в е р т ъ у и о п ю"
- "а с д ф г х й к л ш щ"
- "Shift_L з ь ц ж б н м ч BackSpace"
- "show_numbers preferences space . Return"
upper:
- В Е Р Т Ъ У И О П Ю"
- "А С Д Ф Г Х Й К Л Ш Щ"
- "Shift_L З Ь Ц Ж Б Н М Ч BackSpace"
- "show_numbers preferences space , Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "@ # € % & - _ + ( )"
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "show_letters preferences space Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ $ ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences space Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: erase
preferences:
action: "show_prefs"
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "abc"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"
"\"":
keysym: "quotedbl"

View File

@ -0,0 +1,106 @@
---
outlines:
default: { width: 35.33, height: 52 }
altline: { width: 52.67, height: 52 }
wide: { width: 52.67, height: 52 }
spaceline: { width: 106, height: 52 }
special: { width: 35.33, height: 52 }
views:
base:
- "q w e r t y u i o p"
- "a s d f g h j k l"
- "Shift_L z x c v b n m BackSpace"
- "show_numbers preferences show_accents space , . Return"
upper:
- "Q W E R T Y U I O P"
- "A S D F G H J K L"
- "Shift_L Z X C V B N M BackSpace"
- "show_numbers preferences show_upper_accents space ! ? Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "@ # $ % & - _ + ( )"
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "show_letters preferences show_accents space , . Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ € ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences show_accents space , . Return"
accents:
- "ä ě é ř ť ý ů í ó ö"
- "á š ď ë ŕ ú ü ô ľ"
- "accents_Shift_L ž ß č ç ñ ň ĺ BackSpace"
- "show_letters preferences show_accents space , . Return"
upper_accents:
- "Ä Ě É Ř Ť Ý Ů Í Ó Ö"
- "Á Š Ď Ë Ŕ Ú Ü Ô Ľ"
- "accents_Shift_L Ž ẞ Č Ç Ñ Ň Ĺ BackSpace"
- "show_letters preferences show_upper_accents space , . Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
accents_Shift_L:
action:
locking:
lock_view: "upper_accents"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: erase
preferences:
action: show_prefs
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "abc"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
show_accents:
action:
locking:
lock_view: "accents"
unlock_view: "base"
outline: "special"
label: "á"
show_upper_accents:
action:
locking:
lock_view: "upper_accents"
unlock_view: "base"
outline: "special"
label: "Á"
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"

View File

@ -0,0 +1,106 @@
---
outlines:
default: { width: 54, height: 42 }
altline: { width: 81, height: 42 }
wide: { width: 81, height: 42 }
spaceline: { width: 162, height: 42 }
special: { width: 54, height: 42 }
views:
base:
- "q w e r t y u i o p"
- "a s d f g h j k l"
- "Shift_L z x c v b n m BackSpace"
- "show_numbers preferences show_accents space , . Return"
upper:
- "Q W E R T Y U I O P"
- "A S D F G H J K L"
- "Shift_L Z X C V B N M BackSpace"
- "show_numbers preferences show_upper_accents space ! ? Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "@ # $ % & - _ + ( )"
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "show_letters preferences show_accents space , . Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ € ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences show_accents space , . Return"
accents:
- "ä ě é ř ť ý ů í ó ö"
- "á š ď ë ŕ ú ü ô ľ"
- "accents_Shift_L ž ß č ç ñ ň ĺ BackSpace"
- "show_letters preferences show_accents space , . Return"
upper_accents:
- "Ä Ě É Ř Ť Ý Ů Í Ó Ö"
- "Á Š Ď Ë Ŕ Ú Ü Ô Ľ"
- "accents_Shift_L Ž ẞ Č Ç Ñ Ň Ĺ BackSpace"
- "show_letters preferences show_upper_accents space , . Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
accents_Shift_L:
action:
locking:
lock_view: "upper_accents"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: erase
preferences:
action: show_prefs
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "abc"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
show_accents:
action:
locking:
lock_view: "accents"
unlock_view: "base"
outline: "special"
label: "á"
show_upper_accents:
action:
locking:
lock_view: "upper_accents"
unlock_view: "base"
outline: "special"
label: "Á"
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"

106
data/keyboards/cz.yaml Normal file
View File

@ -0,0 +1,106 @@
---
outlines:
default: { width: 35.33, height: 52 }
altline: { width: 52.67, height: 52 }
wide: { width: 52.67, height: 52 }
spaceline: { width: 106, height: 52 }
special: { width: 35.33, height: 52 }
views:
base:
- "q w e r t z u i o p"
- "a s d f g h j k l"
- "Shift_L y x c v b n m BackSpace"
- "show_numbers preferences show_accents space , . Return"
upper:
- "Q W E R T Z U I O P"
- "A S D F G H J K L"
- "Shift_L Y X C V B N M BackSpace"
- "show_numbers preferences show_upper_accents space ! ? Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "@ # $ % & - _ + ( )"
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "show_letters preferences show_accents space , . Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ € ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences show_accents space , . Return"
accents:
- "ä ě é ř ť ž ů í ó ö"
- "á š ď ë ŕ ú ü ô ľ"
- "accents_Shift_L ý ß č ç ñ ň ĺ BackSpace"
- "show_letters preferences show_accents space , . Return"
upper_accents:
- "Ä Ě É Ř Ť Ž Ů Í Ó Ö"
- "Á Š Ď Ë Ŕ Ú Ü Ô Ľ"
- "accents_Shift_L Ý ẞ Č Ç Ñ Ň Ĺ BackSpace"
- "show_letters preferences show_upper_accents space , . Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
accents_Shift_L:
action:
locking:
lock_view: "upper_accents"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: erase
preferences:
action: show_prefs
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "abc"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
show_accents:
action:
locking:
lock_view: "accents"
unlock_view: "base"
outline: "special"
label: "á"
show_upper_accents:
action:
locking:
lock_view: "upper_accents"
unlock_view: "base"
outline: "special"
label: "Á"
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"

106
data/keyboards/cz_wide.yaml Normal file
View File

@ -0,0 +1,106 @@
---
outlines:
default: { width: 54, height: 42 }
altline: { width: 81, height: 42 }
wide: { width: 81, height: 42 }
spaceline: { width: 162, height: 42 }
special: { width: 54, height: 42 }
views:
base:
- "q w e r t z u i o p"
- "a s d f g h j k l"
- "Shift_L y x c v b n m BackSpace"
- "show_numbers preferences show_accents space , . Return"
upper:
- "Q W E R T Z U I O P"
- "A S D F G H J K L"
- "Shift_L Y X C V B N M BackSpace"
- "show_numbers preferences show_upper_accents space ! ? Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "@ # $ % & - _ + ( )"
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "show_letters preferences show_accents space , . Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ € ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences show_accents space , . Return"
accents:
- "ä ě é ř ť ž ů í ó ö"
- "á š ď ë ŕ ú ü ô ľ"
- "accents_Shift_L ý ß č ç ñ ň ĺ BackSpace"
- "show_letters preferences show_accents space , . Return"
upper_accents:
- "Ä Ě É Ř Ť Ž Ů Í Ó Ö"
- "Á Š Ď Ë Ŕ Ú Ü Ô Ľ"
- "accents_Shift_L Ý ẞ Č Ç Ñ Ň Ĺ BackSpace"
- "show_letters preferences show_upper_accents space , . Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
accents_Shift_L:
action:
locking:
lock_view: "upper_accents"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: erase
preferences:
action: show_prefs
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "abc"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
show_accents:
action:
locking:
lock_view: "accents"
unlock_view: "base"
outline: "special"
label: "á"
show_upper_accents:
action:
locking:
lock_view: "upper_accents"
unlock_view: "base"
outline: "special"
label: "Á"
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"

81
data/keyboards/epo.yaml Normal file
View File

@ -0,0 +1,81 @@
---
outlines:
default: { width: 35.33, height: 52 }
altline: { width: 52.67, height: 52 }
wide: { width: 62, height: 52 }
spaceline: { width: 99.67, height: 52 }
special: { width: 35.33, height: 52 }
views:
base:
- "q w e r t y u i o p"
- "a s d f g h j k l"
- "Shift_L z x c v b n m BackSpace"
- "show_numbers show_eschars preferences space , . Return"
upper:
- "Q W E R T Y U I O P"
- "A S D F G H J K L"
- "Shift_L Z X C V B N M BackSpace"
- "show_numbers show_eschars preferences space ! ? Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "@ # $ % & - _ + ( )"
- "show_symbols , \" ' : ; ! ? BackSpace"
- "show_letters preferences space . Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ € ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences space . Return"
eschars:
- "ĉ ĝ ĥ ĵ ŝ ŭ ?"
- "Ĉ Ĝ Ĥ Ĵ Ŝ Ŭ !"
- "show_numbers ' - 🐊 💚 🌐 . BackSpace"
- "show_letters show_eschars preferences space „ “ Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: "erase"
preferences:
action: "show_prefs"
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "altline"
label: "abc"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
show_eschars:
action:
locking:
lock_view: "eschars"
unlock_view: "base"
outline: "altline"
label: "ŭŜ"
space:
outline: "spaceline"
label: " "
text: " "
Return:
outline: "altline"
icon: "key-enter"
keysym: "Return"

View File

@ -0,0 +1,87 @@
---
outlines:
default: { width: 35.33, height: 52 }
altline: { width: 52.67, height: 52 }
wide: { width: 62, height: 52 }
spaceline: { width: 99.67, height: 52 }
special: { width: 44, height: 52 }
views:
base:
- "q w e r t y u i o p"
- "a s d f g h j k l ç"
- "Shift_L z x c v b n m BackSpace"
- "show_numbers show_eschars preferences space ? period Return"
upper:
- "Q W E R T Y U I O P"
- "A S D F G H J K L Ç"
- "Shift_L Z X C V B N M BackSpace"
- "show_numbers show_eschars preferences space ¿ period Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "@ # € % & - _ + ( )"
- "show_symbols , \" ' colon ; ! = BackSpace"
- "show_letters show_eschars preferences space ? period Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ $ ¥ ^ ° * { }"
- "show_numbers \\ / < > = [ ] BackSpace"
- "show_letters show_eschars preferences space ? period Return"
eschars:
- "á é í ó ú Á É Í Ó Ú"
- "à è ì ò ù À È Ì Ò Ù"
- "show_numbers ü ç ï Ü Ç Ï ¡ BackSpace"
- "show_letters show_eschars preferences space « » Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: "erase"
preferences:
action: "show_prefs"
outline: "default"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "altline"
label: "abc"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
show_eschars:
action:
locking:
lock_view: "eschars"
unlock_view: "base"
outline: "altline"
label: "àÀ"
period:
outline: "default"
text: "."
space:
outline: "spaceline"
text: " "
Return:
outline: "altline"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"

71
data/keyboards/il.yaml Normal file
View File

@ -0,0 +1,71 @@
---
outlines:
default: { width: 40, height: 60 }
altline: { width: 56, height: 60 }
wide: { width: 62, height: 60 }
spaceline: { width: 142, height: 60 }
special: { width: 44, height: 60 }
views:
base:
- "' - ק ר א ט ו ן ם פ"
- "ש ד ג כ ע י ח ל ך ף"
- ס ב ה נ מ צ ת ץ BackSpace"
- "show_numbers comma preferences space period Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "@ # ₪ % & - _ + ( )"
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "show_letters preferences space period Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ € $ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences space period Return"
buttons:
BackSpace:
outline: "default"
icon: "edit-clear-symbolic"
action: erase
comma:
outline: "special"
text: ","
preferences:
action: show_prefs
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "ABC"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
period:
outline: "special"
text: "."
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"

78
data/keyboards/ir.yaml Normal file
View File

@ -0,0 +1,78 @@
---
outlines:
default: { width: 35.33, height: 52 }
altline: { width: 52.67, height: 52 }
wide: { width: 62, height: 52 }
spaceline: { width: 142, height: 52 }
special: { width: 44, height: 52 }
views:
base:
- "ض ص ق ف غ ع ه خ ح ج"
- "ش س ی ب ل ا ت ن م ک"
- "Shift_L ظ ط ز ر ذ د و BackSpace"
- "show_numbers preferences space period Return"
upper:
- "پ { } [ ] ّ َ ِ ُ چ"
- "ؤ‌ ئ ي‌ إ أ آ ة‌ » « گ"
- "Shift_L ك ٓ ژ ء > < ؟ BackSpace"
- "show_numbers preferences space period Return"
numbers:
- "۱ ۲ ۳ ۴ ۵ ۶ ۷ ۸ ۹ ۰"
- "@ # ﷼ % & - _ + ( )"
- "show_symbols , \" ' colon ؛ ! ? BackSpace"
- "show_letters preferences space period Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ € ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences space period Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: erase
preferences:
action: show_prefs
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "ABC"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
period:
outline: "special"
text: "."
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"

View File

@ -0,0 +1,78 @@
---
outlines:
default: { width: 54, height: 42 }
altline: { width: 81, height: 42 }
wide: { width: 108, height: 42 }
spaceline: { width: 216, height: 42 }
special: { width: 54, height: 42 }
views:
base:
- "ض ص ق ف غ ع ه خ ح ج"
- "ش س ی ب ل ا ت ن م ک"
- "Shift_L ظ ط ز ر ذ د و BackSpace"
- "show_numbers preferences space period Return"
upper:
- "پ { } [ ] ّ َ ِ ُ چ"
- "ؤ‌ ئ ي‌ إ أ آ ة‌ » « گ"
- "Shift_L ك ٓ ژ ء > < ؟ BackSpace"
- "show_numbers preferences space period Return"
numbers:
- "۱ ۲ ۳ ۴ ۵ ۶ ۷ ۸ ۹ ۰"
- "@ # ﷼ % & - _ + ( )"
- "show_symbols , \" ' colon ؛ ! ? BackSpace"
- "show_letters preferences space period Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ € ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences space period Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: "erase"
preferences:
action: "show_prefs"
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "ABC"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
".":
outline: "special"
text: "."
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"

View File

@ -22,7 +22,7 @@ views:
numbers: numbers:
- "1 2 3 4 5 6 7 8 9 0" - "1 2 3 4 5 6 7 8 9 0"
- "@ # € % & - _ + ( )" - "@ # € % & - _ + ( )"
- "show_symbols , \" ' colon ; ! = BackSpace" - "show_symbols , \" ' : ; ! = BackSpace"
- "show_letters show_eschars preferences space ? . Return" - "show_letters show_eschars preferences space ? . Return"
symbols: symbols:
- "~ ` | · √ π τ ÷ × ¶" - "~ ` | · √ π τ ÷ × ¶"
@ -86,7 +86,4 @@ buttons:
outline: "altline" outline: "altline"
icon: "key-enter" icon: "key-enter"
keysym: "Return" keysym: "Return"
colon:
label: ":"
"\"":
keysym: "quotedbl"

View File

@ -22,7 +22,7 @@ views:
numbers: numbers:
- "1 2 3 4 5 6 7 8 9 0" - "1 2 3 4 5 6 7 8 9 0"
- "@ # € % & - _ + ( )" - "@ # € % & - _ + ( )"
- "show_symbols , \" ' colon ; ! ? BackSpace" - "show_symbols , \" ' : ; ! ? BackSpace"
- "show_letters show_eschars preferences space ? . Return" - "show_letters show_eschars preferences space ? . Return"
symbols: symbols:
- "~ ` | · √ π τ ÷ × ¶" - "~ ` | · √ π τ ÷ × ¶"
@ -84,7 +84,4 @@ buttons:
outline: "altline" outline: "altline"
icon: "key-enter" icon: "key-enter"
keysym: "Return" keysym: "Return"
colon:
label: ":"
"\"":
keysym: "quotedbl"

View File

@ -2,9 +2,9 @@
outlines: outlines:
default: { width: 32, height: 52 } default: { width: 32, height: 52 }
altline: { width: 48.39024, height: 52 } altline: { width: 48.39024, height: 52 }
wide: { width: 62, height: 52 } wide: { width: 64, height: 52 }
outline7: { width: 88.97561, height: 52 } spaceline: { width: 142, height: 52 }
spaceline: { width: 150.5853, height: 52 } special: { width: 44, height: 52 }
views: views:
base: base:
@ -25,7 +25,7 @@ views:
symbols: symbols:
- "~ ` | U00B7 squareroot Greek_pi Greek_tau division multiply paragraph" - "~ ` | U00B7 squareroot Greek_pi Greek_tau division multiply paragraph"
- "copyright U00AE U00A3 EuroSign U00A5 asciicircum degree * { }" - "copyright U00AE U00A3 EuroSign U00A5 asciicircum degree * { }"
- "show_numbers \\ / < > = [ ] BackSpace" - "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences space . Return" - "show_letters preferences space . Return"
buttons: buttons:
@ -42,17 +42,22 @@ buttons:
action: erase action: erase
preferences: preferences:
action: "show_prefs" action: "show_prefs"
outline: "altline" outline: "special"
icon: "keyboard-mode-symbolic" icon: "keyboard-mode-symbolic"
show_numbers: show_numbers:
action: action:
set_view: "numbers" set_view: "numbers"
outline: "altline" outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: altline
label: "123" label: "123"
show_letters: show_letters:
action: action:
set_view: "base" set_view: "base"
outline: "altline" outline: "wide"
label: "ABC" label: "ABC"
show_symbols: show_symbols:
action: action:
@ -60,7 +65,7 @@ buttons:
outline: "altline" outline: "altline"
label: "*/=" label: "*/="
".": ".":
outline: altline outline: "special"
space: space:
outline: spaceline outline: spaceline
text: " " text: " "

View File

@ -0,0 +1,84 @@
---
outlines:
default: { width: 75, height: 56 }
altline: { width: 75, height: 56 }
wide: { width: 135, height: 56 }
spaceline: { width: 450, height: 56 }
spacelinesymbol: { width: 300, height: 56 }
special: { width: 90, height: 56 }
views:
base:
- "ๅ / _ ภ ถ ุ ึ ค ต จ ข ช"
- "ๆ ไ ำ พ ะ ั ี ร น ย บ ล"
- "ฟ ห ก ด เ ้ ่ า ส ว ง ฃ"
- "Shift_L ผ ป แ อ ิ ื ท ม ใ ฝ BackSpace"
- "show_numbers preferences space period Return"
upper:
- "+ ๑ ๒ ๓ ๔ ู ฿ ๕ ๖ ๗ ๘ ๙"
- " \" ฎ ฑ ธ ํ ๊ ณ ฯ ญ ฐ ,"
- "ฤ ฆ ฏ โ ฌ ็ ๋ ษ ศ ซ . ฅ"
- "Shift_L ( ) ฉ ฮ ฺ ์ ? ฒ ฬ ฦ BackSpace"
- "show_numbers preferences space period Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "@ # $ % & - _ + ( )"
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "show_letters preferences spacesymbol period Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ € ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences spacesymbol period Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: erase
preferences:
action: show_prefs
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "กขค"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
period:
outline: "special"
text: "."
space:
outline: "spaceline"
text: " "
spacesymbol:
outline: "spacelinesymbol"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"

View File

@ -0,0 +1,78 @@
---
outlines:
default: { width: 35.33, height: 52 }
altline: { width: 52.67, height: 52 }
wide: { width: 62, height: 52 }
spaceline: { width: 142, height: 52 }
special: { width: 44, height: 52 }
views:
base:
- "q w f p g j l u y"
- "a r s t d h n e i o"
- "Shift_L z x c v b k m BackSpace"
- "show_numbers preferences space period Return"
upper:
- "Q W F P G J L U Y"
- "A R S T D H N E I O"
- "Shift_L Z X C V B K M BackSpace"
- "show_numbers preferences space period Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "@ # $ % & - _ + ( )"
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "show_letters preferences space period Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ € ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences space period Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: erase
preferences:
action: show_prefs
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "ABC"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
period:
outline: "special"
text: "."
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"

View File

@ -0,0 +1,78 @@
---
outlines:
default: { width: 54, height: 42 }
altline: { width: 81, height: 42 }
wide: { width: 108, height: 42 }
spaceline: { width: 216, height: 42 }
special: { width: 54, height: 42 }
views:
base:
- "q w f p g j l u y"
- "a r s t d h n e i o"
- "Shift_L z x c v b k m BackSpace"
- "show_numbers preferences space . Return"
upper:
- "Q W F P G J L U Y"
- "A R S T D H N E I O"
- "Shift_L Z X C V B K M BackSpace"
- "show_numbers preferences space . Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "@ # $ % & - _ + ( )"
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "show_letters preferences space . Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ € ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences space . Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: "erase"
preferences:
action: "show_prefs"
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "ABC"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
".":
outline: "special"
text: "."
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"

View File

@ -0,0 +1,89 @@
---
outlines:
default: { width: 35.33, height: 52 }
altline: { width: 52.67, height: 52 }
wide: { width: 62, height: 52 }
spaceline: { width: 142, height: 52 }
special: { width: 44, height: 52 }
views:
base:
- "Shift_L p y f g c r l BackSpace"
- "a o e u i d h t n s"
- ", q j k x b m w v z"
- "show_numbers preferences space period Return"
upper:
- "Shift_L P Y F G C R L BackSpace"
- "A O E U I D H T N S"
- ", Q J K X B M W V Z"
- "show_numbers preferences space period Return"
numbers:
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "* # $ / & - _ + ( )"
- "1 2 3 4 5 6 7 8 9 0"
- "show_letters preferences space period Return"
symbols:
- "show_numbers_from_symbols \\ % < > = [ ] BackSpace"
- "© ® £ € ¥ ^ ° @ { }"
- "~ ` | · √ π τ ÷ × ¶"
- "show_letters preferences space period Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: "erase"
preferences:
action: "show_prefs"
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "ABC"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
period:
outline: "special"
text: "."
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"
# The US QWERTY layout has fewer letters on the third row, and so has
# the shift & backspace keys placed there. In contrast, the US DVORAK
# layout has fewer letters on the first row, which makes it a good
# choice for the shift & backspace keys. That leads to what may be,
# for many people, an unexpected layout in numbers mode: the numerals
# are on the third row (not the first) so that the backspace key
# remains in a consistent location regardless of mode, without
# sacrificing key width. (Once could argue that in numbers mode, the
# numerals should be closer to the enter key.) As with any keyboard
# layout, familiarity comes with repeated use.

View File

@ -0,0 +1,89 @@
---
outlines:
default: { width: 54, height: 42 }
altline: { width: 81, height: 42 }
wide: { width: 108, height: 42 }
spaceline: { width: 216, height: 42 }
special: { width: 54, height: 42 }
views:
base:
- "Shift_L p y f g c r l BackSpace"
- "a o e u i d h t n s"
- ", q j k x b m w v z"
- "show_numbers preferences space period Return"
upper:
- "Shift_L P Y F G C R L BackSpace"
- "A O E U I D H T N S"
- ", Q J K X B M W V Z"
- "show_numbers preferences space period Return"
numbers:
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "* # $ / & - _ + ( )"
- "1 2 3 4 5 6 7 8 9 0"
- "show_letters preferences space period Return"
symbols:
- "show_numbers_from_symbols \\ % < > = [ ] BackSpace"
- "© ® £ € ¥ ^ ° @ { }"
- "~ ` | · √ π τ ÷ × ¶"
- "show_letters preferences space period Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: "erase"
preferences:
action: "show_prefs"
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "ABC"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
period:
outline: "special"
text: "."
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"
# The US QWERTY layout has fewer letters on the third row, and so has
# the shift & backspace keys placed there. In contrast, the US DVORAK
# layout has fewer letters on the first row, which makes it a good
# choice for the shift & backspace keys. That leads to what may be,
# for many people, an unexpected layout in numbers mode: the numerals
# are on the third row (not the first) so that the backspace key
# remains in a consistent location regardless of mode, without
# sacrificing key width. (Once could argue that in numbers mode, the
# numerals should be closer to the enter key.) As with any keyboard
# layout, familiarity comes with repeated use.

13
data/langs/bg-BG.txt Normal file
View File

@ -0,0 +1,13 @@
bg Български
de Немски
es Испански
emoji Емоджи
fi Френски
gr Гръцки
it Италянски
no Норевежки
pl Полски
ru Руски
se Шведски
terminal Терминал
us Английски (САЩ)

21
data/langs/cs-CZ.txt Normal file
View File

@ -0,0 +1,21 @@
be Belgická
cz Česká
cz+qwerty Česká (QWERTY)
de Německá
dk Dánská
emoji Emoji
es Španělská
fi Finská
fr Francouzská
gr Řecká
it Italská
jp Japonská
jp+kana Japonská (Kana)
no Norská
pl Polská
ru Ruská
se Švédská
terminal Terminál
th Thajská
ua Ukrajinská
us Anglická (USA)

2
data/langs/fa-IR.txt Normal file
View File

@ -0,0 +1,2 @@
emoji ایموجی
terminal ترمینال

19
data/langs/he_IL.txt Normal file
View File

@ -0,0 +1,19 @@
be בלגית
br פורטוגזית (ברזיל)
cz צ'כית
de גרמנית
dk דנית
es ספרדית
emoji אימוג'י
fi פינית
fr צרפתית
gr יוונית
il עברית
it איטלקית
no נורווגית
pl פולנית
ru רוסית
se שוודית
terminal טרמינל
ua אוקראינית
us אנגלית (ארה"ב)

60
debian/changelog vendored
View File

@ -1,3 +1,63 @@
squeekboard (1.12.0pureos0~amber0) amber-phone; urgency=medium
[ Dorota Czaplejewicz ]
* docs: Correct Cargo update instructions
* visibility: Centralize keyboard panel visibility policy and handling
* build: Fix release
* tests: Prefer the env var for finding test layouts
* tests: Explicitly pass source directory to tests
* debian: Build reproducibly
* tests: Allow legacy mode to have much longer tests.
* build: Enable unused warnings in C
* build: Enable wformat to remove warnings about missing wformat
* build: Fail on any C warnings when strict
* data: Made data flow in fallback clearer
* data: Flattened layout fallback function
* layouts: Use base as fallback for alternative layouts
* layouts: Simplify the main flow of source list
* tests: Add some description to the list of tested layouts
* layout_names: Unmess the list of builtin layouts
* dbus: Reset hints if text input missing
* visibility: Stop calling GTK functions from the visibility manager
[ Wannaphong Phatthiyaphaibun ]
* Add thai keyboard
* Update resources.rs
* Update meson.build
* escape " on thai keyboard
[ clonex10100 ]
* Added US Colemak Keyboard Layout
[ Henry-Nicolas Tourneur ]
* d/rules: fix an FTBFS on mips64el with GOT > 64kb
* d/rules: export RUSTFLAGS only on architecture that needs it
* d/rules: export RUSTFLAGS only on architecture that needs it
[ Jiří Stránský ]
* Add Czech keyboard layouts
[ Stefan Grotz ]
* Esperanto keyboard
[ Vladimir ]
* Bulgarian language keyboard layout
[ Vladimir Stoilov ]
* bulgarian add translation and to needed lists
* Fix bulgarian layout size
[ Andreas Rönnquist ]
* no: Use wide button switching between numbers, symbols and base
[ jranaraki ]
* Farsi/Persian keyboard layout
* Farsi/Persian keyboard layout
* Added requirements to resources.rs and meson.build
* Updated the layout to provide more convenient and faster typing experience
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Sun, 10 Jan 2021 09:43:42 +0000
squeekboard (1.11.1) amber-phone; urgency=medium squeekboard (1.11.1) amber-phone; urgency=medium
[ Mark Müller ] [ Mark Müller ]

View File

@ -5,6 +5,7 @@ Feed it the first changelog line, and then all available tags.
""" """
import re, sys import re, sys
tag = "v" + re.findall("\\((.*)\\)", input())[0] version = re.findall("\\((.*)\\)", input())[0]
tag = 'v' + re.findall("([0-9]+\\.[0-9]+\\.[0-9]+).*", version)[0]
if tag not in map(str.strip, sys.stdin.readlines()): if tag not in map(str.strip, sys.stdin.readlines()):
raise Exception("Changelog's current version doesn't have a tag. Push the tag!") raise Exception("Changelog's current version doesn't have a tag. Push the tag!")

1
debian/control vendored
View File

@ -26,6 +26,7 @@ Build-Depends:
librust-xkbcommon-0.4+wayland-dev (>= 0.4), librust-xkbcommon-0.4+wayland-dev (>= 0.4),
libwayland-dev (>= 1.16), libwayland-dev (>= 1.16),
lsb-release, lsb-release,
python3,
rustc, rustc,
wayland-protocols (>= 1.14), wayland-protocols (>= 1.14),
Standards-Version: 4.1.3 Standards-Version: 4.1.3

16
debian/rules vendored
View File

@ -8,6 +8,22 @@ ifeq ($(DEB_HOST_ARCH),mips64el)
export RUSTFLAGS = -Ctarget-feature=+xgot export RUSTFLAGS = -Ctarget-feature=+xgot
endif endif
# the below avoids an FTBFS on mips64el with a GOT > 64kb
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
ifeq ($(DEB_HOST_ARCH),mips64el)
xgot = -Ctarget-feature=+xgot
else
xgot =
endif
# Don't use paths that may change between builds.
# No need to care about $HOME
# because Cargo will not place any source in ~/.cargo.
# The build directory is a subdirectory of the source directory,
# so it doesn't need to be explicitly taken care of.
export RUSTFLAGS = --remap-path-prefix=$(CURDIR)=/remap-pwd $(xgot)
distrel := $(shell lsb_release --codename --short) distrel := $(shell lsb_release --codename --short)
ifneq (,$(filter $(distrel),buster amber)) ifneq (,$(filter $(distrel),buster amber))
legacy = true legacy = true

View File

@ -45,6 +45,8 @@
typedef struct _EekGtkKeyboardPrivate typedef struct _EekGtkKeyboardPrivate
{ {
EekRenderer *renderer; // owned, nullable EekRenderer *renderer; // owned, nullable
struct render_geometry render_geometry; // mutable
EekboardContextService *eekboard_context; // unowned reference EekboardContextService *eekboard_context; // unowned reference
struct submission *submission; // unowned reference struct submission *submission; // unowned reference
@ -72,12 +74,23 @@ eek_gtk_keyboard_real_realize (GtkWidget *self)
GTK_WIDGET_CLASS (eek_gtk_keyboard_parent_class)->realize (self); GTK_WIDGET_CLASS (eek_gtk_keyboard_parent_class)->realize (self);
} }
static void set_allocation_size(EekGtkKeyboard *gtk_keyboard,
struct squeek_layout *layout, gdouble width, gdouble height)
{
// This is where size-dependent surfaces would be released
EekGtkKeyboardPrivate *priv =
eek_gtk_keyboard_get_instance_private (gtk_keyboard);
priv->render_geometry = eek_render_geometry_from_allocation_size(
layout, width, height);
}
static gboolean static gboolean
eek_gtk_keyboard_real_draw (GtkWidget *self, eek_gtk_keyboard_real_draw (GtkWidget *self,
cairo_t *cr) cairo_t *cr)
{ {
EekGtkKeyboard *keyboard = EEK_GTK_KEYBOARD (self);
EekGtkKeyboardPrivate *priv = EekGtkKeyboardPrivate *priv =
eek_gtk_keyboard_get_instance_private (EEK_GTK_KEYBOARD (self)); eek_gtk_keyboard_get_instance_private (keyboard);
GtkAllocation allocation; GtkAllocation allocation;
gtk_widget_get_allocation (self, &allocation); gtk_widget_get_allocation (self, &allocation);
@ -92,15 +105,14 @@ eek_gtk_keyboard_real_draw (GtkWidget *self,
priv->keyboard, priv->keyboard,
pcontext); pcontext);
eek_renderer_set_allocation_size (priv->renderer, set_allocation_size (keyboard, priv->keyboard->layout,
priv->keyboard->layout, allocation.width, allocation.height);
allocation.width,
allocation.height);
eek_renderer_set_scale_factor (priv->renderer, eek_renderer_set_scale_factor (priv->renderer,
gtk_widget_get_scale_factor (self)); gtk_widget_get_scale_factor (self));
} }
eek_renderer_render_keyboard (priv->renderer, priv->submission, cr, priv->keyboard); eek_renderer_render_keyboard (priv->renderer, priv->render_geometry,
priv->submission, cr, priv->keyboard);
return FALSE; return FALSE;
} }
@ -117,8 +129,9 @@ static void
eek_gtk_keyboard_real_size_allocate (GtkWidget *self, eek_gtk_keyboard_real_size_allocate (GtkWidget *self,
GtkAllocation *allocation) GtkAllocation *allocation)
{ {
EekGtkKeyboard *keyboard = EEK_GTK_KEYBOARD (self);
EekGtkKeyboardPrivate *priv = EekGtkKeyboardPrivate *priv =
eek_gtk_keyboard_get_instance_private (EEK_GTK_KEYBOARD (self)); eek_gtk_keyboard_get_instance_private (keyboard);
// check if the change would switch types // check if the change would switch types
enum squeek_arrangement_kind new_type = get_type( enum squeek_arrangement_kind new_type = get_type(
(uint32_t)(allocation->width - allocation->x), (uint32_t)(allocation->width - allocation->x),
@ -130,10 +143,8 @@ eek_gtk_keyboard_real_size_allocate (GtkWidget *self,
} }
if (priv->renderer) { if (priv->renderer) {
eek_renderer_set_allocation_size (priv->renderer, set_allocation_size (keyboard, priv->keyboard->layout,
priv->keyboard->layout, allocation->width, allocation->height);
allocation->width,
allocation->height);
} }
GTK_WIDGET_CLASS (eek_gtk_keyboard_parent_class)-> GTK_WIDGET_CLASS (eek_gtk_keyboard_parent_class)->
@ -162,7 +173,7 @@ static void depress(EekGtkKeyboard *self,
} }
squeek_layout_depress(priv->keyboard->layout, squeek_layout_depress(priv->keyboard->layout,
priv->submission, priv->submission,
x, y, eek_renderer_get_transformation(priv->renderer), time, self); x, y, priv->render_geometry.widget_to_layout, time, self);
} }
static void drag(EekGtkKeyboard *self, static void drag(EekGtkKeyboard *self,
@ -174,7 +185,7 @@ static void drag(EekGtkKeyboard *self,
} }
squeek_layout_drag(eekboard_context_service_get_keyboard(priv->eekboard_context)->layout, squeek_layout_drag(eekboard_context_service_get_keyboard(priv->eekboard_context)->layout,
priv->submission, priv->submission,
x, y, eek_renderer_get_transformation(priv->renderer), time, x, y, priv->render_geometry.widget_to_layout, time,
priv->eekboard_context, self); priv->eekboard_context, self);
} }
@ -185,8 +196,7 @@ static void release(EekGtkKeyboard *self, guint32 time)
return; return;
} }
squeek_layout_release(eekboard_context_service_get_keyboard(priv->eekboard_context)->layout, squeek_layout_release(eekboard_context_service_get_keyboard(priv->eekboard_context)->layout,
priv->submission, priv->submission, priv->render_geometry.widget_to_layout, time,
eek_renderer_get_transformation(priv->renderer), time,
priv->eekboard_context, self); priv->eekboard_context, self);
} }
@ -396,6 +406,24 @@ eek_gtk_keyboard_new (EekboardContextService *eekservice,
priv->submission = submission; priv->submission = submission;
priv->layout = layout; priv->layout = layout;
priv->renderer = NULL; priv->renderer = NULL;
// This should really be done on initialization.
// Before the widget is allocated,
// we don't really know what geometry it takes.
// When it's off the screen, we also kinda don't.
struct render_geometry initial_geometry = {
// Set to 100 just to make sure if there's any attempt to use it,
// it actually gives plausible results instead of blowing up,
// e.g. on zero division.
.allocation_width = 100,
.allocation_height = 100,
.widget_to_layout = {
.origin_x = 0,
.origin_y = 0,
.scale = 1,
},
};
priv->render_geometry = initial_geometry;
g_signal_connect (eekservice, g_signal_connect (eekservice,
"notify::keyboard", "notify::keyboard",
G_CALLBACK(on_notify_keyboard), G_CALLBACK(on_notify_keyboard),

View File

@ -28,6 +28,7 @@
#include <glib.h> #include <glib.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "eek/eek-renderer.h"
#include "eek/eek-types.h" #include "eek/eek-types.h"
struct submission; struct submission;

View File

@ -193,22 +193,23 @@ render_button_label (cairo_t *cr,
// FIXME: Pass just the active modifiers instead of entire submission // FIXME: Pass just the active modifiers instead of entire submission
void void
eek_renderer_render_keyboard (EekRenderer *self, eek_renderer_render_keyboard (EekRenderer *self,
struct render_geometry geometry,
struct submission *submission, struct submission *submission,
cairo_t *cr, cairo_t *cr,
LevelKeyboard *keyboard) LevelKeyboard *keyboard)
{ {
g_return_if_fail (self->allocation_width > 0.0); g_return_if_fail (geometry.allocation_width > 0.0);
g_return_if_fail (self->allocation_height > 0.0); g_return_if_fail (geometry.allocation_height > 0.0);
/* Paint the background covering the entire widget area */ /* Paint the background covering the entire widget area */
gtk_render_background (self->view_context, gtk_render_background (self->view_context,
cr, cr,
0, 0, 0, 0,
self->allocation_width, self->allocation_height); geometry.allocation_width, geometry.allocation_height);
cairo_save(cr); cairo_save(cr);
cairo_translate (cr, self->widget_to_layout.origin_x, self->widget_to_layout.origin_y); cairo_translate (cr, geometry.widget_to_layout.origin_x, geometry.widget_to_layout.origin_y);
cairo_scale (cr, self->widget_to_layout.scale, self->widget_to_layout.scale); cairo_scale (cr, geometry.widget_to_layout.scale, geometry.widget_to_layout.scale);
squeek_draw_layout_base_view(keyboard->layout, self, cr); squeek_draw_layout_base_view(keyboard->layout, self, cr);
squeek_layout_draw_all_changed(keyboard->layout, self, cr, submission); squeek_layout_draw_all_changed(keyboard->layout, self, cr, submission);
@ -260,8 +261,6 @@ static void
renderer_init (EekRenderer *self) renderer_init (EekRenderer *self)
{ {
self->pcontext = NULL; self->pcontext = NULL;
self->allocation_width = 0.0;
self->allocation_height = 0.0;
self->scale_factor = 1; self->scale_factor = 1;
self->css_provider = squeek_load_style(); self->css_provider = squeek_load_style();
@ -308,22 +307,18 @@ eek_renderer_new (LevelKeyboard *keyboard,
return renderer; return renderer;
} }
void struct render_geometry
eek_renderer_set_allocation_size (EekRenderer *renderer, eek_render_geometry_from_allocation_size (struct squeek_layout *layout,
struct squeek_layout *layout,
gdouble width, gdouble width,
gdouble height) gdouble height)
{ {
g_return_if_fail (width > 0.0 && height > 0.0); struct render_geometry ret = {
.allocation_width = width,
renderer->allocation_width = width; .allocation_height = height,
renderer->allocation_height = height; .widget_to_layout = squeek_layout_calculate_transformation(
layout, width, height),
renderer->widget_to_layout = squeek_layout_calculate_transformation( };
layout, return ret;
renderer->allocation_width, renderer->allocation_height);
// This is where size-dependent surfaces would be released
} }
void void
@ -360,8 +355,3 @@ eek_renderer_get_icon_surface (const gchar *icon_name,
} }
return surface; return surface;
} }
struct transformation
eek_renderer_get_transformation (EekRenderer *renderer) {
return renderer->widget_to_layout;
}

View File

@ -41,22 +41,23 @@ typedef struct EekRenderer
gchar *extra_style; // owned gchar *extra_style; // owned
// Mutable state // Mutable state
gint scale_factor; /* the outputs scale factor */
} EekRenderer;
/// Mutable part of the renderer state.
/// TODO: Possibly should include scale factor.
struct render_geometry {
/// Background extents /// Background extents
gdouble allocation_width; gdouble allocation_width;
gdouble allocation_height; gdouble allocation_height;
gint scale_factor; /* the outputs scale factor */
/// Coords transformation /// Coords transformation
struct transformation widget_to_layout; struct transformation widget_to_layout;
} EekRenderer; };
GType eek_renderer_get_type (void) G_GNUC_CONST; GType eek_renderer_get_type (void) G_GNUC_CONST;
EekRenderer *eek_renderer_new (LevelKeyboard *keyboard, EekRenderer *eek_renderer_new (LevelKeyboard *keyboard,
PangoContext *pcontext); PangoContext *pcontext);
void eek_renderer_set_allocation_size
(EekRenderer *renderer, struct squeek_layout *layout,
gdouble width,
gdouble height);
void eek_renderer_set_scale_factor (EekRenderer *renderer, void eek_renderer_set_scale_factor (EekRenderer *renderer,
gint scale); gint scale);
@ -64,13 +65,14 @@ cairo_surface_t *eek_renderer_get_icon_surface(const gchar *icon_name,
gint size, gint size,
gint scale); gint scale);
void eek_renderer_render_keyboard (EekRenderer *renderer, struct submission *submission, void eek_renderer_render_keyboard (EekRenderer *renderer, struct render_geometry geometry, struct submission *submission,
cairo_t *cr, LevelKeyboard *keyboard); cairo_t *cr, LevelKeyboard *keyboard);
void void
eek_renderer_free (EekRenderer *self); eek_renderer_free (EekRenderer *self);
struct transformation struct render_geometry
eek_renderer_get_transformation (EekRenderer *renderer); eek_render_geometry_from_allocation_size (struct squeek_layout *layout,
gdouble width, gdouble height);
G_END_DECLS G_END_DECLS
#endif /* EEK_RENDERER_H */ #endif /* EEK_RENDERER_H */

View File

@ -1,7 +1,7 @@
project( project(
'squeekboard', 'squeekboard',
'c', 'rust', 'c', 'rust',
version: '1.10.0', version: '1.12.0',
license: 'GPLv3', license: 'GPLv3',
meson_version: '>=0.51.0', meson_version: '>=0.51.0',
default_options: [ default_options: [
@ -23,12 +23,13 @@ add_project_arguments(
'-Werror=parentheses', '-Werror=parentheses',
'-Wformat-nonliteral', '-Wformat-nonliteral',
'-Wformat-security', '-Wformat-security',
'-Wformat',
'-Winit-self', '-Winit-self',
'-Wmaybe-uninitialized', '-Wmaybe-uninitialized',
'-Wold-style-definition', '-Wold-style-definition',
'-Wredundant-decls', '-Wredundant-decls',
'-Wstrict-prototypes', '-Wstrict-prototypes',
'-Wunused-function', '-Wunused',
], ],
language: 'c' language: 'c'
) )
@ -40,6 +41,16 @@ conf_data = configuration_data()
if get_option('buildtype').startswith('debug') if get_option('buildtype').startswith('debug')
add_project_arguments('-DDEBUG=1', language : 'c') add_project_arguments('-DDEBUG=1', language : 'c')
endif endif
if get_option('strict')
add_project_arguments(
[
'-Werror',
],
language: 'c'
)
endif
if get_option('buildtype') != 'plain' if get_option('buildtype') != 'plain'
add_project_arguments('-fstack-protector-strong', language: 'c') add_project_arguments('-fstack-protector-strong', language: 'c')
endif endif
@ -100,7 +111,7 @@ cargo_toml = custom_target(
dep_cargo = find_program('cargo') dep_cargo = find_program('cargo')
cargo_script = find_program('cargo.sh') cargo_script = find_program('cargo.sh')
cargo_build = find_program('cargo_build.sh') cargo_build = find_program('cargo_build.py')
subdir('data') subdir('data')
subdir('protocols') subdir('protocols')

View File

@ -10,3 +10,7 @@ option('tests',
option('legacy', option('legacy',
type: 'boolean', value: false, type: 'boolean', value: false,
description: 'Build with Deban Buster versions of dependencies') description: 'Build with Deban Buster versions of dependencies')
option('strict',
type: 'boolean', value: true,
description: 'Turn more warnings into errors')

View File

@ -294,8 +294,8 @@
The serial number reflects the last state of the zwp_input_method_v2 The serial number reflects the last state of the zwp_input_method_v2
object known to the client. The value of the serial argument must be object known to the client. The value of the serial argument must be
equal to the number of commit requests already issued on that object. equal to the number of done events already issued on that object.
When the compositor receives a done event with a serial different than When the compositor receives a commit request with a serial different than
the number of past commit requests, it must proceed as normal, except the number of past commit requests, it must proceed as normal, except
it should not change the current state of the zwp_input_method_v2 it should not change the current state of the zwp_input_method_v2
object. object.

View File

@ -17,6 +17,7 @@ pub enum Modifier {
/// so it's simple to implement as levels are deprecated in squeekboard. /// so it's simple to implement as levels are deprecated in squeekboard.
Control, Control,
Alt, Alt,
Mod4,
} }
/// Action to perform on the keypress and, in reverse, on keyrelease /// Action to perform on the keypress and, in reverse, on keyrelease

View File

@ -97,6 +97,8 @@ impl fmt::Display for DataSource {
} }
} }
type LayoutSource = (ArrangementKind, DataSource);
/// Lists possible sources, with 0 as the most preferred one /// Lists possible sources, with 0 as the most preferred one
/// Trying order: native lang of the right kind, native base, /// Trying order: native lang of the right kind, native base,
/// fallback lang of the right kind, fallback base /// fallback lang of the right kind, fallback base
@ -104,55 +106,76 @@ fn list_layout_sources(
name: &str, name: &str,
kind: ArrangementKind, kind: ArrangementKind,
keyboards_path: Option<PathBuf>, keyboards_path: Option<PathBuf>,
) -> Vec<(ArrangementKind, DataSource)> { ) -> Vec<LayoutSource> {
let mut ret = Vec::new(); // Just a simplification of often called code.
{ let add_by_name = |
fn name_with_arrangement(name: String, kind: &ArrangementKind) mut ret: Vec<LayoutSource>,
-> String name: &str,
{ kind: &ArrangementKind,
match kind { | -> Vec<LayoutSource> {
ArrangementKind::Base => name, if let Some(path) = keyboards_path.clone() {
ArrangementKind::Wide => name + "_wide",
}
}
let mut add_by_name = |name: &str, kind: &ArrangementKind| {
if let Some(path) = keyboards_path.clone() {
ret.push((
kind.clone(),
DataSource::File(
path.join(name.to_owned()).with_extension("yaml")
)
))
}
ret.push(( ret.push((
kind.clone(), kind.clone(),
DataSource::Resource(name.into()) DataSource::File(
)); path.join(name.to_owned()).with_extension("yaml")
}; )
))
}
match &kind { ret.push((
ArrangementKind::Base => {}, kind.clone(),
DataSource::Resource(name.into())
));
ret
};
// Another grouping.
let add_by_kind = |ret, name: &str, kind| {
let ret = match kind {
&ArrangementKind::Base => ret,
kind => add_by_name( kind => add_by_name(
&name_with_arrangement(name.into(), &kind), ret,
&kind, &name_with_arrangement(name.into(), kind),
kind,
), ),
}; };
add_by_name(name, &ArrangementKind::Base); add_by_name(ret, name, &ArrangementKind::Base)
};
match &kind { fn name_with_arrangement(name: String, kind: &ArrangementKind) -> String {
ArrangementKind::Base => {}, match kind {
kind => add_by_name( ArrangementKind::Base => name,
&name_with_arrangement(FALLBACK_LAYOUT_NAME.into(), &kind), ArrangementKind::Wide => name + "_wide",
&kind, }
),
};
add_by_name(FALLBACK_LAYOUT_NAME, &ArrangementKind::Base);
} }
ret
let ret = Vec::new();
// Name as given takes priority.
let ret = add_by_kind(ret, name, &kind);
// Then try non-alternative name if applicable (`us` for `us+colemak`).
let ret = {
let mut parts = name.splitn(2, '+');
match parts.next() {
Some(base) => {
// The name is already equal to base, so it was already added.
if base == name { ret }
else {
add_by_kind(ret, base, &kind)
}
},
// The layout's base name starts with a "+". Weird but OK.
None => {
log_print!(logging::Level::Surprise, "Base layout name is empty: {}", name);
ret
}
}
};
// No other choices left, so give anything.
add_by_kind(ret, FALLBACK_LAYOUT_NAME.into(), &kind)
} }
fn load_layout_data(source: DataSource) fn load_layout_data(source: DataSource)
@ -645,6 +668,9 @@ fn create_action<H: logging::Handler>(
Modifier::Alt => action::Action::ApplyModifier( Modifier::Alt => action::Action::ApplyModifier(
action::Modifier::Alt, action::Modifier::Alt,
), ),
Modifier::Mod4 => action::Action::ApplyModifier(
action::Modifier::Mod4,
),
unsupported_modifier => { unsupported_modifier => {
warning_handler.handle( warning_handler.handle(
logging::Level::Bug, logging::Level::Bug,
@ -756,13 +782,21 @@ mod tests {
use ::logging::ProblemPanic; use ::logging::ProblemPanic;
const THIS_FILE: &str = file!();
fn path_from_root(file: &'static str) -> PathBuf { fn path_from_root(file: &'static str) -> PathBuf {
PathBuf::from(THIS_FILE) let source_dir = env::var("SOURCE_DIR")
.parent().unwrap() .map(PathBuf::from)
.parent().unwrap() .unwrap_or_else(|e| {
.join(file) if let env::VarError::NotPresent = e {
let this_file = file!();
PathBuf::from(this_file)
.parent().unwrap()
.parent().unwrap()
.into()
} else {
panic!("{:?}", e);
}
});
source_dir.join(file)
} }
#[test] #[test]
@ -919,7 +953,26 @@ mod tests {
) )
); );
} }
/// If layout contains a "+", it should reach for what's in front of it too.
#[test]
fn fallbacks_order_base() {
let sources = list_layout_sources("nb+aliens", ArrangementKind::Base, None);
assert_eq!(
sources,
vec!(
(ArrangementKind::Base, DataSource::Resource("nb+aliens".into())),
(ArrangementKind::Base, DataSource::Resource("nb".into())),
(
ArrangementKind::Base,
DataSource::Resource(FALLBACK_LAYOUT_NAME.into())
),
)
);
}
#[test] #[test]
fn unicode_keysym() { fn unicode_keysym() {
let keysym = xkb::keysym_from_name( let keysym = xkb::keysym_from_name(

View File

@ -59,7 +59,7 @@ handle_set_visible(SmPuriOSK0 *object, GDBusMethodInvocation *invocation,
if (service->context) { if (service->context) {
if (arg_visible) { if (arg_visible) {
server_context_service_show_keyboard (service->context); server_context_service_force_show_keyboard (service->context);
} else { } else {
server_context_service_hide_keyboard (service->context); server_context_service_hide_keyboard (service->context);
} }

View File

@ -36,7 +36,6 @@ mod c {
pub struct GtkStyleContext(*const c_void); pub struct GtkStyleContext(*const c_void);
#[no_mangle]
extern "C" { extern "C" {
#[allow(improper_ctypes)] #[allow(improper_ctypes)]
pub fn eek_renderer_get_scale_factor( pub fn eek_renderer_get_scale_factor(

View File

@ -25,6 +25,7 @@ static const struct zwp_input_method_v2_listener input_method_listener = {
struct submission* get_submission(struct zwp_input_method_manager_v2 *immanager, struct submission* get_submission(struct zwp_input_method_manager_v2 *immanager,
struct zwp_virtual_keyboard_manager_v1 *vkmanager, struct zwp_virtual_keyboard_manager_v1 *vkmanager,
struct vis_manager *vis_manager,
struct wl_seat *seat, struct wl_seat *seat,
EekboardContextService *state) { EekboardContextService *state) {
struct zwp_input_method_v2 *im = NULL; struct zwp_input_method_v2 *im = NULL;
@ -35,7 +36,7 @@ struct submission* get_submission(struct zwp_input_method_manager_v2 *immanager,
if (vkmanager) { if (vkmanager) {
vk = zwp_virtual_keyboard_manager_v1_create_virtual_keyboard(vkmanager, seat); vk = zwp_virtual_keyboard_manager_v1_create_virtual_keyboard(vkmanager, seat);
} }
return submission_new(im, vk, state); return submission_new(im, vk, state, vis_manager);
} }
/// Un-inlined /// Un-inlined

View File

@ -6,7 +6,6 @@
use std::boxed::Box; use std::boxed::Box;
use std::ffi::CString; use std::ffi::CString;
use std::fmt; use std::fmt;
use std::mem;
use std::num::Wrapping; use std::num::Wrapping;
use std::string::String; use std::string::String;
@ -24,7 +23,7 @@ pub mod c {
use std::os::raw::{c_char, c_void}; use std::os::raw::{c_char, c_void};
pub use ::submission::c::UIManager; pub use ::ui_manager::c::UIManager;
pub use ::submission::c::StateManager; pub use ::submission::c::StateManager;
// The following defined in C // The following defined in C
@ -33,17 +32,15 @@ pub mod c {
#[repr(transparent)] #[repr(transparent)]
pub struct InputMethod(*const c_void); pub struct InputMethod(*const c_void);
#[no_mangle]
extern "C" { extern "C" {
fn imservice_destroy_im(im: *mut c::InputMethod); fn imservice_destroy_im(im: *mut c::InputMethod);
#[allow(improper_ctypes)] // IMService will never be dereferenced in C #[allow(improper_ctypes)] // IMService will never be dereferenced in C
pub fn imservice_connect_listeners(im: *mut InputMethod, imservice: *const IMService); pub fn imservice_connect_listeners(im: *mut InputMethod, imservice: *const IMService);
pub fn eek_input_method_commit_string(im: *mut InputMethod, text: *const c_char); pub fn eek_input_method_commit_string(im: *mut InputMethod, text: *const c_char);
pub fn eek_input_method_delete_surrounding_text(im: *mut InputMethod, before: u32, after: u32); pub fn eek_input_method_delete_surrounding_text(im: *mut InputMethod, before: u32, after: u32);
pub fn eek_input_method_commit(im: *mut InputMethod, serial: u32); pub fn eek_input_method_commit(im: *mut InputMethod, serial: u32);
fn eekboard_context_service_set_hint_purpose(state: *const StateManager, hint: u32, purpose: u32); fn eekboard_context_service_set_hint_purpose(state: *const StateManager, hint: u32, purpose: u32);
pub fn server_context_service_set_im_active(imservice: *const UIManager, active: u32);
pub fn server_context_service_keyboard_release_visibility(imservice: *const UIManager);
} }
// The following defined in Rust. TODO: wrap naked pointers to Rust data inside RefCells to prevent multiple writers // The following defined in Rust. TODO: wrap naked pointers to Rust data inside RefCells to prevent multiple writers
@ -152,8 +149,10 @@ pub mod c {
..IMProtocolState::default() ..IMProtocolState::default()
}; };
imservice.serial += Wrapping(1u32);
if active_changed { if active_changed {
imservice.apply_active_to_ui(); (imservice.active_callback)(imservice.current.active);
if imservice.current.active { if imservice.current.active {
unsafe { unsafe {
eekboard_context_service_set_hint_purpose( eekboard_context_service_set_hint_purpose(
@ -179,9 +178,7 @@ pub mod c {
// the keyboard is already decommissioned // the keyboard is already decommissioned
imservice.current.active = false; imservice.current.active = false;
if let Some(ui) = imservice.ui_manager { (imservice.active_callback)(imservice.current.active);
unsafe { server_context_service_keyboard_release_visibility(ui); }
}
} }
// FIXME: destroy and deallocate // FIXME: destroy and deallocate
@ -334,8 +331,7 @@ pub struct IMService {
pub im: *mut c::InputMethod, pub im: *mut c::InputMethod,
/// Unowned reference. Be careful, it's shared with C at large /// Unowned reference. Be careful, it's shared with C at large
state_manager: *const c::StateManager, state_manager: *const c::StateManager,
/// Unowned reference. Be careful, it's shared with C at large active_callback: Box<dyn Fn(bool)>,
ui_manager: Option<*const c::UIManager>,
pending: IMProtocolState, pending: IMProtocolState,
current: IMProtocolState, // turn current into an idiomatic representation? current: IMProtocolState, // turn current into an idiomatic representation?
@ -352,12 +348,13 @@ impl IMService {
pub fn new( pub fn new(
im: *mut c::InputMethod, im: *mut c::InputMethod,
state_manager: *const c::StateManager, state_manager: *const c::StateManager,
active_callback: Box<dyn Fn(bool)>,
) -> Box<IMService> { ) -> Box<IMService> {
// IMService will be referenced to by C, // IMService will be referenced to by C,
// so it needs to stay in the same place in memory via Box // so it needs to stay in the same place in memory via Box
let imservice = Box::new(IMService { let imservice = Box::new(IMService {
im, im,
ui_manager: None, active_callback,
state_manager, state_manager,
pending: IMProtocolState::default(), pending: IMProtocolState::default(),
current: IMProtocolState::default(), current: IMProtocolState::default(),
@ -373,26 +370,6 @@ impl IMService {
imservice imservice
} }
pub fn set_ui_manager(&mut self, mut ui_manager: Option<*const c::UIManager>) {
mem::swap(&mut self.ui_manager, &mut ui_manager);
// Now ui_manager is what was previously self.ui_manager.
// If there wasn't any, we need to consider if UI was requested.
if let None = ui_manager {
self.apply_active_to_ui();
}
}
fn apply_active_to_ui(&self) {
if let Some(ui) = self.ui_manager {
unsafe {
c::server_context_service_set_im_active(
ui,
self.is_active() as u32,
);
}
}
}
pub fn commit_string(&self, text: &CString) -> Result<(), SubmitError> { pub fn commit_string(&self, text: &CString) -> Result<(), SubmitError> {
match self.current.active { match self.current.active {
true => { true => {
@ -429,7 +406,6 @@ impl IMService {
unsafe { unsafe {
c::eek_input_method_commit(self.im, self.serial.0) c::eek_input_method_commit(self.im, self.serial.0)
} }
self.serial += Wrapping(1u32);
Ok(()) Ok(())
}, },
false => Err(SubmitError::NotActive), false => Err(SubmitError::NotActive),

View File

@ -50,7 +50,6 @@ pub mod c {
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct EekGtkKeyboard(pub *const gtk_sys::GtkWidget); pub struct EekGtkKeyboard(pub *const gtk_sys::GtkWidget);
#[no_mangle]
extern "C" { extern "C" {
#[allow(improper_ctypes)] #[allow(improper_ctypes)]
pub fn eek_gtk_keyboard_emit_feedback( pub fn eek_gtk_keyboard_emit_feedback(

View File

@ -24,7 +24,6 @@ mod c {
#[repr(C)] #[repr(C)]
pub struct GnomeXkbInfo(*const c_void); pub struct GnomeXkbInfo(*const c_void);
#[no_mangle]
extern "C" { extern "C" {
// from libc // from libc
pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;

View File

@ -9,7 +9,6 @@ pub mod c {
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub struct Manager(*const c_void); pub struct Manager(*const c_void);
#[no_mangle]
extern "C" { extern "C" {
pub fn eekboard_context_service_set_overlay( pub fn eekboard_context_service_set_overlay(
manager: Manager, manager: Manager,

View File

@ -80,6 +80,7 @@ test(
'rstest', 'rstest',
cargo_script, cargo_script,
args: ['test'] + cargo_build_flags, args: ['test'] + cargo_build_flags,
env: ['SOURCE_DIR=' + meson.source_root()],
# this is a whole Carg-based test suite, let it run for a while # this is a whole Carg-based test suite, let it run for a while
timeout: 900, timeout: 900,
depends: [build_rstests, cargo_toml], depends: [build_rstests, cargo_toml],

View File

@ -29,7 +29,6 @@ use ::logging::Warn;
mod c { mod c {
use std::os::raw::c_char; use std::os::raw::c_char;
#[no_mangle]
extern "C" { extern "C" {
pub fn popover_open_settings_panel(panel: *const c_char); pub fn popover_open_settings_panel(panel: *const c_char);
} }
@ -437,7 +436,8 @@ pub fn show(
let settings_action = gio::SimpleAction::new("settings", None); let settings_action = gio::SimpleAction::new("settings", None);
settings_action.connect_activate(move |_, _| { settings_action.connect_activate(move |_, _| {
unsafe { c::popover_open_settings_panel(CString::new("region").unwrap().as_ptr()) }; let s = CString::new("region").unwrap();
unsafe { c::popover_open_settings_panel(s.as_ptr()) };
}); });
let action_group = gio::SimpleActionGroup::new(); let action_group = gio::SimpleActionGroup::new();

View File

@ -10,34 +10,78 @@ use std::iter::FromIterator;
// TODO: keep a list of what is a language layout, // TODO: keep a list of what is a language layout,
// and what a convenience layout. "_wide" is not a layout, // and what a convenience layout. "_wide" is not a layout,
// neither is "number" // neither is "number"
/// List of builtin layouts
const KEYBOARDS: &[(*const str, *const str)] = &[ const KEYBOARDS: &[(*const str, *const str)] = &[
// layouts: us must be left as first, as it is the, // layouts: us must be left as first, as it is the,
// fallback layout. The others should be alphabetical. // fallback layout.
("us", include_str!("../data/keyboards/us.yaml")), ("us", include_str!("../data/keyboards/us.yaml")),
("us_wide", include_str!("../data/keyboards/us_wide.yaml")), ("us_wide", include_str!("../data/keyboards/us_wide.yaml")),
("br", include_str!("../data/keyboards/br.yaml")),
("de", include_str!("../data/keyboards/de.yaml")), // Language layouts: keep alphabetical.
("be", include_str!("../data/keyboards/be.yaml")), ("be", include_str!("../data/keyboards/be.yaml")),
("be_wide", include_str!("../data/keyboards/be_wide.yaml")), ("be_wide", include_str!("../data/keyboards/be_wide.yaml")),
("bg", include_str!("../data/keyboards/bg.yaml")),
("br", include_str!("../data/keyboards/br.yaml")),
("de", include_str!("../data/keyboards/de.yaml")),
("de_wide", include_str!("../data/keyboards/de_wide.yaml")), ("de_wide", include_str!("../data/keyboards/de_wide.yaml")),
("cz", include_str!("../data/keyboards/cz.yaml")),
("cz_wide", include_str!("../data/keyboards/cz_wide.yaml")),
("cz+qwerty", include_str!("../data/keyboards/cz+qwerty.yaml")),
("cz+qwerty_wide", include_str!("../data/keyboards/cz+qwerty_wide.yaml")),
("dk", include_str!("../data/keyboards/dk.yaml")), ("dk", include_str!("../data/keyboards/dk.yaml")),
("epo", include_str!("../data/keyboards/epo.yaml")),
("es", include_str!("../data/keyboards/es.yaml")), ("es", include_str!("../data/keyboards/es.yaml")),
("es+cat", include_str!("../data/keyboards/es+cat.yaml")),
("fi", include_str!("../data/keyboards/fi.yaml")), ("fi", include_str!("../data/keyboards/fi.yaml")),
("fr", include_str!("../data/keyboards/fr.yaml")), ("fr", include_str!("../data/keyboards/fr.yaml")),
("fr_wide", include_str!("../data/keyboards/fr_wide.yaml")), ("fr_wide", include_str!("../data/keyboards/fr_wide.yaml")),
("it+fur", include_str!("../data/keyboards/it+fur.yaml")),
("gr", include_str!("../data/keyboards/gr.yaml")), ("gr", include_str!("../data/keyboards/gr.yaml")),
("il", include_str!("../data/keyboards/il.yaml")),
("ir", include_str!("../data/keyboards/ir.yaml")),
("ir_wide", include_str!("../data/keyboards/ir_wide.yaml")),
("it", include_str!("../data/keyboards/it.yaml")), ("it", include_str!("../data/keyboards/it.yaml")),
("it+fur", include_str!("../data/keyboards/it+fur.yaml")),
("jp+kana", include_str!("../data/keyboards/jp+kana.yaml")), ("jp+kana", include_str!("../data/keyboards/jp+kana.yaml")),
("jp+kana_wide", include_str!("../data/keyboards/jp+kana_wide.yaml")), ("jp+kana_wide", include_str!("../data/keyboards/jp+kana_wide.yaml")),
("no", include_str!("../data/keyboards/no.yaml")), ("no", include_str!("../data/keyboards/no.yaml")),
("number", include_str!("../data/keyboards/number.yaml")),
("pl", include_str!("../data/keyboards/pl.yaml")), ("pl", include_str!("../data/keyboards/pl.yaml")),
("pl_wide", include_str!("../data/keyboards/pl_wide.yaml")), ("pl_wide", include_str!("../data/keyboards/pl_wide.yaml")),
("ru", include_str!("../data/keyboards/ru.yaml")), ("ru", include_str!("../data/keyboards/ru.yaml")),
("se", include_str!("../data/keyboards/se.yaml")), ("se", include_str!("../data/keyboards/se.yaml")),
("th", include_str!("../data/keyboards/th.yaml")), ("th", include_str!("../data/keyboards/th.yaml")),
("th_wide", include_str!("../data/keyboards/th_wide.yaml")),
("ua", include_str!("../data/keyboards/ua.yaml")), ("ua", include_str!("../data/keyboards/ua.yaml")),
("us+colemak", include_str!("../data/keyboards/us+colemak.yaml")),
("us+colemak_wide", include_str!("../data/keyboards/us+colemak_wide.yaml")),
("us+dvorak", include_str!("../data/keyboards/us+dvorak.yaml")),
("us+dvorak_wide", include_str!("../data/keyboards/us+dvorak_wide.yaml")),
// Others
("number", include_str!("../data/keyboards/number.yaml")),
// layout+overlay // layout+overlay
("terminal", include_str!("../data/keyboards/terminal.yaml")), ("terminal", include_str!("../data/keyboards/terminal.yaml")),
("terminal_wide", include_str!("../data/keyboards/terminal_wide.yaml")), ("terminal_wide", include_str!("../data/keyboards/terminal_wide.yaml")),
@ -78,6 +122,7 @@ const LAYOUT_NAMES: &[(*const str, *const str)] = &[
("en-US", include_str!("../data/langs/en-US.txt")), ("en-US", include_str!("../data/langs/en-US.txt")),
("es-ES", include_str!("../data/langs/es-ES.txt")), ("es-ES", include_str!("../data/langs/es-ES.txt")),
("fur-IT", include_str!("../data/langs/fur-IT.txt")), ("fur-IT", include_str!("../data/langs/fur-IT.txt")),
("he-IL", include_str!("../data/langs/he_IL.txt")),
("ja-JP", include_str!("../data/langs/ja-JP.txt")), ("ja-JP", include_str!("../data/langs/ja-JP.txt")),
("pl-PL", include_str!("../data/langs/pl-PL.txt")), ("pl-PL", include_str!("../data/langs/pl-PL.txt")),
("ru-RU", include_str!("../data/langs/ru-RU.txt")), ("ru-RU", include_str!("../data/langs/ru-RU.txt")),

View File

@ -43,10 +43,9 @@ struct _ServerContextService {
struct submission *submission; // unowned struct submission *submission; // unowned
struct squeek_layout_state *layout; struct squeek_layout_state *layout;
struct ui_manager *manager; // unowned struct ui_manager *manager; // unowned
struct vis_manager *vis_manager; // owned
gboolean visible; gboolean visible;
gboolean enabled;
gboolean im_active;
PhoshLayerSurface *window; PhoshLayerSurface *window;
GtkWidget *widget; // nullable GtkWidget *widget; // nullable
guint hiding; guint hiding;
@ -240,6 +239,13 @@ server_context_service_real_show_keyboard (ServerContextService *self)
gtk_widget_show (GTK_WIDGET(self->window)); gtk_widget_show (GTK_WIDGET(self->window));
} }
static gboolean
show_keyboard_source_func(ServerContextService *context)
{
server_context_service_real_show_keyboard(context);
return G_SOURCE_REMOVE;
}
static void static void
server_context_service_real_hide_keyboard (ServerContextService *self) server_context_service_real_hide_keyboard (ServerContextService *self)
{ {
@ -247,6 +253,13 @@ server_context_service_real_hide_keyboard (ServerContextService *self)
self->visible = FALSE; self->visible = FALSE;
} }
static gboolean
hide_keyboard_source_func(ServerContextService *context)
{
server_context_service_real_hide_keyboard(context);
return G_SOURCE_REMOVE;
}
static gboolean static gboolean
on_hide (ServerContextService *self) on_hide (ServerContextService *self)
{ {
@ -256,7 +269,7 @@ on_hide (ServerContextService *self)
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
void static void
server_context_service_show_keyboard (ServerContextService *self) server_context_service_show_keyboard (ServerContextService *self)
{ {
g_return_if_fail (SERVER_IS_CONTEXT_SERVICE(self)); g_return_if_fail (SERVER_IS_CONTEXT_SERVICE(self));
@ -267,17 +280,30 @@ server_context_service_show_keyboard (ServerContextService *self)
} }
if (!self->visible) { if (!self->visible) {
server_context_service_real_show_keyboard (self); g_idle_add((GSourceFunc)show_keyboard_source_func, self);
} }
} }
void
server_context_service_force_show_keyboard (ServerContextService *self)
{
if (!submission_hint_available(self->submission)) {
eekboard_context_service_set_hint_purpose(
self->state,
ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE,
ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL
);
}
server_context_service_show_keyboard(self);
}
void void
server_context_service_hide_keyboard (ServerContextService *self) server_context_service_hide_keyboard (ServerContextService *self)
{ {
g_return_if_fail (SERVER_IS_CONTEXT_SERVICE(self)); g_return_if_fail (SERVER_IS_CONTEXT_SERVICE(self));
if (self->visible) { if (self->visible) {
server_context_service_real_hide_keyboard (self); g_idle_add((GSourceFunc)hide_keyboard_source_func, self);
} }
} }
@ -288,7 +314,7 @@ server_context_service_hide_keyboard (ServerContextService *self)
/// In this case, the user doesn't really need the keyboard surface /// In this case, the user doesn't really need the keyboard surface
/// to disappear completely. /// to disappear completely.
void void
server_context_service_keyboard_release_visibility (ServerContextService *self) server_context_service_release_visibility (ServerContextService *self)
{ {
g_return_if_fail (SERVER_IS_CONTEXT_SERVICE(self)); g_return_if_fail (SERVER_IS_CONTEXT_SERVICE(self));
@ -297,6 +323,13 @@ server_context_service_keyboard_release_visibility (ServerContextService *self)
} }
} }
static void
server_context_service_set_physical_keyboard_present (ServerContextService *self, gboolean physical_keyboard_present)
{
g_return_if_fail (SERVER_IS_CONTEXT_SERVICE (self));
squeek_visman_set_keyboard_present(self->vis_manager, physical_keyboard_present);
}
static void static void
server_context_service_set_property (GObject *object, server_context_service_set_property (GObject *object,
guint prop_id, guint prop_id,
@ -310,7 +343,7 @@ server_context_service_set_property (GObject *object,
self->visible = g_value_get_boolean (value); self->visible = g_value_get_boolean (value);
break; break;
case PROP_ENABLED: case PROP_ENABLED:
server_context_service_set_enabled (self, g_value_get_boolean (value)); server_context_service_set_physical_keyboard_present (self, !g_value_get_boolean (value));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -385,12 +418,14 @@ server_context_service_class_init (ServerContextServiceClass *klass)
} }
static void static void
server_context_service_init (ServerContextService *self) { server_context_service_init (ServerContextService *self) {}
static void
init (ServerContextService *self) {
const char *schema_name = "org.gnome.desktop.a11y.applications"; const char *schema_name = "org.gnome.desktop.a11y.applications";
GSettingsSchemaSource *ssrc = g_settings_schema_source_get_default(); GSettingsSchemaSource *ssrc = g_settings_schema_source_get_default();
g_autoptr(GSettingsSchema) schema = NULL; g_autoptr(GSettingsSchema) schema = NULL;
self->enabled = TRUE;
if (!ssrc) { if (!ssrc) {
g_warning("No gsettings schemas installed."); g_warning("No gsettings schemas installed.");
return; return;
@ -407,37 +442,24 @@ server_context_service_init (ServerContextService *self) {
} }
ServerContextService * ServerContextService *
server_context_service_new (EekboardContextService *self, struct submission *submission, struct squeek_layout_state *layout, struct ui_manager *uiman) server_context_service_new (EekboardContextService *self, struct submission *submission, struct squeek_layout_state *layout, struct ui_manager *uiman, struct vis_manager *visman)
{ {
ServerContextService *ui = g_object_new (SERVER_TYPE_CONTEXT_SERVICE, NULL); ServerContextService *ui = g_object_new (SERVER_TYPE_CONTEXT_SERVICE, NULL);
ui->submission = submission; ui->submission = submission;
ui->state = self; ui->state = self;
ui->layout = layout; ui->layout = layout;
ui->manager = uiman; ui->manager = uiman;
ui->vis_manager = visman;
init(ui);
return ui; return ui;
} }
void void
server_context_service_update_visible (ServerContextService *self, gboolean delay) { server_context_service_update_visible (ServerContextService *self, gboolean visible) {
if (self->enabled && self->im_active) { if (visible) {
server_context_service_show_keyboard(self); server_context_service_show_keyboard(self);
} else if (delay) {
server_context_service_keyboard_release_visibility(self);
} else { } else {
server_context_service_hide_keyboard(self); server_context_service_hide_keyboard(self);
} }
} }
void
server_context_service_set_enabled (ServerContextService *self, gboolean enabled)
{
g_return_if_fail (SERVER_IS_CONTEXT_SERVICE (self));
self->enabled = enabled;
server_context_service_update_visible(self, FALSE);
}
void
server_context_service_set_im_active(ServerContextService *self, uint32_t active) {
self->im_active = active;
server_context_service_update_visible(self, TRUE);
}

View File

@ -29,11 +29,10 @@ G_BEGIN_DECLS
/** Manages the lifecycle of the window displaying layouts. */ /** Manages the lifecycle of the window displaying layouts. */
G_DECLARE_FINAL_TYPE (ServerContextService, server_context_service, SERVER, CONTEXT_SERVICE, GObject) G_DECLARE_FINAL_TYPE (ServerContextService, server_context_service, SERVER, CONTEXT_SERVICE, GObject)
ServerContextService *server_context_service_new(EekboardContextService *self, struct submission *submission, struct squeek_layout_state *layout, struct ui_manager *uiman); ServerContextService *server_context_service_new(EekboardContextService *self, struct submission *submission, struct squeek_layout_state *layout, struct ui_manager *uiman, struct vis_manager *visman);
enum squeek_arrangement_kind server_context_service_get_layout_type(ServerContextService *); enum squeek_arrangement_kind server_context_service_get_layout_type(ServerContextService *);
void server_context_service_show_keyboard (ServerContextService *self); void server_context_service_force_show_keyboard (ServerContextService *self);
void server_context_service_hide_keyboard (ServerContextService *self); void server_context_service_hide_keyboard (ServerContextService *self);
void server_context_service_set_enabled (ServerContextService *self, gboolean enabled);
G_END_DECLS G_END_DECLS
#endif /* SERVER_CONTEXT_SERVICE_H */ #endif /* SERVER_CONTEXT_SERVICE_H */

View File

@ -50,9 +50,16 @@ struct squeekboard {
}; };
GMainLoop *loop;
static gboolean opt_system = FALSE; static gboolean opt_system = FALSE;
static gchar *opt_address = NULL; static gchar *opt_address = NULL;
static void
quit (void)
{
g_main_loop_quit (loop);
}
// D-Bus // D-Bus
static void static void
@ -131,6 +138,67 @@ static const struct wl_registry_listener registry_listener = {
#define SESSION_NAME "sm.puri.OSK0" #define SESSION_NAME "sm.puri.OSK0"
GDBusProxy *_proxy = NULL; GDBusProxy *_proxy = NULL;
GDBusProxy *_client_proxy = NULL;
gchar *_client_path = NULL;
static void
send_quit_response (GDBusProxy *proxy)
{
g_debug ("Calling EndSessionResponse");
g_dbus_proxy_call (proxy, "EndSessionResponse",
g_variant_new ("(bs)", TRUE, ""), G_DBUS_CALL_FLAGS_NONE,
G_MAXINT, NULL, NULL, NULL);
}
static void
unregister_client (void)
{
g_autoptr (GError) error = NULL;
g_return_if_fail (G_IS_DBUS_PROXY (_proxy));
g_return_if_fail (_client_path != NULL);
g_debug ("Unregistering client");
g_dbus_proxy_call_sync (_proxy,
"UnregisterClient",
g_variant_new ("(o)", _client_path),
G_DBUS_CALL_FLAGS_NONE,
G_MAXINT,
NULL,
&error);
if (error) {
g_warning ("Failed to unregister client: %s", error->message);
}
g_clear_object (&_client_proxy);
g_clear_pointer (&_client_path, g_free);
}
static void client_proxy_signal (GDBusProxy *proxy,
const gchar *sender_name,
const gchar *signal_name,
GVariant *parameters,
gpointer user_data)
{
if (g_str_equal (signal_name, "QueryEndSession")) {
g_debug ("Received QueryEndSession");
send_quit_response (proxy);
} else if (g_str_equal (signal_name, "CancelEndSession")) {
g_debug ("Received CancelEndSession");
} else if (g_str_equal (signal_name, "EndSession")) {
g_debug ("Received EndSession");
send_quit_response (proxy);
unregister_client ();
quit ();
} else if (g_str_equal (signal_name, "Stop")) {
g_debug ("Received Stop");
unregister_client ();
quit ();
}
}
static void static void
session_register(void) { session_register(void) {
@ -151,7 +219,8 @@ session_register(void) {
return; return;
} }
g_dbus_proxy_call_sync(_proxy, "RegisterClient", g_autoptr (GVariant) res = NULL;
res = g_dbus_proxy_call_sync(_proxy, "RegisterClient",
g_variant_new("(ss)", SESSION_NAME, autostart_id), g_variant_new("(ss)", SESSION_NAME, autostart_id),
G_DBUS_CALL_FLAGS_NONE, 1000, NULL, &error); G_DBUS_CALL_FLAGS_NONE, 1000, NULL, &error);
if (error) { if (error) {
@ -160,6 +229,22 @@ session_register(void) {
g_clear_error(&error); g_clear_error(&error);
return; return;
} }
g_variant_get (res, "(o)", &_client_path);
g_debug ("Registered client at '%s'", _client_path);
_client_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
0, NULL, "org.gnome.SessionManager", _client_path,
"org.gnome.SessionManager.ClientPrivate", NULL, &error);
if (error) {
g_warning ("Failed to get client proxy: %s", error->message);
g_clear_error (&error);
g_free (_client_path);
_client_path = NULL;
return;
}
g_signal_connect (_client_proxy, "g-signal", G_CALLBACK (client_proxy_signal), NULL);
} }
int int
@ -277,8 +362,11 @@ main (int argc, char **argv)
} }
} }
struct vis_manager *vis_manager = squeek_visman_new();
instance.submission = get_submission(instance.wayland.input_method_manager, instance.submission = get_submission(instance.wayland.input_method_manager,
instance.wayland.virtual_keyboard_manager, instance.wayland.virtual_keyboard_manager,
vis_manager,
instance.wayland.seat, instance.wayland.seat,
instance.settings_context); instance.settings_context);
@ -288,15 +376,15 @@ main (int argc, char **argv)
instance.settings_context, instance.settings_context,
instance.submission, instance.submission,
&instance.layout_choice, &instance.layout_choice,
instance.ui_manager); instance.ui_manager,
vis_manager);
if (!ui_context) { if (!ui_context) {
g_error("Could not initialize GUI"); g_error("Could not initialize GUI");
exit(1); exit(1);
} }
instance.ui_context = ui_context; instance.ui_context = ui_context;
if (instance.submission) { squeek_visman_set_ui(vis_manager, instance.ui_context);
submission_set_ui(instance.submission, instance.ui_context);
}
if (instance.dbus_handler) { if (instance.dbus_handler) {
dbus_handler_set_ui_context(instance.dbus_handler, instance.ui_context); dbus_handler_set_ui_context(instance.dbus_handler, instance.ui_context);
} }
@ -304,8 +392,7 @@ main (int argc, char **argv)
session_register(); session_register();
GMainLoop *loop = g_main_loop_new (NULL, FALSE); loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop); g_main_loop_run (loop);
if (connection) { if (connection) {

View File

@ -4,17 +4,20 @@
#include "input-method-unstable-v2-client-protocol.h" #include "input-method-unstable-v2-client-protocol.h"
#include "virtual-keyboard-unstable-v1-client-protocol.h" #include "virtual-keyboard-unstable-v1-client-protocol.h"
#include "eek/eek-types.h" #include "eek/eek-types.h"
#include "src/ui_manager.h"
struct submission; struct submission;
struct squeek_layout; struct squeek_layout;
struct submission* get_submission(struct zwp_input_method_manager_v2 *immanager, struct submission* get_submission(struct zwp_input_method_manager_v2 *immanager,
struct zwp_virtual_keyboard_manager_v1 *vkmanager, struct zwp_virtual_keyboard_manager_v1 *vkmanager,
struct vis_manager *vis_manager,
struct wl_seat *seat, struct wl_seat *seat,
EekboardContextService *state); EekboardContextService *state);
// Defined in Rust // Defined in Rust
struct submission* submission_new(struct zwp_input_method_v2 *im, struct zwp_virtual_keyboard_v1 *vk, EekboardContextService *state); struct submission* submission_new(struct zwp_input_method_v2 *im, struct zwp_virtual_keyboard_v1 *vk, EekboardContextService *state, struct vis_manager *vis_manager);
uint8_t submission_hint_available(struct submission *self);
void submission_set_ui(struct submission *self, ServerContextService *ui_context); void submission_set_ui(struct submission *self, ServerContextService *ui_context);
void submission_use_layout(struct submission *self, struct squeek_layout *layout, uint32_t time); void submission_use_layout(struct submission *self, struct squeek_layout *layout, uint32_t time);
#endif #endif

View File

@ -24,6 +24,7 @@ use ::imservice;
use ::imservice::IMService; use ::imservice::IMService;
use ::keyboard::{ KeyCode, KeyStateId, Modifiers, PressType }; use ::keyboard::{ KeyCode, KeyStateId, Modifiers, PressType };
use ::layout; use ::layout;
use ::ui_manager::VisibilityManager;
use ::util::vec_remove; use ::util::vec_remove;
use ::vkeyboard; use ::vkeyboard;
use ::vkeyboard::VirtualKeyboard; use ::vkeyboard::VirtualKeyboard;
@ -38,14 +39,11 @@ pub mod c {
use std::os::raw::c_void; use std::os::raw::c_void;
use ::imservice::c::InputMethod; use ::imservice::c::InputMethod;
use ::util::c::Wrapped;
use ::vkeyboard::c::ZwpVirtualKeyboardV1; use ::vkeyboard::c::ZwpVirtualKeyboardV1;
// The following defined in C // The following defined in C
/// ServerContextService*
#[repr(transparent)]
pub struct UIManager(*const c_void);
/// EekboardContextService* /// EekboardContextService*
#[repr(transparent)] #[repr(transparent)]
pub struct StateManager(*const c_void); pub struct StateManager(*const c_void);
@ -55,12 +53,18 @@ pub mod c {
fn submission_new( fn submission_new(
im: *mut InputMethod, im: *mut InputMethod,
vk: ZwpVirtualKeyboardV1, vk: ZwpVirtualKeyboardV1,
state_manager: *const StateManager state_manager: *const StateManager,
visibility_manager: Wrapped<VisibilityManager>,
) -> *mut Submission { ) -> *mut Submission {
let imservice = if im.is_null() { let imservice = if im.is_null() {
None None
} else { } else {
Some(IMService::new(im, state_manager)) let visibility_manager = visibility_manager.clone_ref();
Some(IMService::new(
im,
state_manager,
Box::new(move |active| visibility_manager.borrow_mut().set_im_active(active)),
))
}; };
// TODO: add vkeyboard too // TODO: add vkeyboard too
Box::<Submission>::into_raw(Box::new( Box::<Submission>::into_raw(Box::new(
@ -75,23 +79,6 @@ pub mod c {
)) ))
} }
/// Use to initialize the UI reference
#[no_mangle]
pub extern "C"
fn submission_set_ui(submission: *mut Submission, ui_manager: *const UIManager) {
if submission.is_null() {
panic!("Null submission pointer");
}
let submission: &mut Submission = unsafe { &mut *submission };
if let Some(ref mut imservice) = &mut submission.imservice {
imservice.set_ui_manager(if ui_manager.is_null() {
None
} else {
Some(ui_manager)
})
};
}
#[no_mangle] #[no_mangle]
pub extern "C" pub extern "C"
fn submission_use_layout( fn submission_use_layout(
@ -106,6 +93,18 @@ pub mod c {
let layout = unsafe { &*layout }; let layout = unsafe { &*layout };
submission.use_layout(layout, Timestamp(time)); submission.use_layout(layout, Timestamp(time));
} }
#[no_mangle]
pub extern "C"
fn submission_hint_available(submission: *mut Submission) -> u8 {
if submission.is_null() {
panic!("Null submission pointer");
}
let submission: &mut Submission = unsafe { &mut *submission };
let active = submission.imservice.as_ref()
.map(|imservice| imservice.is_active());
(Some(true) == active) as u8
}
} }
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
@ -271,6 +270,7 @@ impl Submission {
.map(|(_id, m)| match m { .map(|(_id, m)| match m {
Modifier::Control => Modifiers::CONTROL, Modifier::Control => Modifiers::CONTROL,
Modifier::Alt => Modifiers::MOD1, Modifier::Alt => Modifiers::MOD1,
Modifier::Mod4 => Modifiers::MOD4,
}) })
.fold(Modifiers::empty(), |m, n| m | n); .fold(Modifiers::empty(), |m, n| m | n);
self.virtual_keyboard.set_modifiers_state(raw_modifiers); self.virtual_keyboard.set_modifiers_state(raw_modifiers);

View File

@ -3,6 +3,7 @@
#include <inttypes.h> #include <inttypes.h>
#include "eek/eek-types.h"
#include "outputs.h" #include "outputs.h"
struct ui_manager; struct ui_manager;
@ -11,4 +12,9 @@ struct ui_manager *squeek_uiman_new(void);
void squeek_uiman_set_output(struct ui_manager *uiman, struct squeek_output_handle output); void squeek_uiman_set_output(struct ui_manager *uiman, struct squeek_output_handle output);
uint32_t squeek_uiman_get_perceptual_height(struct ui_manager *uiman); uint32_t squeek_uiman_get_perceptual_height(struct ui_manager *uiman);
struct vis_manager;
struct vis_manager *squeek_visman_new(void);
void squeek_visman_set_ui(struct vis_manager *visman, ServerContextService *ui_context);
void squeek_visman_set_keyboard_present(struct vis_manager *visman, uint32_t keyboard_present);
#endif #endif

View File

@ -10,9 +10,48 @@
use std::cmp::min; use std::cmp::min;
use ::outputs::c::OutputHandle; use ::outputs::c::OutputHandle;
mod c { pub mod c {
use super::*; use super::*;
use std::os::raw::c_void;
use ::util::c::Wrapped; use ::util::c::Wrapped;
/// ServerContextService*
#[repr(transparent)]
pub struct UIManager(*const c_void);
extern "C" {
pub fn server_context_service_update_visible(imservice: *const UIManager, active: u32);
pub fn server_context_service_release_visibility(imservice: *const UIManager);
}
#[no_mangle]
pub extern "C"
fn squeek_visman_new() -> Wrapped<VisibilityManager> {
Wrapped::new(VisibilityManager {
ui_manager: None,
visibility_state: VisibilityFactors {
im_active: false,
physical_keyboard_present: false,
}
})
}
/// Use to initialize the UI reference
#[no_mangle]
pub extern "C"
fn squeek_visman_set_ui(visman: Wrapped<VisibilityManager>, ui_manager: *const UIManager) {
let visman = visman.clone_ref();
let mut visman = visman.borrow_mut();
visman.set_ui_manager(Some(ui_manager))
}
#[no_mangle]
pub extern "C"
fn squeek_visman_set_keyboard_present(visman: Wrapped<VisibilityManager>, present: u32) {
let visman = visman.clone_ref();
let mut visman = visman.borrow_mut();
visman.set_keyboard_present(present != 0)
}
#[no_mangle] #[no_mangle]
pub extern "C" pub extern "C"
@ -79,3 +118,131 @@ impl Manager {
} }
} }
} }
#[derive(PartialEq, Debug)]
enum Visibility {
Hidden,
Visible,
}
#[derive(Debug)]
enum VisibilityTransition {
/// Hide immediately
Hide,
/// Hide if no show request comes soon
Release,
/// Show instantly
Show,
/// Don't do anything
NoTransition,
}
/// Contains visibility policy
#[derive(Clone, Debug)]
struct VisibilityFactors {
im_active: bool,
physical_keyboard_present: bool,
}
impl VisibilityFactors {
/// Static policy.
/// Use when transitioning from an undefined state (e.g. no UI before).
fn desired(&self) -> Visibility {
match self {
VisibilityFactors {
im_active: true,
physical_keyboard_present: false,
} => Visibility::Visible,
_ => Visibility::Hidden,
}
}
/// Stateful policy
fn transition_to(&self, next: &Self) -> VisibilityTransition {
use self::Visibility::*;
let im_deactivation = self.im_active && !next.im_active;
match (self.desired(), next.desired(), im_deactivation) {
(Visible, Hidden, true) => VisibilityTransition::Release,
(Visible, Hidden, _) => VisibilityTransition::Hide,
(Hidden, Visible, _) => VisibilityTransition::Show,
_ => VisibilityTransition::NoTransition,
}
}
}
// Temporary struct for migration. Should be integrated with Manager eventually.
pub struct VisibilityManager {
/// Owned reference. Be careful, it's shared with C at large
ui_manager: Option<*const c::UIManager>,
visibility_state: VisibilityFactors,
}
impl VisibilityManager {
fn set_ui_manager(&mut self, ui_manager: Option<*const c::UIManager>) {
let new = VisibilityManager {
ui_manager,
..unsafe { self.clone() }
};
self.apply_changes(new);
}
fn apply_changes(&mut self, new: Self) {
if let Some(ui) = &new.ui_manager {
if self.ui_manager.is_none() {
// Previous state was never applied, so effectively undefined.
// Just apply the new one.
let new_state = new.visibility_state.desired();
unsafe {
c::server_context_service_update_visible(
*ui,
(new_state == Visibility::Visible) as u32,
);
}
} else {
match self.visibility_state.transition_to(&new.visibility_state) {
VisibilityTransition::Hide => unsafe {
c::server_context_service_update_visible(*ui, 0);
},
VisibilityTransition::Show => unsafe {
c::server_context_service_update_visible(*ui, 1);
},
VisibilityTransition::Release => unsafe {
c::server_context_service_release_visibility(*ui);
},
VisibilityTransition::NoTransition => {}
}
}
}
*self = new;
}
pub fn set_im_active(&mut self, im_active: bool) {
let new = VisibilityManager {
visibility_state: VisibilityFactors {
im_active,
..self.visibility_state.clone()
},
..unsafe { self.clone() }
};
self.apply_changes(new);
}
pub fn set_keyboard_present(&mut self, keyboard_present: bool) {
let new = VisibilityManager {
visibility_state: VisibilityFactors {
physical_keyboard_present: keyboard_present,
..self.visibility_state.clone()
},
..unsafe { self.clone() }
};
self.apply_changes(new);
}
/// The struct is not really safe to clone due to the ui_manager reference.
/// This is only a helper for getting desired visibility.
unsafe fn clone(&self) -> Self {
VisibilityManager {
ui_manager: self.ui_manager.clone(),
visibility_state: self.visibility_state.clone(),
}
}
}

View File

@ -37,7 +37,6 @@ pub mod c {
} }
} }
#[no_mangle]
extern "C" { extern "C" {
// From libc, to let KeyMap get deallocated. // From libc, to let KeyMap get deallocated.
fn close(fd: u32); fn close(fd: u32);

View File

@ -46,42 +46,71 @@ endforeach
# The layout test is in the examples directory # The layout test is in the examples directory
# due to the way Cargo builds executables # due to the way Cargo builds executables
# and the need to call it manually # and the need to call it manually.
# This is the list of tested builtin layouts.
# Please keep each block alphabetical!
# Please keep shapes (with _) on the same line,
# variants (with +) on separate lines.
foreach layout : [ foreach layout : [
# This is the fallback layout,
# so stays first to make sure it never goes missing.
'us', 'us_wide', 'us', 'us_wide',
'br',
# Block: Languages
'be', 'be_wide', 'be', 'be_wide',
'bg',
'br',
'cz', 'cz_wide',
'cz+qwerty', 'cz+qwerty_wide',
'de', 'de_wide', 'de', 'de_wide',
'dk', 'dk',
'epo',
'es', 'es',
'es+cat',
'fi', 'fi',
'fr', 'fr_wide', 'fr', 'fr_wide',
'it+fur',
'gr', 'gr',
'il',
'ir',
'it', 'it',
'it+fur',
'jp+kana','jp+kana_wide', 'jp+kana','jp+kana_wide',
'no', 'no',
'number',
'pl', 'pl_wide', 'pl', 'pl_wide',
'ru', 'ru',
'se', 'se',
'th', 'th_wide',
'ua', 'ua',
'th', 'us+colemak', 'us+colemak_wide',
'terminal', 'terminal_wide', 'us+dvorak', 'us+dvorak_wide',
# Block: Not languages.
'emoji', 'emoji',
'number',
'terminal', 'terminal_wide',
] ]
extra = [] extra = []
if layout == 'emoji' if layout == 'emoji'
extra += ['allow_missing_return'] extra += ['allow_missing_return']
endif endif
# Older Cargo seens to be sensitive to something
# about the RUST_FLAGS env var, and rebuilds all tests when it's set,
# increasing test time by 2 orders of magnitude.
# Let it have its way.
if get_option('legacy') == true
timeout = 300
else
timeout = 30
endif
test( test(
'test_layout_' + layout, 'test_layout_' + layout,
cargo_script, cargo_script,
args: ['run'] + cargo_build_flags args: ['run'] + cargo_build_flags
+ ['--example', 'test_layout', '--', layout] + ['--example', 'test_layout', '--', layout]
+ extra, + extra,
timeout: timeout,
workdir: meson.build_root(), workdir: meson.build_root(),
) )
endforeach endforeach