Compare commits
	
		
			42 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 914c5d4940 | |||
| b72c6b53e4 | |||
| 701168c32b | |||
| 558a2568e3 | |||
| 9517c347b6 | |||
| 8dd92c81e7 | |||
| 03ccfe77ad | |||
| c103b84fa6 | |||
| 9a72db2fcc | |||
| 61a84c47f1 | |||
| a9ecc13185 | |||
| 7143fb2497 | |||
| dfee95430d | |||
| fcd0eaddf2 | |||
| ba2e191918 | |||
| cc4f14e8c6 | |||
| 103e64b96c | |||
| 2796362d34 | |||
| af00d74f71 | |||
| 02d579d757 | |||
| 01d06d0f5f | |||
| 1d1c98c27a | |||
| 696d77293e | |||
| 225c204e37 | |||
| c3b428e517 | |||
| 1fe6d65525 | |||
| 39a3c40d67 | |||
| 963f52bbc3 | |||
| 9dcc4c9868 | |||
| df8e885983 | |||
| 540c4d9c05 | |||
| 42483234e3 | |||
| c9f9a3b577 | |||
| 81041b8035 | |||
| c731124f7b | |||
| fca8984225 | |||
| bd6ab663c0 | |||
| 17db3db296 | |||
| cf09d1b3bc | |||
| 81fb7e0df3 | |||
| 0e533c5e94 | |||
| 5d81cf78f8 | 
							
								
								
									
										49
									
								
								cargo_build.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								cargo_build.py
									
									
									
									
									
										Normal 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)
 | 
			
		||||
 | 
			
		||||
@ -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
									
								
							
							
						
						
									
										78
									
								
								data/keyboards/bg.yaml
									
									
									
									
									
										Normal 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"
 | 
			
		||||
							
								
								
									
										106
									
								
								data/keyboards/cz+qwerty.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										106
									
								
								data/keyboards/cz+qwerty.yaml
									
									
									
									
									
										Normal 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: ":"
 | 
			
		||||
							
								
								
									
										106
									
								
								data/keyboards/cz+qwerty_wide.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										106
									
								
								data/keyboards/cz+qwerty_wide.yaml
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										106
									
								
								data/keyboards/cz.yaml
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										106
									
								
								data/keyboards/cz_wide.yaml
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										81
									
								
								data/keyboards/epo.yaml
									
									
									
									
									
										Normal 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"
 | 
			
		||||
@ -2,9 +2,9 @@
 | 
			
		||||
outlines:
 | 
			
		||||
    default: { width: 32, height: 52 }
 | 
			
		||||
    altline: { width: 48.39024, height: 52 }
 | 
			
		||||
    wide: { width: 62, height: 52 }
 | 
			
		||||
    outline7: { width: 88.97561, height: 52 }
 | 
			
		||||
    spaceline: { width: 150.5853, height: 52 }
 | 
			
		||||
    wide: { width: 64, height: 52 }
 | 
			
		||||
    spaceline: { width: 142, height: 52 }
 | 
			
		||||
    special: { width: 44, height: 52 }
 | 
			
		||||
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
@ -25,7 +25,7 @@ views:
 | 
			
		||||
    symbols:
 | 
			
		||||
        - "~ ` | U00B7 squareroot Greek_pi Greek_tau division multiply paragraph"
 | 
			
		||||
        - "copyright U00AE U00A3 EuroSign U00A5 asciicircum degree * { }"
 | 
			
		||||
        - "show_numbers   \\ / < > = [ ]  BackSpace"
 | 
			
		||||
        - "show_numbers_from_symbols   \\ / < > = [ ]  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        .    Return"
 | 
			
		||||
 | 
			
		||||
buttons:
 | 
			
		||||
@ -42,17 +42,22 @@ buttons:
 | 
			
		||||
        action: erase
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        icon: "keyboard-mode-symbolic"
 | 
			
		||||
    show_numbers:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "numbers"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "123"
 | 
			
		||||
    show_numbers_from_symbols:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "numbers"
 | 
			
		||||
        outline: altline
 | 
			
		||||
        label: "123"
 | 
			
		||||
    show_letters:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "ABC"
 | 
			
		||||
    show_symbols:
 | 
			
		||||
        action:
 | 
			
		||||
@ -60,7 +65,7 @@ buttons:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "*/="
 | 
			
		||||
    ".":
 | 
			
		||||
        outline: altline
 | 
			
		||||
        outline: "special"
 | 
			
		||||
    space:
 | 
			
		||||
        outline: spaceline
 | 
			
		||||
        text: " "
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										80
									
								
								data/keyboards/th.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								data/keyboards/th.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,80 @@
 | 
			
		||||
---
 | 
			
		||||
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:
 | 
			
		||||
        - "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: "กขค"
 | 
			
		||||
    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/us+colemak.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								data/keyboards/us+colemak.yaml
									
									
									
									
									
										Normal 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: ":"
 | 
			
		||||
							
								
								
									
										13
									
								
								data/langs/bg-BG.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								data/langs/bg-BG.txt
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										21
									
								
								data/langs/cs-CZ.txt
									
									
									
									
									
										Normal 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)
 | 
			
		||||
							
								
								
									
										1
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							@ -26,6 +26,7 @@ Build-Depends:
 | 
			
		||||
 librust-xkbcommon-0.4+wayland-dev (>= 0.4),
 | 
			
		||||
 libwayland-dev (>= 1.16),
 | 
			
		||||
 lsb-release,
 | 
			
		||||
 python3,
 | 
			
		||||
 rustc,
 | 
			
		||||
 wayland-protocols (>= 1.14),
 | 
			
		||||
Standards-Version: 4.1.3
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										21
									
								
								debian/rules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								debian/rules
									
									
									
									
										vendored
									
									
								
							@ -2,6 +2,27 @@
 | 
			
		||||
 | 
			
		||||
export CARGO_HOME = $(CURDIR)/debian/cargo
 | 
			
		||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 | 
			
		||||
# 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)
 | 
			
		||||
 export RUSTFLAGS = -Ctarget-feature=+xgot
 | 
			
		||||
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)
 | 
			
		||||
ifneq (,$(filter $(distrel),buster amber))
 | 
			
		||||
 | 
			
		||||
@ -179,7 +179,10 @@ Dependencies must be specified in `Cargo.toml` with 2 numbers: "major.minor". Si
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
cd build_dir
 | 
			
		||||
ninja build src/Cargo.toml
 | 
			
		||||
ninja ./Cargo.toml
 | 
			
		||||
sh /source_path/cargo.sh update
 | 
			
		||||
ninja test
 | 
			
		||||
cp ./Cargo.lock /source_path/
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Since version 1.9.3, `Cargo.lock` is not actually used by the build system, due to `Cargo.toml` being generated at every build.
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										16
									
								
								meson.build
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								meson.build
									
									
									
									
									
								
							@ -23,12 +23,13 @@ add_project_arguments(
 | 
			
		||||
    '-Werror=parentheses',
 | 
			
		||||
    '-Wformat-nonliteral',
 | 
			
		||||
    '-Wformat-security',
 | 
			
		||||
    '-Wformat',
 | 
			
		||||
    '-Winit-self',
 | 
			
		||||
    '-Wmaybe-uninitialized',
 | 
			
		||||
    '-Wold-style-definition',
 | 
			
		||||
    '-Wredundant-decls',
 | 
			
		||||
    '-Wstrict-prototypes',
 | 
			
		||||
    '-Wunused-function',
 | 
			
		||||
    '-Wunused',
 | 
			
		||||
  ],
 | 
			
		||||
  language: 'c'
 | 
			
		||||
)
 | 
			
		||||
@ -40,6 +41,16 @@ conf_data = configuration_data()
 | 
			
		||||
if get_option('buildtype').startswith('debug')
 | 
			
		||||
    add_project_arguments('-DDEBUG=1', language : 'c')
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
if get_option('strict')
 | 
			
		||||
    add_project_arguments(
 | 
			
		||||
        [
 | 
			
		||||
            '-Werror',
 | 
			
		||||
        ],
 | 
			
		||||
        language: 'c'
 | 
			
		||||
    )
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
if get_option('buildtype') != 'plain'
 | 
			
		||||
    add_project_arguments('-fstack-protector-strong', language: 'c')
 | 
			
		||||
endif
 | 
			
		||||
@ -72,6 +83,7 @@ summary = [
 | 
			
		||||
message('\n'.join(summary))
 | 
			
		||||
 | 
			
		||||
# Rust deps are changing, depending on compile flags. Cargo can't handle it alone.
 | 
			
		||||
# As a side effect, Cargo.toml never gets used.
 | 
			
		||||
cargo_toml_in = files('Cargo.toml.in')
 | 
			
		||||
path_data = configuration_data()
 | 
			
		||||
path_data.set('path', meson.source_root())
 | 
			
		||||
@ -99,7 +111,7 @@ cargo_toml = custom_target(
 | 
			
		||||
 | 
			
		||||
dep_cargo = find_program('cargo')
 | 
			
		||||
cargo_script = find_program('cargo.sh')
 | 
			
		||||
cargo_build = find_program('cargo_build.sh')
 | 
			
		||||
cargo_build = find_program('cargo_build.py')
 | 
			
		||||
 | 
			
		||||
subdir('data')
 | 
			
		||||
subdir('protocols')
 | 
			
		||||
 | 
			
		||||
@ -10,3 +10,7 @@ option('tests',
 | 
			
		||||
option('legacy',
 | 
			
		||||
       type: 'boolean', value: false,
 | 
			
		||||
       description: 'Build with Deban Buster versions of dependencies')
 | 
			
		||||
 | 
			
		||||
option('strict',
 | 
			
		||||
       type: 'boolean', value: true,
 | 
			
		||||
       description: 'Turn more warnings into errors')
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										128
									
								
								src/data.rs
									
									
									
									
									
								
							
							
						
						
									
										128
									
								
								src/data.rs
									
									
									
									
									
								
							@ -97,6 +97,8 @@ impl fmt::Display for DataSource {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type LayoutSource = (ArrangementKind, DataSource);
 | 
			
		||||
 | 
			
		||||
/// Lists possible sources, with 0 as the most preferred one
 | 
			
		||||
/// Trying order: native lang of the right kind, native base,
 | 
			
		||||
/// fallback lang of the right kind, fallback base
 | 
			
		||||
@ -104,19 +106,13 @@ fn list_layout_sources(
 | 
			
		||||
    name: &str,
 | 
			
		||||
    kind: ArrangementKind,
 | 
			
		||||
    keyboards_path: Option<PathBuf>,
 | 
			
		||||
) -> Vec<(ArrangementKind, DataSource)> {
 | 
			
		||||
    let mut ret = Vec::new();
 | 
			
		||||
    {
 | 
			
		||||
        fn name_with_arrangement(name: String, kind: &ArrangementKind)
 | 
			
		||||
            -> String
 | 
			
		||||
        {
 | 
			
		||||
            match kind {    
 | 
			
		||||
                ArrangementKind::Base => name,
 | 
			
		||||
                ArrangementKind::Wide => name + "_wide",
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        let mut add_by_name = |name: &str, kind: &ArrangementKind| {
 | 
			
		||||
) -> Vec<LayoutSource> {
 | 
			
		||||
    // Just a simplification of often called code.
 | 
			
		||||
    let add_by_name = |
 | 
			
		||||
        mut ret: Vec<LayoutSource>,
 | 
			
		||||
        name: &str,
 | 
			
		||||
        kind: &ArrangementKind,
 | 
			
		||||
    | -> Vec<LayoutSource> {
 | 
			
		||||
        if let Some(path) = keyboards_path.clone() {
 | 
			
		||||
            ret.push((
 | 
			
		||||
                kind.clone(),
 | 
			
		||||
@ -130,29 +126,56 @@ fn list_layout_sources(
 | 
			
		||||
            kind.clone(),
 | 
			
		||||
            DataSource::Resource(name.into())
 | 
			
		||||
        ));
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        match &kind {
 | 
			
		||||
            ArrangementKind::Base => {},
 | 
			
		||||
            kind => add_by_name(
 | 
			
		||||
                &name_with_arrangement(name.into(), &kind),
 | 
			
		||||
                &kind,
 | 
			
		||||
            ),
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        add_by_name(name, &ArrangementKind::Base);
 | 
			
		||||
 | 
			
		||||
        match &kind {
 | 
			
		||||
            ArrangementKind::Base => {},
 | 
			
		||||
            kind => add_by_name(
 | 
			
		||||
                &name_with_arrangement(FALLBACK_LAYOUT_NAME.into(), &kind),
 | 
			
		||||
                &kind,
 | 
			
		||||
            ),
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        add_by_name(FALLBACK_LAYOUT_NAME, &ArrangementKind::Base);
 | 
			
		||||
    }
 | 
			
		||||
        ret
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    // Another grouping.
 | 
			
		||||
    let add_by_kind = |ret, name: &str, kind| {
 | 
			
		||||
        let ret = match kind {
 | 
			
		||||
            &ArrangementKind::Base => ret,
 | 
			
		||||
            kind => add_by_name(
 | 
			
		||||
                ret,
 | 
			
		||||
                &name_with_arrangement(name.into(), kind),
 | 
			
		||||
                kind,
 | 
			
		||||
            ),
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        add_by_name(ret, name, &ArrangementKind::Base)
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    fn name_with_arrangement(name: String, kind: &ArrangementKind) -> String {
 | 
			
		||||
        match kind {    
 | 
			
		||||
            ArrangementKind::Base => name,
 | 
			
		||||
            ArrangementKind::Wide => name + "_wide",
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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)
 | 
			
		||||
@ -746,13 +769,21 @@ mod tests {
 | 
			
		||||
 | 
			
		||||
    use ::logging::ProblemPanic;
 | 
			
		||||
 | 
			
		||||
    const THIS_FILE: &str = file!();
 | 
			
		||||
 | 
			
		||||
    fn path_from_root(file: &'static str) -> PathBuf {
 | 
			
		||||
        PathBuf::from(THIS_FILE)
 | 
			
		||||
        let source_dir = env::var("SOURCE_DIR")
 | 
			
		||||
            .map(PathBuf::from)
 | 
			
		||||
            .unwrap_or_else(|e| {
 | 
			
		||||
                if let env::VarError::NotPresent = e {
 | 
			
		||||
                    let this_file = file!();
 | 
			
		||||
                    PathBuf::from(this_file)
 | 
			
		||||
                        .parent().unwrap()
 | 
			
		||||
                        .parent().unwrap()
 | 
			
		||||
            .join(file)
 | 
			
		||||
                        .into()
 | 
			
		||||
                } else {
 | 
			
		||||
                    panic!("{:?}", e);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        source_dir.join(file)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
@ -910,6 +941,25 @@ 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]
 | 
			
		||||
    fn unicode_keysym() {
 | 
			
		||||
        let keysym = xkb::keysym_from_name(
 | 
			
		||||
 | 
			
		||||
@ -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 zwp_virtual_keyboard_manager_v1 *vkmanager,
 | 
			
		||||
                                  struct vis_manager *vis_manager,
 | 
			
		||||
                                  struct wl_seat *seat,
 | 
			
		||||
                                  EekboardContextService *state) {
 | 
			
		||||
    struct zwp_input_method_v2 *im = NULL;
 | 
			
		||||
@ -35,7 +36,7 @@ struct submission* get_submission(struct zwp_input_method_manager_v2 *immanager,
 | 
			
		||||
    if (vkmanager) {
 | 
			
		||||
        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
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,6 @@
 | 
			
		||||
use std::boxed::Box;
 | 
			
		||||
use std::ffi::CString;
 | 
			
		||||
use std::fmt;
 | 
			
		||||
use std::mem;
 | 
			
		||||
use std::num::Wrapping;
 | 
			
		||||
use std::string::String;
 | 
			
		||||
 | 
			
		||||
@ -24,7 +23,7 @@ pub mod c {
 | 
			
		||||
 | 
			
		||||
    use std::os::raw::{c_char, c_void};
 | 
			
		||||
 | 
			
		||||
    pub use ::submission::c::UIManager;
 | 
			
		||||
    pub use ::ui_manager::c::UIManager;
 | 
			
		||||
    pub use ::submission::c::StateManager;
 | 
			
		||||
 | 
			
		||||
    // The following defined in C
 | 
			
		||||
@ -42,8 +41,6 @@ pub mod c {
 | 
			
		||||
        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);
 | 
			
		||||
        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
 | 
			
		||||
@ -153,18 +150,23 @@ pub mod c {
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        if active_changed {
 | 
			
		||||
            imservice.apply_active_to_ui();
 | 
			
		||||
            if imservice.current.active {
 | 
			
		||||
            (imservice.active_callback)(imservice.current.active);
 | 
			
		||||
            let (hint, purpose) = if imservice.current.active {(
 | 
			
		||||
                imservice.current.content_hint,
 | 
			
		||||
                imservice.current.content_purpose.clone(),
 | 
			
		||||
            )} else {(
 | 
			
		||||
                ContentHint::NONE,
 | 
			
		||||
                ContentPurpose::Normal,
 | 
			
		||||
            )};
 | 
			
		||||
            unsafe {
 | 
			
		||||
                eekboard_context_service_set_hint_purpose(
 | 
			
		||||
                    imservice.state_manager,
 | 
			
		||||
                        imservice.current.content_hint.bits(),
 | 
			
		||||
                        imservice.current.content_purpose.clone() as u32,
 | 
			
		||||
                    hint.bits(),
 | 
			
		||||
                    purpose as u32,
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    // TODO: this is really untested
 | 
			
		||||
    #[no_mangle]
 | 
			
		||||
@ -179,9 +181,7 @@ pub mod c {
 | 
			
		||||
        // the keyboard is already decommissioned
 | 
			
		||||
        imservice.current.active = false;
 | 
			
		||||
 | 
			
		||||
        if let Some(ui) = imservice.ui_manager {
 | 
			
		||||
            unsafe { server_context_service_keyboard_release_visibility(ui); }
 | 
			
		||||
        }
 | 
			
		||||
        (imservice.active_callback)(imservice.current.active);
 | 
			
		||||
    }    
 | 
			
		||||
 | 
			
		||||
    // FIXME: destroy and deallocate
 | 
			
		||||
@ -334,8 +334,7 @@ pub struct IMService {
 | 
			
		||||
    pub im: *mut c::InputMethod,
 | 
			
		||||
    /// Unowned reference. Be careful, it's shared with C at large
 | 
			
		||||
    state_manager: *const c::StateManager,
 | 
			
		||||
    /// Unowned reference. Be careful, it's shared with C at large
 | 
			
		||||
    ui_manager: Option<*const c::UIManager>,
 | 
			
		||||
    active_callback: Box<dyn Fn(bool)>,
 | 
			
		||||
 | 
			
		||||
    pending: IMProtocolState,
 | 
			
		||||
    current: IMProtocolState, // turn current into an idiomatic representation?
 | 
			
		||||
@ -352,12 +351,13 @@ impl IMService {
 | 
			
		||||
    pub fn new(
 | 
			
		||||
        im: *mut c::InputMethod,
 | 
			
		||||
        state_manager: *const c::StateManager,
 | 
			
		||||
        active_callback: Box<dyn Fn(bool)>,
 | 
			
		||||
    ) -> Box<IMService> {
 | 
			
		||||
        // IMService will be referenced to by C,
 | 
			
		||||
        // so it needs to stay in the same place in memory via Box
 | 
			
		||||
        let imservice = Box::new(IMService {
 | 
			
		||||
            im,
 | 
			
		||||
            ui_manager: None,
 | 
			
		||||
            active_callback,
 | 
			
		||||
            state_manager,
 | 
			
		||||
            pending: IMProtocolState::default(),
 | 
			
		||||
            current: IMProtocolState::default(),
 | 
			
		||||
@ -373,26 +373,6 @@ impl 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> {
 | 
			
		||||
        match self.current.active {
 | 
			
		||||
            true => {
 | 
			
		||||
 | 
			
		||||
@ -80,6 +80,7 @@ test(
 | 
			
		||||
    'rstest',
 | 
			
		||||
    cargo_script,
 | 
			
		||||
    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
 | 
			
		||||
    timeout: 900,
 | 
			
		||||
    depends: [build_rstests, cargo_toml],
 | 
			
		||||
 | 
			
		||||
@ -14,13 +14,19 @@ const KEYBOARDS: &[(*const str, *const str)] = &[
 | 
			
		||||
    // layouts: us must be left as first, as it is the,
 | 
			
		||||
    // fallback layout. The others should be alphabetical.
 | 
			
		||||
    ("us", include_str!("../data/keyboards/us.yaml")),
 | 
			
		||||
    ("us+colemak", include_str!("../data/keyboards/us+colemak.yaml")),
 | 
			
		||||
    ("us_wide", include_str!("../data/keyboards/us_wide.yaml")),
 | 
			
		||||
    ("br", include_str!("../data/keyboards/br.yaml")),
 | 
			
		||||
    ("de", include_str!("../data/keyboards/de.yaml")),
 | 
			
		||||
    ("be", include_str!("../data/keyboards/be.yaml")),
 | 
			
		||||
    ("be_wide", include_str!("../data/keyboards/be_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")),
 | 
			
		||||
    ("epo", include_str!("../data/keyboards/epo.yaml")),
 | 
			
		||||
    ("es", include_str!("../data/keyboards/es.yaml")),
 | 
			
		||||
    ("fi", include_str!("../data/keyboards/fi.yaml")),
 | 
			
		||||
    ("fr", include_str!("../data/keyboards/fr.yaml")),
 | 
			
		||||
@ -36,7 +42,9 @@ const KEYBOARDS: &[(*const str, *const str)] = &[
 | 
			
		||||
    ("pl_wide", include_str!("../data/keyboards/pl_wide.yaml")),
 | 
			
		||||
    ("ru", include_str!("../data/keyboards/ru.yaml")),
 | 
			
		||||
    ("se", include_str!("../data/keyboards/se.yaml")),
 | 
			
		||||
    ("th", include_str!("../data/keyboards/th.yaml")),
 | 
			
		||||
    ("ua", include_str!("../data/keyboards/ua.yaml")),
 | 
			
		||||
    ("bg", include_str!("../data/keyboards/bg.yaml")),
 | 
			
		||||
    // layout+overlay
 | 
			
		||||
    ("terminal", include_str!("../data/keyboards/terminal.yaml")),
 | 
			
		||||
    ("terminal_wide", include_str!("../data/keyboards/terminal_wide.yaml")),
 | 
			
		||||
 | 
			
		||||
@ -43,10 +43,9 @@ struct _ServerContextService {
 | 
			
		||||
    struct submission *submission; // unowned
 | 
			
		||||
    struct squeek_layout_state *layout;
 | 
			
		||||
    struct ui_manager *manager; // unowned
 | 
			
		||||
    struct vis_manager *vis_manager; // owned
 | 
			
		||||
 | 
			
		||||
    gboolean visible;
 | 
			
		||||
    gboolean enabled;
 | 
			
		||||
    gboolean im_active;
 | 
			
		||||
    PhoshLayerSurface *window;
 | 
			
		||||
    GtkWidget *widget; // nullable
 | 
			
		||||
    guint hiding;
 | 
			
		||||
@ -288,7 +287,7 @@ server_context_service_hide_keyboard (ServerContextService *self)
 | 
			
		||||
/// In this case, the user doesn't really need the keyboard surface
 | 
			
		||||
/// to disappear completely.
 | 
			
		||||
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));
 | 
			
		||||
 | 
			
		||||
@ -297,6 +296,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
 | 
			
		||||
server_context_service_set_property (GObject      *object,
 | 
			
		||||
                                     guint         prop_id,
 | 
			
		||||
@ -310,7 +316,7 @@ server_context_service_set_property (GObject      *object,
 | 
			
		||||
        self->visible = g_value_get_boolean (value);
 | 
			
		||||
        break;
 | 
			
		||||
    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;
 | 
			
		||||
    default:
 | 
			
		||||
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
@ -385,12 +391,14 @@ server_context_service_class_init (ServerContextServiceClass *klass)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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";
 | 
			
		||||
    GSettingsSchemaSource *ssrc = g_settings_schema_source_get_default();
 | 
			
		||||
    g_autoptr(GSettingsSchema) schema = NULL;
 | 
			
		||||
 | 
			
		||||
    self->enabled = TRUE;
 | 
			
		||||
    if (!ssrc) {
 | 
			
		||||
        g_warning("No gsettings schemas installed.");
 | 
			
		||||
        return;
 | 
			
		||||
@ -407,37 +415,24 @@ server_context_service_init (ServerContextService *self) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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);
 | 
			
		||||
    ui->submission = submission;
 | 
			
		||||
    ui->state = self;
 | 
			
		||||
    ui->layout = layout;
 | 
			
		||||
    ui->manager = uiman;
 | 
			
		||||
    ui->vis_manager = visman;
 | 
			
		||||
    init(ui);
 | 
			
		||||
    return ui;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
server_context_service_update_visible (ServerContextService *self, gboolean delay) {
 | 
			
		||||
    if (self->enabled && self->im_active) {
 | 
			
		||||
server_context_service_update_visible (ServerContextService *self, gboolean visible) {
 | 
			
		||||
    if (visible) {
 | 
			
		||||
        server_context_service_show_keyboard(self);
 | 
			
		||||
    } else if (delay) {
 | 
			
		||||
        server_context_service_keyboard_release_visibility(self);
 | 
			
		||||
    } else {
 | 
			
		||||
        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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -29,11 +29,10 @@ G_BEGIN_DECLS
 | 
			
		||||
/** Manages the lifecycle of the window displaying layouts. */
 | 
			
		||||
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 *);
 | 
			
		||||
void server_context_service_show_keyboard (ServerContextService *self);
 | 
			
		||||
void server_context_service_hide_keyboard (ServerContextService *self);
 | 
			
		||||
void server_context_service_set_enabled (ServerContextService *self, gboolean enabled);
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
#endif  /* SERVER_CONTEXT_SERVICE_H */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -277,8 +277,11 @@ main (int argc, char **argv)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    struct vis_manager *vis_manager = squeek_visman_new();
 | 
			
		||||
 | 
			
		||||
    instance.submission = get_submission(instance.wayland.input_method_manager,
 | 
			
		||||
                                         instance.wayland.virtual_keyboard_manager,
 | 
			
		||||
                                         vis_manager,
 | 
			
		||||
                                         instance.wayland.seat,
 | 
			
		||||
                                         instance.settings_context);
 | 
			
		||||
 | 
			
		||||
@ -288,15 +291,15 @@ main (int argc, char **argv)
 | 
			
		||||
                instance.settings_context,
 | 
			
		||||
                instance.submission,
 | 
			
		||||
                &instance.layout_choice,
 | 
			
		||||
                instance.ui_manager);
 | 
			
		||||
                instance.ui_manager,
 | 
			
		||||
                vis_manager);
 | 
			
		||||
    if (!ui_context) {
 | 
			
		||||
        g_error("Could not initialize GUI");
 | 
			
		||||
        exit(1);
 | 
			
		||||
    }
 | 
			
		||||
    instance.ui_context = ui_context;
 | 
			
		||||
    if (instance.submission) {
 | 
			
		||||
        submission_set_ui(instance.submission, instance.ui_context);
 | 
			
		||||
    }
 | 
			
		||||
    squeek_visman_set_ui(vis_manager, instance.ui_context);
 | 
			
		||||
 | 
			
		||||
    if (instance.dbus_handler) {
 | 
			
		||||
        dbus_handler_set_ui_context(instance.dbus_handler, instance.ui_context);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -4,17 +4,19 @@
 | 
			
		||||
#include "input-method-unstable-v2-client-protocol.h"
 | 
			
		||||
#include "virtual-keyboard-unstable-v1-client-protocol.h"
 | 
			
		||||
#include "eek/eek-types.h"
 | 
			
		||||
#include "src/ui_manager.h"
 | 
			
		||||
 | 
			
		||||
struct submission;
 | 
			
		||||
struct squeek_layout;
 | 
			
		||||
 | 
			
		||||
struct submission* get_submission(struct zwp_input_method_manager_v2 *immanager,
 | 
			
		||||
                                  struct zwp_virtual_keyboard_manager_v1 *vkmanager,
 | 
			
		||||
                                  struct vis_manager *vis_manager,
 | 
			
		||||
                                  struct wl_seat *seat,
 | 
			
		||||
                                  EekboardContextService *state);
 | 
			
		||||
 | 
			
		||||
// 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);
 | 
			
		||||
void submission_set_ui(struct submission *self, ServerContextService *ui_context);
 | 
			
		||||
void submission_use_layout(struct submission *self, struct squeek_layout *layout, uint32_t time);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -24,6 +24,7 @@ use ::imservice;
 | 
			
		||||
use ::imservice::IMService;
 | 
			
		||||
use ::keyboard::{ KeyCode, KeyStateId, Modifiers, PressType };
 | 
			
		||||
use ::layout;
 | 
			
		||||
use ::ui_manager::VisibilityManager;
 | 
			
		||||
use ::util::vec_remove;
 | 
			
		||||
use ::vkeyboard;
 | 
			
		||||
use ::vkeyboard::VirtualKeyboard;
 | 
			
		||||
@ -38,14 +39,11 @@ pub mod c {
 | 
			
		||||
    use std::os::raw::c_void;
 | 
			
		||||
 | 
			
		||||
    use ::imservice::c::InputMethod;
 | 
			
		||||
    use ::util::c::Wrapped;
 | 
			
		||||
    use ::vkeyboard::c::ZwpVirtualKeyboardV1;
 | 
			
		||||
 | 
			
		||||
    // The following defined in C
 | 
			
		||||
 | 
			
		||||
    /// ServerContextService*
 | 
			
		||||
    #[repr(transparent)]
 | 
			
		||||
    pub struct UIManager(*const c_void);
 | 
			
		||||
 | 
			
		||||
    /// EekboardContextService*
 | 
			
		||||
    #[repr(transparent)]
 | 
			
		||||
    pub struct StateManager(*const c_void);
 | 
			
		||||
@ -55,12 +53,18 @@ pub mod c {
 | 
			
		||||
    fn submission_new(
 | 
			
		||||
        im: *mut InputMethod,
 | 
			
		||||
        vk: ZwpVirtualKeyboardV1,
 | 
			
		||||
        state_manager: *const StateManager
 | 
			
		||||
        state_manager: *const StateManager,
 | 
			
		||||
        visibility_manager: Wrapped<VisibilityManager>,
 | 
			
		||||
    ) -> *mut Submission {
 | 
			
		||||
        let imservice = if im.is_null() {
 | 
			
		||||
            None
 | 
			
		||||
        } 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
 | 
			
		||||
        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]
 | 
			
		||||
    pub extern "C"
 | 
			
		||||
    fn submission_use_layout(
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@
 | 
			
		||||
 | 
			
		||||
#include <inttypes.h>
 | 
			
		||||
 | 
			
		||||
#include "eek/eek-types.h"
 | 
			
		||||
#include "outputs.h"
 | 
			
		||||
 | 
			
		||||
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);
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
@ -10,10 +10,50 @@
 | 
			
		||||
use std::cmp::min;
 | 
			
		||||
use ::outputs::c::OutputHandle;
 | 
			
		||||
 | 
			
		||||
mod c {
 | 
			
		||||
pub mod c {
 | 
			
		||||
    use super::*;
 | 
			
		||||
    use std::os::raw::c_void;
 | 
			
		||||
    use ::util::c::Wrapped;
 | 
			
		||||
    
 | 
			
		||||
    /// ServerContextService*
 | 
			
		||||
    #[repr(transparent)]
 | 
			
		||||
    pub struct UIManager(*const c_void);
 | 
			
		||||
 | 
			
		||||
    #[no_mangle]
 | 
			
		||||
    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]
 | 
			
		||||
    pub extern "C"
 | 
			
		||||
    fn squeek_uiman_new() -> Wrapped<Manager> {
 | 
			
		||||
@ -79,3 +119,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(),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -48,11 +48,15 @@ endforeach
 | 
			
		||||
# due to the way Cargo builds executables
 | 
			
		||||
# and the need to call it manually
 | 
			
		||||
foreach layout : [
 | 
			
		||||
    'us', 'us_wide',
 | 
			
		||||
    'us', 'us+colemak', 'us_wide',
 | 
			
		||||
    'br',
 | 
			
		||||
    'be', 'be_wide',
 | 
			
		||||
    'bg',
 | 
			
		||||
    'cz', 'cz_wide',
 | 
			
		||||
    'cz+qwerty', 'cz+qwerty_wide',
 | 
			
		||||
    'de', 'de_wide',
 | 
			
		||||
    'dk',
 | 
			
		||||
    'epo',
 | 
			
		||||
    'es',
 | 
			
		||||
    'fi',
 | 
			
		||||
    'fr', 'fr_wide',
 | 
			
		||||
@ -66,6 +70,7 @@ foreach layout : [
 | 
			
		||||
    'ru',
 | 
			
		||||
    'se',
 | 
			
		||||
    'ua',
 | 
			
		||||
    'th',
 | 
			
		||||
    'terminal', 'terminal_wide',
 | 
			
		||||
 | 
			
		||||
    'emoji',
 | 
			
		||||
@ -75,12 +80,22 @@ foreach layout : [
 | 
			
		||||
        extra += ['allow_missing_return']
 | 
			
		||||
    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_layout_' + layout,
 | 
			
		||||
        cargo_script,
 | 
			
		||||
        args: ['run'] + cargo_build_flags
 | 
			
		||||
            + ['--example', 'test_layout', '--', layout]
 | 
			
		||||
            + extra,
 | 
			
		||||
        timeout: timeout,
 | 
			
		||||
        workdir: meson.build_root(),
 | 
			
		||||
    )
 | 
			
		||||
endforeach
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user