Compare commits
	
		
			111 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 273423f626 | |||
| d80cbf880f | |||
| 1924a8e634 | |||
| 647fde26f5 | |||
| 23f8f9b091 | |||
| c3c1e1c76d | |||
| 7a21b992dc | |||
| 5485153599 | |||
| 4a92489de8 | |||
| 825409c97f | |||
| 6ad85d79e4 | |||
| 7e57df3434 | |||
| 24cacf988b | |||
| 2657b5ef1f | |||
| 674bef2b00 | |||
| 8e55e9ee56 | |||
| e1a012cf50 | |||
| 50dab14754 | |||
| 733cbe94ee | |||
| 01a8afad0d | |||
| bafd1e6eb3 | |||
| a799178b6a | |||
| 12be3e980f | |||
| ca8a2baefa | |||
| 6b72d09fb8 | |||
| d76deb0655 | |||
| 3b0456b5cd | |||
| 77a6ca1900 | |||
| c0331434d7 | |||
| e9d6631159 | |||
| f335ea92d4 | |||
| c8dd34c829 | |||
| 4d656ff54d | |||
| e2b89e85f7 | |||
| b6f3d9c1ea | |||
| 9ff11dc511 | |||
| 1cffdda09d | |||
| d9f284b19a | |||
| ed602faeaf | |||
| 0e1bf19737 | |||
| 1237537005 | |||
| 257b97e9ca | |||
| 5e700219f9 | |||
| 927f088027 | |||
| 8b3f7e0b11 | |||
| ae43d7ca47 | |||
| 432e4fe1e5 | |||
| 6afa2133d0 | |||
| cfa66d8182 | |||
| b6e67256c3 | |||
| d5c8f32088 | |||
| 6f990f4528 | |||
| 7641b4da6f | |||
| a84730198d | |||
| 0b136468c8 | |||
| fe4642e71e | |||
| 16289c6f82 | |||
| b639c7f3f0 | |||
| d80758fcd1 | |||
| dd21bfed8d | |||
| 1f69787fac | |||
| 36362291ef | |||
| 1c4d027af5 | |||
| 51a77c41c3 | |||
| 8b4c643d3e | |||
| 358b25c431 | |||
| f77db1bb73 | |||
| 581c86809a | |||
| 804aa53351 | |||
| e6da2a3b5b | |||
| f9fbd3fb2d | |||
| 2749fdb686 | |||
| 8e7909e877 | |||
| afaacd3f68 | |||
| 6a164d8119 | |||
| 6e32a2ef41 | |||
| 34fce7395d | |||
| d415ecf5d0 | |||
| 5266c621fd | |||
| 4ee832c594 | |||
| 83fea8cd31 | |||
| 3c45e3e53c | |||
| cdf263d984 | |||
| 2ddfcfaff0 | |||
| a901c85bcb | |||
| fdbbe8f126 | |||
| f284627beb | |||
| d45724c462 | |||
| 93d0dcdc99 | |||
| b252f7659b | |||
| af6ad1fce6 | |||
| 4ee8a91dfe | |||
| 6d5f793718 | |||
| 59f6173282 | |||
| 3aec821f92 | |||
| 3ac4caa3b9 | |||
| 80ac591535 | |||
| 579ba8ab87 | |||
| 5a262242a3 | |||
| 034570bfa0 | |||
| 1abca0a44e | |||
| 23693521b7 | |||
| bb18e60754 | |||
| 0179507254 | |||
| 0c7e77a05f | |||
| 0adde1004f | |||
| 9b271a6919 | |||
| 1db561d33a | |||
| 9571adb107 | |||
| f834f174d8 | |||
| 3c0b142c4f | 
@ -14,7 +14,16 @@ before_script:
 | 
			
		||||
  - echo "deb http://ci.puri.sm/ scratch librem5" > /etc/apt/sources.list.d/ci.list
 | 
			
		||||
  - wget -O- https://ci.puri.sm/ci-repo.key | apt-key add -
 | 
			
		||||
  - apt-get -y update
 | 
			
		||||
  - apt-get -y build-dep .
 | 
			
		||||
 | 
			
		||||
build_docs:
 | 
			
		||||
  <<: *tags
 | 
			
		||||
  stage: build
 | 
			
		||||
  artifacts:
 | 
			
		||||
    paths:
 | 
			
		||||
      - _build
 | 
			
		||||
  script:
 | 
			
		||||
      - apt-get -y install python3-recommonmark python3-sphinx
 | 
			
		||||
      - ./doc/build.sh _build
 | 
			
		||||
 | 
			
		||||
build_meson:
 | 
			
		||||
  <<: *tags
 | 
			
		||||
@ -24,16 +33,33 @@ build_meson:
 | 
			
		||||
      - _build
 | 
			
		||||
    expire_in: 3h
 | 
			
		||||
  script:
 | 
			
		||||
    - apt-get -y build-dep .
 | 
			
		||||
    - meson . _build/ -Ddepdatadir=/usr/share
 | 
			
		||||
    - ninja -C _build install
 | 
			
		||||
 | 
			
		||||
build_deb:
 | 
			
		||||
    <<: *tags
 | 
			
		||||
    tags:
 | 
			
		||||
        - librem5
 | 
			
		||||
    stage: build
 | 
			
		||||
    artifacts:
 | 
			
		||||
      paths:
 | 
			
		||||
        - "*.deb"
 | 
			
		||||
    script:
 | 
			
		||||
        - apt-get -y build-dep .
 | 
			
		||||
        - apt-get -y install devscripts
 | 
			
		||||
        - debuild -i -us -uc -b
 | 
			
		||||
        - cp ../*.deb .
 | 
			
		||||
 | 
			
		||||
build_deb:arm64:
 | 
			
		||||
    tags:
 | 
			
		||||
        - librem5:arm64
 | 
			
		||||
    allow_failure: true
 | 
			
		||||
    stage: build
 | 
			
		||||
    artifacts:
 | 
			
		||||
      paths:
 | 
			
		||||
        - "*.deb"
 | 
			
		||||
    script:
 | 
			
		||||
        - apt-get -y build-dep .
 | 
			
		||||
        - apt-get -y install devscripts
 | 
			
		||||
        - debuild -i -us -uc -b
 | 
			
		||||
        - cp ../*.deb .
 | 
			
		||||
@ -53,4 +79,5 @@ test:
 | 
			
		||||
  needs:
 | 
			
		||||
    - build_meson
 | 
			
		||||
  script:
 | 
			
		||||
    - apt-get -y build-dep .
 | 
			
		||||
    - ninja -C _build test
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										179
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										179
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							@ -8,6 +8,14 @@ dependencies = [
 | 
			
		||||
 "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ansi_term"
 | 
			
		||||
version = "0.11.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "atk-sys"
 | 
			
		||||
version = "0.7.0"
 | 
			
		||||
@ -15,8 +23,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "atty"
 | 
			
		||||
version = "0.2.14"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@ -33,7 +51,7 @@ dependencies = [
 | 
			
		||||
 "glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@ -44,16 +62,30 @@ dependencies = [
 | 
			
		||||
 "glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "cc"
 | 
			
		||||
version = "1.0.45"
 | 
			
		||||
version = "1.0.49"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "clap"
 | 
			
		||||
version = "2.32.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "dtoa"
 | 
			
		||||
version = "0.4.4"
 | 
			
		||||
@ -79,7 +111,7 @@ dependencies = [
 | 
			
		||||
 "glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
@ -94,7 +126,7 @@ dependencies = [
 | 
			
		||||
 "glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@ -105,8 +137,8 @@ dependencies = [
 | 
			
		||||
 "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@ -119,9 +151,9 @@ dependencies = [
 | 
			
		||||
 "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@ -136,7 +168,7 @@ dependencies = [
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@ -146,8 +178,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@ -159,7 +191,7 @@ dependencies = [
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@ -167,8 +199,8 @@ name = "glib-sys"
 | 
			
		||||
version = "0.7.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@ -177,8 +209,8 @@ version = "0.7.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@ -189,7 +221,7 @@ dependencies = [
 | 
			
		||||
 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "cc 1.0.49 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gdk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gdk-pixbuf 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
@ -201,7 +233,7 @@ dependencies = [
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gtk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
@ -217,9 +249,17 @@ dependencies = [
 | 
			
		||||
 "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "hermit-abi"
 | 
			
		||||
version = "0.1.6"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@ -229,7 +269,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "libc"
 | 
			
		||||
version = "0.2.62"
 | 
			
		||||
version = "0.2.66"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@ -252,7 +292,7 @@ name = "memmap"
 | 
			
		||||
version = "0.7.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
@ -266,7 +306,7 @@ dependencies = [
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
@ -277,18 +317,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "pkg-config"
 | 
			
		||||
version = "0.3.16"
 | 
			
		||||
version = "0.3.17"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "proc-macro2"
 | 
			
		||||
version = "1.0.4"
 | 
			
		||||
version = "1.0.7"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
@ -299,7 +339,7 @@ name = "quote"
 | 
			
		||||
version = "1.0.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@ -324,6 +364,10 @@ name = "rs"
 | 
			
		||||
version = "0.1.0"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gdk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
@ -331,50 +375,63 @@ dependencies = [
 | 
			
		||||
 "gtk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "maplit 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "xkbcommon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "serde"
 | 
			
		||||
version = "1.0.101"
 | 
			
		||||
version = "1.0.104"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "serde_derive"
 | 
			
		||||
version = "1.0.101"
 | 
			
		||||
version = "1.0.104"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "serde_yaml"
 | 
			
		||||
version = "0.8.9"
 | 
			
		||||
version = "0.8.11"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "strsim"
 | 
			
		||||
version = "0.7.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "syn"
 | 
			
		||||
version = "1.0.5"
 | 
			
		||||
version = "1.0.13"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "textwrap"
 | 
			
		||||
version = "0.10.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "thread_local"
 | 
			
		||||
version = "0.3.6"
 | 
			
		||||
@ -383,6 +440,11 @@ dependencies = [
 | 
			
		||||
 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "unicode-width"
 | 
			
		||||
version = "0.1.7"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "unicode-xid"
 | 
			
		||||
version = "0.2.0"
 | 
			
		||||
@ -393,6 +455,11 @@ name = "utf8-ranges"
 | 
			
		||||
version = "1.0.4"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "vec_map"
 | 
			
		||||
version = "0.8.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "winapi"
 | 
			
		||||
version = "0.3.8"
 | 
			
		||||
@ -417,7 +484,7 @@ name = "xkbcommon"
 | 
			
		||||
version = "0.4.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
@ -431,11 +498,14 @@ dependencies = [
 | 
			
		||||
 | 
			
		||||
[metadata]
 | 
			
		||||
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
 | 
			
		||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
 | 
			
		||||
"checksum atk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7017e53393e713212aed7aea336b6553be4927f58c37070a56c2fe3d107e489"
 | 
			
		||||
"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
 | 
			
		||||
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
 | 
			
		||||
"checksum cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd940f0d609699e343ef71c4af5f66423afbf30d666f796dabd8fd15229cf5b6"
 | 
			
		||||
"checksum cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d25596627380be4381247dba06c69ad05ca21b3b065bd9827e416882ac41dcd2"
 | 
			
		||||
"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be"
 | 
			
		||||
"checksum cc 1.0.49 (registry+https://github.com/rust-lang/crates.io-index)" = "e450b8da92aa6f274e7c6437692f9f2ce6d701fb73bacfcf87897b3f89a4c20e"
 | 
			
		||||
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
 | 
			
		||||
"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e"
 | 
			
		||||
"checksum fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f8140122fa0d5dcb9fc8627cfce2b37cc1500f752636d46ea28bc26785c2f9"
 | 
			
		||||
"checksum gdk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc52c7244046df9d959df87289f1fc5cca23f9f850bab0c967963e2ecb83a96"
 | 
			
		||||
@ -449,26 +519,31 @@ dependencies = [
 | 
			
		||||
"checksum gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08475e4a08f27e6e2287005950114735ed61cec2cb8c1187682a5aec8c69b715"
 | 
			
		||||
"checksum gtk 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "56a6b30f194f09a17bb7ffa95c3ecdb405abd3b75ff981f831b1f6d18fe115ff"
 | 
			
		||||
"checksum gtk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d487d333a4b87072e6bf9f2e55befa0ebef01b9496c2e263c0f4a1ff3d6c04b1"
 | 
			
		||||
"checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772"
 | 
			
		||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
 | 
			
		||||
"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
 | 
			
		||||
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
 | 
			
		||||
"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83"
 | 
			
		||||
"checksum maplit 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
 | 
			
		||||
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
 | 
			
		||||
"checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
 | 
			
		||||
"checksum pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c2cb169402a3eb1ba034a7cc7d95b8b1c106e9be5ba4be79a5a93dc1a2795f4"
 | 
			
		||||
"checksum pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6eb49268e69dd0c1da5d3001a61aac08e2e9d2bfbe4ae4b19b9963c998f6453"
 | 
			
		||||
"checksum pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "72d5370d90f49f70bd033c3d75e87fc529fbfff9d6f7cccef07d6170079d91ea"
 | 
			
		||||
"checksum proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afdc77cc74ec70ed262262942ebb7dac3d479e9e5cfa2da1841c0806f6cdabcc"
 | 
			
		||||
"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
 | 
			
		||||
"checksum proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0319972dcae462681daf4da1adeeaa066e3ebd29c69be96c6abb1259d2ee2bcc"
 | 
			
		||||
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
 | 
			
		||||
"checksum regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d9d8297cc20bbb6184f8b45ff61c8ee6a9ac56c156cec8e38c3e5084773c44ad"
 | 
			
		||||
"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
 | 
			
		||||
"checksum serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "9796c9b7ba2ffe7a9ce53c2287dfc48080f4b2b362fcc245a259b3a7201119dd"
 | 
			
		||||
"checksum serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e"
 | 
			
		||||
"checksum serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "38b08a9a90e5260fe01c6480ec7c811606df6d3a660415808c3c3fa8ed95b582"
 | 
			
		||||
"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
 | 
			
		||||
"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449"
 | 
			
		||||
"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64"
 | 
			
		||||
"checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35"
 | 
			
		||||
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
 | 
			
		||||
"checksum syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4ff033220a41d1a57d8125eab57bf5263783dfdcc18688b1dacc6ce9651ef8"
 | 
			
		||||
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
 | 
			
		||||
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
 | 
			
		||||
"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
 | 
			
		||||
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
 | 
			
		||||
"checksum utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba"
 | 
			
		||||
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
 | 
			
		||||
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
 | 
			
		||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
 | 
			
		||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								Cargo.toml
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								Cargo.toml
									
									
									
									
									
								
							@ -4,12 +4,22 @@ version = "0.1.0"
 | 
			
		||||
 | 
			
		||||
[dependencies]
 | 
			
		||||
bitflags = "1.0.*"
 | 
			
		||||
clap = "2.32.*"
 | 
			
		||||
maplit = "1.0.*"
 | 
			
		||||
regex = "1.1.*"
 | 
			
		||||
serde = { version = "1.0.*", features = ["derive"] }
 | 
			
		||||
serde_yaml = "0.8.*"
 | 
			
		||||
xkbcommon = { version = "0.4.*", features = ["wayland"] }
 | 
			
		||||
 | 
			
		||||
[dependencies.cairo-rs]
 | 
			
		||||
version = "0.5.*"
 | 
			
		||||
 | 
			
		||||
[dependencies.cairo-sys-rs]
 | 
			
		||||
version = ""
 | 
			
		||||
 | 
			
		||||
[dependencies.gdk]
 | 
			
		||||
version = ""
 | 
			
		||||
 | 
			
		||||
[dependencies.gio]
 | 
			
		||||
version = ""
 | 
			
		||||
features = ["v2_44"]
 | 
			
		||||
@ -22,7 +32,6 @@ features = ["v2_44"]
 | 
			
		||||
version = ""
 | 
			
		||||
features = ["v2_44"]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
[dependencies.gtk]
 | 
			
		||||
version = "0.5.*"
 | 
			
		||||
features = ["v3_22"]
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										41
									
								
								HACKING.md
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								HACKING.md
									
									
									
									
									
								
							@ -3,6 +3,11 @@ Hacking
 | 
			
		||||
 | 
			
		||||
This document describes the standards for modifying and maintaining the *squeekboard* project.
 | 
			
		||||
 | 
			
		||||
Sending patches
 | 
			
		||||
---------------
 | 
			
		||||
 | 
			
		||||
By submitting a change to this project, you agree to license it under the [GPL license version 3](./COPYING), or any later version. You also certify that your contribution fulfills the [Developer's Certificate of Origin 1.1](./dco.txt).
 | 
			
		||||
 | 
			
		||||
Development environment
 | 
			
		||||
-----------------------
 | 
			
		||||
 | 
			
		||||
@ -20,7 +25,7 @@ sudo apt-get -y build-dep .
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
For an explicit list of dependencies check the `Build-Depends` entry in the
 | 
			
		||||
[debian/control][] file.
 | 
			
		||||
[`debian/control`](./debian/control) file.
 | 
			
		||||
 | 
			
		||||
Testing
 | 
			
		||||
-------
 | 
			
		||||
@ -30,12 +35,12 @@ Most common testing is done in CI. Occasionally, and for each release, do perfor
 | 
			
		||||
- the application draws correctly
 | 
			
		||||
- it shows when relevant
 | 
			
		||||
- it changes layouts
 | 
			
		||||
- it changes levels
 | 
			
		||||
- it changes views
 | 
			
		||||
 | 
			
		||||
Testing with an application:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
python3 tests/entry.py
 | 
			
		||||
python3 tools/entry.py
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Testing visibility:
 | 
			
		||||
@ -50,15 +55,31 @@ Testing layouts:
 | 
			
		||||
Layouts can be selected using the GNOME Settings application.
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
# define all available layouts
 | 
			
		||||
$ gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'ua')]"
 | 
			
		||||
# choose the active layout
 | 
			
		||||
$ gsettings set org.gnome.desktop.input-sources current 1
 | 
			
		||||
# define all available layouts. First one is currently selected.
 | 
			
		||||
$ gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'de')]"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Coding
 | 
			
		||||
------
 | 
			
		||||
 | 
			
		||||
### Project structure
 | 
			
		||||
 | 
			
		||||
Rust modules should be split into 2 categories: libraries, and user interface. They differ in the way they do error handling.
 | 
			
		||||
 | 
			
		||||
Libraries should:
 | 
			
		||||
 | 
			
		||||
- not panic due to external surprises, only due to internal inconsistencies
 | 
			
		||||
- pass errors and surprises they can't handle to the callers instead
 | 
			
		||||
- not silence errors and surprises
 | 
			
		||||
 | 
			
		||||
User interface modules should:
 | 
			
		||||
 | 
			
		||||
- try to provide safe values whenever they encounter an error
 | 
			
		||||
- do the logging
 | 
			
		||||
- give libraries the ability to report errors and surprises (e.g. via giving them loggers)
 | 
			
		||||
 | 
			
		||||
### Style
 | 
			
		||||
 | 
			
		||||
Code submitted should roughly match the style of surrounding code. Things that will *not* be accepted are ones that often lead to errors:
 | 
			
		||||
 | 
			
		||||
- skipping brackets `{}` after every `if()`, `else`, and similar
 | 
			
		||||
@ -114,17 +135,19 @@ Use the `cargo.sh` script for maintaining the Cargo part of the build. The scrip
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
cd build_dir
 | 
			
		||||
sh /source_path/cargo.sh '' test
 | 
			
		||||
sh /source_path/cargo.sh test
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Cargo dependencies
 | 
			
		||||
 | 
			
		||||
All Cargo dependencies must be selected in the version available in PureOS, and added to the file `debian/control`. Please check with https://software.pureos.net/search_pkg?term=librust .
 | 
			
		||||
 | 
			
		||||
Dependencies must be specified in `Cargo.toml` with 2 numbers: "major.minor". Since bugfix version number is meant to not affect the interface, this allows for safe updates.
 | 
			
		||||
 | 
			
		||||
`Cargo.lock` is used for remembering the revisions of all Rust dependencies. It should be updated often, preferably with each bugfix revision, and in a commit on its own:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
cd build_dir
 | 
			
		||||
sh /source_path/cargo.sh '' update
 | 
			
		||||
sh /source_path/cargo.sh update
 | 
			
		||||
ninja test
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										7
									
								
								cargo.sh
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								cargo.sh
									
									
									
									
									
								
							@ -11,14 +11,7 @@ SOURCE_DIR="$(dirname "$SCRIPT_PATH")"
 | 
			
		||||
 | 
			
		||||
CARGO_TARGET_DIR="$(pwd)"
 | 
			
		||||
export CARGO_TARGET_DIR
 | 
			
		||||
if [ -n "${1}" ]; then
 | 
			
		||||
    OUT_PATH="$(realpath "$1")"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
cd "$SOURCE_DIR"
 | 
			
		||||
shift
 | 
			
		||||
cargo "$@"
 | 
			
		||||
 | 
			
		||||
if [ -n "${OUT_PATH}" ]; then
 | 
			
		||||
    cp "${CARGO_TARGET_DIR}"/debug/librs.a "${OUT_PATH}"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										34
									
								
								cargo_build.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										34
									
								
								cargo_build.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,34 @@
 | 
			
		||||
#!/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
 | 
			
		||||
@ -1,19 +1,11 @@
 | 
			
		||||
# German layout by Mark Müller
 | 
			
		||||
# Version 2019111700
 | 
			
		||||
# Maintained by: Mark Müller <markmueller86@gmail.com>
 | 
			
		||||
---
 | 
			
		||||
bounds: { x: 0, y: 1, width: 360, height: 208 }
 | 
			
		||||
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 35.33, height: 52 }
 | 
			
		||||
    altline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 52.67, height: 52 }
 | 
			
		||||
    wide:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 62, height: 52 }
 | 
			
		||||
    spaceline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 99.67, height: 52 }
 | 
			
		||||
    special:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 35.33, height: 52 }
 | 
			
		||||
    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:
 | 
			
		||||
@ -83,7 +75,7 @@ buttons:
 | 
			
		||||
    space:
 | 
			
		||||
        outline: "spaceline"
 | 
			
		||||
        label: " "
 | 
			
		||||
        keysym: "space"
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										81
									
								
								data/keyboards/de_wide.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								data/keyboards/de_wide.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,81 @@
 | 
			
		||||
# Maintained by: Mark Müller <markmueller86@gmail.com>
 | 
			
		||||
---
 | 
			
		||||
outlines:
 | 
			
		||||
    default: { width: 48, height: 42 }
 | 
			
		||||
    altline: { width: 81, height: 42 }
 | 
			
		||||
    wide: { width: 108, height: 42 }
 | 
			
		||||
    spaceline: { width: 216, height: 42 }
 | 
			
		||||
    special: { width: 48, 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         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         space        ! ? Return"
 | 
			
		||||
    numbers:
 | 
			
		||||
        - "1 2 3 4 5 6 7 8 9 0"
 | 
			
		||||
        - "@ # % & - _ + ( ) ß"
 | 
			
		||||
        - "show_symbols   , \" ' : = < >  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        , . Return"
 | 
			
		||||
    symbols:
 | 
			
		||||
        - "~ ` ´  · © ® ÷ × ¶"
 | 
			
		||||
        - "€ £ $ ¥ ^ ° * { } |"
 | 
			
		||||
        - "show_numbers   \\ / § π τ [ ]  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        , . Return"
 | 
			
		||||
    eschars:
 | 
			
		||||
        - "ä è é ö ü Ä È É Ö Ü"
 | 
			
		||||
        - "à â ê î ô À Â È Î Ô"
 | 
			
		||||
        - "show_numbers  « » ç Ç æ œ ß  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"
 | 
			
		||||
        keysym: "BackSpace"
 | 
			
		||||
    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"
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
@ -2,19 +2,12 @@
 | 
			
		||||
# University of the Aegean, Department of Mathematics, atsol@aegean.gr
 | 
			
		||||
# Sep 2019
 | 
			
		||||
---
 | 
			
		||||
bounds: { x: 0, y: 0.33, width: 360, height: 210 }
 | 
			
		||||
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 32, height: 52 }
 | 
			
		||||
    altline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 48.39024, height: 52 }
 | 
			
		||||
    wide:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 62, height: 52 }
 | 
			
		||||
    outline7:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 88.97561, height: 52 }
 | 
			
		||||
    spaceline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 150.5853, height: 52 }
 | 
			
		||||
    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 }
 | 
			
		||||
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
@ -53,6 +46,7 @@ buttons:
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        keysym: "BackSpace"
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
@ -86,111 +80,112 @@ buttons:
 | 
			
		||||
        label: "αι"
 | 
			
		||||
    period:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "."
 | 
			
		||||
        text: "."
 | 
			
		||||
    space:
 | 
			
		||||
        outline: spaceline
 | 
			
		||||
        label: " "
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    aring:
 | 
			
		||||
        label: "å"
 | 
			
		||||
        text: "å"
 | 
			
		||||
    Aring:
 | 
			
		||||
        label: "Å"
 | 
			
		||||
        text: "Å"
 | 
			
		||||
    oslash:
 | 
			
		||||
        label: "ø"
 | 
			
		||||
        text: "ø"
 | 
			
		||||
    Oslash:
 | 
			
		||||
        label: "Ø"
 | 
			
		||||
        text: "Ø"
 | 
			
		||||
    ae:
 | 
			
		||||
        label: "æ"
 | 
			
		||||
        text: "æ"
 | 
			
		||||
    AE:
 | 
			
		||||
        label: "Æ"
 | 
			
		||||
        text: "Æ"
 | 
			
		||||
    asterisk:
 | 
			
		||||
        label: "*"
 | 
			
		||||
        text: "*"
 | 
			
		||||
    asciitilde:
 | 
			
		||||
        label: "~"
 | 
			
		||||
        text: "~"
 | 
			
		||||
    quoteleft:
 | 
			
		||||
        label: "`"
 | 
			
		||||
        text: "`"
 | 
			
		||||
    bar:
 | 
			
		||||
        label: "|"
 | 
			
		||||
        text: "|"
 | 
			
		||||
    U00B7:
 | 
			
		||||
        label: "·"
 | 
			
		||||
        text: "·"
 | 
			
		||||
    squareroot:
 | 
			
		||||
        label: "√"
 | 
			
		||||
        text: "√"
 | 
			
		||||
    Greek_pi:
 | 
			
		||||
        label: "π"
 | 
			
		||||
        text: "π"
 | 
			
		||||
    division:
 | 
			
		||||
        label: "÷"
 | 
			
		||||
        text: "÷"
 | 
			
		||||
    multiply:
 | 
			
		||||
        label: "×"
 | 
			
		||||
        text: "×"
 | 
			
		||||
    paragraph:
 | 
			
		||||
        label: "¶"
 | 
			
		||||
        text: "¶"
 | 
			
		||||
    Greek_tau:
 | 
			
		||||
        label: "τ"
 | 
			
		||||
        text: "τ"
 | 
			
		||||
    copyright:
 | 
			
		||||
        label: "©"
 | 
			
		||||
        text: "©"
 | 
			
		||||
    numbersign:
 | 
			
		||||
        label: "#"
 | 
			
		||||
        text: "#"
 | 
			
		||||
    U00AE:
 | 
			
		||||
        label: "®"
 | 
			
		||||
        text: "®"
 | 
			
		||||
    at:
 | 
			
		||||
        label: "@"
 | 
			
		||||
        text: "@"
 | 
			
		||||
    dollar:
 | 
			
		||||
        label: "$"
 | 
			
		||||
        text: "$"
 | 
			
		||||
    U00A3:
 | 
			
		||||
        label: "£"
 | 
			
		||||
        text: "£"
 | 
			
		||||
    percent:
 | 
			
		||||
        label: "%"
 | 
			
		||||
        text: "%"
 | 
			
		||||
    EuroSign:
 | 
			
		||||
        label: "€"
 | 
			
		||||
        text: "€"
 | 
			
		||||
    ampersand:
 | 
			
		||||
        label: "&"
 | 
			
		||||
        text: "&"
 | 
			
		||||
    U00A5:
 | 
			
		||||
        label: "¥"
 | 
			
		||||
        text: "¥"
 | 
			
		||||
    minus:
 | 
			
		||||
        label: "-"
 | 
			
		||||
        text: "-"
 | 
			
		||||
    asciicircum:
 | 
			
		||||
        label: "^"
 | 
			
		||||
        text: "^"
 | 
			
		||||
    underscore:
 | 
			
		||||
        label: "_"
 | 
			
		||||
        text: "_"
 | 
			
		||||
    degree:
 | 
			
		||||
        label: "°"
 | 
			
		||||
        text: "°"
 | 
			
		||||
    plus:
 | 
			
		||||
        label: "+"
 | 
			
		||||
        text: "+"
 | 
			
		||||
    equal:
 | 
			
		||||
        label: "="
 | 
			
		||||
        text: "="
 | 
			
		||||
    parenleft:
 | 
			
		||||
        label: "("
 | 
			
		||||
        text: "("
 | 
			
		||||
    parenright:
 | 
			
		||||
        label: ")"
 | 
			
		||||
        text: ")"
 | 
			
		||||
    braceleft:
 | 
			
		||||
        label: "{"
 | 
			
		||||
        text: "{"
 | 
			
		||||
    braceright:
 | 
			
		||||
        label: "}"
 | 
			
		||||
        text: "}"
 | 
			
		||||
    comma:
 | 
			
		||||
        label: ","
 | 
			
		||||
        text: ","
 | 
			
		||||
    backslash:
 | 
			
		||||
        label: "\\"
 | 
			
		||||
        text: "\\"
 | 
			
		||||
    slash:
 | 
			
		||||
        label: "/"
 | 
			
		||||
        text: "/"
 | 
			
		||||
    quotedbl:
 | 
			
		||||
        label: "\""
 | 
			
		||||
        text: "\""
 | 
			
		||||
    quoteright:
 | 
			
		||||
        label: "'"
 | 
			
		||||
        text: "'"
 | 
			
		||||
    less:
 | 
			
		||||
        label: "<"
 | 
			
		||||
        text: "<"
 | 
			
		||||
    greater:
 | 
			
		||||
        label: ">"
 | 
			
		||||
        text: ">"
 | 
			
		||||
    colon:
 | 
			
		||||
        label: ":"
 | 
			
		||||
        text: ":"
 | 
			
		||||
    semicolon:
 | 
			
		||||
        label: ";"
 | 
			
		||||
        text: ";"
 | 
			
		||||
    exclam:
 | 
			
		||||
        label: "!"
 | 
			
		||||
        text: "!"
 | 
			
		||||
    question:
 | 
			
		||||
        label: "?"
 | 
			
		||||
        text: "?"
 | 
			
		||||
    bracketleft:
 | 
			
		||||
        label: "["
 | 
			
		||||
        text: "["
 | 
			
		||||
    bracketright:
 | 
			
		||||
        label: "]"
 | 
			
		||||
        text: "]"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										16
									
								
								data/keyboards/emoji.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								data/keyboards/emoji.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,16 @@
 | 
			
		||||
---
 | 
			
		||||
outlines:
 | 
			
		||||
    default: { width: 52, height: 52 }
 | 
			
		||||
    altline: { width: 52, height: 52 }
 | 
			
		||||
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
        - "😀 😁 😅 😂 😊 😇 🙃"
 | 
			
		||||
        - "😍 😘 😋 😜 😎 🥳 😔"
 | 
			
		||||
        - "😢 😭 😡 😱 🤔 😬 🙄"
 | 
			
		||||
        - "preferences 🤨 🤓 😴 🤢 🤮 😈"
 | 
			
		||||
buttons:
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "keyboard-mode-symbolic"
 | 
			
		||||
@ -1,17 +1,10 @@
 | 
			
		||||
---
 | 
			
		||||
bounds: { x: 0, y: 1, width: 360, height: 210 }
 | 
			
		||||
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 35.33, height: 52 }
 | 
			
		||||
    altline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 52.67, height: 52 }
 | 
			
		||||
    wide:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 62, height: 52 }
 | 
			
		||||
    spaceline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 99.67, height: 52 }
 | 
			
		||||
    special:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 44, height: 52 }
 | 
			
		||||
    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:
 | 
			
		||||
@ -51,6 +44,7 @@ buttons:
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        keysym: "BackSpace"
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "default"
 | 
			
		||||
@ -80,14 +74,14 @@ buttons:
 | 
			
		||||
 | 
			
		||||
    period:
 | 
			
		||||
        outline: "default"
 | 
			
		||||
        label: "."
 | 
			
		||||
        text: "."
 | 
			
		||||
    space:
 | 
			
		||||
        outline: "spaceline"
 | 
			
		||||
        label: " "
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    colon:
 | 
			
		||||
        label: ":"
 | 
			
		||||
    "\"":
 | 
			
		||||
        keysym: "quotedbl"
 | 
			
		||||
        text: ":"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,17 +1,10 @@
 | 
			
		||||
---
 | 
			
		||||
bounds: { x: 0, y: 0.33, width: 360, height: 210 }
 | 
			
		||||
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 32, height: 52 }
 | 
			
		||||
    altline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 48.39024, height: 52 }
 | 
			
		||||
    wide:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 62, height: 52 }
 | 
			
		||||
    outline7:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 88.97561, height: 52 }
 | 
			
		||||
    spaceline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 150.5853, height: 52 }
 | 
			
		||||
    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 }
 | 
			
		||||
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
@ -46,6 +39,7 @@ buttons:
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        keysym: "BackSpace"
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
@ -69,108 +63,109 @@ buttons:
 | 
			
		||||
        outline: altline
 | 
			
		||||
    space:
 | 
			
		||||
        outline: spaceline
 | 
			
		||||
        label: " "
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    aring:
 | 
			
		||||
        label: "å"
 | 
			
		||||
        text: "å"
 | 
			
		||||
    Aring:
 | 
			
		||||
        label: "Å"
 | 
			
		||||
        text: "Å"
 | 
			
		||||
    ouml:
 | 
			
		||||
        label: "ö"
 | 
			
		||||
        text: "ö"
 | 
			
		||||
    Ouml:
 | 
			
		||||
        label: "Ö"
 | 
			
		||||
        text: "Ö"
 | 
			
		||||
    auml:
 | 
			
		||||
        label: "ä"
 | 
			
		||||
        text: "ä"
 | 
			
		||||
    Auml:
 | 
			
		||||
        label: "Ä"
 | 
			
		||||
        text: "Ä"
 | 
			
		||||
    asterisk:
 | 
			
		||||
        label: "*"
 | 
			
		||||
        text: "*"
 | 
			
		||||
    asciitilde:
 | 
			
		||||
        label: "~"
 | 
			
		||||
        text: "~"
 | 
			
		||||
    quoteleft:
 | 
			
		||||
        label: "`"
 | 
			
		||||
        text: "`"
 | 
			
		||||
    bar:
 | 
			
		||||
        label: "|"
 | 
			
		||||
        text: "|"
 | 
			
		||||
    U00B7:
 | 
			
		||||
        label: "·"
 | 
			
		||||
        text: "·"
 | 
			
		||||
    squareroot:
 | 
			
		||||
        label: "√"
 | 
			
		||||
        text: "√"
 | 
			
		||||
    Greek_pi:
 | 
			
		||||
        label: "π"
 | 
			
		||||
        text: "π"
 | 
			
		||||
    division:
 | 
			
		||||
        label: "÷"
 | 
			
		||||
        text: "÷"
 | 
			
		||||
    multiply:
 | 
			
		||||
        label: "×"
 | 
			
		||||
        text: "×"
 | 
			
		||||
    paragraph:
 | 
			
		||||
        label: "¶"
 | 
			
		||||
        text: "¶"
 | 
			
		||||
    Greek_tau:
 | 
			
		||||
        label: "τ"
 | 
			
		||||
        text: "τ"
 | 
			
		||||
    copyright:
 | 
			
		||||
        label: "©"
 | 
			
		||||
        text: "©"
 | 
			
		||||
    numbersign:
 | 
			
		||||
        label: "#"
 | 
			
		||||
        text: "#"
 | 
			
		||||
    U00AE:
 | 
			
		||||
        label: "®"
 | 
			
		||||
        text: "®"
 | 
			
		||||
    at:
 | 
			
		||||
        label: "@"
 | 
			
		||||
        text: "@"
 | 
			
		||||
    dollar:
 | 
			
		||||
        label: "$"
 | 
			
		||||
        text: "$"
 | 
			
		||||
    U00A3:
 | 
			
		||||
        label: "£"
 | 
			
		||||
        text: "£"
 | 
			
		||||
    percent:
 | 
			
		||||
        label: "%"
 | 
			
		||||
        text: "%"
 | 
			
		||||
    EuroSign:
 | 
			
		||||
        label: "€"
 | 
			
		||||
        text: "€"
 | 
			
		||||
    ampersand:
 | 
			
		||||
        label: "&"
 | 
			
		||||
        text: "&"
 | 
			
		||||
    U00A5:
 | 
			
		||||
        label: "¥"
 | 
			
		||||
        text: "¥"
 | 
			
		||||
    minus:
 | 
			
		||||
        label: "-"
 | 
			
		||||
        text: "-"
 | 
			
		||||
    asciicircum:
 | 
			
		||||
        label: "^"
 | 
			
		||||
        text: "^"
 | 
			
		||||
    underscore:
 | 
			
		||||
        label: "_"
 | 
			
		||||
        text: "_"
 | 
			
		||||
    degree:
 | 
			
		||||
        label: "°"
 | 
			
		||||
        text: "°"
 | 
			
		||||
    plus:
 | 
			
		||||
        label: "+"
 | 
			
		||||
        text: "+"
 | 
			
		||||
    equal:
 | 
			
		||||
        label: "="
 | 
			
		||||
        text: "="
 | 
			
		||||
    parenleft:
 | 
			
		||||
        label: "("
 | 
			
		||||
        text: "("
 | 
			
		||||
    parenright:
 | 
			
		||||
        label: ")"
 | 
			
		||||
        text: ")"
 | 
			
		||||
    braceleft:
 | 
			
		||||
        label: "{"
 | 
			
		||||
        text: "{"
 | 
			
		||||
    braceright:
 | 
			
		||||
        label: "}"
 | 
			
		||||
        text: "}"
 | 
			
		||||
    comma:
 | 
			
		||||
        label: ","
 | 
			
		||||
        text: ","
 | 
			
		||||
    backslash:
 | 
			
		||||
        label: "\\"
 | 
			
		||||
        text: "\\"
 | 
			
		||||
    slash:
 | 
			
		||||
        label: "/"
 | 
			
		||||
        text: "/"
 | 
			
		||||
    quotedbl:
 | 
			
		||||
        label: "\""
 | 
			
		||||
        text: "\""
 | 
			
		||||
    quoteright:
 | 
			
		||||
        label: "'"
 | 
			
		||||
        text: "'"
 | 
			
		||||
    less:
 | 
			
		||||
        label: "<"
 | 
			
		||||
        text: "<"
 | 
			
		||||
    greater:
 | 
			
		||||
        label: ">"
 | 
			
		||||
        text: ">"
 | 
			
		||||
    colon:
 | 
			
		||||
        label: ":"
 | 
			
		||||
        text: ":"
 | 
			
		||||
    semicolon:
 | 
			
		||||
        label: ";"
 | 
			
		||||
        text: ";"
 | 
			
		||||
    exclam:
 | 
			
		||||
        label: "!"
 | 
			
		||||
        text: "!"
 | 
			
		||||
    question:
 | 
			
		||||
        label: "?"
 | 
			
		||||
        text: "?"
 | 
			
		||||
    bracketleft:
 | 
			
		||||
        label: "["
 | 
			
		||||
        text: "["
 | 
			
		||||
    bracketright:
 | 
			
		||||
        label: "]"
 | 
			
		||||
        text: "]"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,19 +1,12 @@
 | 
			
		||||
# Italian layout created by Antonio Pandolfo
 | 
			
		||||
# 03 october 2019
 | 
			
		||||
---
 | 
			
		||||
bounds: { x: 0, y: 1, width: 360, height: 210 }
 | 
			
		||||
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 35.33, height: 52 }
 | 
			
		||||
    altline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 52.67, height: 52 }
 | 
			
		||||
    wide:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 62, height: 52 }
 | 
			
		||||
    spaceline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 99.67, height: 52 }
 | 
			
		||||
    special:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 44, height: 52 }
 | 
			
		||||
    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:
 | 
			
		||||
@ -53,6 +46,7 @@ buttons:
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        keysym: "BackSpace"
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "default"
 | 
			
		||||
@ -91,6 +85,7 @@ buttons:
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    colon:
 | 
			
		||||
        label: ":"
 | 
			
		||||
    "\"":
 | 
			
		||||
 | 
			
		||||
@ -1,19 +1,11 @@
 | 
			
		||||
# Japanese Kana layout by Mark Müller
 | 
			
		||||
# Version 2019111800
 | 
			
		||||
# Maintained by: Mark Müller <markmueller86@gmail.com>
 | 
			
		||||
---
 | 
			
		||||
bounds: { x: 0, y: 1, width: 360, height: 208 }
 | 
			
		||||
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 62, height: 52 }
 | 
			
		||||
    default-wide:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 62, height: 52 }
 | 
			
		||||
    altline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 62, height: 52 }
 | 
			
		||||
    wide:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 62, height: 52 }
 | 
			
		||||
    special:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 62, height: 52 }
 | 
			
		||||
    default: { width: 62, height: 52 }
 | 
			
		||||
    default-wide: { width: 62, height: 52 }
 | 
			
		||||
    altline: { width: 62, height: 52 }
 | 
			
		||||
    wide: { width: 62, height: 52 }
 | 
			
		||||
    special: { width: 62, height: 52 }
 | 
			
		||||
 | 
			
		||||
views:
 | 
			
		||||
    base: # hiragana
 | 
			
		||||
@ -221,11 +213,11 @@ buttons:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        icon: "keyboard-mode-symbolic"
 | 
			
		||||
    # space button with unicode keysym for ideographic space
 | 
			
		||||
    # space button using text tag for ideographic space
 | 
			
		||||
    space:
 | 
			
		||||
        outline: "default-wide"
 | 
			
		||||
        label: "␣"
 | 
			
		||||
        keysym: "U3000"
 | 
			
		||||
        text: " "
 | 
			
		||||
    # switch to number view
 | 
			
		||||
    numbers:
 | 
			
		||||
        action:
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										525
									
								
								data/keyboards/jp+kana_wide.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										525
									
								
								data/keyboards/jp+kana_wide.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,525 @@
 | 
			
		||||
# Maintained by: Mark Müller <markmueller86@gmail.com>
 | 
			
		||||
---
 | 
			
		||||
outlines:
 | 
			
		||||
    default: { width: 62, height: 42 }
 | 
			
		||||
    default-wide: { width: 62, height: 42 }
 | 
			
		||||
    altline: { width: 62, height: 42 }
 | 
			
		||||
    wide: { width: 62, height: 42 }
 | 
			
		||||
    special: { width: 62, height: 42 }
 | 
			
		||||
 | 
			
		||||
views:
 | 
			
		||||
    base: # hiragana
 | 
			
		||||
        - "preferences _a ka sa BackSpace"
 | 
			
		||||
        - "Left ta na ha Right"
 | 
			
		||||
        - "カタカナ ma ya ra space"
 | 
			
		||||
        - "switch2roman symbols wa punct Return"
 | 
			
		||||
    _a:
 | 
			
		||||
        - "preferences dummykey _a dummykey BackSpace"
 | 
			
		||||
        - "あ い う え お"
 | 
			
		||||
        - "ぁ ぃ ぅ ぇ ぉ" # 2 code points each
 | 
			
		||||
        - "dummykey dummykey ゔ dummykey dummykey"
 | 
			
		||||
    ka:
 | 
			
		||||
        - "preferences dummykey ka dummykey BackSpace"
 | 
			
		||||
        - "か き く け こ"
 | 
			
		||||
        - "が ぎ ぐ げ ご"
 | 
			
		||||
        - "ゕ dummykey dummykey ゖ dummykey"
 | 
			
		||||
    sa:
 | 
			
		||||
        - "preferences dummykey sa dummykey BackSpace"
 | 
			
		||||
        - "さ し す せ そ"
 | 
			
		||||
        - "ざ じ ず ぜ ぞ"
 | 
			
		||||
    ta:
 | 
			
		||||
        - "preferences dummykey ta dummykey BackSpace"
 | 
			
		||||
        - "た ち つ て と"
 | 
			
		||||
        - "だ ぢ づ で ど"
 | 
			
		||||
        - "dummykey dummykey っ dummykey dummykey"
 | 
			
		||||
    na:
 | 
			
		||||
        - "preferences dummykey na dummykey BackSpace"
 | 
			
		||||
        - "な に ぬ ね の"
 | 
			
		||||
    ha:
 | 
			
		||||
        - "preferences dummykey ha dummykey BackSpace"
 | 
			
		||||
        - "は ひ ふ へ ほ"
 | 
			
		||||
        - "ば び ぶ べ ぼ"
 | 
			
		||||
        - "ぱ ぴ ぷ ぺ ぽ"
 | 
			
		||||
    ma:
 | 
			
		||||
        - "preferences dummykey ma dummykey BackSpace"
 | 
			
		||||
        - "ま み む め も"
 | 
			
		||||
    ya:
 | 
			
		||||
        - "preferences dummykey ya dummykey BackSpace"
 | 
			
		||||
        - "や dummykey ゆ dummykey よ"
 | 
			
		||||
        - "ゃ dummykey ゅ dummykey ょ"
 | 
			
		||||
    ra:
 | 
			
		||||
        - "preferences dummykey ra dummykey BackSpace"
 | 
			
		||||
        - "ら り る れ ろ"
 | 
			
		||||
    wa:
 | 
			
		||||
        - "preferences dummykey wa dummykey BackSpace"
 | 
			
		||||
        - "わ ゐ dummykey ゑ を"
 | 
			
		||||
        - "ゎ dummykey ん dummykey dummykey"
 | 
			
		||||
    symbols:
 | 
			
		||||
        - "preferences dummykey symbols dummykey BackSpace"
 | 
			
		||||
        - "「 」 ( ) §"
 | 
			
		||||
        - "【 】 < > ="
 | 
			
		||||
        - "+ * & % $ "
 | 
			
		||||
    punct:
 | 
			
		||||
        - "preferences dummykey punct dummykey BackSpace"
 | 
			
		||||
        - "。 、 ? ! ー"
 | 
			
		||||
 | 
			
		||||
        - ": ; ・ 〜 …"
 | 
			
		||||
        - "♪ ” ’ ゙ ゚"
 | 
			
		||||
        
 | 
			
		||||
#a 	あア 	かカ 	さサ 	たタ 	なナ 	はハ 	まマ 	やヤ 	らラ 	わワ
 | 
			
		||||
#i 	いイ 	きキ 	しシ 	ちチ 	にニ 	ひヒ 	みミ 	※      りリ 	ゐヰ
 | 
			
		||||
#u 	うウ 	くク 	すス 	つツ 	ぬヌ 	ふフ 	むム 	ゆユ 	るル 	※
 | 
			
		||||
#e 	えエ 	けケ 	せセ 	てテ 	ねネ 	へヘ 	めメ 	※      れレ 	ゑヱ
 | 
			
		||||
#o 	おオ 	こコ 	そソ 	とト 	のノ 	ほホ 	もモ 	よヨ 	ろロ 	をヲ
 | 
			
		||||
 | 
			
		||||
#      g       z       d       b       p      n
 | 
			
		||||
#a 	が ガ 	ざ ザ 	だ ダ 	ば バ 	ぱ パ   ん ン
 | 
			
		||||
#i 	ぎ ギ 	じ ジ 	ぢ ヂ 	び ビ 	ぴ ピ 
 | 
			
		||||
#u 	ぐ グ 	ず ズ 	づ ヅ 	ぶ ブ 	ぷ プ 
 | 
			
		||||
#e 	げ ゲ 	ぜ ゼ 	で デ 	べ ベ 	ぺ ペ 
 | 
			
		||||
#o 	ご ゴ 	ぞ ゾ 	ど ド 	ぼ ボ 	ぽ ポ 
 | 
			
		||||
 | 
			
		||||
    カタカナ: # katakana
 | 
			
		||||
        - "preferences _A KA SA BackSpace"
 | 
			
		||||
        - "Left TA NA HA Right"
 | 
			
		||||
        - "ひらがな MA YA RA space"
 | 
			
		||||
        - "switch2roman SYMBOLS WA PUNCT Return"
 | 
			
		||||
    _A:
 | 
			
		||||
        - "preferences DUMMYKEY _A DUMMYKEY BackSpace"
 | 
			
		||||
        - "ア イ ウ エ オ"
 | 
			
		||||
        - "ァ ィ ゥ ェ ォ"
 | 
			
		||||
        - "DUMMYKEY DUMMYKEY ヴ DUMMYKEY DUMMYKEY"
 | 
			
		||||
    KA:
 | 
			
		||||
        - "preferences DUMMYKEY KA DUMMYKEY BackSpace"
 | 
			
		||||
        - "カ キ ク ケ コ"
 | 
			
		||||
        - "ガ ギ グ ゲ ゴ"
 | 
			
		||||
        - "ヵ DUMMYKEY ㇰ ヶ DUMMYKEY"
 | 
			
		||||
    SA:
 | 
			
		||||
        - "preferences DUMMYKEY SA DUMMYKEY BackSpace"
 | 
			
		||||
        - "サ シ ス セ ソ"
 | 
			
		||||
        - "ザ ジ ズ ゼ ゾ"
 | 
			
		||||
        - "DUMMYKEY ㇱ ㇲ DUMMYKEY DUMMYKEY"
 | 
			
		||||
    TA:
 | 
			
		||||
        - "preferences DUMMYKEY TA DUMMYKEY BackSpace"
 | 
			
		||||
        - "タ チ ツ テ ト"
 | 
			
		||||
        - "ダ ヂ ヅ デ ド"
 | 
			
		||||
        - "DUMMYKEY DUMMYKEY ッ DUMMYKEY ㇳ"
 | 
			
		||||
    NA: 
 | 
			
		||||
        - "preferences DUMMYKEY NA DUMMYKEY BackSpace"
 | 
			
		||||
        - "ナ ニ ヌ ネ ノ"
 | 
			
		||||
        - "DUMMYKEY DUMMYKEY ㇴ DUMMYKEY DUMMYKEY"
 | 
			
		||||
    HA:
 | 
			
		||||
        - "preferences DUMMYKEY HA DUMMYKEY BackSpace"
 | 
			
		||||
        - "ハ ヒ フ ヘ ホ"
 | 
			
		||||
        - "バ ビ ブ ベ ボ"
 | 
			
		||||
        - "パ ピ プ ペ ポ"
 | 
			
		||||
    MA:
 | 
			
		||||
        - "preferences DUMMYKEY MA DUMMYKEY BackSpace"
 | 
			
		||||
        - "マ ミ ム メ モ"
 | 
			
		||||
        - "DUMMYKEY DUMMYKEY ㇺ DUMMYKEY DUMMYKEY"
 | 
			
		||||
    YA:
 | 
			
		||||
        - "preferences DUMMYKEY YA DUMMYKEY BackSpace"
 | 
			
		||||
        - "ヤ DUMMYKEY ユ DUMMYKEY ヨ"
 | 
			
		||||
        - "ャ DUMMYKEY ュ DUMMYKEY ョ"
 | 
			
		||||
    RA:
 | 
			
		||||
        - "preferences DUMMYKEY RA DUMMYKEY BackSpace"
 | 
			
		||||
        - "ラ リ ル レ ロ"
 | 
			
		||||
        - "ㇻ ㇼ ㇽ ㇾ ㇿ"
 | 
			
		||||
    WA:
 | 
			
		||||
        - "preferences DUMMYKEY WA DUMMYKEY BackSpace"
 | 
			
		||||
        - "ワ ヰ DUMMYKEY ヱ ヲ"
 | 
			
		||||
        - "ヮ ヸ ン ヹ ヺ"
 | 
			
		||||
    # numbers view
 | 
			
		||||
    numbers:
 | 
			
		||||
        - "preferences 1 2 3 BackSpace"
 | 
			
		||||
        - "Left 4 5 6 Right"
 | 
			
		||||
        - "roman 7 8 9 space"
 | 
			
		||||
        - "switch2kana * 0 # Return"
 | 
			
		||||
    # Roman alphabet view
 | 
			
		||||
    roman:
 | 
			
		||||
        - "preferences RSYM1 ABC DEF BackSpace"
 | 
			
		||||
        - "Left GHI JKL MNO Right"
 | 
			
		||||
        - "ひらがな PQRS TUV WXYZ space"
 | 
			
		||||
        - "switch2num RSYM2 RSYM3 RSYM4 Return"
 | 
			
		||||
    RSYM1:
 | 
			
		||||
        - "preferences dummykey RSYM1 dummykey BackSpace"
 | 
			
		||||
        - "@ # $ § :"
 | 
			
		||||
        - "| € ¥ £ 1"
 | 
			
		||||
    ABC:
 | 
			
		||||
        - "preferences dummykey ABC dummykey BackSpace"
 | 
			
		||||
        - "A B C Ä ç"
 | 
			
		||||
        - "a b c ä 2"
 | 
			
		||||
    DEF:
 | 
			
		||||
        - "preferences dummykey DEF dummykey BackSpace"
 | 
			
		||||
        - "D E F dummykey"
 | 
			
		||||
        - "d e f 3"
 | 
			
		||||
    GHI:
 | 
			
		||||
        - "preferences dummykey GHI dummykey BackSpace"
 | 
			
		||||
        - "G H I dummykey"
 | 
			
		||||
        - "g h i 4"
 | 
			
		||||
    JKL:
 | 
			
		||||
        - "preferences dummykey JKL dummykey BackSpace"
 | 
			
		||||
        - "J K L dummykey"
 | 
			
		||||
        - "j k l 5"
 | 
			
		||||
    MNO:
 | 
			
		||||
        - "preferences dummykey MNO dummykey BackSpace"
 | 
			
		||||
        - "M N O Ö dummykey"
 | 
			
		||||
        - "m n o ö 6"
 | 
			
		||||
    PQRS:
 | 
			
		||||
        - "preferences dummykey PQRS dummykey BackSpace"
 | 
			
		||||
        - "P Q R S ß"
 | 
			
		||||
        - "p q r s 7"
 | 
			
		||||
    TUV:
 | 
			
		||||
        - "preferences dummykey TUV dummykey BackSpace"
 | 
			
		||||
        - "T U V Ü dummykey"
 | 
			
		||||
        - "t u v ü 8"
 | 
			
		||||
    WXYZ:
 | 
			
		||||
        - "preferences dummykey WXYZ dummykey BackSpace"
 | 
			
		||||
        - "W X Y Z dummykey"
 | 
			
		||||
        - "w x y z 9"
 | 
			
		||||
    RSYM2:
 | 
			
		||||
        - "preferences dummykey RSYM2 dummykey BackSpace"
 | 
			
		||||
        - "( ) ' \" ~"
 | 
			
		||||
        - "[ ] { } _"
 | 
			
		||||
    RSYM3:
 | 
			
		||||
        - "preferences dummykey RSYM3 dummykey BackSpace"
 | 
			
		||||
        - "+ - * / ="
 | 
			
		||||
        - "< > ^ ° 0"
 | 
			
		||||
    RSYM4:
 | 
			
		||||
        - "preferences dummykey RSYM4 dummykey BackSpace"
 | 
			
		||||
        - ", . ? ! ;"
 | 
			
		||||
        - "\\ ´ ` · ¶" 
 | 
			
		||||
 | 
			
		||||
buttons:
 | 
			
		||||
    # following 4 buttons use the corresponding xkb name as keysym
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        keysym: "BackSpace"
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    Left:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "←"
 | 
			
		||||
        keysym: "Left"
 | 
			
		||||
    Right:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "→"
 | 
			
		||||
        keysym: "Right"
 | 
			
		||||
    # special button "preferences" is handled in the code
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        icon: "keyboard-mode-symbolic"
 | 
			
		||||
    # space button using text tag for ideographic space
 | 
			
		||||
    space:
 | 
			
		||||
        outline: "default-wide"
 | 
			
		||||
        label: "␣"
 | 
			
		||||
        text: " "
 | 
			
		||||
    # switch to number view
 | 
			
		||||
    numbers:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "numbers"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "123"
 | 
			
		||||
    # switch to latin characters
 | 
			
		||||
    roman:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "roman"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "ᴀʙᴄ"
 | 
			
		||||
    # toggle button with 3 different states
 | 
			
		||||
    switch2roman: # switch from kana to latin characters view
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "roman"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "あᴀ₁"
 | 
			
		||||
    switch2num: # switch from latin characters to numbers view
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "numbers"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "ぁA₁"
 | 
			
		||||
    switch2kana: # switch from numbers to hiragana view
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "base"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "ぁᴀ1"
 | 
			
		||||
    # Buttons for katakana and symbols
 | 
			
		||||
    ひらがな:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "base"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "あさ"
 | 
			
		||||
    _a:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "_a"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "あ"
 | 
			
		||||
    ka:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "ka"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "か"
 | 
			
		||||
    sa:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "sa"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "さ"
 | 
			
		||||
    ta:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "ta"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "た"
 | 
			
		||||
    na:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "na"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "な"
 | 
			
		||||
    ha:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "ha"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "は"
 | 
			
		||||
    ma:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "ma"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ま"
 | 
			
		||||
    ya:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "ya"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "や"
 | 
			
		||||
    ra:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "ra"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ら"
 | 
			
		||||
    wa:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "wa"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "わ"
 | 
			
		||||
    dummykey:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: ""
 | 
			
		||||
    # buttons available on different views like symbols and punct should go
 | 
			
		||||
    # back to their corresponding view
 | 
			
		||||
    symbols:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "symbols"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "()"
 | 
			
		||||
    punct:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "punct"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "。"
 | 
			
		||||
    # Buttons for katakana and symbols
 | 
			
		||||
    カタカナ:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "カタカナ"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "アサ"
 | 
			
		||||
    _A:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "_A"
 | 
			
		||||
                unlock_view: "カタカナ"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ア"
 | 
			
		||||
    KA:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "KA"
 | 
			
		||||
                unlock_view: "カタカナ"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "カ"
 | 
			
		||||
    SA:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "SA"
 | 
			
		||||
                unlock_view: "カタカナ"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "サ"
 | 
			
		||||
    TA:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "TA"
 | 
			
		||||
                unlock_view: "カタカナ"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "タ"
 | 
			
		||||
    NA:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "NA"
 | 
			
		||||
                unlock_view: "カタカナ"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ナ"
 | 
			
		||||
    HA:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "HA"
 | 
			
		||||
                unlock_view: "カタカナ"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ハ"
 | 
			
		||||
    MA:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "MA"
 | 
			
		||||
                unlock_view: "カタカナ"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "マ"
 | 
			
		||||
    YA:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "YA"
 | 
			
		||||
                unlock_view: "カタカナ"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ヤ"
 | 
			
		||||
    RA:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "RA"
 | 
			
		||||
                unlock_view: "カタカナ"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ラ"
 | 
			
		||||
    WA:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "WA"
 | 
			
		||||
                unlock_view: "カタカナ"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ワ"
 | 
			
		||||
    DUMMYKEY:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "カタカナ"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: ""
 | 
			
		||||
    SYMBOLS:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "symbols"
 | 
			
		||||
                unlock_view: "カタカナ"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "()"
 | 
			
		||||
    PUNCT:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "punct"
 | 
			
		||||
                unlock_view: "カタカナ"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "。"
 | 
			
		||||
    # Buttons for Latin charachters
 | 
			
		||||
    RSYM1:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "RSYM1"
 | 
			
		||||
                unlock_view: "roman"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "@#"
 | 
			
		||||
    ABC:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "ABC"
 | 
			
		||||
                unlock_view: "roman"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ᴀʙᴄ"
 | 
			
		||||
    DEF:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "DEF"
 | 
			
		||||
                unlock_view: "roman"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ᴅᴇꜰ"
 | 
			
		||||
    GHI:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "GHI"
 | 
			
		||||
                unlock_view: "roman"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ɢʜɪ"
 | 
			
		||||
    JKL:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "JKL"
 | 
			
		||||
                unlock_view: "roman"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ᴊᴋʟ"
 | 
			
		||||
    MNO:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "MNO"
 | 
			
		||||
                unlock_view: "roman"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ᴍɴᴏ"
 | 
			
		||||
    PQRS:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "PQRS"
 | 
			
		||||
                unlock_view: "roman"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ᴘǫʀs"
 | 
			
		||||
    TUV:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "TUV"
 | 
			
		||||
                unlock_view: "roman"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ᴛᴜᴠ"
 | 
			
		||||
    WXYZ:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "WXYZ"
 | 
			
		||||
                unlock_view: "roman"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "ᴡxʏᴢ"
 | 
			
		||||
    RSYM2:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "RSYM2"
 | 
			
		||||
                unlock_view: "roman"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "()"
 | 
			
		||||
    RSYM3:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "RSYM3"
 | 
			
		||||
                unlock_view: "roman"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "+-"
 | 
			
		||||
    RSYM4:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "RSYM4"
 | 
			
		||||
                unlock_view: "roman"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: ",.?"
 | 
			
		||||
@ -1,17 +1,10 @@
 | 
			
		||||
---
 | 
			
		||||
bounds: { x: 0, y: 0.33, width: 360, height: 210 }
 | 
			
		||||
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 32, height: 52 }
 | 
			
		||||
    altline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 48.39024, height: 52 }
 | 
			
		||||
    wide:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 62, height: 52 }
 | 
			
		||||
    outline7:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 88.97561, height: 52 }
 | 
			
		||||
    spaceline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 150.5853, height: 52 }
 | 
			
		||||
    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 }
 | 
			
		||||
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
@ -26,13 +19,13 @@ views:
 | 
			
		||||
        - "show_numbers preferences         space        .    Return"
 | 
			
		||||
    numbers:
 | 
			
		||||
        - "1 2 3 4 5 6 7 8 9 0"
 | 
			
		||||
        - "at numbersign dollar percent ampersand minus underscore plus parenleft parenright"
 | 
			
		||||
        - "show_symbols   comma quotedbl quoteright colon semicolon exclam question  BackSpace"
 | 
			
		||||
        - "@ # $ % & - _ + ( )"
 | 
			
		||||
        - "show_symbols   , \" ' : ; ! ?  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        .    Return"
 | 
			
		||||
    symbols:
 | 
			
		||||
        - "asciitilde quoteleft bar U00B7 squareroot Greek_pi Greek_tau division multiply paragraph"
 | 
			
		||||
        - "copyright U00AE U00A3 EuroSign U00A5 asciicircum degree asterisk braceleft braceright"
 | 
			
		||||
        - "show_numbers   backslash slash less greater equal bracketleft bracketright  BackSpace"
 | 
			
		||||
        - "~ ` | U00B7 squareroot Greek_pi Greek_tau division multiply paragraph"
 | 
			
		||||
        - "copyright U00AE U00A3 EuroSign U00A5 asciicircum degree * { }"
 | 
			
		||||
        - "show_numbers   \\ / < > = [ ]  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        .    Return"
 | 
			
		||||
 | 
			
		||||
buttons:
 | 
			
		||||
@ -46,6 +39,7 @@ buttons:
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        keysym: "BackSpace"
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
@ -69,108 +63,37 @@ buttons:
 | 
			
		||||
        outline: altline
 | 
			
		||||
    space:
 | 
			
		||||
        outline: spaceline
 | 
			
		||||
        label: " "
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
    aring:
 | 
			
		||||
        label: "å"
 | 
			
		||||
    Aring:
 | 
			
		||||
        label: "Å"
 | 
			
		||||
    oslash:
 | 
			
		||||
        label: "ø"
 | 
			
		||||
    Oslash:
 | 
			
		||||
        label: "Ø"
 | 
			
		||||
    ae:
 | 
			
		||||
        label: "æ"
 | 
			
		||||
    AE:
 | 
			
		||||
        label: "Æ"
 | 
			
		||||
    asterisk:
 | 
			
		||||
        label: "*"
 | 
			
		||||
    asciitilde:
 | 
			
		||||
        label: "~"
 | 
			
		||||
    quoteleft:
 | 
			
		||||
        label: "`"
 | 
			
		||||
    bar:
 | 
			
		||||
        label: "|"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    U00B7:
 | 
			
		||||
        label: "·"
 | 
			
		||||
        text: "·"
 | 
			
		||||
    squareroot:
 | 
			
		||||
        label: "√"
 | 
			
		||||
        text: "√"
 | 
			
		||||
    Greek_pi:
 | 
			
		||||
        label: "π"
 | 
			
		||||
        text: "π"
 | 
			
		||||
    division:
 | 
			
		||||
        label: "÷"
 | 
			
		||||
        text: "÷"
 | 
			
		||||
    multiply:
 | 
			
		||||
        label: "×"
 | 
			
		||||
        text: "×"
 | 
			
		||||
    paragraph:
 | 
			
		||||
        label: "¶"
 | 
			
		||||
        text: "¶"
 | 
			
		||||
    Greek_tau:
 | 
			
		||||
        label: "τ"
 | 
			
		||||
        text: "τ"
 | 
			
		||||
    copyright:
 | 
			
		||||
        label: "©"
 | 
			
		||||
    numbersign:
 | 
			
		||||
        label: "#"
 | 
			
		||||
        text: "©"
 | 
			
		||||
    U00AE:
 | 
			
		||||
        label: "®"
 | 
			
		||||
    at:
 | 
			
		||||
        label: "@"
 | 
			
		||||
    dollar:
 | 
			
		||||
        label: "$"
 | 
			
		||||
        text: "®"
 | 
			
		||||
    U00A3:
 | 
			
		||||
        label: "£"
 | 
			
		||||
    percent:
 | 
			
		||||
        label: "%"
 | 
			
		||||
        text: "£"
 | 
			
		||||
    EuroSign:
 | 
			
		||||
        label: "€"
 | 
			
		||||
    ampersand:
 | 
			
		||||
        label: "&"
 | 
			
		||||
        text: "€"
 | 
			
		||||
    U00A5:
 | 
			
		||||
        label: "¥"
 | 
			
		||||
    minus:
 | 
			
		||||
        label: "-"
 | 
			
		||||
        text: "¥"
 | 
			
		||||
    asciicircum:
 | 
			
		||||
        label: "^"
 | 
			
		||||
    underscore:
 | 
			
		||||
        label: "_"
 | 
			
		||||
        text: "^"
 | 
			
		||||
    degree:
 | 
			
		||||
        label: "°"
 | 
			
		||||
    plus:
 | 
			
		||||
        label: "+"
 | 
			
		||||
    equal:
 | 
			
		||||
        label: "="
 | 
			
		||||
    parenleft:
 | 
			
		||||
        label: "("
 | 
			
		||||
    parenright:
 | 
			
		||||
        label: ")"
 | 
			
		||||
    braceleft:
 | 
			
		||||
        label: "{"
 | 
			
		||||
    braceright:
 | 
			
		||||
        label: "}"
 | 
			
		||||
    comma:
 | 
			
		||||
        label: ","
 | 
			
		||||
    backslash:
 | 
			
		||||
        label: "\\"
 | 
			
		||||
    slash:
 | 
			
		||||
        label: "/"
 | 
			
		||||
    quotedbl:
 | 
			
		||||
        label: "\""
 | 
			
		||||
    quoteright:
 | 
			
		||||
        label: "'"
 | 
			
		||||
    less:
 | 
			
		||||
        label: "<"
 | 
			
		||||
    greater:
 | 
			
		||||
        label: ">"
 | 
			
		||||
    colon:
 | 
			
		||||
        label: ":"
 | 
			
		||||
    semicolon:
 | 
			
		||||
        label: ";"
 | 
			
		||||
    exclam:
 | 
			
		||||
        label: "!"
 | 
			
		||||
    question:
 | 
			
		||||
        label: "?"
 | 
			
		||||
    bracketleft:
 | 
			
		||||
        label: "["
 | 
			
		||||
    bracketright:
 | 
			
		||||
        label: "]"
 | 
			
		||||
        text: "°"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,15 +1,9 @@
 | 
			
		||||
---
 | 
			
		||||
bounds: { x: 0, y: 0.33, width: 360, height: 210 }
 | 
			
		||||
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 37.46341, height: 52 }
 | 
			
		||||
    altline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 48.39024, height: 52 }
 | 
			
		||||
    outline7:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 88.97561, height: 52 }
 | 
			
		||||
    spaceline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 120.5853, height: 52 }
 | 
			
		||||
    default: { width: 37.46341, height: 52 }
 | 
			
		||||
    altline: { width: 48.39024, height: 52 }
 | 
			
		||||
    outline7: { width: 88.97561, height: 52 }
 | 
			
		||||
    spaceline: { width: 120.5853, height: 52 }
 | 
			
		||||
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
@ -22,22 +16,24 @@ buttons:
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        keysym: "BackSpace"
 | 
			
		||||
    space:
 | 
			
		||||
        outline: spaceline
 | 
			
		||||
        label: " "
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: outline7
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "BackSpace"
 | 
			
		||||
    asterisk:
 | 
			
		||||
        label: "*"
 | 
			
		||||
        text: "*"
 | 
			
		||||
    numbersign:
 | 
			
		||||
        label: "#"
 | 
			
		||||
        text: "#"
 | 
			
		||||
    minus:
 | 
			
		||||
        label: "-"
 | 
			
		||||
        text: "-"
 | 
			
		||||
    plus:
 | 
			
		||||
        label: "+"
 | 
			
		||||
        text: "+"
 | 
			
		||||
    parenleft:
 | 
			
		||||
        label: "("
 | 
			
		||||
        text: "("
 | 
			
		||||
    parenright:
 | 
			
		||||
        label: ")"
 | 
			
		||||
        text: ")"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,17 +1,10 @@
 | 
			
		||||
---
 | 
			
		||||
bounds: { x: 0, y: 0.33, width: 360, height: 210 }
 | 
			
		||||
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 32, height: 52 }
 | 
			
		||||
    altline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 48.39024, height: 52 }
 | 
			
		||||
    wide:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 62, height: 52 }
 | 
			
		||||
    outline7:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 88.97561, height: 52 }
 | 
			
		||||
    spaceline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 150.5853, height: 52 }
 | 
			
		||||
    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 }
 | 
			
		||||
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
@ -46,6 +39,7 @@ buttons:
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        keysym: "BackSpace"
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
@ -69,96 +63,97 @@ buttons:
 | 
			
		||||
        outline: altline
 | 
			
		||||
    space:
 | 
			
		||||
        outline: spaceline
 | 
			
		||||
        label: " "
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    asterisk:
 | 
			
		||||
        label: "*"
 | 
			
		||||
        text: "*"
 | 
			
		||||
    asciitilde:
 | 
			
		||||
        label: "~"
 | 
			
		||||
        text: "~"
 | 
			
		||||
    quoteleft:
 | 
			
		||||
        label: "`"
 | 
			
		||||
        text: "`"
 | 
			
		||||
    bar:
 | 
			
		||||
        label: "|"
 | 
			
		||||
        text: "|"
 | 
			
		||||
    U00B7:
 | 
			
		||||
        label: "·"
 | 
			
		||||
        text: "·"
 | 
			
		||||
    squareroot:
 | 
			
		||||
        label: "√"
 | 
			
		||||
        text: "√"
 | 
			
		||||
    Greek_pi:
 | 
			
		||||
        label: "π"
 | 
			
		||||
        text: "π"
 | 
			
		||||
    division:
 | 
			
		||||
        label: "÷"
 | 
			
		||||
        text: "÷"
 | 
			
		||||
    multiply:
 | 
			
		||||
        label: "×"
 | 
			
		||||
        text: "×"
 | 
			
		||||
    paragraph:
 | 
			
		||||
        label: "¶"
 | 
			
		||||
        text: "¶"
 | 
			
		||||
    Greek_tau:
 | 
			
		||||
        label: "τ"
 | 
			
		||||
        text: "τ"
 | 
			
		||||
    copyright:
 | 
			
		||||
        label: "©"
 | 
			
		||||
        text: "©"
 | 
			
		||||
    numbersign:
 | 
			
		||||
        label: "#"
 | 
			
		||||
        text: "#"
 | 
			
		||||
    U00AE:
 | 
			
		||||
        label: "®"
 | 
			
		||||
        text: "®"
 | 
			
		||||
    at:
 | 
			
		||||
        label: "@"
 | 
			
		||||
        text: "@"
 | 
			
		||||
    dollar:
 | 
			
		||||
        label: "$"
 | 
			
		||||
        text: "$"
 | 
			
		||||
    U00A3:
 | 
			
		||||
        label: "£"
 | 
			
		||||
        text: "£"
 | 
			
		||||
    percent:
 | 
			
		||||
        label: "%"
 | 
			
		||||
        text: "%"
 | 
			
		||||
    EuroSign:
 | 
			
		||||
        label: "€"
 | 
			
		||||
        text: "€"
 | 
			
		||||
    ampersand:
 | 
			
		||||
        label: "&"
 | 
			
		||||
        text: "&"
 | 
			
		||||
    U00A5:
 | 
			
		||||
        label: "¥"
 | 
			
		||||
        text: "¥"
 | 
			
		||||
    minus:
 | 
			
		||||
        label: "-"
 | 
			
		||||
        text: "-"
 | 
			
		||||
    asciicircum:
 | 
			
		||||
        label: "^"
 | 
			
		||||
        text: "^"
 | 
			
		||||
    underscore:
 | 
			
		||||
        label: "_"
 | 
			
		||||
        text: "_"
 | 
			
		||||
    degree:
 | 
			
		||||
        label: "°"
 | 
			
		||||
        text: "°"
 | 
			
		||||
    plus:
 | 
			
		||||
        label: "+"
 | 
			
		||||
        text: "+"
 | 
			
		||||
    equal:
 | 
			
		||||
        label: "="
 | 
			
		||||
        text: "="
 | 
			
		||||
    parenleft:
 | 
			
		||||
        label: "("
 | 
			
		||||
        text: "("
 | 
			
		||||
    parenright:
 | 
			
		||||
        label: ")"
 | 
			
		||||
        text: ")"
 | 
			
		||||
    braceleft:
 | 
			
		||||
        label: "{"
 | 
			
		||||
        text: "{"
 | 
			
		||||
    braceright:
 | 
			
		||||
        label: "}"
 | 
			
		||||
        text: "}"
 | 
			
		||||
    comma:
 | 
			
		||||
        label: ","
 | 
			
		||||
        text: ","
 | 
			
		||||
    backslash:
 | 
			
		||||
        label: "\\"
 | 
			
		||||
        text: "\\"
 | 
			
		||||
    slash:
 | 
			
		||||
        label: "/"
 | 
			
		||||
        text: "/"
 | 
			
		||||
    quotedbl:
 | 
			
		||||
        label: "\""
 | 
			
		||||
        text: "\""
 | 
			
		||||
    quoteright:
 | 
			
		||||
        label: "'"
 | 
			
		||||
        text: "'"
 | 
			
		||||
    less:
 | 
			
		||||
        label: "<"
 | 
			
		||||
        text: "<"
 | 
			
		||||
    greater:
 | 
			
		||||
        label: ">"
 | 
			
		||||
        text: ">"
 | 
			
		||||
    colon:
 | 
			
		||||
        label: ":"
 | 
			
		||||
        text: ":"
 | 
			
		||||
    semicolon:
 | 
			
		||||
        label: ";"
 | 
			
		||||
        text: ";"
 | 
			
		||||
    exclam:
 | 
			
		||||
        label: "!"
 | 
			
		||||
        text: "!"
 | 
			
		||||
    question:
 | 
			
		||||
        label: "?"
 | 
			
		||||
        text: "?"
 | 
			
		||||
    bracketleft:
 | 
			
		||||
        label: "["
 | 
			
		||||
        text: "["
 | 
			
		||||
    bracketright:
 | 
			
		||||
        label: "]"
 | 
			
		||||
        text: "]"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										159
									
								
								data/keyboards/terminal.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										159
									
								
								data/keyboards/terminal.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,159 @@
 | 
			
		||||
---
 | 
			
		||||
outlines:
 | 
			
		||||
    default: { width: 35.33, height: 52 }
 | 
			
		||||
    action:  { width: 59,    height: 52 }
 | 
			
		||||
    altline: { width: 52.67, height: 52 }
 | 
			
		||||
    wide: { width: 59, height: 52 }
 | 
			
		||||
    spaceline: { width: 140, 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_actions      space        preferences 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         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"
 | 
			
		||||
    actions:
 | 
			
		||||
        - "F1  F2  F3  F4  F5  F6"
 | 
			
		||||
        - "F7  F8  F9  F10 F11 F12"
 | 
			
		||||
        - "Esc Tab Del PgUp ↑ PgDn"
 | 
			
		||||
        - "show_letters Home End ← ↓ →"
 | 
			
		||||
 | 
			
		||||
buttons:
 | 
			
		||||
    Shift_L:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "upper"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "key-shift"
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        keysym: "BackSpace"
 | 
			
		||||
    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_actions:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "actions"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: ">_"
 | 
			
		||||
    period:
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        text: "."
 | 
			
		||||
    space:
 | 
			
		||||
        outline: "spaceline"
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    colon:
 | 
			
		||||
        text: ":"
 | 
			
		||||
    F1:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F1"
 | 
			
		||||
    F2:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F2"
 | 
			
		||||
    F3:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F3"
 | 
			
		||||
    F4:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F4"
 | 
			
		||||
    F5:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F5"
 | 
			
		||||
    F6:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F6"
 | 
			
		||||
    F7:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F7"
 | 
			
		||||
    F8:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F8"
 | 
			
		||||
    F9:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F9"
 | 
			
		||||
    F10:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F10"
 | 
			
		||||
    F11:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F11"
 | 
			
		||||
    F12:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F12"
 | 
			
		||||
    Esc:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Escape"
 | 
			
		||||
    Tab:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Tab"
 | 
			
		||||
    Del:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Delete"
 | 
			
		||||
    Home:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Home"
 | 
			
		||||
    End:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "End"
 | 
			
		||||
    PgUp:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Page_Up"
 | 
			
		||||
    PgDn:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Page_Down"
 | 
			
		||||
    "↑":
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Up"
 | 
			
		||||
    "↓":
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Down"
 | 
			
		||||
    "←":
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Left"
 | 
			
		||||
    "→":
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Right"
 | 
			
		||||
 | 
			
		||||
@ -1,17 +1,10 @@
 | 
			
		||||
---
 | 
			
		||||
bounds: { x: 0, y: 1, width: 360, height: 208 }
 | 
			
		||||
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 35.33, height: 52 }
 | 
			
		||||
    altline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 52.67, height: 52 }
 | 
			
		||||
    wide:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 62, height: 52 }
 | 
			
		||||
    spaceline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 142, height: 52 }
 | 
			
		||||
    special:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 44, height: 52 }
 | 
			
		||||
    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:
 | 
			
		||||
@ -46,6 +39,7 @@ buttons:
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        keysym: "BackSpace"
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "special"
 | 
			
		||||
@ -72,14 +66,13 @@ buttons:
 | 
			
		||||
        label: "*/="
 | 
			
		||||
    period:
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        label: "."
 | 
			
		||||
        text: "."
 | 
			
		||||
    space:
 | 
			
		||||
        outline: "spaceline"
 | 
			
		||||
        label: " "
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    colon:
 | 
			
		||||
        label: ":"
 | 
			
		||||
    "\"":
 | 
			
		||||
        keysym: "quotedbl"
 | 
			
		||||
        text: ":"
 | 
			
		||||
 | 
			
		||||
@ -1,39 +1,32 @@
 | 
			
		||||
---
 | 
			
		||||
bounds: { x: 0, y: 1, width: 540, height: 168 }
 | 
			
		||||
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 54, height: 42 }
 | 
			
		||||
    altline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 81, height: 42 }
 | 
			
		||||
    wide:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 108, height: 42 }
 | 
			
		||||
    spaceline:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 216, height: 42 }
 | 
			
		||||
    special:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 54, height: 42 }
 | 
			
		||||
    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 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         space        period Return"
 | 
			
		||||
        - "show_numbers 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 preferences         space        period Return"
 | 
			
		||||
        - "show_numbers preferences         space        . Return"
 | 
			
		||||
    numbers:
 | 
			
		||||
        - "1 2 3 4 5 6 7 8 9 0"
 | 
			
		||||
        - "@ # $ % & - _ + ( )"
 | 
			
		||||
        - "show_symbols   , \" ' colon ; ! ?  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        period Return"
 | 
			
		||||
        - "show_letters preferences         space        . Return"
 | 
			
		||||
    symbols:
 | 
			
		||||
        - "~ ` | · √ π τ ÷ × ¶"
 | 
			
		||||
        - "© ® £ € ¥ ^ ° * { }"
 | 
			
		||||
        - "show_numbers_from_symbols   \\ / < > = [ ]  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        period Return"
 | 
			
		||||
        - "show_letters preferences         space        . Return"
 | 
			
		||||
 | 
			
		||||
buttons:
 | 
			
		||||
    Shift_L:
 | 
			
		||||
@ -46,6 +39,7 @@ buttons:
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        keysym: "BackSpace"
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "special"
 | 
			
		||||
@ -70,16 +64,15 @@ buttons:
 | 
			
		||||
            set_view: "symbols"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "*/="
 | 
			
		||||
    period:
 | 
			
		||||
    ".":
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        label: "."
 | 
			
		||||
        text: "."
 | 
			
		||||
    space:
 | 
			
		||||
        outline: "spaceline"
 | 
			
		||||
        label: " "
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    colon:
 | 
			
		||||
        label: ":"
 | 
			
		||||
    "\"":
 | 
			
		||||
        keysym: "quotedbl"
 | 
			
		||||
        text: ":"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										8
									
								
								data/langs/ja-JP.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								data/langs/ja-JP.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
			
		||||
us 英語 (US)
 | 
			
		||||
de ドイツ語
 | 
			
		||||
el ギリシャ語
 | 
			
		||||
es スペイン語
 | 
			
		||||
it イタリア語
 | 
			
		||||
jp+kana 日本語 (かな)
 | 
			
		||||
nb ノルウェー語
 | 
			
		||||
 | 
			
		||||
@ -2,6 +2,7 @@
 | 
			
		||||
<gresources>
 | 
			
		||||
  <gresource prefix="/sm/puri/squeekboard">
 | 
			
		||||
   <file compressed="true">style.css</file>
 | 
			
		||||
   <file compressed="true">style-Adwaita:dark.css</file>
 | 
			
		||||
   <file compressed="true" preprocess="xml-stripblanks">popup.ui</file>
 | 
			
		||||
   <file>icons/key-enter.svg</file>
 | 
			
		||||
   <file>icons/key-shift.svg</file>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										46
									
								
								data/style-Adwaita:dark.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								data/style-Adwaita:dark.css
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,46 @@
 | 
			
		||||
sq_view {
 | 
			
		||||
    background-color: rgba(0, 0, 0, 255);
 | 
			
		||||
    color: #ffffff;
 | 
			
		||||
    font-family: cantarell, sans-serif;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sq_view sq_button {
 | 
			
		||||
    color: #deddda;
 | 
			
		||||
    background: #464448;
 | 
			
		||||
    border-style: solid;
 | 
			
		||||
    border-width: 1px;
 | 
			
		||||
    border-color: #5e5c64;
 | 
			
		||||
    border-radius: 3px;
 | 
			
		||||
    margin: 4px 2px 4px 2px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sq_view.wide sq_button {
 | 
			
		||||
    margin: 1px 1px 1px 1px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sq_button:active {
 | 
			
		||||
    background: #747077;
 | 
			
		||||
    border-color: #96949d;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sq_button.altline,
 | 
			
		||||
sq_button.special,
 | 
			
		||||
sq_button.wide {
 | 
			
		||||
    background: #2b292f;
 | 
			
		||||
    border-color: #3e3a44;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sq_button.locked {
 | 
			
		||||
    background: #ffffff;
 | 
			
		||||
    color: #2b292f;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#Return {
 | 
			
		||||
    background: #1c71d8;
 | 
			
		||||
    border-color: #1a5fb4;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#Return:active {
 | 
			
		||||
    background: #1c71d8;
 | 
			
		||||
    border-color: #3584e4;
 | 
			
		||||
}
 | 
			
		||||
@ -1,15 +1,15 @@
 | 
			
		||||
sq_view {
 | 
			
		||||
    background-color: rgba(0, 0, 0, 255);
 | 
			
		||||
    color: #ffffff;
 | 
			
		||||
    background-color: @theme_base_color; /*rgba(0, 0, 0, 255);*/
 | 
			
		||||
    color: @theme_text_color; /*#ffffff;*/
 | 
			
		||||
    font-family: cantarell, sans-serif;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sq_view sq_button {
 | 
			
		||||
    color: #deddda;
 | 
			
		||||
    background: #464448;
 | 
			
		||||
    color: @theme_fg_color; /*#deddda;*/
 | 
			
		||||
    background: mix(@theme_bg_color, @theme_base_color, -0.5); /* #464448; */
 | 
			
		||||
    border-style: solid;
 | 
			
		||||
    border-width: 1px;
 | 
			
		||||
    border-color: #5e5c64;
 | 
			
		||||
    border-color: @borders; /* #5e5c64;*/
 | 
			
		||||
    border-radius: 3px;
 | 
			
		||||
    margin: 4px 2px 4px 2px;
 | 
			
		||||
}
 | 
			
		||||
@ -18,29 +18,32 @@ sq_view.wide sq_button {
 | 
			
		||||
    margin: 1px 1px 1px 1px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sq_button:active {
 | 
			
		||||
    background: #747077;
 | 
			
		||||
    border-color: #96949d;
 | 
			
		||||
sq_button:active,
 | 
			
		||||
sq_button.altline:active,
 | 
			
		||||
sq_button.special:active,
 | 
			
		||||
sq_button.wide:active {
 | 
			
		||||
    background: mix(@theme_bg_color, @theme_selected_bg_color, 0.4);/* #747077; */
 | 
			
		||||
    border-color: mix(@borders, @theme_selected_fg_color, 0.5);/* #96949d; */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sq_button.altline,
 | 
			
		||||
sq_button.special,
 | 
			
		||||
sq_button.wide {
 | 
			
		||||
    background: #2b292f;
 | 
			
		||||
    border-color: #3e3a44;
 | 
			
		||||
    background: mix(@theme_bg_color, @theme_base_color, 0.5); /*#2b292f;*/
 | 
			
		||||
    border-color: @borders; /* #3e3a44; */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sq_button.locked {
 | 
			
		||||
    background: #ffffff;
 | 
			
		||||
    color: #2b292f;
 | 
			
		||||
    background: @theme_fg_color; /*#ffffff;*/
 | 
			
		||||
    color: @theme_bg_color; /*#2b292f;*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#Return {
 | 
			
		||||
    background: #1c71d8;
 | 
			
		||||
    border-color: #1a5fb4;
 | 
			
		||||
    background: @theme_selected_bg_color; /* #1c71d8; */
 | 
			
		||||
    border-color: @borders; /*#1a5fb4;*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#Return:active {
 | 
			
		||||
    background: #1c71d8;
 | 
			
		||||
    border-color: #3584e4;
 | 
			
		||||
    background: mix(@theme_selected_bg_color, @theme_bg_color, 0.4); /*#1c71d8;*/
 | 
			
		||||
    border-color: @borders; /*#3584e4;*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										39
									
								
								dco.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								dco.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,39 @@
 | 
			
		||||
Developer Certificate of Origin
 | 
			
		||||
Version 1.1
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
 | 
			
		||||
1 Letterman Drive
 | 
			
		||||
Suite D4700
 | 
			
		||||
San Francisco, CA, 94129
 | 
			
		||||
 | 
			
		||||
Everyone is permitted to copy and distribute verbatim copies of this
 | 
			
		||||
license document, but changing it is not allowed.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Developer's Certificate of Origin 1.1
 | 
			
		||||
 | 
			
		||||
By making a contribution to this project, I certify that:
 | 
			
		||||
 | 
			
		||||
(a) The contribution was created in whole or in part by me and I
 | 
			
		||||
    have the right to submit it under the open source license
 | 
			
		||||
    indicated in the file; or
 | 
			
		||||
 | 
			
		||||
(b) The contribution is based upon previous work that, to the best
 | 
			
		||||
    of my knowledge, is covered under an appropriate open source
 | 
			
		||||
    license and I have the right under that license to submit that
 | 
			
		||||
    work with modifications, whether created in whole or in part
 | 
			
		||||
    by me, under the same open source license (unless I am
 | 
			
		||||
    permitted to submit under a different license), as indicated
 | 
			
		||||
    in the file; or
 | 
			
		||||
 | 
			
		||||
(c) The contribution was provided directly to me by some other
 | 
			
		||||
    person who certified (a), (b) or (c) and I have not modified
 | 
			
		||||
    it.
 | 
			
		||||
 | 
			
		||||
(d) I understand and agree that this project and the contribution
 | 
			
		||||
    are public and that a record of the contribution (including all
 | 
			
		||||
    personal information I submit with it, including my sign-off) is
 | 
			
		||||
    maintained indefinitely and may be redistributed consistent with
 | 
			
		||||
    this project or the open source license(s) involved.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										88
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										88
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							@ -1,3 +1,91 @@
 | 
			
		||||
squeekboard (1.7.0) amber-phone; urgency=medium
 | 
			
		||||
 | 
			
		||||
  * New terminal layout appearing on terminal input hint
 | 
			
		||||
 | 
			
		||||
 -- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>  Wed, 08 Jan 2020 11:53:07 +0000
 | 
			
		||||
 | 
			
		||||
squeekboard (1.6.0) amber-phone; urgency=medium
 | 
			
		||||
 | 
			
		||||
  [ Dorota Czaplejewicz ]
 | 
			
		||||
  * tools: Move entry.py
 | 
			
		||||
  * build: Move building of squeekboard-test-layout to tools
 | 
			
		||||
  * packaging: Install entty.py as squeekboard-entry
 | 
			
		||||
  * Remove unused build dependencies
 | 
			
		||||
  * Remove unused header generator
 | 
			
		||||
  * logging: Move all facilities to one file
 | 
			
		||||
  * logging: Described the design
 | 
			
		||||
  * logging: Add described log levels
 | 
			
		||||
  * popover: Install emoji layout
 | 
			
		||||
  * popover: Show overlays as selected
 | 
			
		||||
  * Fix old Rust woes
 | 
			
		||||
  * emoji: Add a passable layout
 | 
			
		||||
  * Fix g_ and stdlib allocation/free mismatches
 | 
			
		||||
 | 
			
		||||
 -- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>  Thu, 02 Jan 2020 12:02:50 +0000
 | 
			
		||||
 
 | 
			
		||||
squeekboard (1.5.0) amber-phone; urgency=medium
 | 
			
		||||
 | 
			
		||||
  [ Dorota Czaplejewicz ]
 | 
			
		||||
  * keycodes: Sort to eliminate runtime indeterminism
 | 
			
		||||
  * switcher: Switch layout on menu item click
 | 
			
		||||
  * Drop squeek_key
 | 
			
		||||
  * renderer: Remove some unneeded vars
 | 
			
		||||
  * renderer: Simplified outline rendering
 | 
			
		||||
  * renderer: Drop row from button rendering
 | 
			
		||||
  * renderer: Drop unused params
 | 
			
		||||
  * renderer: Simplify surface rendering
 | 
			
		||||
  * rendering: Simplify Cairo context usage, remove unneeded calls.
 | 
			
		||||
  * rendering: Remove unneeded redraw after button release
 | 
			
		||||
  * renderer: Remove unused locked key render function
 | 
			
		||||
  * renderer: Simply cut off when painting outside bounds
 | 
			
		||||
  * renderer: Render whole keyboard the same way as pressed buttons
 | 
			
		||||
 | 
			
		||||
  [ Mark Müller ]
 | 
			
		||||
  * layout: add German wide layout
 | 
			
		||||
 | 
			
		||||
  [ Dorota Czaplejewicz ]
 | 
			
		||||
  * renderer: Remove unused functions
 | 
			
		||||
  * cleanup: Remove references to squeek_view
 | 
			
		||||
  * cleanup: Unbox View and Row
 | 
			
		||||
  * cleanup: Remove unused single frame draw
 | 
			
		||||
  * positioning: Calculate sizes instead of storing, move position out of widgets
 | 
			
		||||
  * positioning: Clean up unused code
 | 
			
		||||
  * Fix old Rust woes
 | 
			
		||||
 | 
			
		||||
  [ Mark Müller ]
 | 
			
		||||
  * layout: add Japanese Kana wide layout
 | 
			
		||||
 | 
			
		||||
  [ Dorota Czaplejewicz ]
 | 
			
		||||
  * Entry test: Add Terminal input purpose
 | 
			
		||||
  * readme: Add note about Cargo dependencies
 | 
			
		||||
  * Create a library/UI module separation
 | 
			
		||||
  * hacking: Add DCO and licensing requirement
 | 
			
		||||
  * Fix internal .md link
 | 
			
		||||
 | 
			
		||||
  [ Mark Müller ]
 | 
			
		||||
  * squeekboard-test-layout: add argument parsing and some more output
 | 
			
		||||
 | 
			
		||||
  [ Dorota Czaplejewicz ]
 | 
			
		||||
  * Use clap in the lockfile
 | 
			
		||||
  * parsing: Remove bounds which weren't used anyway
 | 
			
		||||
  * layout: Respect margins
 | 
			
		||||
  * CI: Build arm64 .deb
 | 
			
		||||
 | 
			
		||||
 -- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>  Mon, 23 Dec 2019 11:58:57 +0000
 | 
			
		||||
 | 
			
		||||
squeekboard (1.4.0) amber-phone; urgency=medium
 | 
			
		||||
 | 
			
		||||
  * "text" property in layouts
 | 
			
		||||
  * Adjusts to user's color scheme
 | 
			
		||||
 | 
			
		||||
 -- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>  Mon, 02 Dec 2019 19:37:01 +0000
 | 
			
		||||
 | 
			
		||||
squeekboard (1.3.2) amber-phone; urgency=medium
 | 
			
		||||
 | 
			
		||||
  * Make sure all key presses get accepted by the compositor
 | 
			
		||||
 | 
			
		||||
 -- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>  Tue, 26 Nov 2019 15:36:27 +0000
 | 
			
		||||
 | 
			
		||||
squeekboard (1.3.1) amber-phone; urgency=medium
 | 
			
		||||
 | 
			
		||||
  * Update and fix layouts and languages
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										17
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							@ -12,6 +12,7 @@ Build-Depends:
 | 
			
		||||
 libgtk-3-dev,
 | 
			
		||||
 libcroco3-dev,
 | 
			
		||||
 librust-bitflags-1-dev (>= 1.0),
 | 
			
		||||
 librust-clap-2+default-dev (>= 2.32),
 | 
			
		||||
 librust-gio+v2-44-dev,
 | 
			
		||||
 librust-glib+v2-44-dev,
 | 
			
		||||
 librust-glib-sys-dev,
 | 
			
		||||
@ -25,9 +26,6 @@ Build-Depends:
 | 
			
		||||
 libwayland-dev (>= 1.16),
 | 
			
		||||
 rustc,
 | 
			
		||||
 wayland-protocols (>= 1.14),
 | 
			
		||||
# for running the tests
 | 
			
		||||
 xvfb,
 | 
			
		||||
 xauth,
 | 
			
		||||
Standards-Version: 4.1.3
 | 
			
		||||
Homepage: https://source.puri.sm/Librem5/squeekboard
 | 
			
		||||
 | 
			
		||||
@ -40,3 +38,16 @@ Depends:
 | 
			
		||||
 ${misc:Depends}
 | 
			
		||||
Description: On-screen keyboard for Wayland
 | 
			
		||||
 Virtual keyboard supporting Wayland, built primarily for the Librem 5 phone.
 | 
			
		||||
 | 
			
		||||
Package: squeekboard-devel
 | 
			
		||||
Architecture: linux-any
 | 
			
		||||
Depends:
 | 
			
		||||
 python3,
 | 
			
		||||
 python3-gi,
 | 
			
		||||
 ${shlibs:Depends}
 | 
			
		||||
 ${misc:Depends}
 | 
			
		||||
Description: Resources for making Squeekboard layouts
 | 
			
		||||
 Tools for creating and testing Squeekboard layouts:
 | 
			
		||||
 .
 | 
			
		||||
  * squeekboard-entry
 | 
			
		||||
  * squeekboard-test-layout
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								debian/squeekboard-devel.install
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								debian/squeekboard-devel.install
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
			
		||||
usr/bin/squeekboard-test-layout /usr/bin
 | 
			
		||||
usr/bin/squeekboard-entry /usr/bin
 | 
			
		||||
							
								
								
									
										2
									
								
								debian/squeekboard.install
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								debian/squeekboard.install
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
			
		||||
tools/squeekboard-restyled usr/bin
 | 
			
		||||
usr/bin/squeekboard /usr/bin
 | 
			
		||||
							
								
								
									
										2
									
								
								debian/squeekboard.lintian-overrides
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								debian/squeekboard.lintian-overrides
									
									
									
									
										vendored
									
									
								
							@ -1,2 +1,2 @@
 | 
			
		||||
# yaml-rust 0.4.3 shares some roots with libyaml, including the string which lintian checks, creating a false positive
 | 
			
		||||
squeekboard binary: embedded-library usr/bin/squeekboard-real: libyaml
 | 
			
		||||
squeekboard binary: embedded-library usr/bin/squeekboard: libyaml
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								doc/build.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										18
									
								
								doc/build.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,18 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
# Builds the documentation and places in the selected directory,
 | 
			
		||||
# or the working directory.
 | 
			
		||||
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
SCRIPT_PATH="$(realpath "$0")"
 | 
			
		||||
DOCS_DIR="$(dirname "$SCRIPT_PATH")"
 | 
			
		||||
 | 
			
		||||
TARGET_DIR="${1:-./}"
 | 
			
		||||
 | 
			
		||||
SPHINX=sphinx-build
 | 
			
		||||
 | 
			
		||||
if ! which sphinx-build ; then
 | 
			
		||||
    SPHINX=sphinx-build-3
 | 
			
		||||
fi
 | 
			
		||||
$SPHINX -b html "${DOCS_DIR}" "${TARGET_DIR}"
 | 
			
		||||
							
								
								
									
										165
									
								
								doc/conf.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										165
									
								
								doc/conf.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,165 @@
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
#
 | 
			
		||||
# Configuration file for the Sphinx documentation builder.
 | 
			
		||||
#
 | 
			
		||||
# This file does only contain a selection of the most common options. For a
 | 
			
		||||
# full list see the documentation:
 | 
			
		||||
# http://www.sphinx-doc.org/en/master/config
 | 
			
		||||
 | 
			
		||||
# -- Path setup --------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
# If extensions (or modules to document with autodoc) are in another directory,
 | 
			
		||||
# add these directories to sys.path here. If the directory is relative to the
 | 
			
		||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
 | 
			
		||||
#
 | 
			
		||||
# import os
 | 
			
		||||
# import sys
 | 
			
		||||
# sys.path.insert(0, os.path.abspath('.'))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# -- Project information -----------------------------------------------------
 | 
			
		||||
 | 
			
		||||
project = 'squeekboard'
 | 
			
		||||
copyright = 'Squeekboard contributors'
 | 
			
		||||
author = 'Dorota Czaplejewicz'
 | 
			
		||||
 | 
			
		||||
# The short X.Y version
 | 
			
		||||
version = ''
 | 
			
		||||
# The full version, including alpha/beta/rc tags
 | 
			
		||||
release = ''
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# -- General configuration ---------------------------------------------------
 | 
			
		||||
 | 
			
		||||
# If your documentation needs a minimal Sphinx version, state it here.
 | 
			
		||||
#
 | 
			
		||||
# needs_sphinx = '1.0'
 | 
			
		||||
 | 
			
		||||
# Add any Sphinx extension module names here, as strings. They can be
 | 
			
		||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 | 
			
		||||
# ones.
 | 
			
		||||
extensions = [
 | 
			
		||||
    'recommonmark'
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
# Add any paths that contain templates here, relative to this directory.
 | 
			
		||||
templates_path = ['_templates']
 | 
			
		||||
 | 
			
		||||
# The suffix(es) of source filenames.
 | 
			
		||||
# You can specify multiple suffix as a list of string:
 | 
			
		||||
#
 | 
			
		||||
# source_suffix = ['.rst', '.md']
 | 
			
		||||
source_suffix = '.md'
 | 
			
		||||
 | 
			
		||||
# The master toctree document.
 | 
			
		||||
master_doc = 'index'
 | 
			
		||||
 | 
			
		||||
# The language for content autogenerated by Sphinx. Refer to documentation
 | 
			
		||||
# for a list of supported languages.
 | 
			
		||||
#
 | 
			
		||||
# This is also used if you do content translation via gettext catalogs.
 | 
			
		||||
# Usually you set "language" from the command line for these cases.
 | 
			
		||||
language = None
 | 
			
		||||
 | 
			
		||||
# List of patterns, relative to source directory, that match files and
 | 
			
		||||
# directories to ignore when looking for source files.
 | 
			
		||||
# This pattern also affects html_static_path and html_extra_path .
 | 
			
		||||
exclude_patterns = []
 | 
			
		||||
 | 
			
		||||
# The name of the Pygments (syntax highlighting) style to use.
 | 
			
		||||
pygments_style = 'sphinx'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# -- Options for HTML output -------------------------------------------------
 | 
			
		||||
 | 
			
		||||
# The theme to use for HTML and HTML Help pages.  See the documentation for
 | 
			
		||||
# a list of builtin themes.
 | 
			
		||||
#
 | 
			
		||||
html_theme = 'alabaster'
 | 
			
		||||
 | 
			
		||||
# Theme options are theme-specific and customize the look and feel of a theme
 | 
			
		||||
# further.  For a list of options available for each theme, see the
 | 
			
		||||
# documentation.
 | 
			
		||||
#
 | 
			
		||||
# html_theme_options = {}
 | 
			
		||||
 | 
			
		||||
# Add any paths that contain custom static files (such as style sheets) here,
 | 
			
		||||
# relative to this directory. They are copied after the builtin static files,
 | 
			
		||||
# so a file named "default.css" will overwrite the builtin "default.css".
 | 
			
		||||
html_static_path = ['_static']
 | 
			
		||||
 | 
			
		||||
# Custom sidebar templates, must be a dictionary that maps document names
 | 
			
		||||
# to template names.
 | 
			
		||||
#
 | 
			
		||||
# The default sidebars (for documents that don't match any pattern) are
 | 
			
		||||
# defined by theme itself.  Builtin themes are using these templates by
 | 
			
		||||
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
 | 
			
		||||
# 'searchbox.html']``.
 | 
			
		||||
#
 | 
			
		||||
# html_sidebars = {}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# -- Options for HTMLHelp output ---------------------------------------------
 | 
			
		||||
 | 
			
		||||
# Output file base name for HTML help builder.
 | 
			
		||||
htmlhelp_basename = 'squeekboarddoc'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# -- Options for LaTeX output ------------------------------------------------
 | 
			
		||||
 | 
			
		||||
latex_elements = {
 | 
			
		||||
    # The paper size ('letterpaper' or 'a4paper').
 | 
			
		||||
    #
 | 
			
		||||
    # 'papersize': 'letterpaper',
 | 
			
		||||
 | 
			
		||||
    # The font size ('10pt', '11pt' or '12pt').
 | 
			
		||||
    #
 | 
			
		||||
    # 'pointsize': '10pt',
 | 
			
		||||
 | 
			
		||||
    # Additional stuff for the LaTeX preamble.
 | 
			
		||||
    #
 | 
			
		||||
    # 'preamble': '',
 | 
			
		||||
 | 
			
		||||
    # Latex figure (float) alignment
 | 
			
		||||
    #
 | 
			
		||||
    # 'figure_align': 'htbp',
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Grouping the document tree into LaTeX files. List of tuples
 | 
			
		||||
# (source start file, target name, title,
 | 
			
		||||
#  author, documentclass [howto, manual, or own class]).
 | 
			
		||||
latex_documents = [
 | 
			
		||||
    (master_doc, 'squeekboard.tex', 'squeekboard Documentation',
 | 
			
		||||
     'Dorota Czaplejewicz', 'manual'),
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# -- Options for manual page output ------------------------------------------
 | 
			
		||||
 | 
			
		||||
# One entry per manual page. List of tuples
 | 
			
		||||
# (source start file, name, description, authors, manual section).
 | 
			
		||||
man_pages = [
 | 
			
		||||
    (master_doc, 'squeekboard', 'squeekboard Documentation',
 | 
			
		||||
     [author], 1)
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# -- Options for Texinfo output ----------------------------------------------
 | 
			
		||||
 | 
			
		||||
# Grouping the document tree into Texinfo files. List of tuples
 | 
			
		||||
# (source start file, target name, title, author,
 | 
			
		||||
#  dir menu entry, description, category)
 | 
			
		||||
texinfo_documents = [
 | 
			
		||||
    (master_doc, 'squeekboard', 'squeekboard Documentation',
 | 
			
		||||
     author, 'squeekboard', 'One line description of project.',
 | 
			
		||||
     'Miscellaneous'),
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
from recommonmark.transform import AutoStructify
 | 
			
		||||
 | 
			
		||||
def setup(app):
 | 
			
		||||
    app.add_config_value('recommonmark_config', {
 | 
			
		||||
        'enable_auto_toc_tree': True,
 | 
			
		||||
        'auto_toc_tree_section': 'Contents',
 | 
			
		||||
    }, True)
 | 
			
		||||
    app.add_transform(AutoStructify)
 | 
			
		||||
							
								
								
									
										21
									
								
								doc/index.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								doc/index.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
			
		||||
Welcome to squeekboard's documentation!
 | 
			
		||||
=======================================
 | 
			
		||||
 | 
			
		||||
Contents
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
* [Tutorial](tutorial.md)
 | 
			
		||||
 | 
			
		||||
Introduction
 | 
			
		||||
------------
 | 
			
		||||
 | 
			
		||||
Squeekboard is the on-screen keyobard for the Librem 5 phone. For more information, look at the [README](https://source.puri.sm/Librem5/squeekboard/blob/master/README.md).
 | 
			
		||||
 | 
			
		||||
Layouts
 | 
			
		||||
-------
 | 
			
		||||
 | 
			
		||||
Squeekboard allows user-provided keyboard layouts. They can be created without recompiling the keyboard code. The tutorial](/tutorial.md) explains the process in detail.
 | 
			
		||||
 | 
			
		||||
Layouts are created using a text-based format, based on YAML.
 | 
			
		||||
 | 
			
		||||
TODO: Provide a description of the format.
 | 
			
		||||
							
								
								
									
										53
									
								
								doc/tutorial.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								doc/tutorial.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,53 @@
 | 
			
		||||
Kareema's guide to creating layouts
 | 
			
		||||
===================================
 | 
			
		||||
 | 
			
		||||
It’s long overdue to write a comprehensive guide how to add a keyboard layout from start. But unfortunately, I don’t have much time left ATM. A lot of information can be found in [this ](https://forums.puri.sm/t/using-non-latin-language-on-librem-5/7103/5) thread.
 | 
			
		||||
 | 
			
		||||
So at least I will try to start writing a short how-to here and edit this post as I find the time. Hope this helps a bit - comments and corrections welcome.
 | 
			
		||||
 | 
			
		||||
**Get one of the existing keyboard layouts**
 | 
			
		||||
 | 
			
		||||
* You can get one of the keyboards from the squeekboard git repository : [https://source.puri.sm/Librem5/squeekboard ](https://source.puri.sm/Librem5/squeekboard)
 | 
			
		||||
* The keyboard layouts are located in the subdirectory `data/keyboard/` in the `.yaml` files
 | 
			
		||||
* Take a look and try to understand them :slight_smile:
 | 
			
		||||
 | 
			
		||||
**Fork your own copy of squeekboard**
 | 
			
		||||
 | 
			
		||||
* Best way would be to start with a fork of the squeekboard repository: Create a user account at https://source.puri.sm/, go the the squeekboard git repository, press “Fork” in the web interface. You can find further instructions [here](https://docs.gitlab.com/ee/user/project/repository/forking_workflow.html#creating-a-fork).
 | 
			
		||||
* Clone your fork locally with `git clone` and use the uri of your forked repo there
 | 
			
		||||
 | 
			
		||||
**Workflow to edit your keyboard and get it merged**
 | 
			
		||||
 | 
			
		||||
* A generic guide how the workflow to contribute works, can be found at https://developer.puri.sm/Librem5/Contact/Contributing.html
 | 
			
		||||
* Create a branch: Name it “keyboard-layout-mylanguage” or whatever
 | 
			
		||||
* Checkout your branch, edit your keyboard layout and commit your changes
 | 
			
		||||
* Push the local changes (to the branch of your fork of squeekboard)
 | 
			
		||||
* Create a merge request for the branch to get your changes merged to the official squeekboard git repository
 | 
			
		||||
 | 
			
		||||
**Compile squeekboard**
 | 
			
		||||
 | 
			
		||||
* Follow the instructions found in “Building” section of the squeekboard’s README: Running squeekboard: [https://source.puri.sm/Librem5/squeekboard/blob/master/README.md#building ](https://source.puri.sm/Librem5/squeekboard/blob/master/README.md#building)
 | 
			
		||||
 | 
			
		||||
**Running squeekboard**
 | 
			
		||||
 | 
			
		||||
* Follow these instructions to run squeekboard: [https://source.puri.sm/Librem5/squeekboard/blob/master/README.md#running ](https://source.puri.sm/Librem5/squeekboard/blob/master/README.md#running)
 | 
			
		||||
* Additionally take a look at https://source.puri.sm/Librem5/squeekboard/blob/master/HACKING.md#testing
 | 
			
		||||
* You can either test it locally on your Linux system or use the [QEMU Librem 5 image ](https://developer.puri.sm/Librem5/Development_Environment/Boards/emulators.html)
 | 
			
		||||
* To test squeekboard locally, you need phoc. Either compile that from the sources as well or use the CI repository ci.puri.sm for Debian based systems:
 | 
			
		||||
`deb [arch=amd64] http://ci.puri.sm/ scratch librem5`
 | 
			
		||||
Squeekboard can be installed from there as a Debian package, too (that’s what I often do). But beware - there be dragons! You could bork your system with these packages and you should probably disable this repository again after installing what you need - these packages are not meant for production systems (or so I heard :wink: )
 | 
			
		||||
 | 
			
		||||
**Creating the keyboard layout**
 | 
			
		||||
 | 
			
		||||
* To be written: For the time being, take a look at [Using non-latin language on Librem 5 ](https://forums.puri.sm/t/using-non-latin-language-on-librem-5/7103/5)
 | 
			
		||||
* The correct name of the .yaml file can be found with the command `gsettings get org.gnome.desktop.input-sources sources`
 | 
			
		||||
The output should be something like this: `[('xkb', 'us'), ('xkb', 'de')]`
 | 
			
		||||
So f.ex. “de.yaml” would be the correct name for the German keyboard layout.
 | 
			
		||||
* The translations for the keyboard layout names in the different languages can be found at `data/langs/`
 | 
			
		||||
* Don’t forget to add your newly created layout or translation to `src/resources.rs` and the layout to `tests/meson.build` (that’s for me, because I always forget it)
 | 
			
		||||
 | 
			
		||||
**Testing the layout**
 | 
			
		||||
 | 
			
		||||
* Copy your yaml file to `~/.local/share/squeekboard/keyboards/` for testing purposes. From there it should get picked up by squeekboard
 | 
			
		||||
* To test the translations in `data/langs/` , you have to compile squeekboard
 | 
			
		||||
 | 
			
		||||
@ -61,10 +61,6 @@ typedef struct _EekGtkKeyboardPrivate
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_PRIVATE (EekGtkKeyboard, eek_gtk_keyboard, GTK_TYPE_DRAWING_AREA)
 | 
			
		||||
 | 
			
		||||
static void       render_pressed_button      (GtkWidget *widget, struct button_place *place);
 | 
			
		||||
static void       render_released_button     (GtkWidget *widget,
 | 
			
		||||
                                              const struct squeek_button *button);
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eek_gtk_keyboard_real_realize (GtkWidget      *self)
 | 
			
		||||
{
 | 
			
		||||
@ -101,10 +97,7 @@ eek_gtk_keyboard_real_draw (GtkWidget *self,
 | 
			
		||||
                                       gtk_widget_get_scale_factor (self));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // render the keyboard without any key activity (TODO: from a cached buffer)
 | 
			
		||||
    eek_renderer_render_keyboard (priv->renderer, cr);
 | 
			
		||||
    // render only a few remaining changes
 | 
			
		||||
    squeek_layout_draw_all_changed(priv->keyboard->layout, EEK_GTK_KEYBOARD(self));
 | 
			
		||||
    return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -138,14 +131,17 @@ static void drag(EekGtkKeyboard *self,
 | 
			
		||||
{
 | 
			
		||||
    EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
 | 
			
		||||
    squeek_layout_drag(priv->keyboard->layout, priv->keyboard->manager->virtual_keyboard,
 | 
			
		||||
                       x, y, eek_renderer_get_transformation(priv->renderer), time, self);
 | 
			
		||||
                       x, y, eek_renderer_get_transformation(priv->renderer), time,
 | 
			
		||||
                       priv->keyboard->manager, self);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void release(EekGtkKeyboard *self, guint32 time)
 | 
			
		||||
{
 | 
			
		||||
    EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
 | 
			
		||||
 | 
			
		||||
    squeek_layout_release(priv->keyboard->layout, priv->keyboard->manager->virtual_keyboard, eek_renderer_get_transformation(priv->renderer), time, self);
 | 
			
		||||
    squeek_layout_release(priv->keyboard->layout, priv->keyboard->manager->virtual_keyboard,
 | 
			
		||||
                          eek_renderer_get_transformation(priv->renderer), time,
 | 
			
		||||
                          priv->keyboard->manager, self);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
@ -170,6 +166,18 @@ eek_gtk_keyboard_real_button_release_event (GtkWidget      *self,
 | 
			
		||||
    return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
eek_gtk_keyboard_leave_event (GtkWidget      *self,
 | 
			
		||||
                              GdkEventCrossing *event)
 | 
			
		||||
{
 | 
			
		||||
    if (event->type == GDK_LEAVE_NOTIFY) {
 | 
			
		||||
        // TODO: can the event have different coords than the previous move event?
 | 
			
		||||
        release(EEK_GTK_KEYBOARD(self), event->time);
 | 
			
		||||
    }
 | 
			
		||||
    return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
eek_gtk_keyboard_real_motion_notify_event (GtkWidget      *self,
 | 
			
		||||
                                           GdkEventMotion *event)
 | 
			
		||||
@ -234,6 +242,7 @@ eek_gtk_keyboard_set_property (GObject      *object,
 | 
			
		||||
                               const GValue *value,
 | 
			
		||||
                               GParamSpec   *pspec)
 | 
			
		||||
{
 | 
			
		||||
    (void)value;
 | 
			
		||||
    switch (prop_id) {
 | 
			
		||||
    default:
 | 
			
		||||
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
@ -279,6 +288,9 @@ eek_gtk_keyboard_class_init (EekGtkKeyboardClass *klass)
 | 
			
		||||
        eek_gtk_keyboard_real_button_release_event;
 | 
			
		||||
    widget_class->motion_notify_event =
 | 
			
		||||
        eek_gtk_keyboard_real_motion_notify_event;
 | 
			
		||||
    widget_class->leave_notify_event =
 | 
			
		||||
        eek_gtk_keyboard_leave_event;
 | 
			
		||||
 | 
			
		||||
    widget_class->touch_event = handle_touch_event;
 | 
			
		||||
 | 
			
		||||
    gobject_class->set_property = eek_gtk_keyboard_set_property;
 | 
			
		||||
@ -287,7 +299,9 @@ eek_gtk_keyboard_class_init (EekGtkKeyboardClass *klass)
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eek_gtk_keyboard_init (EekGtkKeyboard *self)
 | 
			
		||||
{}
 | 
			
		||||
{
 | 
			
		||||
    (void)self;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_gtk_keyboard_new:
 | 
			
		||||
@ -305,110 +319,7 @@ eek_gtk_keyboard_new (LevelKeyboard *keyboard)
 | 
			
		||||
    return GTK_WIDGET(ret);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
render_pressed_button (GtkWidget *widget,
 | 
			
		||||
                       struct button_place *place)
 | 
			
		||||
{
 | 
			
		||||
    EekGtkKeyboard        *self = EEK_GTK_KEYBOARD (widget);
 | 
			
		||||
EekRenderer *eek_gtk_keyboard_get_renderer(EekGtkKeyboard *self) {
 | 
			
		||||
    EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
 | 
			
		||||
 | 
			
		||||
    GdkWindow         *window  = gtk_widget_get_window (widget);
 | 
			
		||||
    cairo_region_t    *region  = gdk_window_get_clip_region (window);
 | 
			
		||||
    GdkDrawingContext *context = gdk_window_begin_draw_frame (window, region);
 | 
			
		||||
    cairo_t           *cr      = gdk_drawing_context_get_cairo_context (context);
 | 
			
		||||
 | 
			
		||||
    eek_renderer_render_button (priv->renderer, cr, place, 1.0, TRUE);
 | 
			
		||||
/*
 | 
			
		||||
    eek_renderer_render_key (priv->renderer, cr, key, 1.5, TRUE);
 | 
			
		||||
*/
 | 
			
		||||
    gdk_window_end_draw_frame (window, context);
 | 
			
		||||
 | 
			
		||||
    cairo_region_destroy (region);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
eek_gtk_render_locked_button (EekGtkKeyboard *self, struct button_place place)
 | 
			
		||||
{
 | 
			
		||||
    EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
 | 
			
		||||
 | 
			
		||||
    GdkWindow         *window  = gtk_widget_get_window (GTK_WIDGET(self));
 | 
			
		||||
    cairo_region_t    *region  = gdk_window_get_clip_region (window);
 | 
			
		||||
    GdkDrawingContext *context = gdk_window_begin_draw_frame (window, region);
 | 
			
		||||
    cairo_t           *cr      = gdk_drawing_context_get_cairo_context (context);
 | 
			
		||||
 | 
			
		||||
    eek_renderer_render_button (priv->renderer, cr, &place, 1.0, TRUE);
 | 
			
		||||
 | 
			
		||||
    gdk_window_end_draw_frame (window, context);
 | 
			
		||||
 | 
			
		||||
    cairo_region_destroy (region);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TODO: does it really redraw the entire keyboard?
 | 
			
		||||
static void
 | 
			
		||||
render_released_button (GtkWidget *widget,
 | 
			
		||||
                        const struct squeek_button *button)
 | 
			
		||||
{
 | 
			
		||||
    (void)button;
 | 
			
		||||
    EekGtkKeyboard        *self = EEK_GTK_KEYBOARD (widget);
 | 
			
		||||
    EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
 | 
			
		||||
 | 
			
		||||
    GdkWindow         *window  = gtk_widget_get_window (widget);
 | 
			
		||||
    cairo_region_t    *region  = gdk_window_get_clip_region (window);
 | 
			
		||||
    GdkDrawingContext *context = gdk_window_begin_draw_frame (window, region);
 | 
			
		||||
    cairo_t           *cr      = gdk_drawing_context_get_cairo_context (context);
 | 
			
		||||
 | 
			
		||||
    eek_renderer_render_keyboard (priv->renderer, cr);
 | 
			
		||||
 | 
			
		||||
    gdk_window_end_draw_frame (window, context);
 | 
			
		||||
 | 
			
		||||
    cairo_region_destroy (region);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
eek_gtk_on_button_pressed (struct button_place place,
 | 
			
		||||
                   EekGtkKeyboard *self)
 | 
			
		||||
{
 | 
			
		||||
    EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
 | 
			
		||||
 | 
			
		||||
    /* renderer may have not been set yet if the widget is a popup */
 | 
			
		||||
    if (!priv->renderer)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    if (!place.row) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    render_pressed_button (GTK_WIDGET(self), &place);
 | 
			
		||||
    gtk_widget_queue_draw (GTK_WIDGET(self));
 | 
			
		||||
 | 
			
		||||
#if HAVE_LIBCANBERRA
 | 
			
		||||
    ca_gtk_play_for_widget (widget, 0,
 | 
			
		||||
                            CA_PROP_EVENT_ID, "button-pressed",
 | 
			
		||||
                            CA_PROP_EVENT_DESCRIPTION, "virtual key pressed",
 | 
			
		||||
                            CA_PROP_APPLICATION_ID, "org.fedorahosted.Eekboard",
 | 
			
		||||
                            NULL);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
eek_gtk_on_button_released (const struct squeek_button *button,
 | 
			
		||||
                    struct squeek_view *view,
 | 
			
		||||
                    EekGtkKeyboard *self)
 | 
			
		||||
{
 | 
			
		||||
    (void)view;
 | 
			
		||||
    EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
 | 
			
		||||
 | 
			
		||||
    /* renderer may have not been set yet if the widget is a popup */
 | 
			
		||||
    if (!priv->renderer)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    render_released_button (GTK_WIDGET(self), button);
 | 
			
		||||
    gtk_widget_queue_draw (GTK_WIDGET(self));
 | 
			
		||||
 | 
			
		||||
#if HAVE_LIBCANBERRA
 | 
			
		||||
    ca_gtk_play_for_widget (widget, 0,
 | 
			
		||||
                            CA_PROP_EVENT_ID, "button-released",
 | 
			
		||||
                            CA_PROP_EVENT_DESCRIPTION, "virtual key pressed",
 | 
			
		||||
                            CA_PROP_APPLICATION_ID, "org.fedorahosted.Eekboard",
 | 
			
		||||
                            NULL);
 | 
			
		||||
#endif
 | 
			
		||||
    return priv->renderer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -30,12 +30,9 @@
 | 
			
		||||
#include "config.h"
 | 
			
		||||
#include <glib/gprintf.h>
 | 
			
		||||
 | 
			
		||||
#include "eek-enumtypes.h"
 | 
			
		||||
#include "eekboard/eekboard-context-service.h"
 | 
			
		||||
#include "eekboard/key-emitter.h"
 | 
			
		||||
#include "keymap.h"
 | 
			
		||||
#include "src/keyboard.h"
 | 
			
		||||
 | 
			
		||||
#include "eek-keyboard.h"
 | 
			
		||||
 | 
			
		||||
void level_keyboard_deinit(LevelKeyboard *self) {
 | 
			
		||||
@ -59,8 +56,3 @@ LevelKeyboard *level_keyboard_new(EekboardContextService *manager, struct squeek
 | 
			
		||||
    keyboard->manager = manager;
 | 
			
		||||
    return keyboard;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct squeek_view *level_keyboard_current(LevelKeyboard *keyboard)
 | 
			
		||||
{
 | 
			
		||||
    return squeek_layout_get_current_view(keyboard->layout);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -49,7 +49,6 @@ typedef struct _LevelKeyboard LevelKeyboard;
 | 
			
		||||
gchar *             eek_keyboard_get_keymap
 | 
			
		||||
                                     (LevelKeyboard *keyboard);
 | 
			
		||||
 | 
			
		||||
struct squeek_view *level_keyboard_current(LevelKeyboard *keyboard);
 | 
			
		||||
LevelKeyboard *level_keyboard_new(EekboardContextService *manager, struct squeek_layout *layout);
 | 
			
		||||
void level_keyboard_deinit(LevelKeyboard *self);
 | 
			
		||||
void level_keyboard_free(LevelKeyboard *self);
 | 
			
		||||
 | 
			
		||||
@ -26,6 +26,7 @@
 | 
			
		||||
 | 
			
		||||
#include "eek-keyboard.h"
 | 
			
		||||
#include "eek-renderer.h"
 | 
			
		||||
#include "src/style.h"
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
    PROP_0,
 | 
			
		||||
@ -41,17 +42,14 @@ typedef struct _EekRendererPrivate
 | 
			
		||||
    GtkStyleContext *view_context; // owned
 | 
			
		||||
    GtkStyleContext *button_context; // TODO: maybe move a copy to each button
 | 
			
		||||
 | 
			
		||||
    gdouble border_width;
 | 
			
		||||
    gdouble border_width; // FIXME: border of what?
 | 
			
		||||
 | 
			
		||||
    gdouble allocation_width;
 | 
			
		||||
    gdouble allocation_height;
 | 
			
		||||
    gdouble scale;
 | 
			
		||||
    gint scale_factor; /* the outputs scale factor */
 | 
			
		||||
    gint origin_x;
 | 
			
		||||
    gint origin_y;
 | 
			
		||||
    struct transformation widget_to_layout;
 | 
			
		||||
 | 
			
		||||
    PangoFontDescription *font; // owned reference
 | 
			
		||||
    cairo_surface_t *keyboard_surface;
 | 
			
		||||
 | 
			
		||||
} EekRendererPrivate;
 | 
			
		||||
 | 
			
		||||
@ -61,110 +59,10 @@ G_DEFINE_TYPE_WITH_PRIVATE (EekRenderer, eek_renderer, G_TYPE_OBJECT)
 | 
			
		||||
static void eek_renderer_render_button_label (EekRenderer *self, cairo_t *cr, GtkStyleContext *ctx,
 | 
			
		||||
                                                const struct squeek_button *button);
 | 
			
		||||
 | 
			
		||||
static void invalidate                         (EekRenderer *renderer);
 | 
			
		||||
static void render_button                         (EekRenderer *self,
 | 
			
		||||
                                                cairo_t     *cr, EekBounds view_bounds, struct button_place *place,
 | 
			
		||||
void eek_render_button                         (EekRenderer *self,
 | 
			
		||||
                                                cairo_t     *cr, const struct squeek_button *button,
 | 
			
		||||
                                                gboolean     pressed, gboolean locked);
 | 
			
		||||
 | 
			
		||||
struct _CreateKeyboardSurfaceCallbackData {
 | 
			
		||||
    cairo_t *cr;
 | 
			
		||||
    EekRenderer *renderer;
 | 
			
		||||
    struct squeek_view *view;
 | 
			
		||||
    struct squeek_row *row;
 | 
			
		||||
};
 | 
			
		||||
typedef struct _CreateKeyboardSurfaceCallbackData CreateKeyboardSurfaceCallbackData;
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
create_keyboard_surface_button_callback (struct squeek_button *button,
 | 
			
		||||
                                      gpointer    user_data)
 | 
			
		||||
{
 | 
			
		||||
    CreateKeyboardSurfaceCallbackData *data = user_data;
 | 
			
		||||
    EekBounds bounds = squeek_button_get_bounds(button);
 | 
			
		||||
 | 
			
		||||
    cairo_save (data->cr);
 | 
			
		||||
 | 
			
		||||
    cairo_translate (data->cr, bounds.x, bounds.y);
 | 
			
		||||
    cairo_rectangle (data->cr,
 | 
			
		||||
                     0.0,
 | 
			
		||||
                     0.0,
 | 
			
		||||
                     bounds.width + 100,
 | 
			
		||||
                     bounds.height + 100);
 | 
			
		||||
    cairo_clip (data->cr);
 | 
			
		||||
    struct button_place place = {
 | 
			
		||||
        .row = data->row,
 | 
			
		||||
        .button = button,
 | 
			
		||||
    };
 | 
			
		||||
    render_button (data->renderer, data->cr, squeek_view_get_bounds(data->view), &place, FALSE, FALSE);
 | 
			
		||||
 | 
			
		||||
    cairo_restore (data->cr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
create_keyboard_surface_row_callback (struct squeek_row *row,
 | 
			
		||||
                                          gpointer    user_data)
 | 
			
		||||
{
 | 
			
		||||
    CreateKeyboardSurfaceCallbackData *data = user_data;
 | 
			
		||||
 | 
			
		||||
    EekBounds bounds = squeek_row_get_bounds(row);
 | 
			
		||||
 | 
			
		||||
    cairo_save (data->cr);
 | 
			
		||||
    cairo_translate (data->cr, bounds.x, bounds.y);
 | 
			
		||||
 | 
			
		||||
    gint angle = squeek_row_get_angle (row);
 | 
			
		||||
    cairo_rotate (data->cr, angle * G_PI / 180);
 | 
			
		||||
 | 
			
		||||
    data->row = row;
 | 
			
		||||
    squeek_row_foreach(row, create_keyboard_surface_button_callback, data);
 | 
			
		||||
 | 
			
		||||
    cairo_restore (data->cr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
render_keyboard_surface (EekRenderer *renderer, struct squeek_view *view)
 | 
			
		||||
{
 | 
			
		||||
    EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
 | 
			
		||||
 | 
			
		||||
    GdkRGBA color = {0};
 | 
			
		||||
    gtk_style_context_get_color (priv->view_context, GTK_STATE_FLAG_NORMAL, &color);
 | 
			
		||||
 | 
			
		||||
    EekBounds bounds = squeek_view_get_bounds (level_keyboard_current(priv->keyboard));
 | 
			
		||||
 | 
			
		||||
    CreateKeyboardSurfaceCallbackData data = {
 | 
			
		||||
        .cr = cairo_create (priv->keyboard_surface),
 | 
			
		||||
        .renderer = renderer,
 | 
			
		||||
        .view = view,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    /* Paint the background covering the entire widget area */
 | 
			
		||||
    gtk_render_background (priv->view_context,
 | 
			
		||||
                           data.cr,
 | 
			
		||||
                           0, 0,
 | 
			
		||||
                           priv->allocation_width, priv->allocation_height);
 | 
			
		||||
    gtk_render_frame (priv->view_context,
 | 
			
		||||
                      data.cr,
 | 
			
		||||
                      0, 0,
 | 
			
		||||
                      priv->allocation_width, priv->allocation_height);
 | 
			
		||||
 | 
			
		||||
    cairo_save (data.cr);
 | 
			
		||||
    cairo_scale (data.cr, priv->scale, priv->scale);
 | 
			
		||||
    cairo_translate (data.cr, bounds.x, bounds.y);
 | 
			
		||||
 | 
			
		||||
    cairo_set_source_rgba (data.cr,
 | 
			
		||||
                           color.red,
 | 
			
		||||
                           color.green,
 | 
			
		||||
                           color.blue,
 | 
			
		||||
                           color.alpha);
 | 
			
		||||
 | 
			
		||||
    /* draw rows */
 | 
			
		||||
    squeek_view_foreach(level_keyboard_current(priv->keyboard),
 | 
			
		||||
                        create_keyboard_surface_row_callback,
 | 
			
		||||
                        &data);
 | 
			
		||||
 | 
			
		||||
    cairo_restore (data.cr);
 | 
			
		||||
 | 
			
		||||
    cairo_destroy (data.cr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
render_outline (cairo_t     *cr,
 | 
			
		||||
                GtkStyleContext *ctx,
 | 
			
		||||
@ -189,46 +87,20 @@ render_outline (cairo_t     *cr,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void render_button_in_context(EekRenderer *self,
 | 
			
		||||
                                     gdouble scale,
 | 
			
		||||
                                     gint scale_factor,
 | 
			
		||||
                                     cairo_t     *cr,
 | 
			
		||||
                                     GtkStyleContext *ctx,
 | 
			
		||||
                                     EekBounds view_bounds,
 | 
			
		||||
                                     struct button_place *place,
 | 
			
		||||
                                     gboolean active) {
 | 
			
		||||
    cairo_surface_t *outline_surface = NULL;
 | 
			
		||||
 | 
			
		||||
    /* render outline */
 | 
			
		||||
    EekBounds bounds = squeek_button_get_bounds(place->button);
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
        cairo_t *cr;
 | 
			
		||||
 | 
			
		||||
        // Outline will be drawn on the outside of the button, so the
 | 
			
		||||
        // surface needs to be bigger than the button
 | 
			
		||||
        outline_surface =
 | 
			
		||||
            cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
 | 
			
		||||
                                        (int)ceil(bounds.width) + 10,
 | 
			
		||||
                                        (int)ceil(bounds.height) + 10);
 | 
			
		||||
        cr = cairo_create (outline_surface);
 | 
			
		||||
 | 
			
		||||
                                     const struct squeek_button *button) {
 | 
			
		||||
    /* blank background */
 | 
			
		||||
    cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.0);
 | 
			
		||||
    cairo_paint (cr);
 | 
			
		||||
 | 
			
		||||
        cairo_save (cr);
 | 
			
		||||
        eek_renderer_apply_transformation_for_button (cr, view_bounds, place, 1.0, FALSE);
 | 
			
		||||
    EekBounds bounds = squeek_button_get_bounds(button);
 | 
			
		||||
    render_outline (cr, ctx, bounds);
 | 
			
		||||
        cairo_restore (cr);
 | 
			
		||||
 | 
			
		||||
        cairo_destroy (cr);
 | 
			
		||||
    }
 | 
			
		||||
    cairo_set_source_surface (cr, outline_surface, 0.0, 0.0);
 | 
			
		||||
    cairo_surface_destroy(outline_surface);
 | 
			
		||||
    cairo_paint (cr);
 | 
			
		||||
 | 
			
		||||
    /* render icon (if any) */
 | 
			
		||||
    const char *icon_name = squeek_button_get_icon_name(place->button);
 | 
			
		||||
    const char *icon_name = squeek_button_get_icon_name(button);
 | 
			
		||||
 | 
			
		||||
    if (icon_name) {
 | 
			
		||||
        cairo_surface_t *icon_surface =
 | 
			
		||||
@ -258,14 +130,13 @@ static void render_button_in_context(EekRenderer *self,
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    eek_renderer_render_button_label (self, cr, ctx, place->button);
 | 
			
		||||
    eek_renderer_render_button_label (self, cr, ctx, button);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
render_button (EekRenderer *self,
 | 
			
		||||
void
 | 
			
		||||
eek_render_button (EekRenderer *self,
 | 
			
		||||
            cairo_t     *cr,
 | 
			
		||||
               EekBounds view_bounds,
 | 
			
		||||
            struct button_place *place,
 | 
			
		||||
            const struct squeek_button *button,
 | 
			
		||||
               gboolean     pressed,
 | 
			
		||||
               gboolean     locked)
 | 
			
		||||
{
 | 
			
		||||
@ -276,7 +147,7 @@ render_button (EekRenderer *self,
 | 
			
		||||
       from the button's symbol. */
 | 
			
		||||
    g_autoptr (GtkWidgetPath) path = NULL;
 | 
			
		||||
    path = gtk_widget_path_copy (gtk_style_context_get_path (ctx));
 | 
			
		||||
    const char *name = squeek_button_get_name(place->button);
 | 
			
		||||
    const char *name = squeek_button_get_name(button);
 | 
			
		||||
    gtk_widget_path_iter_set_name (path, -1, name);
 | 
			
		||||
 | 
			
		||||
    /* Update the style context with the updated widget path. */
 | 
			
		||||
@ -285,13 +156,13 @@ render_button (EekRenderer *self,
 | 
			
		||||
       (pressed) or normal. */
 | 
			
		||||
    gtk_style_context_set_state(ctx,
 | 
			
		||||
        pressed ? GTK_STATE_FLAG_ACTIVE : GTK_STATE_FLAG_NORMAL);
 | 
			
		||||
    const char *outline_name = squeek_button_get_outline_name(place->button);
 | 
			
		||||
    const char *outline_name = squeek_button_get_outline_name(button);
 | 
			
		||||
    if (locked) {
 | 
			
		||||
        gtk_style_context_add_class(ctx, "locked");
 | 
			
		||||
    }
 | 
			
		||||
    gtk_style_context_add_class(ctx, outline_name);
 | 
			
		||||
 | 
			
		||||
    render_button_in_context(self, priv->scale, priv->scale_factor, cr, ctx, view_bounds, place, pressed);
 | 
			
		||||
    render_button_in_context(self, priv->scale_factor, cr, ctx, button);
 | 
			
		||||
 | 
			
		||||
    // Save and restore functions don't work if gtk_render_* was used in between
 | 
			
		||||
    gtk_style_context_set_state(ctx, GTK_STATE_FLAG_NORMAL);
 | 
			
		||||
@ -301,47 +172,6 @@ render_button (EekRenderer *self,
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_renderer_apply_transformation_for_key:
 | 
			
		||||
 * @self: The renderer used to render the key
 | 
			
		||||
 * @cr: The Cairo rendering context used for rendering
 | 
			
		||||
 * @key: The key to be transformed
 | 
			
		||||
 * @scale: The factor used to scale the key bounds before rendering
 | 
			
		||||
 * @rotate: Whether to rotate the key by the angle defined for the key's
 | 
			
		||||
 *   in its section definition
 | 
			
		||||
 *
 | 
			
		||||
 *  Applies a transformation, consisting of scaling and rotation, to the
 | 
			
		||||
 *  current rendering context using the bounds for the given key. The scale
 | 
			
		||||
 *  factor is separate to the normal scale factor for the keyboard as a whole
 | 
			
		||||
 *  and is applied cumulatively. It is typically used to render larger than
 | 
			
		||||
 *  normal keys for popups.
 | 
			
		||||
*/
 | 
			
		||||
void
 | 
			
		||||
eek_renderer_apply_transformation_for_button (cairo_t     *cr,
 | 
			
		||||
                                              EekBounds view_bounds,
 | 
			
		||||
                                           struct button_place *place,
 | 
			
		||||
                                           gdouble      scale,
 | 
			
		||||
                                           gboolean     rotate)
 | 
			
		||||
{
 | 
			
		||||
    EekBounds bounds, rotated_bounds;
 | 
			
		||||
    gdouble s;
 | 
			
		||||
 | 
			
		||||
    eek_renderer_get_button_bounds (view_bounds, place, &bounds, FALSE);
 | 
			
		||||
    eek_renderer_get_button_bounds (view_bounds, place, &rotated_bounds, TRUE);
 | 
			
		||||
 | 
			
		||||
    gint angle = squeek_row_get_angle (place->row);
 | 
			
		||||
 | 
			
		||||
    cairo_scale (cr, scale, scale);
 | 
			
		||||
    if (rotate) {
 | 
			
		||||
        s = sin (angle * G_PI / 180);
 | 
			
		||||
        if (s < 0)
 | 
			
		||||
            cairo_translate (cr, 0, - bounds.width * s);
 | 
			
		||||
        else
 | 
			
		||||
            cairo_translate (cr, bounds.height * s, 0);
 | 
			
		||||
        cairo_rotate (cr, angle * G_PI / 180);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eek_renderer_render_button_label (EekRenderer *self,
 | 
			
		||||
                                  cairo_t     *cr,
 | 
			
		||||
@ -414,76 +244,28 @@ eek_renderer_render_button_label (EekRenderer *self,
 | 
			
		||||
    g_object_unref (layout);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * eek_renderer_real_render_key:
 | 
			
		||||
 * @self: The renderer used to render the key
 | 
			
		||||
 * @cr: The Cairo rendering context used for rendering
 | 
			
		||||
 * @key: The key to be transformed
 | 
			
		||||
 * @scale: The factor used to scale the key bounds before rendering
 | 
			
		||||
 * @rotate: Whether to rotate the key by the angle defined for the key's
 | 
			
		||||
 *   in its section definition
 | 
			
		||||
 *
 | 
			
		||||
 *   Renders a key separately from the normal keyboard rendering.
 | 
			
		||||
*/
 | 
			
		||||
static void
 | 
			
		||||
eek_renderer_real_render_button (EekRenderer *self,
 | 
			
		||||
                              cairo_t     *cr,
 | 
			
		||||
                              struct button_place *place,
 | 
			
		||||
                              gdouble      scale,
 | 
			
		||||
                              gboolean     rotate)
 | 
			
		||||
{
 | 
			
		||||
    EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
 | 
			
		||||
    EekBounds bounds;
 | 
			
		||||
 | 
			
		||||
    EekBounds view_bounds = squeek_view_get_bounds (level_keyboard_current(priv->keyboard));
 | 
			
		||||
    eek_renderer_get_button_bounds (view_bounds, place, &bounds, rotate);
 | 
			
		||||
 | 
			
		||||
    cairo_save (cr);
 | 
			
		||||
    /* Because this function is called separately from the keyboard rendering
 | 
			
		||||
       function, the transformation for the context needs to be set up */
 | 
			
		||||
    cairo_translate (cr, priv->origin_x, priv->origin_y);
 | 
			
		||||
    cairo_scale (cr, priv->scale, priv->scale);
 | 
			
		||||
    cairo_translate (cr, bounds.x, bounds.y);
 | 
			
		||||
 | 
			
		||||
    eek_renderer_apply_transformation_for_button (cr, view_bounds, place, scale, rotate);
 | 
			
		||||
    struct squeek_key *key = squeek_button_get_key(place->button);
 | 
			
		||||
    render_button (
 | 
			
		||||
                self, cr, view_bounds, place,
 | 
			
		||||
                squeek_key_is_pressed(key) != 0,
 | 
			
		||||
                squeek_key_is_locked (key) != 0
 | 
			
		||||
    );
 | 
			
		||||
    cairo_restore (cr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eek_renderer_real_render_keyboard (EekRenderer *self,
 | 
			
		||||
void
 | 
			
		||||
eek_renderer_render_keyboard (EekRenderer *self,
 | 
			
		||||
                                   cairo_t     *cr)
 | 
			
		||||
{
 | 
			
		||||
    EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
 | 
			
		||||
    cairo_pattern_t *source;
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (priv->keyboard);
 | 
			
		||||
    g_return_if_fail (priv->allocation_width > 0.0);
 | 
			
		||||
    g_return_if_fail (priv->allocation_height > 0.0);
 | 
			
		||||
 | 
			
		||||
    cairo_save (cr);
 | 
			
		||||
 | 
			
		||||
    cairo_translate (cr, priv->origin_x, priv->origin_y);
 | 
			
		||||
 | 
			
		||||
    if (priv->keyboard_surface)
 | 
			
		||||
        cairo_surface_destroy (priv->keyboard_surface);
 | 
			
		||||
 | 
			
		||||
    priv->keyboard_surface = cairo_surface_create_for_rectangle (
 | 
			
		||||
        cairo_get_target (cr), 0, 0,
 | 
			
		||||
    /* Paint the background covering the entire widget area */
 | 
			
		||||
    gtk_render_background (priv->view_context,
 | 
			
		||||
                           cr,
 | 
			
		||||
                           0, 0,
 | 
			
		||||
                           priv->allocation_width, priv->allocation_height);
 | 
			
		||||
 | 
			
		||||
    render_keyboard_surface (self, squeek_layout_get_current_view(priv->keyboard->layout));
 | 
			
		||||
 | 
			
		||||
    cairo_set_source_surface (cr, priv->keyboard_surface, 0.0, 0.0);
 | 
			
		||||
    source = cairo_get_source (cr);
 | 
			
		||||
    cairo_pattern_set_extend (source, CAIRO_EXTEND_PAD);
 | 
			
		||||
    cairo_paint (cr);
 | 
			
		||||
    cairo_save(cr);
 | 
			
		||||
    cairo_translate (cr, priv->widget_to_layout.origin_x, priv->widget_to_layout.origin_y);
 | 
			
		||||
    cairo_scale (cr, priv->widget_to_layout.scale, priv->widget_to_layout.scale);
 | 
			
		||||
 | 
			
		||||
    squeek_draw_layout_base_view(priv->keyboard->layout, self, cr);
 | 
			
		||||
    squeek_layout_draw_all_changed(priv->keyboard->layout, self, cr);
 | 
			
		||||
    cairo_restore (cr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -513,6 +295,7 @@ eek_renderer_get_property (GObject    *object,
 | 
			
		||||
                           GValue     *value,
 | 
			
		||||
                           GParamSpec *pspec)
 | 
			
		||||
{
 | 
			
		||||
    (void)value;
 | 
			
		||||
    switch (prop_id) {
 | 
			
		||||
    default:
 | 
			
		||||
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
@ -534,8 +317,7 @@ eek_renderer_dispose (GObject *object)
 | 
			
		||||
        priv->pcontext = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* this will release all allocated surfaces and font if any */
 | 
			
		||||
    invalidate (EEK_RENDERER(object));
 | 
			
		||||
    // this is where renderer-specific surfaces would be released
 | 
			
		||||
 | 
			
		||||
    G_OBJECT_CLASS (eek_renderer_parent_class)->dispose (object);
 | 
			
		||||
}
 | 
			
		||||
@ -559,9 +341,6 @@ eek_renderer_class_init (EekRendererClass *klass)
 | 
			
		||||
    GObjectClass      *gobject_class = G_OBJECT_CLASS (klass);
 | 
			
		||||
    GParamSpec        *pspec;
 | 
			
		||||
 | 
			
		||||
    klass->render_button = eek_renderer_real_render_button;
 | 
			
		||||
    klass->render_keyboard = eek_renderer_real_render_keyboard;
 | 
			
		||||
 | 
			
		||||
    gobject_class->set_property = eek_renderer_set_property;
 | 
			
		||||
    gobject_class->get_property = eek_renderer_get_property;
 | 
			
		||||
    gobject_class->dispose = eek_renderer_dispose;
 | 
			
		||||
@ -614,30 +393,14 @@ eek_renderer_init (EekRenderer *self)
 | 
			
		||||
    priv->border_width = 1.0;
 | 
			
		||||
    priv->allocation_width = 0.0;
 | 
			
		||||
    priv->allocation_height = 0.0;
 | 
			
		||||
    priv->scale = 1.0;
 | 
			
		||||
    priv->scale_factor = 1;
 | 
			
		||||
    priv->font = NULL;
 | 
			
		||||
    priv->keyboard_surface = NULL;
 | 
			
		||||
 | 
			
		||||
    GtkIconTheme *theme = gtk_icon_theme_get_default ();
 | 
			
		||||
 | 
			
		||||
    gtk_icon_theme_add_resource_path (theme, "/sm/puri/squeekboard/icons");
 | 
			
		||||
 | 
			
		||||
    /* Create a default CSS provider and load a style sheet */
 | 
			
		||||
    priv->css_provider = gtk_css_provider_new ();
 | 
			
		||||
    gtk_css_provider_load_from_resource (priv->css_provider,
 | 
			
		||||
        "/sm/puri/squeekboard/style.css");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
invalidate (EekRenderer *renderer)
 | 
			
		||||
{
 | 
			
		||||
    EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
 | 
			
		||||
 | 
			
		||||
    if (priv->keyboard_surface) {
 | 
			
		||||
        cairo_surface_destroy (priv->keyboard_surface);
 | 
			
		||||
        priv->keyboard_surface = NULL;
 | 
			
		||||
    }
 | 
			
		||||
    priv->css_provider = squeek_load_style();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
EekRenderer *
 | 
			
		||||
@ -687,8 +450,6 @@ eek_renderer_set_allocation_size (EekRenderer *renderer,
 | 
			
		||||
                                  gdouble      width,
 | 
			
		||||
                                  gdouble      height)
 | 
			
		||||
{
 | 
			
		||||
    gdouble scale;
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (EEK_IS_RENDERER(renderer));
 | 
			
		||||
    g_return_if_fail (width > 0.0 && height > 0.0);
 | 
			
		||||
 | 
			
		||||
@ -697,99 +458,11 @@ eek_renderer_set_allocation_size (EekRenderer *renderer,
 | 
			
		||||
    priv->allocation_width = width;
 | 
			
		||||
    priv->allocation_height = height;
 | 
			
		||||
 | 
			
		||||
    /* Calculate a scale factor to use when rendering the keyboard into the
 | 
			
		||||
       available space. */
 | 
			
		||||
    EekBounds bounds = squeek_view_get_bounds (level_keyboard_current(priv->keyboard));
 | 
			
		||||
    priv->widget_to_layout = squeek_layout_calculate_transformation(
 | 
			
		||||
                priv->keyboard->layout,
 | 
			
		||||
                priv->allocation_width, priv->allocation_height);
 | 
			
		||||
 | 
			
		||||
    gdouble w = (bounds.x * 2) + bounds.width;
 | 
			
		||||
    gdouble h = (bounds.y * 2) + bounds.height;
 | 
			
		||||
 | 
			
		||||
    scale = MIN(width / w, height / h);
 | 
			
		||||
 | 
			
		||||
    priv->scale = scale;
 | 
			
		||||
    /* Set the rendering offset in widget coordinates to center the keyboard */
 | 
			
		||||
    priv->origin_x = (gint)floor((width - (scale * w)) / 2);
 | 
			
		||||
    priv->origin_y = (gint)floor((height - (scale * h)) / 2);
 | 
			
		||||
    invalidate (renderer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
eek_renderer_get_size (EekRenderer *renderer,
 | 
			
		||||
                       gdouble     *width,
 | 
			
		||||
                       gdouble     *height)
 | 
			
		||||
{
 | 
			
		||||
    g_return_if_fail (EEK_IS_RENDERER(renderer));
 | 
			
		||||
 | 
			
		||||
    EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
 | 
			
		||||
 | 
			
		||||
    EekBounds bounds = squeek_view_get_bounds (level_keyboard_current(priv->keyboard));
 | 
			
		||||
    if (width)
 | 
			
		||||
        *width = bounds.width;
 | 
			
		||||
    if (height)
 | 
			
		||||
        *height = bounds.height;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
eek_renderer_get_button_bounds (EekBounds view_bounds,
 | 
			
		||||
                                struct button_place *place,
 | 
			
		||||
                             EekBounds   *bounds,
 | 
			
		||||
                             gboolean     rotate)
 | 
			
		||||
{
 | 
			
		||||
    gint angle = 0;
 | 
			
		||||
    EekPoint points[4], min, max;
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (place);
 | 
			
		||||
    g_return_if_fail (bounds != NULL);
 | 
			
		||||
 | 
			
		||||
    EekBounds button_bounds = squeek_button_get_bounds(place->button);
 | 
			
		||||
    EekBounds row_bounds = squeek_row_get_bounds (place->row);
 | 
			
		||||
 | 
			
		||||
    if (!rotate) {
 | 
			
		||||
        button_bounds.x += view_bounds.x + row_bounds.x;
 | 
			
		||||
        button_bounds.y += view_bounds.y + row_bounds.y;
 | 
			
		||||
        *bounds = button_bounds;
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    points[0].x = button_bounds.x;
 | 
			
		||||
    points[0].y = button_bounds.y;
 | 
			
		||||
    points[1].x = points[0].x + button_bounds.width;
 | 
			
		||||
    points[1].y = points[0].y;
 | 
			
		||||
    points[2].x = points[1].x;
 | 
			
		||||
    points[2].y = points[1].y + button_bounds.height;
 | 
			
		||||
    points[3].x = points[0].x;
 | 
			
		||||
    points[3].y = points[2].y;
 | 
			
		||||
 | 
			
		||||
    if (rotate) {
 | 
			
		||||
        angle = squeek_row_get_angle (place->row);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    min = points[2];
 | 
			
		||||
    max = points[0];
 | 
			
		||||
    for (unsigned i = 0; i < G_N_ELEMENTS(points); i++) {
 | 
			
		||||
        eek_point_rotate (&points[i], angle);
 | 
			
		||||
        if (points[i].x < min.x)
 | 
			
		||||
            min.x = points[i].x;
 | 
			
		||||
        if (points[i].x > max.x)
 | 
			
		||||
            max.x = points[i].x;
 | 
			
		||||
        if (points[i].y < min.y)
 | 
			
		||||
            min.y = points[i].y;
 | 
			
		||||
        if (points[i].y > max.y)
 | 
			
		||||
            max.y = points[i].y;
 | 
			
		||||
    }
 | 
			
		||||
    bounds->x = view_bounds.x + row_bounds.x + min.x;
 | 
			
		||||
    bounds->y = view_bounds.y + row_bounds.y + min.y;
 | 
			
		||||
    bounds->width = (max.x - min.x);
 | 
			
		||||
    bounds->height = (max.y - min.y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gdouble
 | 
			
		||||
eek_renderer_get_scale (EekRenderer *renderer)
 | 
			
		||||
{
 | 
			
		||||
    g_return_val_if_fail (EEK_IS_RENDERER(renderer), 0);
 | 
			
		||||
 | 
			
		||||
    EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
 | 
			
		||||
 | 
			
		||||
    return priv->scale;
 | 
			
		||||
    // This is where size-dependent surfaces would be released
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
@ -825,86 +498,11 @@ eek_renderer_get_icon_surface (const gchar *icon_name,
 | 
			
		||||
    return surface;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
eek_renderer_render_button (EekRenderer *renderer,
 | 
			
		||||
                         cairo_t     *cr,
 | 
			
		||||
                         struct button_place *place,
 | 
			
		||||
                         gdouble      scale,
 | 
			
		||||
                         gboolean     rotate)
 | 
			
		||||
{
 | 
			
		||||
    g_return_if_fail (EEK_IS_RENDERER(renderer));
 | 
			
		||||
    g_return_if_fail (place);
 | 
			
		||||
    g_return_if_fail (scale >= 0.0);
 | 
			
		||||
 | 
			
		||||
    EEK_RENDERER_GET_CLASS(renderer)->
 | 
			
		||||
        render_button (renderer, cr, place, scale, rotate);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
eek_renderer_render_keyboard (EekRenderer *renderer,
 | 
			
		||||
                              cairo_t     *cr)
 | 
			
		||||
{
 | 
			
		||||
    g_return_if_fail (EEK_IS_RENDERER(renderer));
 | 
			
		||||
    EEK_RENDERER_GET_CLASS(renderer)->render_keyboard (renderer, cr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
sign (EekPoint *p1, EekPoint *p2, EekPoint *p3)
 | 
			
		||||
{
 | 
			
		||||
    // FIXME: what is this actually checking?
 | 
			
		||||
    return (p1->x - p3->x) * (p2->y - p3->y) -
 | 
			
		||||
        (p2->x - p3->x) * (p1->y - p3->y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t
 | 
			
		||||
eek_are_bounds_inside (EekBounds bounds, EekPoint point, EekPoint origin, int32_t angle)
 | 
			
		||||
{
 | 
			
		||||
    EekPoint points[4];
 | 
			
		||||
    gboolean b1, b2, b3;
 | 
			
		||||
 | 
			
		||||
    points[0].x = bounds.x;
 | 
			
		||||
    points[0].y = bounds.y;
 | 
			
		||||
    points[1].x = points[0].x + bounds.width;
 | 
			
		||||
    points[1].y = points[0].y;
 | 
			
		||||
    points[2].x = points[1].x;
 | 
			
		||||
    points[2].y = points[1].y + bounds.height;
 | 
			
		||||
    points[3].x = points[0].x;
 | 
			
		||||
    points[3].y = points[2].y;
 | 
			
		||||
 | 
			
		||||
    for (unsigned i = 0; i < G_N_ELEMENTS(points); i++) {
 | 
			
		||||
        eek_point_rotate (&points[i], angle);
 | 
			
		||||
        points[i].x += origin.x;
 | 
			
		||||
        points[i].y += origin.y;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    b1 = sign (&point, &points[0], &points[1]) < 0.0;
 | 
			
		||||
    b2 = sign (&point, &points[1], &points[2]) < 0.0;
 | 
			
		||||
    b3 = sign (&point, &points[2], &points[0]) < 0.0;
 | 
			
		||||
 | 
			
		||||
    if (b1 == b2 && b2 == b3) {
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    b1 = sign (&point, &points[2], &points[3]) < 0.0;
 | 
			
		||||
    b2 = sign (&point, &points[3], &points[0]) < 0.0;
 | 
			
		||||
    b3 = sign (&point, &points[0], &points[2]) < 0.0;
 | 
			
		||||
 | 
			
		||||
    if (b1 == b2 && b2 == b3) {
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct transformation
 | 
			
		||||
eek_renderer_get_transformation (EekRenderer *renderer) {
 | 
			
		||||
    struct transformation failed = {0};
 | 
			
		||||
    g_return_val_if_fail (EEK_IS_RENDERER(renderer), failed);
 | 
			
		||||
 | 
			
		||||
    EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
 | 
			
		||||
    struct transformation ret = {
 | 
			
		||||
        .origin_x = priv->origin_x,
 | 
			
		||||
        .origin_y = priv->origin_y,
 | 
			
		||||
        .scale = priv->scale,
 | 
			
		||||
    };
 | 
			
		||||
    return ret;
 | 
			
		||||
    return priv->widget_to_layout;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,6 @@
 | 
			
		||||
#include <pango/pangocairo.h>
 | 
			
		||||
 | 
			
		||||
#include "eek-types.h"
 | 
			
		||||
#include "src/layout.h"
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
@ -36,15 +35,6 @@ struct _EekRendererClass
 | 
			
		||||
{
 | 
			
		||||
    GObjectClass parent_class;
 | 
			
		||||
 | 
			
		||||
    void             (* render_button)         (EekRenderer *self,
 | 
			
		||||
                                             cairo_t     *cr,
 | 
			
		||||
                                             struct button_place *place,
 | 
			
		||||
                                             gdouble      scale,
 | 
			
		||||
                                             gboolean     rotate);
 | 
			
		||||
 | 
			
		||||
    void             (* render_keyboard)    (EekRenderer *self,
 | 
			
		||||
                                             cairo_t     *cr);
 | 
			
		||||
 | 
			
		||||
    cairo_surface_t *(* get_icon_surface)   (EekRenderer *self,
 | 
			
		||||
                                             const gchar *icon_name,
 | 
			
		||||
                                             gint         size,
 | 
			
		||||
@ -62,38 +52,15 @@ void             eek_renderer_set_allocation_size
 | 
			
		||||
                                               (EekRenderer     *renderer,
 | 
			
		||||
                                                gdouble          width,
 | 
			
		||||
                                                gdouble          height);
 | 
			
		||||
void             eek_renderer_get_size         (EekRenderer     *renderer,
 | 
			
		||||
                                                gdouble         *width,
 | 
			
		||||
                                                gdouble         *height);
 | 
			
		||||
void             eek_renderer_get_button_bounds   (EekBounds view_bounds,
 | 
			
		||||
                                                struct button_place *button,
 | 
			
		||||
                                                EekBounds       *bounds,
 | 
			
		||||
                                                gboolean         rotate);
 | 
			
		||||
 | 
			
		||||
gdouble          eek_renderer_get_scale        (EekRenderer     *renderer);
 | 
			
		||||
void             eek_renderer_set_scale_factor (EekRenderer     *renderer,
 | 
			
		||||
                                                gint             scale);
 | 
			
		||||
 | 
			
		||||
void             eek_renderer_render_button       (EekRenderer     *renderer,
 | 
			
		||||
                                                cairo_t         *cr,
 | 
			
		||||
                                                struct button_place *place,
 | 
			
		||||
                                                gdouble          scale,
 | 
			
		||||
                                                gboolean         rotate);
 | 
			
		||||
 | 
			
		||||
cairo_surface_t *eek_renderer_get_icon_surface(const gchar     *icon_name,
 | 
			
		||||
                                                gint             size,
 | 
			
		||||
                                                gint             scale);
 | 
			
		||||
 | 
			
		||||
void             eek_renderer_render_keyboard  (EekRenderer     *renderer,
 | 
			
		||||
                                                cairo_t         *cr);
 | 
			
		||||
void             eek_renderer_set_border_width (EekRenderer     *renderer,
 | 
			
		||||
                                                gdouble          border_width);
 | 
			
		||||
void             eek_renderer_apply_transformation_for_button
 | 
			
		||||
                                               (cairo_t         *cr,
 | 
			
		||||
                                                EekBounds view_bounds,
 | 
			
		||||
                                                struct button_place *place,
 | 
			
		||||
                                                gdouble          scale,
 | 
			
		||||
                                                gboolean         rotate);
 | 
			
		||||
 | 
			
		||||
struct transformation
 | 
			
		||||
eek_renderer_get_transformation (EekRenderer *renderer);
 | 
			
		||||
 | 
			
		||||
@ -88,5 +88,14 @@ struct transformation {
 | 
			
		||||
    gdouble origin_y;
 | 
			
		||||
    gdouble scale;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct squeek_button;
 | 
			
		||||
struct squeek_row;
 | 
			
		||||
 | 
			
		||||
/// Represents the path to the button within a view
 | 
			
		||||
struct button_place {
 | 
			
		||||
    const struct squeek_row *row;
 | 
			
		||||
    const struct squeek_button *button;
 | 
			
		||||
};
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
#endif  /* EEK_TYPES_H */
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,6 @@
 | 
			
		||||
#include "config.h"
 | 
			
		||||
 | 
			
		||||
#include "eek-keyboard.h"
 | 
			
		||||
#include "src/keyboard.h"
 | 
			
		||||
#include "src/layout.h"
 | 
			
		||||
 | 
			
		||||
#include "eek-xml-layout.h"
 | 
			
		||||
@ -35,6 +34,5 @@ eek_xml_layout_real_create_keyboard (const char *keyboard_type,
 | 
			
		||||
                                     enum squeek_arrangement_kind t)
 | 
			
		||||
{
 | 
			
		||||
    struct squeek_layout *layout = squeek_load_layout(keyboard_type, t);
 | 
			
		||||
    squeek_layout_place_contents(layout);
 | 
			
		||||
    return level_keyboard_new(manager, layout);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,8 +0,0 @@
 | 
			
		||||
gnome = import('gnome')
 | 
			
		||||
 | 
			
		||||
enum_headers = [
 | 
			
		||||
  'eek-types.h',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
enums = gnome.mkenums_simple('eek-enumtypes', sources: enum_headers)
 | 
			
		||||
 | 
			
		||||
@ -71,6 +71,8 @@ struct _EekboardContextServicePrivate {
 | 
			
		||||
    LevelKeyboard *keyboard; // currently used keyboard
 | 
			
		||||
    GHashTable *keyboard_hash; // a table of available keyboards, per layout
 | 
			
		||||
 | 
			
		||||
    char *overlay;
 | 
			
		||||
 | 
			
		||||
    GSettings *settings;
 | 
			
		||||
    uint32_t hint;
 | 
			
		||||
    uint32_t purpose;
 | 
			
		||||
@ -207,36 +209,24 @@ static void
 | 
			
		||||
settings_get_layout(GSettings *settings, char **type, char **layout)
 | 
			
		||||
{
 | 
			
		||||
    GVariant *inputs = g_settings_get_value(settings, "sources");
 | 
			
		||||
    guint32 index;
 | 
			
		||||
    g_settings_get(settings, "current", "u", &index);
 | 
			
		||||
 | 
			
		||||
    GVariantIter *iter;
 | 
			
		||||
    g_variant_get(inputs, "a(ss)", &iter);
 | 
			
		||||
 | 
			
		||||
    for (unsigned i = 0;
 | 
			
		||||
         g_variant_iter_loop(iter, "(ss)", type, layout);
 | 
			
		||||
         i++) {
 | 
			
		||||
        if (i == index) {
 | 
			
		||||
            //printf("Found layout %s %s\n", *type, *layout);
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    g_variant_iter_free(iter);
 | 
			
		||||
    g_variant_unref(inputs);
 | 
			
		||||
    // current layout is always first
 | 
			
		||||
    g_variant_get_child(inputs, 0, "(ss)", type, layout);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
eekboard_context_service_update_layout(EekboardContextService *context, enum squeek_arrangement_kind t)
 | 
			
		||||
{
 | 
			
		||||
    g_autofree gchar *keyboard_type = NULL;
 | 
			
		||||
    g_autofree gchar *keyboard_layout = NULL;
 | 
			
		||||
    settings_get_layout(context->priv->settings, &keyboard_type, &keyboard_layout);
 | 
			
		||||
 | 
			
		||||
    if (!keyboard_type) {
 | 
			
		||||
        keyboard_type = g_strdup("us");
 | 
			
		||||
    if (context->priv->overlay) {
 | 
			
		||||
        keyboard_layout = g_strdup(context->priv->overlay);
 | 
			
		||||
    } else {
 | 
			
		||||
        g_autofree gchar *keyboard_type = NULL;
 | 
			
		||||
        settings_get_layout(context->priv->settings,
 | 
			
		||||
                            &keyboard_type, &keyboard_layout);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!keyboard_layout) {
 | 
			
		||||
        keyboard_layout = g_strdup("undefined");
 | 
			
		||||
        keyboard_layout = g_strdup("us");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    EekboardContextServicePrivate *priv = EEKBOARD_CONTEXT_SERVICE_GET_PRIVATE(context);
 | 
			
		||||
@ -246,6 +236,9 @@ eekboard_context_service_update_layout(EekboardContextService *context, enum squ
 | 
			
		||||
    case ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PHONE:
 | 
			
		||||
        keyboard_layout = g_strdup("number");
 | 
			
		||||
        break;
 | 
			
		||||
    case ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_TERMINAL:
 | 
			
		||||
        keyboard_layout = g_strdup("terminal");
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        ;
 | 
			
		||||
    }
 | 
			
		||||
@ -276,6 +269,8 @@ settings_handle_layout_changed(GSettings *s,
 | 
			
		||||
    (void)keys;
 | 
			
		||||
    (void)n_keys;
 | 
			
		||||
    EekboardContextService *context = user_data;
 | 
			
		||||
    g_free(context->priv->overlay);
 | 
			
		||||
    context->priv->overlay = NULL;
 | 
			
		||||
    update_layout_and_type(context);
 | 
			
		||||
    return TRUE;
 | 
			
		||||
}
 | 
			
		||||
@ -405,6 +400,8 @@ eekboard_context_service_init (EekboardContextService *self)
 | 
			
		||||
        g_warning ("Could not connect to gsettings updates, layout"
 | 
			
		||||
                   " changing unavailable");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    self->priv->overlay = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -477,6 +474,7 @@ eekboard_context_service_destroy (EekboardContextService *context)
 | 
			
		||||
    if (context->priv->enabled) {
 | 
			
		||||
        eekboard_context_service_disable (context);
 | 
			
		||||
    }
 | 
			
		||||
    g_free(context->priv->overlay);
 | 
			
		||||
    g_signal_emit (context, signals[DESTROYED], 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -512,3 +510,14 @@ void eekboard_context_service_set_hint_purpose(EekboardContextService *context,
 | 
			
		||||
        update_layout_and_type(context);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
eekboard_context_service_set_overlay(EekboardContextService *context, const char* name) {
 | 
			
		||||
    context->priv->overlay = g_strdup(name);
 | 
			
		||||
    update_layout_and_type(context);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char*
 | 
			
		||||
eekboard_context_service_get_overlay(EekboardContextService *context) {
 | 
			
		||||
    return context->priv->overlay;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,52 +1,10 @@
 | 
			
		||||
extern crate rs;
 | 
			
		||||
extern crate xkbcommon;
 | 
			
		||||
 | 
			
		||||
use rs::tests::check_builtin_layout;
 | 
			
		||||
use std::env;
 | 
			
		||||
 | 
			
		||||
use rs::data::{ Layout, LoadError };
 | 
			
		||||
 | 
			
		||||
use xkbcommon::xkb;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
fn check_layout(name: &str) {
 | 
			
		||||
    let layout = Layout::from_resource(name)
 | 
			
		||||
        .and_then(|layout| layout.build().map_err(LoadError::BadKeyMap))
 | 
			
		||||
        .expect("layout broken");
 | 
			
		||||
    
 | 
			
		||||
    let context = xkb::Context::new(xkb::CONTEXT_NO_FLAGS);
 | 
			
		||||
    
 | 
			
		||||
    let keymap_str = layout.keymap_str
 | 
			
		||||
        .clone()
 | 
			
		||||
        .into_string().expect("Failed to decode keymap string");
 | 
			
		||||
    
 | 
			
		||||
    let keymap = xkb::Keymap::new_from_string(
 | 
			
		||||
        &context,
 | 
			
		||||
        keymap_str.clone(),
 | 
			
		||||
        xkb::KEYMAP_FORMAT_TEXT_V1,
 | 
			
		||||
        xkb::KEYMAP_COMPILE_NO_FLAGS,
 | 
			
		||||
    ).expect("Failed to create keymap");
 | 
			
		||||
 | 
			
		||||
    let state = xkb::State::new(&keymap);
 | 
			
		||||
    
 | 
			
		||||
    // "Press" each button with keysyms
 | 
			
		||||
    for view in layout.views.values() {
 | 
			
		||||
        for row in &view.rows {
 | 
			
		||||
            for button in &row.buttons {
 | 
			
		||||
                let keystate = button.state.borrow();
 | 
			
		||||
                for keycode in &keystate.keycodes {
 | 
			
		||||
                    match state.key_get_one_sym(*keycode) {
 | 
			
		||||
                        xkb::KEY_NoSymbol => {
 | 
			
		||||
                            eprintln!("{}", keymap_str);
 | 
			
		||||
                            panic!("Keysym {} on key {:?} can't be resolved", keycode, button.name);
 | 
			
		||||
                        },
 | 
			
		||||
                        _ => {},
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn main() -> () {
 | 
			
		||||
    check_layout(env::args().nth(1).expect("No argument given").as_str());
 | 
			
		||||
    check_builtin_layout(
 | 
			
		||||
        env::args().nth(1).expect("No argument given").as_str()
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										13
									
								
								meson.build
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								meson.build
									
									
									
									
									
								
							@ -1,7 +1,7 @@
 | 
			
		||||
project(
 | 
			
		||||
    'squeekboard',
 | 
			
		||||
    'c', 'rust',
 | 
			
		||||
    version: '1.3.1',
 | 
			
		||||
    version: '1.7.0',
 | 
			
		||||
    license: 'GPLv3',
 | 
			
		||||
    meson_version: '>=0.51.0',
 | 
			
		||||
    default_options: [
 | 
			
		||||
@ -33,8 +33,14 @@ endif
 | 
			
		||||
if get_option('buildtype') != 'plain'
 | 
			
		||||
    add_project_arguments('-fstack-protector-strong', language: 'c')
 | 
			
		||||
endif
 | 
			
		||||
if get_option('buildtype') == 'release'
 | 
			
		||||
    cargo_build_flags = ['--release'] # for artifacts
 | 
			
		||||
else
 | 
			
		||||
    cargo_build_flags = []
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
prefix = get_option('prefix')
 | 
			
		||||
bindir = join_paths(prefix, get_option('bindir'))
 | 
			
		||||
datadir = join_paths(prefix, get_option('datadir'))
 | 
			
		||||
pkgdatadir = join_paths(datadir, meson.project_name())
 | 
			
		||||
if get_option('depdatadir') == ''
 | 
			
		||||
@ -54,11 +60,12 @@ summary = [
 | 
			
		||||
]
 | 
			
		||||
message('\n'.join(summary))
 | 
			
		||||
 | 
			
		||||
cargo = find_program('cargo')
 | 
			
		||||
dep_cargo = find_program('cargo')
 | 
			
		||||
cargo_script = find_program('cargo.sh')
 | 
			
		||||
cargo_build = find_program('cargo_build.sh')
 | 
			
		||||
 | 
			
		||||
subdir('data')
 | 
			
		||||
subdir('protocols')
 | 
			
		||||
subdir('eek')
 | 
			
		||||
subdir('src')
 | 
			
		||||
subdir('tools')
 | 
			
		||||
subdir('tests')
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										16
									
								
								src/bin/test_layout.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/bin/test_layout.rs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,16 @@
 | 
			
		||||
#[macro_use]
 | 
			
		||||
extern crate clap;
 | 
			
		||||
extern crate rs;
 | 
			
		||||
 | 
			
		||||
use rs::tests::check_layout_file;
 | 
			
		||||
 | 
			
		||||
fn main() -> () {
 | 
			
		||||
    let matches = clap_app!(test_layout =>
 | 
			
		||||
        (name: "squeekboard-test-layout")
 | 
			
		||||
        (about: "Test keyboard layout for errors. Returns OK or an error message containing further information.")
 | 
			
		||||
        (@arg INPUT: +required "Yaml keyboard layout file to test")
 | 
			
		||||
    ).get_matches();
 | 
			
		||||
    if check_layout_file(matches.value_of("INPUT").unwrap()) == () {
 | 
			
		||||
        println!("Test result: OK");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										378
									
								
								src/data.rs
									
									
									
									
									
								
							
							
						
						
									
										378
									
								
								src/data.rs
									
									
									
									
									
								
							@ -1,5 +1,7 @@
 | 
			
		||||
/**! The parsing of the data files for layouts */
 | 
			
		||||
 | 
			
		||||
// TODO: find a nice way to make sure non-positive sizes don't break layouts
 | 
			
		||||
 | 
			
		||||
use std::cell::RefCell;
 | 
			
		||||
use std::collections::{ HashMap, HashSet };
 | 
			
		||||
use std::env;
 | 
			
		||||
@ -17,18 +19,19 @@ use ::keyboard::{
 | 
			
		||||
    KeyState, PressType,
 | 
			
		||||
    generate_keymap, generate_keycodes, FormattingError
 | 
			
		||||
};
 | 
			
		||||
use ::layout;
 | 
			
		||||
use ::layout::ArrangementKind;
 | 
			
		||||
use ::logging::PrintWarnings;
 | 
			
		||||
use ::resources;
 | 
			
		||||
use ::util::c::as_str;
 | 
			
		||||
use ::util::hash_map_map;
 | 
			
		||||
use ::xdg;
 | 
			
		||||
 | 
			
		||||
// traits, derives
 | 
			
		||||
use serde::Deserialize;
 | 
			
		||||
use std::io::BufReader;
 | 
			
		||||
use std::iter::FromIterator;
 | 
			
		||||
 | 
			
		||||
use serde::Deserialize;
 | 
			
		||||
 | 
			
		||||
use ::logging::WarningHandler;
 | 
			
		||||
 | 
			
		||||
/// Gathers stuff defined in C or called by C
 | 
			
		||||
pub mod c {
 | 
			
		||||
@ -154,18 +157,19 @@ fn list_layout_sources(
 | 
			
		||||
fn load_layout_data(source: DataSource)
 | 
			
		||||
    -> Result<::layout::LayoutData, LoadError>
 | 
			
		||||
{
 | 
			
		||||
    let handler = PrintWarnings{};
 | 
			
		||||
    match source {
 | 
			
		||||
        DataSource::File(path) => {
 | 
			
		||||
            Layout::from_file(path.clone())
 | 
			
		||||
                .map_err(LoadError::BadData)
 | 
			
		||||
                .and_then(|layout|
 | 
			
		||||
                    layout.build().map_err(LoadError::BadKeyMap)
 | 
			
		||||
                    layout.build(handler).0.map_err(LoadError::BadKeyMap)
 | 
			
		||||
                )
 | 
			
		||||
        },
 | 
			
		||||
        DataSource::Resource(name) => {
 | 
			
		||||
            Layout::from_resource(&name)
 | 
			
		||||
                .and_then(|layout|
 | 
			
		||||
                    layout.build().map_err(LoadError::BadKeyMap)
 | 
			
		||||
                    layout.build(handler).0.map_err(LoadError::BadKeyMap)
 | 
			
		||||
                )
 | 
			
		||||
        },
 | 
			
		||||
    }
 | 
			
		||||
@ -206,41 +210,47 @@ fn load_layout_data_with_fallback(
 | 
			
		||||
#[derive(Debug, Deserialize, PartialEq)]
 | 
			
		||||
#[serde(deny_unknown_fields)]
 | 
			
		||||
pub struct Layout {
 | 
			
		||||
    bounds: Bounds,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    margins: Margins,
 | 
			
		||||
    views: HashMap<String, Vec<ButtonIds>>,
 | 
			
		||||
    #[serde(default)] 
 | 
			
		||||
    buttons: HashMap<String, ButtonMeta>,
 | 
			
		||||
    outlines: HashMap<String, Outline>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, Clone, Deserialize, PartialEq)]
 | 
			
		||||
#[derive(Debug, Clone, Deserialize, PartialEq, Default)]
 | 
			
		||||
#[serde(deny_unknown_fields)]
 | 
			
		||||
struct Bounds {
 | 
			
		||||
    x: f64,
 | 
			
		||||
    y: f64,
 | 
			
		||||
    width: f64,
 | 
			
		||||
    height: f64,
 | 
			
		||||
struct Margins {
 | 
			
		||||
    top: f64,
 | 
			
		||||
    bottom: f64,
 | 
			
		||||
    side: f64,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Buttons are embedded in a single string
 | 
			
		||||
type ButtonIds = String;
 | 
			
		||||
 | 
			
		||||
/// All info about a single button
 | 
			
		||||
/// Buttons can have multiple instances though.
 | 
			
		||||
#[derive(Debug, Default, Deserialize, PartialEq)]
 | 
			
		||||
#[serde(deny_unknown_fields)]
 | 
			
		||||
struct ButtonMeta {
 | 
			
		||||
    /// Action other than keysym (conflicts with keysym)
 | 
			
		||||
    /// Special action to perform on activation. Conflicts with keysym, text.
 | 
			
		||||
    action: Option<Action>,
 | 
			
		||||
    /// The name of the outline. If not present, will be "default"
 | 
			
		||||
    outline: Option<String>,
 | 
			
		||||
    /// FIXME: start using it
 | 
			
		||||
    /// The name of the XKB keysym to emit on activation.
 | 
			
		||||
    /// Conflicts with action, text
 | 
			
		||||
    keysym: Option<String>,
 | 
			
		||||
    /// If not present, will be derived from the button ID
 | 
			
		||||
    /// The text to submit on activation. Will be derived from ID if not present
 | 
			
		||||
    /// Conflicts with action, keysym
 | 
			
		||||
    text: Option<String>,
 | 
			
		||||
    /// If not present, will be derived from text or the button ID
 | 
			
		||||
    label: Option<String>,
 | 
			
		||||
    /// Conflicts with label
 | 
			
		||||
    icon: Option<String>,
 | 
			
		||||
    /// The name of the outline. If not present, will be "default"
 | 
			
		||||
    outline: Option<String>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, Deserialize, PartialEq)]
 | 
			
		||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
 | 
			
		||||
#[serde(deny_unknown_fields)]
 | 
			
		||||
enum Action {
 | 
			
		||||
    #[serde(rename="locking")]
 | 
			
		||||
@ -254,7 +264,8 @@ enum Action {
 | 
			
		||||
#[derive(Debug, Clone, Deserialize, PartialEq)]
 | 
			
		||||
#[serde(deny_unknown_fields)]
 | 
			
		||||
struct Outline {
 | 
			
		||||
    bounds: Bounds,
 | 
			
		||||
    width: f64,
 | 
			
		||||
    height: f64,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Errors encountered loading the layout into yaml
 | 
			
		||||
@ -288,6 +299,20 @@ impl From<io::Error> for Error {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn add_offsets<'a, I: 'a, T, F: 'a>(iterator: I, get_size: F)
 | 
			
		||||
    -> impl Iterator<Item=(f64, T)> + 'a
 | 
			
		||||
    where I: Iterator<Item=T>,
 | 
			
		||||
        F: Fn(&T) -> f64,
 | 
			
		||||
{
 | 
			
		||||
    let mut offset = 0.0;
 | 
			
		||||
    iterator.map(move |item| {
 | 
			
		||||
        let size = get_size(&item);
 | 
			
		||||
        let value = (offset, item);
 | 
			
		||||
        offset += size;
 | 
			
		||||
        value
 | 
			
		||||
    })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl Layout {
 | 
			
		||||
    pub fn from_resource(name: &str) -> Result<Layout, LoadError> {
 | 
			
		||||
        let data = resources::get_keyboard(name)
 | 
			
		||||
@ -296,7 +321,7 @@ impl Layout {
 | 
			
		||||
                    .map_err(LoadError::BadResource)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn from_file(path: PathBuf) -> Result<Layout, Error> {
 | 
			
		||||
    pub fn from_file(path: PathBuf) -> Result<Layout, Error> {
 | 
			
		||||
        let infile = BufReader::new(
 | 
			
		||||
            fs::OpenOptions::new()
 | 
			
		||||
                .read(true)
 | 
			
		||||
@ -305,8 +330,8 @@ impl Layout {
 | 
			
		||||
        serde_yaml::from_reader(infile).map_err(Error::Yaml)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn build(self)
 | 
			
		||||
        -> Result<::layout::LayoutData, FormattingError>
 | 
			
		||||
    pub fn build<H: WarningHandler>(self, mut warning_handler: H)
 | 
			
		||||
        -> (Result<::layout::LayoutData, FormattingError>, H)
 | 
			
		||||
    {
 | 
			
		||||
        let button_names = self.views.values()
 | 
			
		||||
            .flat_map(|rows| {
 | 
			
		||||
@ -323,7 +348,8 @@ impl Layout {
 | 
			
		||||
                create_action(
 | 
			
		||||
                    &self.buttons,
 | 
			
		||||
                    name,
 | 
			
		||||
                    self.views.keys().collect()
 | 
			
		||||
                    self.views.keys().collect(),
 | 
			
		||||
                    &mut warning_handler,
 | 
			
		||||
                )
 | 
			
		||||
            )}).collect();
 | 
			
		||||
 | 
			
		||||
@ -368,13 +394,15 @@ impl Layout {
 | 
			
		||||
            )
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        let button_states
 | 
			
		||||
            = HashMap::<String, KeyState>::from_iter(
 | 
			
		||||
        let button_states = HashMap::<String, KeyState>::from_iter(
 | 
			
		||||
            button_states
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        // TODO: generate from symbols
 | 
			
		||||
        let keymap_str = generate_keymap(&button_states)?;
 | 
			
		||||
        let keymap_str = match generate_keymap(&button_states) {
 | 
			
		||||
            Err(e) => { return (Err(e), warning_handler) },
 | 
			
		||||
            Ok(v) => v,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        let button_states_cache = hash_map_map(
 | 
			
		||||
            button_states,
 | 
			
		||||
@ -385,145 +413,186 @@ impl Layout {
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        let views = HashMap::from_iter(
 | 
			
		||||
            self.views.iter().map(|(name, view)| {(
 | 
			
		||||
                name.clone(),
 | 
			
		||||
                Box::new(::layout::View {
 | 
			
		||||
                    bounds: ::layout::c::Bounds {
 | 
			
		||||
                        x: self.bounds.x,
 | 
			
		||||
                        y: self.bounds.y,
 | 
			
		||||
                        width: self.bounds.width,
 | 
			
		||||
                        height: self.bounds.height,
 | 
			
		||||
                    },
 | 
			
		||||
                    rows: view.iter().map(|row| {
 | 
			
		||||
                        Box::new(::layout::Row {
 | 
			
		||||
                            angle: 0,
 | 
			
		||||
                            bounds: None,
 | 
			
		||||
                            buttons: row.split_ascii_whitespace().map(|name| {
 | 
			
		||||
            self.views.iter().map(|(name, view)| {
 | 
			
		||||
                let rows = view.iter().map(|row| {
 | 
			
		||||
                    let buttons = row.split_ascii_whitespace()
 | 
			
		||||
                        .map(|name| {
 | 
			
		||||
                            Box::new(create_button(
 | 
			
		||||
                                &self.buttons,
 | 
			
		||||
                                &self.outlines,
 | 
			
		||||
                                name,
 | 
			
		||||
                                button_states_cache.get(name.into())
 | 
			
		||||
                                    .expect("Button state not created")
 | 
			
		||||
                                        .clone()
 | 
			
		||||
                                    .clone(),
 | 
			
		||||
                                &mut warning_handler,
 | 
			
		||||
                            ))
 | 
			
		||||
                            }).collect(),
 | 
			
		||||
                        });
 | 
			
		||||
                    ::layout::Row {
 | 
			
		||||
                        angle: 0,
 | 
			
		||||
                        buttons: add_offsets(
 | 
			
		||||
                            buttons,
 | 
			
		||||
                            |button| button.size.width,
 | 
			
		||||
                        ).collect()
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
                let rows = add_offsets(rows, |row| row.get_height())
 | 
			
		||||
                    .collect();
 | 
			
		||||
                (
 | 
			
		||||
                    name.clone(),
 | 
			
		||||
                    layout::View::new(rows)
 | 
			
		||||
                )
 | 
			
		||||
            })
 | 
			
		||||
                    }).collect(),
 | 
			
		||||
                })
 | 
			
		||||
            )})
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        (
 | 
			
		||||
            Ok(::layout::LayoutData {
 | 
			
		||||
                views: views,
 | 
			
		||||
                keymap_str: {
 | 
			
		||||
                    CString::new(keymap_str)
 | 
			
		||||
                        .expect("Invalid keymap string generated")
 | 
			
		||||
                },
 | 
			
		||||
        })
 | 
			
		||||
                // FIXME: use a dedicated field
 | 
			
		||||
                margins: layout::Margins {
 | 
			
		||||
                    top: self.margins.top,
 | 
			
		||||
                    left: self.margins.side,
 | 
			
		||||
                    bottom: self.margins.bottom,
 | 
			
		||||
                    right: self.margins.side,
 | 
			
		||||
                },
 | 
			
		||||
            }),
 | 
			
		||||
            warning_handler,
 | 
			
		||||
        )
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn create_action(
 | 
			
		||||
fn create_action<H: WarningHandler>(
 | 
			
		||||
    button_info: &HashMap<String, ButtonMeta>,
 | 
			
		||||
    name: &str,
 | 
			
		||||
    view_names: Vec<&String>,
 | 
			
		||||
    warning_handler: &mut H,
 | 
			
		||||
) -> ::action::Action {
 | 
			
		||||
    let default_meta = ButtonMeta::default();
 | 
			
		||||
    let symbol_meta = button_info.get(name)
 | 
			
		||||
        .unwrap_or(&default_meta);
 | 
			
		||||
 | 
			
		||||
    fn filter_view_name(
 | 
			
		||||
        button_name: &str,
 | 
			
		||||
        view_name: String,
 | 
			
		||||
        view_names: &Vec<&String>
 | 
			
		||||
    ) -> String {
 | 
			
		||||
        if view_names.contains(&&view_name) {
 | 
			
		||||
            view_name
 | 
			
		||||
        } else {
 | 
			
		||||
            eprintln!(
 | 
			
		||||
                "Button {} switches to missing view {}",
 | 
			
		||||
                button_name,
 | 
			
		||||
                view_name
 | 
			
		||||
            );
 | 
			
		||||
            "base".into()
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    fn keysym_valid(name: &str) -> bool {
 | 
			
		||||
        xkb::keysym_from_name(name, xkb::KEYSYM_NO_FLAGS) != xkb::KEY_NoSymbol
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    let keysyms = match &symbol_meta.action {
 | 
			
		||||
        // Non-submit action
 | 
			
		||||
        Some(_) => Vec::new(),
 | 
			
		||||
        // Submit action
 | 
			
		||||
        None => match &symbol_meta.keysym {
 | 
			
		||||
            // Keysym given explicitly
 | 
			
		||||
            Some(keysym) => vec!(match keysym_valid(keysym.as_str()) {
 | 
			
		||||
                true => keysym.clone(),
 | 
			
		||||
                false => {
 | 
			
		||||
                    eprintln!("Keysym name invalid: {}", keysym);
 | 
			
		||||
                    "space".into() // placeholder
 | 
			
		||||
                },
 | 
			
		||||
            }),
 | 
			
		||||
            // Keysyms left open to derive
 | 
			
		||||
            // TODO: when button name is meant diretly as xkb keysym name,
 | 
			
		||||
            // mark it so, e.g. with a "#"
 | 
			
		||||
            None => match keysym_valid(name) {
 | 
			
		||||
                // Button name is actually a valid xkb name
 | 
			
		||||
                true => vec!(String::from(name)),
 | 
			
		||||
                // Button name is not a valid xkb name,
 | 
			
		||||
                // so assume it's a literal string to be submitted
 | 
			
		||||
                false => {
 | 
			
		||||
                    if name.chars().count() == 0 {
 | 
			
		||||
                        // A name read from yaml with no valid Unicode.
 | 
			
		||||
                        // Highly improbable, but let's be safe.
 | 
			
		||||
                        eprintln!("Key {} doesn't have any characters", name);
 | 
			
		||||
                        vec!("space".into()) // placeholder
 | 
			
		||||
                    } else {
 | 
			
		||||
                        name.chars().map(|codepoint| {
 | 
			
		||||
                            let codepoint_string = codepoint.to_string();
 | 
			
		||||
                            match keysym_valid(codepoint_string.as_str()) {
 | 
			
		||||
                                true => codepoint_string,
 | 
			
		||||
                                false => format!("U{:04X}", codepoint as u32),
 | 
			
		||||
                            }
 | 
			
		||||
                        }).collect()
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
            },
 | 
			
		||||
    enum SubmitData {
 | 
			
		||||
        Action(Action),
 | 
			
		||||
        Text(String),
 | 
			
		||||
        Keysym(String),
 | 
			
		||||
    };
 | 
			
		||||
    
 | 
			
		||||
    let submission = match (
 | 
			
		||||
        &symbol_meta.action,
 | 
			
		||||
        &symbol_meta.keysym,
 | 
			
		||||
        &symbol_meta.text
 | 
			
		||||
    ) {
 | 
			
		||||
        (Some(action), None, None) => SubmitData::Action(action.clone()),
 | 
			
		||||
        (None, Some(keysym), None) => SubmitData::Keysym(keysym.clone()),
 | 
			
		||||
        (None, None, Some(text)) => SubmitData::Text(text.clone()),
 | 
			
		||||
        (None, None, None) => SubmitData::Text(name.into()),
 | 
			
		||||
        _ => {
 | 
			
		||||
            warning_handler.handle(&format!(
 | 
			
		||||
                "Button {} has more than one of (action, keysym, text)",
 | 
			
		||||
                name
 | 
			
		||||
            ));
 | 
			
		||||
            SubmitData::Text("".into())
 | 
			
		||||
        },
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    match &symbol_meta.action {
 | 
			
		||||
        Some(Action::SetView(view_name)) => ::action::Action::SetLevel(
 | 
			
		||||
            filter_view_name(name, view_name.clone(), &view_names)
 | 
			
		||||
    fn filter_view_name<H: WarningHandler>(
 | 
			
		||||
        button_name: &str,
 | 
			
		||||
        view_name: String,
 | 
			
		||||
        view_names: &Vec<&String>,
 | 
			
		||||
        warning_handler: &mut H,
 | 
			
		||||
    ) -> String {
 | 
			
		||||
        if view_names.contains(&&view_name) {
 | 
			
		||||
            view_name
 | 
			
		||||
        } else {
 | 
			
		||||
            warning_handler.handle(&format!("Button {} switches to missing view {}",
 | 
			
		||||
                button_name,
 | 
			
		||||
                view_name,
 | 
			
		||||
            ));
 | 
			
		||||
            "base".into()
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    match submission {
 | 
			
		||||
        SubmitData::Action(
 | 
			
		||||
            Action::SetView(view_name)
 | 
			
		||||
        ) => ::action::Action::SetLevel(
 | 
			
		||||
            filter_view_name(
 | 
			
		||||
                name, view_name.clone(), &view_names,
 | 
			
		||||
                warning_handler,
 | 
			
		||||
            )
 | 
			
		||||
        ),
 | 
			
		||||
        Some(Action::Locking {
 | 
			
		||||
        SubmitData::Action(Action::Locking {
 | 
			
		||||
            lock_view, unlock_view
 | 
			
		||||
        }) => ::action::Action::LockLevel {
 | 
			
		||||
            lock: filter_view_name(name, lock_view.clone(), &view_names),
 | 
			
		||||
            lock: filter_view_name(
 | 
			
		||||
                name,
 | 
			
		||||
                lock_view.clone(),
 | 
			
		||||
                &view_names,
 | 
			
		||||
                warning_handler,
 | 
			
		||||
            ),
 | 
			
		||||
            unlock: filter_view_name(
 | 
			
		||||
                name,
 | 
			
		||||
                unlock_view.clone(),
 | 
			
		||||
                &view_names
 | 
			
		||||
                &view_names,
 | 
			
		||||
                warning_handler,
 | 
			
		||||
            ),
 | 
			
		||||
        },
 | 
			
		||||
        Some(Action::ShowPrefs) => ::action::Action::ShowPreferences,
 | 
			
		||||
        None => ::action::Action::Submit {
 | 
			
		||||
        SubmitData::Action(
 | 
			
		||||
            Action::ShowPrefs
 | 
			
		||||
        ) => ::action::Action::ShowPreferences,
 | 
			
		||||
        SubmitData::Keysym(keysym) => ::action::Action::Submit {
 | 
			
		||||
            text: None,
 | 
			
		||||
            keys: keysyms.into_iter().map(::action::KeySym).collect(),
 | 
			
		||||
            keys: vec!(::action::KeySym(
 | 
			
		||||
                match keysym_valid(keysym.as_str()) {
 | 
			
		||||
                    true => keysym.clone(),
 | 
			
		||||
                    false => {
 | 
			
		||||
                        warning_handler.handle(&format!(
 | 
			
		||||
                            "Keysym name invalid: {}",
 | 
			
		||||
                            keysym,
 | 
			
		||||
                        ));
 | 
			
		||||
                        "space".into() // placeholder
 | 
			
		||||
                    },
 | 
			
		||||
                }
 | 
			
		||||
            )),
 | 
			
		||||
        },
 | 
			
		||||
        SubmitData::Text(text) => ::action::Action::Submit {
 | 
			
		||||
            text: {
 | 
			
		||||
                CString::new(text.clone())
 | 
			
		||||
                    .map_err(|e| {
 | 
			
		||||
                        warning_handler.handle(&format!(
 | 
			
		||||
                            "Text {} contains problems: {:?}",
 | 
			
		||||
                            text,
 | 
			
		||||
                            e
 | 
			
		||||
                        ));
 | 
			
		||||
                        e
 | 
			
		||||
                    }).ok()
 | 
			
		||||
            },
 | 
			
		||||
            keys: text.chars().map(|codepoint| {
 | 
			
		||||
                let codepoint_string = codepoint.to_string();
 | 
			
		||||
                ::action::KeySym(match keysym_valid(codepoint_string.as_str()) {
 | 
			
		||||
                    true => codepoint_string,
 | 
			
		||||
                    false => format!("U{:04X}", codepoint as u32),
 | 
			
		||||
                })
 | 
			
		||||
            }).collect(),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// TODO: Since this will receive user-provided data,
 | 
			
		||||
/// all .expect() on them should be turned into soft fails
 | 
			
		||||
fn create_button(
 | 
			
		||||
fn create_button<H: WarningHandler>(
 | 
			
		||||
    button_info: &HashMap<String, ButtonMeta>,
 | 
			
		||||
    outlines: &HashMap<String, Outline>,
 | 
			
		||||
    name: &str,
 | 
			
		||||
    state: Rc<RefCell<KeyState>>,
 | 
			
		||||
    warning_handler: &mut H,
 | 
			
		||||
) -> ::layout::Button {
 | 
			
		||||
    let cname = CString::new(name.clone())
 | 
			
		||||
        .expect("Bad name");
 | 
			
		||||
@ -539,6 +608,18 @@ fn create_button(
 | 
			
		||||
    } else if let Some(icon) = &button_meta.icon {
 | 
			
		||||
        ::layout::Label::IconName(CString::new(icon.as_str())
 | 
			
		||||
            .expect("Bad icon"))
 | 
			
		||||
    } else if let Some(text) = &button_meta.text {
 | 
			
		||||
        ::layout::Label::Text(
 | 
			
		||||
            CString::new(text.as_str())
 | 
			
		||||
                .unwrap_or_else(|e| {
 | 
			
		||||
                    warning_handler.handle(&format!(
 | 
			
		||||
                        "Text {} is invalid: {}",
 | 
			
		||||
                        text,
 | 
			
		||||
                        e,
 | 
			
		||||
                    ));
 | 
			
		||||
                    CString::new("").unwrap()
 | 
			
		||||
                })
 | 
			
		||||
        )
 | 
			
		||||
    } else {
 | 
			
		||||
        ::layout::Label::Text(cname.clone())
 | 
			
		||||
    };
 | 
			
		||||
@ -548,7 +629,7 @@ fn create_button(
 | 
			
		||||
            if outlines.contains_key(outline) {
 | 
			
		||||
                outline.clone()
 | 
			
		||||
            } else {
 | 
			
		||||
                eprintln!("Outline named {} does not exist! Using default for button {}", outline, name);
 | 
			
		||||
                warning_handler.handle(&format!("Outline named {} does not exist! Using default for button {}", outline, name));
 | 
			
		||||
                "default".into()
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -558,21 +639,19 @@ fn create_button(
 | 
			
		||||
    let outline = outlines.get(&outline_name)
 | 
			
		||||
        .map(|outline| (*outline).clone())
 | 
			
		||||
        .unwrap_or_else(|| {
 | 
			
		||||
            eprintln!("No default outline defied Using 1x1!");
 | 
			
		||||
            Outline {
 | 
			
		||||
                bounds: Bounds { x: 0f64, y: 0f64, width: 1f64, height: 1f64 },
 | 
			
		||||
            }
 | 
			
		||||
            warning_handler.handle(
 | 
			
		||||
                &format!("No default outline defined! Using 1x1!")
 | 
			
		||||
            );
 | 
			
		||||
            Outline { width: 1f64, height: 1f64 }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    ::layout::Button {
 | 
			
		||||
    layout::Button {
 | 
			
		||||
        name: cname,
 | 
			
		||||
        outline_name: CString::new(outline_name).expect("Bad outline"),
 | 
			
		||||
        // TODO: do layout before creating buttons
 | 
			
		||||
        bounds: ::layout::c::Bounds {
 | 
			
		||||
            x: outline.bounds.x,
 | 
			
		||||
            y: outline.bounds.y,
 | 
			
		||||
            width: outline.bounds.width,
 | 
			
		||||
            height: outline.bounds.height,
 | 
			
		||||
        size: layout::Size {
 | 
			
		||||
            width: outline.width,
 | 
			
		||||
            height: outline.height,
 | 
			
		||||
        },
 | 
			
		||||
        label: label,
 | 
			
		||||
        state: state,
 | 
			
		||||
@ -584,13 +663,14 @@ mod tests {
 | 
			
		||||
    use super::*;
 | 
			
		||||
    
 | 
			
		||||
    use std::error::Error as ErrorTrait;
 | 
			
		||||
    use ::logging::PanicWarn;
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn test_parse_path() {
 | 
			
		||||
        assert_eq!(
 | 
			
		||||
            Layout::from_file(PathBuf::from("tests/layout.yaml")).unwrap(),
 | 
			
		||||
            Layout {
 | 
			
		||||
                bounds: Bounds { x: 0f64, y: 0f64, width: 0f64, height: 0f64 },
 | 
			
		||||
                margins: Margins { top: 0f64, bottom: 0f64, side: 0f64 },
 | 
			
		||||
                views: hashmap!(
 | 
			
		||||
                    "base".into() => vec!("test".into()),
 | 
			
		||||
                ),
 | 
			
		||||
@ -599,16 +679,13 @@ mod tests {
 | 
			
		||||
                        icon: None,
 | 
			
		||||
                        keysym: None,
 | 
			
		||||
                        action: None,
 | 
			
		||||
                        text: None,
 | 
			
		||||
                        label: Some("test".into()),
 | 
			
		||||
                        outline: None,
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
                outlines: hashmap!{
 | 
			
		||||
                    "default".into() => Outline {
 | 
			
		||||
                        bounds: Bounds {
 | 
			
		||||
                            x: 0f64, y: 0f64, width: 0f64, height: 0f64
 | 
			
		||||
                        }, 
 | 
			
		||||
                    }
 | 
			
		||||
                    "default".into() => Outline { width: 0f64, height: 0f64 }, 
 | 
			
		||||
                },
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
@ -656,12 +733,12 @@ mod tests {
 | 
			
		||||
    fn test_layout_punctuation() {
 | 
			
		||||
        let out = Layout::from_file(PathBuf::from("tests/layout_key1.yaml"))
 | 
			
		||||
            .unwrap()
 | 
			
		||||
            .build()
 | 
			
		||||
            .build(PanicWarn).0
 | 
			
		||||
            .unwrap();
 | 
			
		||||
        assert_eq!(
 | 
			
		||||
            out.views["base"]
 | 
			
		||||
                .rows[0]
 | 
			
		||||
                .buttons[0]
 | 
			
		||||
                .get_rows()[0].1
 | 
			
		||||
                .buttons[0].1
 | 
			
		||||
                .label,
 | 
			
		||||
            ::layout::Label::Text(CString::new("test").unwrap())
 | 
			
		||||
        );
 | 
			
		||||
@ -671,12 +748,12 @@ mod tests {
 | 
			
		||||
    fn test_layout_unicode() {
 | 
			
		||||
        let out = Layout::from_file(PathBuf::from("tests/layout_key2.yaml"))
 | 
			
		||||
            .unwrap()
 | 
			
		||||
            .build()
 | 
			
		||||
            .build(PanicWarn).0
 | 
			
		||||
            .unwrap();
 | 
			
		||||
        assert_eq!(
 | 
			
		||||
            out.views["base"]
 | 
			
		||||
                .rows[0]
 | 
			
		||||
                .buttons[0]
 | 
			
		||||
                .get_rows()[0].1
 | 
			
		||||
                .buttons[0].1
 | 
			
		||||
                .label,
 | 
			
		||||
            ::layout::Label::Text(CString::new("test").unwrap())
 | 
			
		||||
        );
 | 
			
		||||
@ -687,12 +764,12 @@ mod tests {
 | 
			
		||||
    fn test_layout_unicode_multi() {
 | 
			
		||||
        let out = Layout::from_file(PathBuf::from("tests/layout_key3.yaml"))
 | 
			
		||||
            .unwrap()
 | 
			
		||||
            .build()
 | 
			
		||||
            .build(PanicWarn).0
 | 
			
		||||
            .unwrap();
 | 
			
		||||
        assert_eq!(
 | 
			
		||||
            out.views["base"]
 | 
			
		||||
                .rows[0]
 | 
			
		||||
                .buttons[0]
 | 
			
		||||
                .get_rows()[0].1
 | 
			
		||||
                .buttons[0].1
 | 
			
		||||
                .state.borrow()
 | 
			
		||||
                .keycodes.len(),
 | 
			
		||||
            2
 | 
			
		||||
@ -702,7 +779,7 @@ mod tests {
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn parsing_fallback() {
 | 
			
		||||
        assert!(Layout::from_resource(FALLBACK_LAYOUT_NAME)
 | 
			
		||||
            .and_then(|layout| layout.build().map_err(LoadError::BadKeyMap))
 | 
			
		||||
            .map(|layout| layout.build(PanicWarn).0.unwrap())
 | 
			
		||||
            .is_ok()
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
@ -742,17 +819,36 @@ mod tests {
 | 
			
		||||
                    ".".into() => ButtonMeta {
 | 
			
		||||
                        icon: None,
 | 
			
		||||
                        keysym: None,
 | 
			
		||||
                        text: None,
 | 
			
		||||
                        action: None,
 | 
			
		||||
                        label: Some("test".into()),
 | 
			
		||||
                        outline: None,
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
                ".",
 | 
			
		||||
                Vec::new()
 | 
			
		||||
                Vec::new(),
 | 
			
		||||
                &mut PanicWarn,
 | 
			
		||||
            ),
 | 
			
		||||
            ::action::Action::Submit {
 | 
			
		||||
                text: None,
 | 
			
		||||
                text: Some(CString::new(".").unwrap()),
 | 
			
		||||
                keys: vec!(::action::KeySym("U002E".into())),
 | 
			
		||||
            },
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn test_layout_margins() {
 | 
			
		||||
        let out = Layout::from_file(PathBuf::from("tests/layout_margins.yaml"))
 | 
			
		||||
            .unwrap()
 | 
			
		||||
            .build(PanicWarn).0
 | 
			
		||||
            .unwrap();
 | 
			
		||||
        assert_eq!(
 | 
			
		||||
            out.margins,
 | 
			
		||||
            layout::Margins {
 | 
			
		||||
                top: 1.0,
 | 
			
		||||
                bottom: 3.0,
 | 
			
		||||
                left: 2.0,
 | 
			
		||||
                right: 2.0,
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										120
									
								
								src/drawing.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										120
									
								
								src/drawing.rs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,120 @@
 | 
			
		||||
/*! Drawing the UI */
 | 
			
		||||
 | 
			
		||||
use cairo;
 | 
			
		||||
use std::cell::RefCell;
 | 
			
		||||
 | 
			
		||||
use ::keyboard;
 | 
			
		||||
use ::layout::{ Button, Layout };
 | 
			
		||||
use ::layout::c::{ EekGtkKeyboard, Point };
 | 
			
		||||
 | 
			
		||||
use glib::translate::FromGlibPtrNone;
 | 
			
		||||
use gtk::WidgetExt;
 | 
			
		||||
 | 
			
		||||
mod c {
 | 
			
		||||
    use super::*;
 | 
			
		||||
 | 
			
		||||
    use cairo_sys;
 | 
			
		||||
    use std::os::raw::c_void;
 | 
			
		||||
    
 | 
			
		||||
    // This is constructed only in C, no need for warnings
 | 
			
		||||
    #[allow(dead_code)]
 | 
			
		||||
    #[repr(transparent)]
 | 
			
		||||
    #[derive(Clone, Copy)]
 | 
			
		||||
    pub struct EekRenderer(*const c_void);
 | 
			
		||||
 | 
			
		||||
    #[no_mangle]
 | 
			
		||||
    extern "C" {
 | 
			
		||||
        // Button and View inside CButtonPlace are safe to pass to C
 | 
			
		||||
        // as long as they don't outlive the call
 | 
			
		||||
        // and nothing dereferences them
 | 
			
		||||
        #[allow(improper_ctypes)]
 | 
			
		||||
        pub fn eek_render_button(
 | 
			
		||||
            renderer: EekRenderer,
 | 
			
		||||
            cr: *mut cairo_sys::cairo_t,
 | 
			
		||||
            button: *const Button,
 | 
			
		||||
            pressed: u64,
 | 
			
		||||
            locked: u64,
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[no_mangle]
 | 
			
		||||
    pub extern "C"
 | 
			
		||||
    fn squeek_layout_draw_all_changed(
 | 
			
		||||
        layout: *mut Layout,
 | 
			
		||||
        renderer: EekRenderer,
 | 
			
		||||
        cr: *mut cairo_sys::cairo_t,
 | 
			
		||||
    ) {
 | 
			
		||||
        let layout = unsafe { &mut *layout };
 | 
			
		||||
        let cr = unsafe { cairo::Context::from_raw_none(cr) };
 | 
			
		||||
 | 
			
		||||
        let view = layout.get_current_view();
 | 
			
		||||
        for (row_offset, row) in &view.get_rows() {
 | 
			
		||||
            for (x_offset, button) in &row.buttons {
 | 
			
		||||
                let state = RefCell::borrow(&button.state).clone();
 | 
			
		||||
                if state.pressed == keyboard::PressType::Pressed || state.locked {
 | 
			
		||||
                    render_button_at_position(
 | 
			
		||||
                        renderer, &cr,
 | 
			
		||||
                        row_offset + Point { x: *x_offset, y: 0.0 },
 | 
			
		||||
                        button.as_ref(),
 | 
			
		||||
                        state.pressed, state.locked,
 | 
			
		||||
                    );
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    #[no_mangle]
 | 
			
		||||
    pub extern "C"
 | 
			
		||||
    fn squeek_draw_layout_base_view(
 | 
			
		||||
        layout: *mut Layout,
 | 
			
		||||
        renderer: EekRenderer,
 | 
			
		||||
        cr: *mut cairo_sys::cairo_t,
 | 
			
		||||
    ) {
 | 
			
		||||
        let layout = unsafe { &mut *layout };
 | 
			
		||||
        let cr = unsafe { cairo::Context::from_raw_none(cr) };
 | 
			
		||||
        let view = layout.get_current_view();
 | 
			
		||||
        for (row_offset, row) in &view.get_rows() {
 | 
			
		||||
            for (x_offset, button) in &row.buttons {
 | 
			
		||||
                render_button_at_position(
 | 
			
		||||
                    renderer, &cr,
 | 
			
		||||
                    row_offset + Point { x: *x_offset, y: 0.0 },
 | 
			
		||||
                    button.as_ref(),
 | 
			
		||||
                    keyboard::PressType::Released, false,
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Renders a button at a position (button's own bounds ignored)
 | 
			
		||||
pub fn render_button_at_position(
 | 
			
		||||
    renderer: c::EekRenderer,
 | 
			
		||||
    cr: &cairo::Context,
 | 
			
		||||
    position: Point,
 | 
			
		||||
    button: &Button,
 | 
			
		||||
    pressed: keyboard::PressType,
 | 
			
		||||
    locked: bool,
 | 
			
		||||
) {
 | 
			
		||||
    cr.save();
 | 
			
		||||
    cr.translate(position.x, position.y);
 | 
			
		||||
    cr.rectangle(
 | 
			
		||||
        0.0, 0.0,
 | 
			
		||||
        button.size.width, button.size.height
 | 
			
		||||
    );
 | 
			
		||||
    cr.clip();
 | 
			
		||||
    unsafe {
 | 
			
		||||
        c::eek_render_button(
 | 
			
		||||
            renderer,
 | 
			
		||||
            cairo::Context::to_raw_none(&cr),
 | 
			
		||||
            button as *const Button,
 | 
			
		||||
            pressed as u64,
 | 
			
		||||
            locked as u64,
 | 
			
		||||
        )
 | 
			
		||||
    };
 | 
			
		||||
    cr.restore();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn queue_redraw(keyboard: EekGtkKeyboard) {
 | 
			
		||||
    let widget = unsafe { gtk::Widget::from_glib_none(keyboard.0) };
 | 
			
		||||
    widget.queue_draw();
 | 
			
		||||
}
 | 
			
		||||
@ -1,12 +0,0 @@
 | 
			
		||||
#ifndef __KEYBOARD_H
 | 
			
		||||
#define __KEYBOARD_H
 | 
			
		||||
 | 
			
		||||
#include "inttypes.h"
 | 
			
		||||
#include "stdbool.h"
 | 
			
		||||
#include "virtual-keyboard-unstable-v1-client-protocol.h"
 | 
			
		||||
 | 
			
		||||
struct squeek_key;
 | 
			
		||||
 | 
			
		||||
uint32_t squeek_key_is_pressed(struct squeek_key *key);
 | 
			
		||||
uint32_t squeek_key_is_locked(struct squeek_key *key);
 | 
			
		||||
#endif
 | 
			
		||||
@ -10,32 +10,8 @@ use ::action::Action;
 | 
			
		||||
 | 
			
		||||
use std::io::Write;
 | 
			
		||||
use std::iter::{ FromIterator, IntoIterator };
 | 
			
		||||
use ::util::CloneOwned;
 | 
			
		||||
 | 
			
		||||
/// Gathers stuff defined in C or called by C
 | 
			
		||||
pub mod c {
 | 
			
		||||
    use super::*;
 | 
			
		||||
    use ::util::c;
 | 
			
		||||
 | 
			
		||||
    pub type CKeyState = c::Wrapped<KeyState>;
 | 
			
		||||
 | 
			
		||||
    // The following defined in Rust. TODO: wrap naked pointers to Rust data inside RefCells to prevent multiple writers
 | 
			
		||||
 | 
			
		||||
    #[no_mangle]
 | 
			
		||||
    pub extern "C"
 | 
			
		||||
    fn squeek_key_is_pressed(key: CKeyState) -> u32 {
 | 
			
		||||
        //let key = unsafe { Rc::from_raw(key.0) };
 | 
			
		||||
        return key.clone_owned().pressed as u32;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[no_mangle]
 | 
			
		||||
    pub extern "C"
 | 
			
		||||
    fn squeek_key_is_locked(key: CKeyState) -> u32 {
 | 
			
		||||
        return key.clone_owned().locked as u32;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, Clone, Copy)]
 | 
			
		||||
#[derive(Debug, Clone, Copy, PartialEq)]
 | 
			
		||||
pub enum PressType {
 | 
			
		||||
    Released = 0,
 | 
			
		||||
    Pressed = 1,
 | 
			
		||||
@ -51,14 +27,26 @@ pub struct KeyState {
 | 
			
		||||
    pub action: Action,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Generates a mapping where each key gets a keycode, starting from 8
 | 
			
		||||
/// Sorts an iterator by converting it to a Vector and back
 | 
			
		||||
fn sorted<'a, I: Iterator<Item=&'a str>>(
 | 
			
		||||
    iter: I
 | 
			
		||||
) -> impl Iterator<Item=&'a str> {
 | 
			
		||||
    let mut v: Vec<&'a str> = iter.collect();
 | 
			
		||||
    v.sort();
 | 
			
		||||
    v.into_iter()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Generates a mapping where each key gets a keycode, starting from ~~8~~
 | 
			
		||||
/// HACK: starting from 9, because 8 results in keycode 0,
 | 
			
		||||
/// which the compositor likes to discard
 | 
			
		||||
pub fn generate_keycodes<'a, C: IntoIterator<Item=&'a str>>(
 | 
			
		||||
    key_names: C
 | 
			
		||||
) -> HashMap<String, u32> {
 | 
			
		||||
    HashMap::from_iter(
 | 
			
		||||
        key_names.into_iter()
 | 
			
		||||
        // sort to remove a source of indeterminism in keycode assignment
 | 
			
		||||
        sorted(key_names.into_iter())
 | 
			
		||||
            .map(|name| String::from(name))
 | 
			
		||||
            .zip(8..)
 | 
			
		||||
            .zip(9..)
 | 
			
		||||
    )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										44
									
								
								src/layout.h
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								src/layout.h
									
									
									
									
									
								
							@ -5,8 +5,8 @@
 | 
			
		||||
#include <glib.h>
 | 
			
		||||
#include "eek/eek-element.h"
 | 
			
		||||
#include "eek/eek-gtk-keyboard.h"
 | 
			
		||||
#include "eek/eek-renderer.h"
 | 
			
		||||
#include "eek/eek-types.h"
 | 
			
		||||
#include "src/keyboard.h"
 | 
			
		||||
#include "virtual-keyboard-unstable-v1-client-protocol.h"
 | 
			
		||||
 | 
			
		||||
enum squeek_arrangement_kind {
 | 
			
		||||
@ -14,48 +14,19 @@ enum squeek_arrangement_kind {
 | 
			
		||||
    ARRANGEMENT_KIND_WIDE = 1,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct squeek_button;
 | 
			
		||||
struct squeek_row;
 | 
			
		||||
struct squeek_view;
 | 
			
		||||
struct squeek_layout;
 | 
			
		||||
 | 
			
		||||
/// Represents the path to the button within a view
 | 
			
		||||
struct button_place {
 | 
			
		||||
    const struct squeek_row *row;
 | 
			
		||||
    const struct squeek_button *button;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int32_t squeek_row_get_angle(const struct squeek_row*);
 | 
			
		||||
 | 
			
		||||
EekBounds squeek_row_get_bounds(const struct squeek_row*);
 | 
			
		||||
 | 
			
		||||
typedef void (*ButtonCallback) (struct squeek_button *button, gpointer user_data);
 | 
			
		||||
void squeek_row_foreach(struct squeek_row*,
 | 
			
		||||
                            ButtonCallback   callback,
 | 
			
		||||
                            gpointer      user_data);
 | 
			
		||||
 | 
			
		||||
EekBounds squeek_button_get_bounds(const struct squeek_button*);
 | 
			
		||||
const char *squeek_button_get_label(const struct squeek_button*);
 | 
			
		||||
const char *squeek_button_get_icon_name(const struct squeek_button*);
 | 
			
		||||
const char *squeek_button_get_name(const struct squeek_button*);
 | 
			
		||||
const char *squeek_button_get_outline_name(const struct squeek_button*);
 | 
			
		||||
 | 
			
		||||
struct squeek_key *squeek_button_get_key(const struct squeek_button*);
 | 
			
		||||
uint32_t *squeek_button_has_key(const struct squeek_button* button,
 | 
			
		||||
                                const struct squeek_key *key);
 | 
			
		||||
void squeek_button_print(const struct squeek_button* button);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EekBounds squeek_view_get_bounds(const struct squeek_view*);
 | 
			
		||||
 | 
			
		||||
typedef void (*RowCallback) (struct squeek_row *row, gpointer user_data);
 | 
			
		||||
void squeek_view_foreach(struct squeek_view*,
 | 
			
		||||
                            RowCallback   callback,
 | 
			
		||||
                            gpointer      user_data);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
squeek_layout_place_contents(struct squeek_layout*);
 | 
			
		||||
struct squeek_view *squeek_layout_get_current_view(struct squeek_layout*);
 | 
			
		||||
struct transformation squeek_layout_calculate_transformation(
 | 
			
		||||
        const struct squeek_layout *layout,
 | 
			
		||||
        double allocation_width, double allocation_size);
 | 
			
		||||
 | 
			
		||||
struct squeek_layout *squeek_load_layout(const char *name, uint32_t type);
 | 
			
		||||
const char *squeek_layout_get_keymap(const struct squeek_layout*);
 | 
			
		||||
@ -65,6 +36,7 @@ void squeek_layout_free(struct squeek_layout*);
 | 
			
		||||
void squeek_layout_release(struct squeek_layout *layout, struct zwp_virtual_keyboard_v1 *virtual_keyboard,
 | 
			
		||||
                           struct transformation widget_to_layout,
 | 
			
		||||
                           uint32_t timestamp,
 | 
			
		||||
                           EekboardContextService *manager,
 | 
			
		||||
                           EekGtkKeyboard *ui_keyboard);
 | 
			
		||||
void squeek_layout_release_all_only(struct squeek_layout *layout, struct zwp_virtual_keyboard_v1 *virtual_keyboard, uint32_t timestamp);
 | 
			
		||||
void squeek_layout_depress(struct squeek_layout *layout, struct zwp_virtual_keyboard_v1 *virtual_keyboard,
 | 
			
		||||
@ -74,6 +46,8 @@ void squeek_layout_depress(struct squeek_layout *layout, struct zwp_virtual_keyb
 | 
			
		||||
void squeek_layout_drag(struct squeek_layout *layout, struct zwp_virtual_keyboard_v1 *virtual_keyboard,
 | 
			
		||||
                        double x_widget, double y_widget,
 | 
			
		||||
                        struct transformation widget_to_layout,
 | 
			
		||||
                        uint32_t timestamp, EekGtkKeyboard *ui_keyboard);
 | 
			
		||||
void squeek_layout_draw_all_changed(struct squeek_layout *layout, EekGtkKeyboard *ui_keyboard);
 | 
			
		||||
                        uint32_t timestamp, EekboardContextService *manager,
 | 
			
		||||
                        EekGtkKeyboard *ui_keyboard);
 | 
			
		||||
void squeek_layout_draw_all_changed(struct squeek_layout *layout, EekRenderer* renderer, cairo_t     *cr);
 | 
			
		||||
void squeek_draw_layout_base_view(struct squeek_layout *layout, EekRenderer* renderer, cairo_t     *cr);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										823
									
								
								src/layout.rs
									
									
									
									
									
								
							
							
						
						
									
										823
									
								
								src/layout.rs
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										10
									
								
								src/lib.rs
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/lib.rs
									
									
									
									
									
								
							@ -1,5 +1,8 @@
 | 
			
		||||
#[macro_use]
 | 
			
		||||
extern crate bitflags;
 | 
			
		||||
extern crate cairo;
 | 
			
		||||
extern crate cairo_sys;
 | 
			
		||||
extern crate gdk;
 | 
			
		||||
extern crate gio;
 | 
			
		||||
extern crate glib;
 | 
			
		||||
extern crate glib_sys;
 | 
			
		||||
@ -14,15 +17,20 @@ extern crate xkbcommon;
 | 
			
		||||
 | 
			
		||||
mod action;
 | 
			
		||||
pub mod data;
 | 
			
		||||
mod drawing;
 | 
			
		||||
pub mod float_ord;
 | 
			
		||||
pub mod imservice;
 | 
			
		||||
mod keyboard;
 | 
			
		||||
mod layout;
 | 
			
		||||
mod locale;
 | 
			
		||||
mod locale_config;
 | 
			
		||||
mod logging;
 | 
			
		||||
mod manager;
 | 
			
		||||
mod outputs;
 | 
			
		||||
mod popover;
 | 
			
		||||
mod resources;
 | 
			
		||||
mod submission;
 | 
			
		||||
mod util;
 | 
			
		||||
mod style;
 | 
			
		||||
pub mod tests;
 | 
			
		||||
pub mod util;
 | 
			
		||||
mod xdg;
 | 
			
		||||
 | 
			
		||||
@ -16,6 +16,9 @@ mod c {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Clone, Debug, PartialEq)]
 | 
			
		||||
pub struct Translation<'a>(pub &'a str);
 | 
			
		||||
 | 
			
		||||
fn cstring_safe(s: &str) -> CString {
 | 
			
		||||
    CString::new(s)
 | 
			
		||||
        .unwrap_or(CString::new("").unwrap())
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										110
									
								
								src/logging.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								src/logging.rs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,110 @@
 | 
			
		||||
/*! Logging library.
 | 
			
		||||
 * 
 | 
			
		||||
 * This is probably the only part of squeekboard
 | 
			
		||||
 * that should be doing any direct printing.
 | 
			
		||||
 * 
 | 
			
		||||
 * There are several approaches to logging,
 | 
			
		||||
 * in the order of increasing flexibility and/or purity:
 | 
			
		||||
 * 
 | 
			
		||||
 * 1. `println!` directly
 | 
			
		||||
 * 
 | 
			
		||||
 *   It can't be easily replaced by a different solution
 | 
			
		||||
 * 
 | 
			
		||||
 * 2. simple `log!` macro
 | 
			
		||||
 * 
 | 
			
		||||
 *   Replacing the destination at runtime other than globally would be awkward,
 | 
			
		||||
 *   so no easy way to suppress errors for things that don't matter,
 | 
			
		||||
 *   but formatting is still easy.
 | 
			
		||||
 * 
 | 
			
		||||
 * 3. logging to a mutable destination type
 | 
			
		||||
 * 
 | 
			
		||||
 *   Can be easily replaced, but logging `Result` types,
 | 
			
		||||
 *   which should be done by calling a method on the result,
 | 
			
		||||
 *   can't be formatted directly.
 | 
			
		||||
 *   Cannot be parallelized.
 | 
			
		||||
 * 
 | 
			
		||||
 * 4. logging to an immutable destination type
 | 
			
		||||
 * 
 | 
			
		||||
 *   Same as above, except it can be parallelized.
 | 
			
		||||
 *   It seems more difficult to pass the logger around,
 | 
			
		||||
 *   but this may be a solved problem from the area of functional programming.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library generally aims at the approach in 3.
 | 
			
		||||
 * */
 | 
			
		||||
 | 
			
		||||
use std::error::Error;
 | 
			
		||||
 | 
			
		||||
/// Levels are not in order.
 | 
			
		||||
pub enum Level {
 | 
			
		||||
    // Levels for reporting violated constraints
 | 
			
		||||
    /// The program violated a self-imposed constraint,
 | 
			
		||||
    /// ended up in an inconsistent state, and cannot recover.
 | 
			
		||||
    /// Handlers must not actually panic. (should they?)
 | 
			
		||||
    Panic,
 | 
			
		||||
    /// The program violated a self-imposed constraint,
 | 
			
		||||
    /// ended up in an inconsistent state, but some state can be recovered.
 | 
			
		||||
    Bug,
 | 
			
		||||
    /// Invalid data given by an external source,
 | 
			
		||||
    /// some state of the program must be dropped.
 | 
			
		||||
    Error,
 | 
			
		||||
    // Still violated constraints, but harmless
 | 
			
		||||
    /// Invalid data given by an external source, parts of data are ignored.
 | 
			
		||||
    /// No previous program state needs to be dropped.
 | 
			
		||||
    Warning,
 | 
			
		||||
    /// External source not in an expected state,
 | 
			
		||||
    /// but not violating any protocols (including no relevant protocol).
 | 
			
		||||
    Surprise,
 | 
			
		||||
    // Informational
 | 
			
		||||
    /// A change in internal state that results in a change of behaviour
 | 
			
		||||
    /// that a user can observe, and a tinkerer might find useful.
 | 
			
		||||
    /// E.g. selection of external sources, like loading user's UI files,
 | 
			
		||||
    /// language switch, overrides.
 | 
			
		||||
    Info,
 | 
			
		||||
    /// Information useful for application developer only.
 | 
			
		||||
    /// Should be limited to information gotten from external sources,
 | 
			
		||||
    /// and more tricky parts of internal state.
 | 
			
		||||
    Debug,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Sugar for logging errors in results.
 | 
			
		||||
/// Approach 2.
 | 
			
		||||
pub trait Warn {
 | 
			
		||||
    type Value;
 | 
			
		||||
    fn ok_warn(self, msg: &str) -> Option<Self::Value>;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<T, E: Error> Warn for Result<T, E> {
 | 
			
		||||
    type Value = T;
 | 
			
		||||
    fn ok_warn(self, msg: &str) -> Option<T> {
 | 
			
		||||
        self.map_err(|e| {
 | 
			
		||||
            eprintln!("{}: {}", msg, e);
 | 
			
		||||
            e
 | 
			
		||||
        }).ok()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// A mutable handler for text warnings.
 | 
			
		||||
/// Approach 3.
 | 
			
		||||
pub trait WarningHandler {
 | 
			
		||||
    /// Handle a warning
 | 
			
		||||
    fn handle(&mut self, warning: &str);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Prints warnings to stderr
 | 
			
		||||
pub struct PrintWarnings;
 | 
			
		||||
 | 
			
		||||
impl WarningHandler for PrintWarnings {
 | 
			
		||||
    fn handle(&mut self, warning: &str) {
 | 
			
		||||
        eprintln!("{}", warning);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Warning handler that will panic at any warning.
 | 
			
		||||
/// Don't use except in tests
 | 
			
		||||
pub struct PanicWarn;
 | 
			
		||||
 | 
			
		||||
impl WarningHandler for PanicWarn {
 | 
			
		||||
    fn handle(&mut self, warning: &str) {
 | 
			
		||||
        panic!("{}", warning);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										34
									
								
								src/manager.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								src/manager.rs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
			
		||||
/*! Procedures relating to the management of the switching of layouts */
 | 
			
		||||
use ::util;
 | 
			
		||||
 | 
			
		||||
pub mod c {
 | 
			
		||||
    use std::os::raw::{c_char, c_void};
 | 
			
		||||
 | 
			
		||||
    /// EekboardContextService*
 | 
			
		||||
    #[repr(transparent)]
 | 
			
		||||
    #[derive(Clone, Copy)]
 | 
			
		||||
    pub struct Manager(*const c_void);
 | 
			
		||||
    
 | 
			
		||||
    #[no_mangle]
 | 
			
		||||
    extern "C" {
 | 
			
		||||
        pub fn eekboard_context_service_set_overlay(
 | 
			
		||||
            manager: Manager,
 | 
			
		||||
            name: *const c_char,
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        pub fn eekboard_context_service_get_overlay(
 | 
			
		||||
            manager: Manager,
 | 
			
		||||
        ) -> *const c_char;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Returns the overlay name.
 | 
			
		||||
/// The result lifetime is "as long as the C copy lives"
 | 
			
		||||
pub fn get_overlay(manager: c::Manager) -> Option<String> {
 | 
			
		||||
    let raw_str = unsafe {
 | 
			
		||||
        c::eekboard_context_service_get_overlay(manager)
 | 
			
		||||
    };
 | 
			
		||||
    // this string is generated from Rust, should never be invalid
 | 
			
		||||
    util::c::as_str(&raw_str).unwrap()
 | 
			
		||||
        .map(String::from)
 | 
			
		||||
}
 | 
			
		||||
@ -25,7 +25,6 @@ sources = [
 | 
			
		||||
  '../eek/eek-xml-layout.c',
 | 
			
		||||
  '../eek/layersurface.c',
 | 
			
		||||
  dbus_src,
 | 
			
		||||
  enums,
 | 
			
		||||
  '../eekboard/key-emitter.c',
 | 
			
		||||
  '../eekboard/eekboard-context-service.c',
 | 
			
		||||
  '../eekboard/eekboard-service.c',
 | 
			
		||||
@ -58,7 +57,7 @@ rslibs = custom_target(
 | 
			
		||||
    output: ['librs.a'],
 | 
			
		||||
    install: false,
 | 
			
		||||
    console: true,
 | 
			
		||||
    command: [cargo_script, '@OUTPUT@', 'build']
 | 
			
		||||
    command: [cargo_build] + cargo_build_flags + ['@OUTPUT@', '--lib']
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
build_rstests = custom_target(
 | 
			
		||||
@ -72,14 +71,14 @@ build_rstests = custom_target(
 | 
			
		||||
    output: ['src'],
 | 
			
		||||
    install: false,
 | 
			
		||||
    console: true,
 | 
			
		||||
    command: [cargo_script, '', 'test', '--no-run'],
 | 
			
		||||
    command: [cargo_script, 'test', '--no-run'],
 | 
			
		||||
    depends: rslibs, # no point building tests if the code itself fails
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
test(
 | 
			
		||||
    'rstest',
 | 
			
		||||
    cargo_script,
 | 
			
		||||
    args: ['', 'test'],
 | 
			
		||||
    args: ['test'],
 | 
			
		||||
    # this is a whole Carg-based test suite, let it run for a while
 | 
			
		||||
    timeout: 900,
 | 
			
		||||
    depends: build_rstests,
 | 
			
		||||
@ -97,20 +96,7 @@ libsqueekboard = static_library('libsqueekboard',
 | 
			
		||||
    '-DEEK_COMPILATION=1'],
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
# the straight binary needs to be demoted in favor of the wrapper script
 | 
			
		||||
# due to styling being inconsistent
 | 
			
		||||
bindir = join_paths(prefix, get_option('bindir'))
 | 
			
		||||
wrapper_conf = configuration_data()
 | 
			
		||||
wrapper_conf.set('bindir', bindir)
 | 
			
		||||
configure_file(
 | 
			
		||||
  input: '../tools/squeekboard.in',
 | 
			
		||||
  output: 'squeekboard',
 | 
			
		||||
  install_dir: bindir,
 | 
			
		||||
  configuration: wrapper_conf,
 | 
			
		||||
  install: true,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
squeekboard = executable('squeekboard-real',
 | 
			
		||||
squeekboard = executable('squeekboard',
 | 
			
		||||
  'server-main.c',
 | 
			
		||||
  wl_proto_sources,
 | 
			
		||||
  squeekboard_resources,
 | 
			
		||||
@ -124,3 +110,4 @@ squeekboard = executable('squeekboard-real',
 | 
			
		||||
    '-DEEKBOARD_COMPILATION=1',
 | 
			
		||||
    '-DEEK_COMPILATION=1'],
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										249
									
								
								src/popover.rs
									
									
									
									
									
								
							
							
						
						
									
										249
									
								
								src/popover.rs
									
									
									
									
									
								
							@ -2,14 +2,16 @@
 | 
			
		||||
 | 
			
		||||
use gio;
 | 
			
		||||
use gtk;
 | 
			
		||||
use ::layout::c::EekGtkKeyboard;
 | 
			
		||||
use ::locale::compare_current_locale;
 | 
			
		||||
use std::ffi::CString;
 | 
			
		||||
use ::layout::c::{ Bounds, EekGtkKeyboard };
 | 
			
		||||
use ::locale::{ Translation, compare_current_locale };
 | 
			
		||||
use ::locale_config::system_locale;
 | 
			
		||||
use ::manager;
 | 
			
		||||
use ::resources;
 | 
			
		||||
 | 
			
		||||
use gio::ActionExt;
 | 
			
		||||
use gio::ActionMapExt;
 | 
			
		||||
use gio::SettingsExt;
 | 
			
		||||
use gio::SimpleActionExt;
 | 
			
		||||
use glib::translate::FromGlibPtrNone;
 | 
			
		||||
use glib::variant::ToVariant;
 | 
			
		||||
use gtk::PopoverExt;
 | 
			
		||||
@ -18,8 +20,11 @@ use std::io::Write;
 | 
			
		||||
 | 
			
		||||
mod variants {
 | 
			
		||||
    use glib;
 | 
			
		||||
    use glib::Variant;
 | 
			
		||||
    use glib_sys;
 | 
			
		||||
    use std::os::raw::c_char;
 | 
			
		||||
 | 
			
		||||
    use glib::ToVariant;
 | 
			
		||||
    use glib::translate::FromGlibPtrFull;
 | 
			
		||||
    use glib::translate::ToGlibPtr;
 | 
			
		||||
 | 
			
		||||
@ -49,9 +54,47 @@ mod variants {
 | 
			
		||||
            })
 | 
			
		||||
            .collect()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// "a(ss)" variant
 | 
			
		||||
    /// Rust doesn't allow implementing existing traits for existing types
 | 
			
		||||
    pub struct ArrayPairString(pub Vec<(String, String)>);
 | 
			
		||||
    
 | 
			
		||||
    impl ToVariant for ArrayPairString {
 | 
			
		||||
        fn to_variant(&self) -> Variant {
 | 
			
		||||
            let tspec = "a(ss)".to_glib_none();
 | 
			
		||||
            let builder = unsafe {
 | 
			
		||||
                let vtype = glib_sys::g_variant_type_checked_(tspec.0);
 | 
			
		||||
                glib_sys::g_variant_builder_new(vtype)
 | 
			
		||||
            };
 | 
			
		||||
            let ispec = "(ss)".to_glib_none();
 | 
			
		||||
            for (a, b) in &self.0 {
 | 
			
		||||
                let a = a.to_glib_none();
 | 
			
		||||
                let b = b.to_glib_none();
 | 
			
		||||
                // string pointers are weak references
 | 
			
		||||
                // and will get silently invalidated
 | 
			
		||||
                // as soon as the source is out of scope
 | 
			
		||||
                {
 | 
			
		||||
                    let a: *const c_char = a.0;
 | 
			
		||||
                    let b: *const c_char = b.0;
 | 
			
		||||
                    unsafe {
 | 
			
		||||
                        glib_sys::g_variant_builder_add(
 | 
			
		||||
                            builder,
 | 
			
		||||
                            ispec.0,
 | 
			
		||||
                            a, b
 | 
			
		||||
                        );
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            unsafe {
 | 
			
		||||
                let ret = glib_sys::g_variant_builder_end(builder);
 | 
			
		||||
                glib_sys::g_variant_builder_unref(builder);
 | 
			
		||||
                glib::Variant::from_glib_full(ret)
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn make_menu_builder(inputs: Vec<(&str, &str)>) -> gtk::Builder {
 | 
			
		||||
fn make_menu_builder(inputs: Vec<(&str, Translation)>) -> gtk::Builder {
 | 
			
		||||
    let mut xml: Vec<u8> = Vec::new();
 | 
			
		||||
    writeln!(
 | 
			
		||||
        xml,
 | 
			
		||||
@ -60,7 +103,7 @@ fn make_menu_builder(inputs: Vec<(&str, &str)>) -> gtk::Builder {
 | 
			
		||||
  <menu id=\"app-menu\">
 | 
			
		||||
    <section>"
 | 
			
		||||
    ).unwrap();
 | 
			
		||||
    for (input_name, human_name) in inputs {
 | 
			
		||||
    for (input_name, translation) in inputs {
 | 
			
		||||
        writeln!(
 | 
			
		||||
            xml,
 | 
			
		||||
            "
 | 
			
		||||
@ -69,7 +112,7 @@ fn make_menu_builder(inputs: Vec<(&str, &str)>) -> gtk::Builder {
 | 
			
		||||
            <attribute name=\"action\">layout</attribute>
 | 
			
		||||
            <attribute name=\"target\">{}</attribute>
 | 
			
		||||
        </item>",
 | 
			
		||||
            human_name,
 | 
			
		||||
            translation.0,
 | 
			
		||||
            input_name,
 | 
			
		||||
        ).unwrap();
 | 
			
		||||
    }
 | 
			
		||||
@ -88,26 +131,91 @@ fn make_menu_builder(inputs: Vec<(&str, &str)>) -> gtk::Builder {
 | 
			
		||||
fn set_layout(kind: String, name: String) {
 | 
			
		||||
    let settings = gio::Settings::new("org.gnome.desktop.input-sources");
 | 
			
		||||
    let inputs = settings.get_value("sources").unwrap();
 | 
			
		||||
    let inputs = variants::get_tuples(inputs).into_iter();
 | 
			
		||||
    for (index, (ikind, iname)) in inputs.enumerate() {
 | 
			
		||||
        if (&ikind, &iname) == (&kind, &name) {
 | 
			
		||||
            settings.set_uint("current", index as u32);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    let current = (kind.clone(), name.clone());
 | 
			
		||||
    let inputs = variants::get_tuples(inputs).into_iter()
 | 
			
		||||
        .filter(|t| t != ¤t);
 | 
			
		||||
    let inputs = vec![(kind, name)].into_iter()
 | 
			
		||||
        .chain(inputs).collect();
 | 
			
		||||
    settings.set_value(
 | 
			
		||||
        "sources",
 | 
			
		||||
        &variants::ArrayPairString(inputs).to_variant()
 | 
			
		||||
    );
 | 
			
		||||
    settings.apply();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn show(window: EekGtkKeyboard, position: ::layout::c::Bounds) {
 | 
			
		||||
/// A reference to what the user wants to see
 | 
			
		||||
#[derive(PartialEq, Clone, Debug)]
 | 
			
		||||
enum LayoutId {
 | 
			
		||||
    /// Affects the layout in system settings
 | 
			
		||||
    System {
 | 
			
		||||
        kind: String,
 | 
			
		||||
        name: String,
 | 
			
		||||
    },
 | 
			
		||||
    /// Only affects what this input method presents
 | 
			
		||||
    Local(String),
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl LayoutId {
 | 
			
		||||
    fn get_name(&self) -> &str {
 | 
			
		||||
        match &self {
 | 
			
		||||
            LayoutId::System { kind: _, name } => name.as_str(),
 | 
			
		||||
            LayoutId::Local(name) => name.as_str(),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn set_visible_layout(
 | 
			
		||||
    manager: manager::c::Manager,
 | 
			
		||||
    layout_id: LayoutId,
 | 
			
		||||
) {
 | 
			
		||||
    match layout_id {
 | 
			
		||||
        LayoutId::System { kind, name } => set_layout(kind, name),
 | 
			
		||||
        LayoutId::Local(name) => {
 | 
			
		||||
            let name = CString::new(name.as_str()).unwrap();
 | 
			
		||||
            let name_ptr = name.as_ptr();
 | 
			
		||||
            unsafe {
 | 
			
		||||
                manager::c::eekboard_context_service_set_overlay(
 | 
			
		||||
                    manager,
 | 
			
		||||
                    name_ptr,
 | 
			
		||||
                )
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Takes into account first any overlays, then system layouts from the list
 | 
			
		||||
fn get_current_layout(
 | 
			
		||||
    manager: manager::c::Manager,
 | 
			
		||||
    system_layouts: &Vec<LayoutId>,
 | 
			
		||||
) -> Option<LayoutId> {
 | 
			
		||||
    match manager::get_overlay(manager) {
 | 
			
		||||
        Some(name) => Some(LayoutId::Local(name)),
 | 
			
		||||
        None => system_layouts.get(0).map(LayoutId::clone),
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn show(
 | 
			
		||||
    window: EekGtkKeyboard,
 | 
			
		||||
    position: Bounds,
 | 
			
		||||
    manager: manager::c::Manager,
 | 
			
		||||
) {
 | 
			
		||||
    unsafe { gtk::set_initialized() };
 | 
			
		||||
    let window = unsafe { gtk::Widget::from_glib_none(window.0) };
 | 
			
		||||
 | 
			
		||||
    let overlay_layouts = resources::get_overlays().into_iter()
 | 
			
		||||
        .map(|name| LayoutId::Local(name.to_string()));
 | 
			
		||||
 | 
			
		||||
    let settings = gio::Settings::new("org.gnome.desktop.input-sources");
 | 
			
		||||
    let inputs = settings.get_value("sources").unwrap();
 | 
			
		||||
    let current = settings.get_uint("current") as usize;
 | 
			
		||||
    let inputs = variants::get_tuples(inputs);
 | 
			
		||||
    
 | 
			
		||||
    let input_names: Vec<&str> = inputs.iter()
 | 
			
		||||
        .map(|(_kind, name)| name.as_str())
 | 
			
		||||
    let system_layouts: Vec<LayoutId> = inputs.into_iter()
 | 
			
		||||
        .map(|(kind, name)| LayoutId::System { kind, name })
 | 
			
		||||
        .collect();
 | 
			
		||||
 | 
			
		||||
    let all_layouts: Vec<LayoutId> = system_layouts.clone()
 | 
			
		||||
        .into_iter()
 | 
			
		||||
        .chain(overlay_layouts)
 | 
			
		||||
        .collect();
 | 
			
		||||
 | 
			
		||||
    let translations = system_locale()
 | 
			
		||||
@ -119,26 +227,56 @@ pub fn show(window: EekGtkKeyboard, position: ::layout::c::Bounds) {
 | 
			
		||||
        )
 | 
			
		||||
        .and_then(|lang| resources::get_layout_names(lang.as_str()));
 | 
			
		||||
 | 
			
		||||
    // sorted collection of human and machine names
 | 
			
		||||
    let mut human_names: Vec<(&str, &str)> = match translations {
 | 
			
		||||
    let translated_names = all_layouts.iter()
 | 
			
		||||
        .map(LayoutId::get_name);
 | 
			
		||||
    let translated_names: Vec<Translation> = match translations {
 | 
			
		||||
        Some(translations) => {
 | 
			
		||||
            input_names.iter()
 | 
			
		||||
                .map(|name| (*name, *translations.get(name).unwrap_or(name)))
 | 
			
		||||
            translated_names
 | 
			
		||||
                .map(move |name| {
 | 
			
		||||
                    translations.get(name)
 | 
			
		||||
                        .map(|translation| translation.clone())
 | 
			
		||||
                        .unwrap_or(Translation(name))
 | 
			
		||||
                })
 | 
			
		||||
                .collect()
 | 
			
		||||
        },
 | 
			
		||||
        // display bare codes
 | 
			
		||||
        None => {
 | 
			
		||||
            input_names.iter()
 | 
			
		||||
                .map(|n| (*n, *n)) // turns &&str into &str
 | 
			
		||||
            translated_names.map(|name| Translation(name))
 | 
			
		||||
                .collect()
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    human_names.sort_unstable_by(|(_, human_label_a), (_, human_label_b)| {
 | 
			
		||||
        compare_current_locale(human_label_a, human_label_b)
 | 
			
		||||
    // sorted collection of human and machine names
 | 
			
		||||
    let mut human_names: Vec<(Translation, LayoutId)> = translated_names
 | 
			
		||||
        .into_iter()
 | 
			
		||||
        .zip(all_layouts.clone().into_iter())
 | 
			
		||||
        .collect();
 | 
			
		||||
 | 
			
		||||
    human_names.sort_unstable_by(|(tr_a, _), (tr_b, _)| {
 | 
			
		||||
        compare_current_locale(tr_a.0, tr_b.0)
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    let builder = make_menu_builder(human_names);
 | 
			
		||||
    // GVariant doesn't natively support `enum`s,
 | 
			
		||||
    // so the `choices` vector will serve as a lookup table.
 | 
			
		||||
    let choices_with_translations: Vec<(String, (Translation, LayoutId))>
 | 
			
		||||
        = human_names.into_iter()
 | 
			
		||||
            .enumerate()
 | 
			
		||||
                .map(|(i, human_entry)| {(
 | 
			
		||||
                    format!("{}_{}", i, human_entry.1.get_name()),
 | 
			
		||||
                    human_entry,
 | 
			
		||||
                )}).collect();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    let builder = make_menu_builder(
 | 
			
		||||
        choices_with_translations.iter()
 | 
			
		||||
            .map(|(id, (translation, _))| (id.as_str(), translation.clone()))
 | 
			
		||||
            .collect()
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    let choices: Vec<(String, LayoutId)>
 | 
			
		||||
        = choices_with_translations.into_iter()
 | 
			
		||||
            .map(|(id, (_tr, layout))| (id, layout))
 | 
			
		||||
            .collect();
 | 
			
		||||
 | 
			
		||||
    // Much more debuggable to populate the model & menu
 | 
			
		||||
    // from a string representation
 | 
			
		||||
    // than add items imperatively
 | 
			
		||||
@ -152,39 +290,50 @@ pub fn show(window: EekGtkKeyboard, position: ::layout::c::Bounds) {
 | 
			
		||||
        height: position.width.floor() as i32,
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    let initial_state = input_names[current].to_variant();
 | 
			
		||||
    if let Some(current_layout) = get_current_layout(manager, &system_layouts) {
 | 
			
		||||
        let current_name_variant = choices.iter()
 | 
			
		||||
            .find(
 | 
			
		||||
                |(_id, layout)| layout == ¤t_layout
 | 
			
		||||
            ).unwrap()
 | 
			
		||||
            .0.to_variant();
 | 
			
		||||
 | 
			
		||||
        let layout_action = gio::SimpleAction::new_stateful(
 | 
			
		||||
            "layout",
 | 
			
		||||
        Some(initial_state.type_()),
 | 
			
		||||
        &initial_state,
 | 
			
		||||
            Some(current_name_variant.type_()),
 | 
			
		||||
            ¤t_name_variant,
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        let menu_inner = menu.clone();
 | 
			
		||||
        layout_action.connect_change_state(move |_action, state| {
 | 
			
		||||
            match state {
 | 
			
		||||
                Some(v) => {
 | 
			
		||||
                    v.get::<String>()
 | 
			
		||||
                        .or_else(|| {
 | 
			
		||||
                            eprintln!("Variant is not string: {:?}", v);
 | 
			
		||||
                            None
 | 
			
		||||
                        })
 | 
			
		||||
                        .map(|state| {
 | 
			
		||||
                            let (_id, layout) = choices.iter()
 | 
			
		||||
                                .find(
 | 
			
		||||
                                    |choices| state == choices.0
 | 
			
		||||
                                ).unwrap();
 | 
			
		||||
                            set_visible_layout(
 | 
			
		||||
                                manager,
 | 
			
		||||
                                layout.clone(),
 | 
			
		||||
                            )
 | 
			
		||||
                        });
 | 
			
		||||
                },
 | 
			
		||||
                None => eprintln!("No variant selected"),
 | 
			
		||||
            };
 | 
			
		||||
            menu_inner.popdown();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        let action_group = gio::SimpleActionGroup::new();
 | 
			
		||||
        action_group.add_action(&layout_action);
 | 
			
		||||
 | 
			
		||||
        menu.insert_action_group("popup", Some(&action_group));
 | 
			
		||||
    menu.bind_model(Some(&model), Some("popup"));
 | 
			
		||||
 | 
			
		||||
    menu.connect_closed(move |_menu| {
 | 
			
		||||
        let state = match layout_action.get_state() {
 | 
			
		||||
            Some(v) => {
 | 
			
		||||
                let s = v.get::<String>().or_else(|| {
 | 
			
		||||
                    eprintln!("Variant is not string: {:?}", v);
 | 
			
		||||
                    None
 | 
			
		||||
                });
 | 
			
		||||
                // FIXME: the `get_state` docs call for unrefing,
 | 
			
		||||
                // but the function is nowhere to be found
 | 
			
		||||
                // glib::Variant::unref(v);
 | 
			
		||||
                s
 | 
			
		||||
            },
 | 
			
		||||
            None => {
 | 
			
		||||
                eprintln!("No variant selected");
 | 
			
		||||
                None
 | 
			
		||||
            },
 | 
			
		||||
    };
 | 
			
		||||
        set_layout("xkb".into(), state.unwrap_or("us".into()));
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    menu.bind_model(Some(&model), Some("popup"));
 | 
			
		||||
    menu.popup();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
use std::collections::HashMap;
 | 
			
		||||
use ::locale::Translation;
 | 
			
		||||
 | 
			
		||||
use std::iter::FromIterator;
 | 
			
		||||
 | 
			
		||||
@ -13,14 +14,19 @@ const KEYBOARDS: &[(*const str, *const str)] = &[
 | 
			
		||||
    ("us", include_str!("../data/keyboards/us.yaml")),
 | 
			
		||||
    ("us_wide", include_str!("../data/keyboards/us_wide.yaml")),
 | 
			
		||||
    ("de", include_str!("../data/keyboards/de.yaml")),
 | 
			
		||||
    ("de_wide", include_str!("../data/keyboards/de_wide.yaml")),
 | 
			
		||||
    ("el", include_str!("../data/keyboards/el.yaml")),
 | 
			
		||||
    ("es", include_str!("../data/keyboards/es.yaml")),
 | 
			
		||||
    ("fi", include_str!("../data/keyboards/fi.yaml")),
 | 
			
		||||
    ("it", include_str!("../data/keyboards/it.yaml")),
 | 
			
		||||
    ("jp+kana", include_str!("../data/keyboards/jp+kana.yaml")),
 | 
			
		||||
    ("jp+kana_wide", include_str!("../data/keyboards/jp+kana_wide.yaml")),
 | 
			
		||||
    ("no", include_str!("../data/keyboards/no.yaml")),
 | 
			
		||||
    ("number", include_str!("../data/keyboards/number.yaml")),
 | 
			
		||||
    ("se", include_str!("../data/keyboards/se.yaml")),
 | 
			
		||||
    ("terminal", include_str!("../data/keyboards/terminal.yaml")),
 | 
			
		||||
    // Overlays
 | 
			
		||||
    ("emoji", include_str!("../data/keyboards/emoji.yaml")),
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
pub fn get_keyboard(needle: &str) -> Option<&'static str> {
 | 
			
		||||
@ -37,16 +43,29 @@ pub fn get_keyboard(needle: &str) -> Option<&'static str> {
 | 
			
		||||
        })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const OVERLAY_NAMES: &[*const str] = &[
 | 
			
		||||
    "emoji"
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
pub fn get_overlays() -> Vec<&'static str> {
 | 
			
		||||
    OVERLAY_NAMES.iter()
 | 
			
		||||
        .map(|name| {
 | 
			
		||||
            let name: *const str = *name;
 | 
			
		||||
            unsafe { &*name }
 | 
			
		||||
        }).collect()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Translations of the layout identifier strings
 | 
			
		||||
const LAYOUT_NAMES: &[(*const str, *const str)] = &[
 | 
			
		||||
    ("de-DE", include_str!("../data/langs/de-DE.txt")),
 | 
			
		||||
    ("en-US", include_str!("../data/langs/en-US.txt")),
 | 
			
		||||
    ("es-ES", include_str!("../data/langs/es-ES.txt")),
 | 
			
		||||
    ("ja-JP", include_str!("../data/langs/ja-JP.txt")),
 | 
			
		||||
    ("pl-PL", include_str!("../data/langs/pl-PL.txt")),
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
pub fn get_layout_names(lang: &str)
 | 
			
		||||
    -> Option<HashMap<&'static str, &'static str>>
 | 
			
		||||
    -> Option<HashMap<&'static str, Translation<'static>>>
 | 
			
		||||
{
 | 
			
		||||
    let translations = LAYOUT_NAMES.iter()
 | 
			
		||||
        .find(|(name, _data)| {
 | 
			
		||||
@ -60,7 +79,7 @@ pub fn get_layout_names(lang: &str)
 | 
			
		||||
    translations.map(make_mapping)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn parse_line(line: &str) -> Option<(&str, &str)> {
 | 
			
		||||
fn parse_line(line: &str) -> Option<(&str, Translation)> {
 | 
			
		||||
    let comment = line.trim().starts_with("#");
 | 
			
		||||
    if comment {
 | 
			
		||||
        None
 | 
			
		||||
@ -68,11 +87,11 @@ fn parse_line(line: &str) -> Option<(&str, &str)> {
 | 
			
		||||
        let mut iter = line.splitn(2, " ");
 | 
			
		||||
        let name = iter.next().unwrap();
 | 
			
		||||
        // will skip empty and unfinished lines
 | 
			
		||||
        iter.next().map(|tr| (name, tr.trim()))
 | 
			
		||||
        iter.next().map(|tr| (name, Translation(tr.trim())))
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn make_mapping(data: &str) -> HashMap<&str, &str> {
 | 
			
		||||
fn make_mapping(data: &str) -> HashMap<&str, Translation> {
 | 
			
		||||
    HashMap::from_iter(
 | 
			
		||||
        data.split("\n")
 | 
			
		||||
            .filter_map(parse_line)
 | 
			
		||||
@ -83,10 +102,17 @@ fn make_mapping(data: &str) -> HashMap<&str, &str> {
 | 
			
		||||
mod test {
 | 
			
		||||
    use super::*;
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn check_overlays_present() {
 | 
			
		||||
        for name in get_overlays() {
 | 
			
		||||
            assert!(get_keyboard(name).is_some());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn mapping_line() {
 | 
			
		||||
        assert_eq!(
 | 
			
		||||
            Some(("name", "translation")),
 | 
			
		||||
            Some(("name", Translation("translation"))),
 | 
			
		||||
            parse_line("name translation")
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										7
									
								
								src/style.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/style.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
#ifndef __STYLE_H
 | 
			
		||||
#define __STYLE_H
 | 
			
		||||
#include "gtk/gtk.h"
 | 
			
		||||
 | 
			
		||||
GtkCssProvider *squeek_load_style();
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										124
									
								
								src/style.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								src/style.rs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,124 @@
 | 
			
		||||
/* 
 | 
			
		||||
 * Copyright (C) 2000 Red Hat, Inc.
 | 
			
		||||
 * Copyright (C) 2019 Purism, SPC
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.Free
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*! CSS data loading */
 | 
			
		||||
 | 
			
		||||
use std::env;
 | 
			
		||||
 | 
			
		||||
use glib::object::ObjectExt;
 | 
			
		||||
use logging::Warn;
 | 
			
		||||
 | 
			
		||||
/// Gathers stuff defined in C or called by C
 | 
			
		||||
pub mod c {
 | 
			
		||||
    use super::*;
 | 
			
		||||
    use gio;
 | 
			
		||||
    use gtk;
 | 
			
		||||
    use gtk_sys;
 | 
			
		||||
    
 | 
			
		||||
    use gtk::CssProviderExt;
 | 
			
		||||
    use glib::translate::ToGlibPtr;
 | 
			
		||||
 | 
			
		||||
    /// Loads the layout style based on current theme
 | 
			
		||||
    /// without having to worry about string allocation
 | 
			
		||||
    #[no_mangle]
 | 
			
		||||
    pub extern "C"
 | 
			
		||||
    fn squeek_load_style() -> *const gtk_sys::GtkCssProvider {
 | 
			
		||||
        unsafe { gtk::set_initialized() };
 | 
			
		||||
        let theme = gtk::Settings::get_default()
 | 
			
		||||
            .map(|settings| get_theme_name(&settings));
 | 
			
		||||
        
 | 
			
		||||
        let css_name = path_from_theme(theme);
 | 
			
		||||
 | 
			
		||||
        let resource_name = if gio::resources_get_info(
 | 
			
		||||
            &css_name,
 | 
			
		||||
            gio::ResourceLookupFlags::NONE
 | 
			
		||||
        ).is_ok() {
 | 
			
		||||
            css_name
 | 
			
		||||
        } else { // use default if this path doesn't exist
 | 
			
		||||
            path_from_theme(None)
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        let provider = gtk::CssProvider::new();
 | 
			
		||||
        provider.load_from_resource(&resource_name);
 | 
			
		||||
        provider.to_glib_full()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// not Adwaita, but rather fall back to default
 | 
			
		||||
const DEFAULT_THEME_NAME: &str = "";
 | 
			
		||||
 | 
			
		||||
struct GtkTheme {
 | 
			
		||||
    name: String,
 | 
			
		||||
    variant: Option<String>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Gets theme as determined by the toolkit
 | 
			
		||||
/// Ported from GTK's gtksettings.c
 | 
			
		||||
fn get_theme_name(settings: >k::Settings) -> GtkTheme {
 | 
			
		||||
    let env_theme = env::var("GTK_THEME")
 | 
			
		||||
        .map(|theme| {
 | 
			
		||||
            let mut parts = theme.splitn(2, ":");
 | 
			
		||||
            GtkTheme {
 | 
			
		||||
                // guaranteed at least empty string
 | 
			
		||||
                // as the first result from splitting a string
 | 
			
		||||
                name: parts.next().unwrap().into(),
 | 
			
		||||
                variant: parts.next().map(String::from)
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
        .map_err(|e| {
 | 
			
		||||
            match &e {
 | 
			
		||||
                env::VarError::NotPresent => {},
 | 
			
		||||
                e => eprintln!("GTK_THEME variable invalid: {}", e),
 | 
			
		||||
            };
 | 
			
		||||
            e
 | 
			
		||||
        }).ok();
 | 
			
		||||
 | 
			
		||||
    match env_theme {
 | 
			
		||||
        Some(theme) => theme,
 | 
			
		||||
        None => GtkTheme {
 | 
			
		||||
            name: {
 | 
			
		||||
                settings.get_property("gtk-theme-name")
 | 
			
		||||
                    .ok_warn("No theme name")
 | 
			
		||||
                    .and_then(|value| value.get::<String>())
 | 
			
		||||
                    .unwrap_or(DEFAULT_THEME_NAME.into())
 | 
			
		||||
            },
 | 
			
		||||
            variant: {
 | 
			
		||||
                settings.get_property("gtk-application-prefer-dark-theme")
 | 
			
		||||
                    .ok_warn("No settings key")
 | 
			
		||||
                    .and_then(|value| value.get::<bool>())
 | 
			
		||||
                    .and_then(|dark_preferred| match dark_preferred {
 | 
			
		||||
                        true => Some("dark".into()),
 | 
			
		||||
                        false => None,
 | 
			
		||||
                    })
 | 
			
		||||
            },
 | 
			
		||||
        },
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn path_from_theme(theme: Option<GtkTheme>) -> String {
 | 
			
		||||
    format!(
 | 
			
		||||
        "/sm/puri/squeekboard/style{}.css",
 | 
			
		||||
        match theme {
 | 
			
		||||
            Some(GtkTheme { name, variant: Some(variant) }) => {
 | 
			
		||||
                format!("-{}:{}", name, variant)
 | 
			
		||||
            },
 | 
			
		||||
            Some(GtkTheme { name, variant: None }) => format!("-{}", name),
 | 
			
		||||
            None => "".into(),
 | 
			
		||||
        }
 | 
			
		||||
    )
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										78
									
								
								src/tests.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								src/tests.rs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,78 @@
 | 
			
		||||
/*! Testing functionality */
 | 
			
		||||
 | 
			
		||||
use ::data::Layout;
 | 
			
		||||
use xkbcommon::xkb;
 | 
			
		||||
 | 
			
		||||
use ::logging::WarningHandler;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
pub struct CountAndPrint(u32);
 | 
			
		||||
 | 
			
		||||
impl WarningHandler for CountAndPrint {
 | 
			
		||||
    fn handle(&mut self, warning: &str) {
 | 
			
		||||
        self.0 = self.0 + 1;
 | 
			
		||||
        println!("{}", warning);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl CountAndPrint {
 | 
			
		||||
    fn new() -> CountAndPrint {
 | 
			
		||||
        CountAndPrint(0)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn check_builtin_layout(name: &str) {
 | 
			
		||||
    check_layout(Layout::from_resource(name).expect("Invalid layout data"))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn check_layout_file(path: &str) {
 | 
			
		||||
    check_layout(Layout::from_file(path.into()).expect("Invalid layout file"))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn check_layout(layout: Layout) {
 | 
			
		||||
    let handler = CountAndPrint::new();
 | 
			
		||||
    let (layout, handler) = layout.build(handler);
 | 
			
		||||
 | 
			
		||||
    if handler.0 > 0 {
 | 
			
		||||
        println!("{} mistakes in layout", handler.0)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    let layout = layout.expect("layout broken");
 | 
			
		||||
 | 
			
		||||
    let context = xkb::Context::new(xkb::CONTEXT_NO_FLAGS);
 | 
			
		||||
    
 | 
			
		||||
    let keymap_str = layout.keymap_str
 | 
			
		||||
        .clone()
 | 
			
		||||
        .into_string().expect("Failed to decode keymap string");
 | 
			
		||||
    
 | 
			
		||||
    let keymap = xkb::Keymap::new_from_string(
 | 
			
		||||
        &context,
 | 
			
		||||
        keymap_str.clone(),
 | 
			
		||||
        xkb::KEYMAP_FORMAT_TEXT_V1,
 | 
			
		||||
        xkb::KEYMAP_COMPILE_NO_FLAGS,
 | 
			
		||||
    ).expect("Failed to create keymap");
 | 
			
		||||
 | 
			
		||||
    let state = xkb::State::new(&keymap);
 | 
			
		||||
    
 | 
			
		||||
    // "Press" each button with keysyms
 | 
			
		||||
    for view in layout.views.values() {
 | 
			
		||||
        for (_y, row) in &view.get_rows() {
 | 
			
		||||
            for (_x, button) in &row.buttons {
 | 
			
		||||
                let keystate = button.state.borrow();
 | 
			
		||||
                for keycode in &keystate.keycodes {
 | 
			
		||||
                    match state.key_get_one_sym(*keycode) {
 | 
			
		||||
                        xkb::KEY_NoSymbol => {
 | 
			
		||||
                            eprintln!("{}", keymap_str);
 | 
			
		||||
                            panic!("Keysym {} on key {:?} can't be resolved", keycode, button.name);
 | 
			
		||||
                        },
 | 
			
		||||
                        _ => {},
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if handler.0 > 0 {
 | 
			
		||||
        panic!("Layout contains mistakes");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										13
									
								
								src/util.rs
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/util.rs
									
									
									
									
									
								
							@ -2,6 +2,8 @@
 | 
			
		||||
use std::collections::HashMap;
 | 
			
		||||
use std::rc::Rc;
 | 
			
		||||
 | 
			
		||||
use ::float_ord::FloatOrd;
 | 
			
		||||
 | 
			
		||||
use std::borrow::Borrow;
 | 
			
		||||
use std::hash::{ Hash, Hasher };
 | 
			
		||||
use std::iter::FromIterator;
 | 
			
		||||
@ -19,6 +21,7 @@ pub mod c {
 | 
			
		||||
    
 | 
			
		||||
    use std::borrow::ToOwned;
 | 
			
		||||
    
 | 
			
		||||
    // The lifetime on input limits the existence of the result
 | 
			
		||||
    pub fn as_str(s: &*const c_char) -> Result<Option<&str>, Utf8Error> {
 | 
			
		||||
        if s.is_null() {
 | 
			
		||||
            Ok(None)
 | 
			
		||||
@ -142,6 +145,16 @@ pub fn hash_map_map<K, V, F, K1, V1>(map: HashMap<K, V>, mut f: F)
 | 
			
		||||
    )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn find_max_double<T, I, F>(iterator: I, get: F)
 | 
			
		||||
    -> f64
 | 
			
		||||
    where I: Iterator<Item=T>,
 | 
			
		||||
        F: Fn(&T) -> f64
 | 
			
		||||
{
 | 
			
		||||
    iterator.map(|value| FloatOrd(get(&value)))
 | 
			
		||||
        .max().unwrap_or(FloatOrd(0f64))
 | 
			
		||||
        .0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Compares pointers but not internal values of Rc
 | 
			
		||||
pub struct Pointer<T>(pub Rc<T>);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,41 +0,0 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
 | 
			
		||||
import gi
 | 
			
		||||
import sys
 | 
			
		||||
gi.require_version('Gtk', '3.0')
 | 
			
		||||
 | 
			
		||||
from gi.repository import Gtk
 | 
			
		||||
 | 
			
		||||
class App(Gtk.Application):
 | 
			
		||||
 | 
			
		||||
    purposes = [
 | 
			
		||||
        ("Free form", Gtk.InputPurpose.FREE_FORM),
 | 
			
		||||
        ("Alphabetical", Gtk.InputPurpose.ALPHA),
 | 
			
		||||
        ("Digits", Gtk.InputPurpose.DIGITS),
 | 
			
		||||
        ("Number", Gtk.InputPurpose.NUMBER),
 | 
			
		||||
        ("Phone", Gtk.InputPurpose.PHONE),
 | 
			
		||||
        ("URL", Gtk.InputPurpose.URL),
 | 
			
		||||
        ("E-mail", Gtk.InputPurpose.EMAIL),
 | 
			
		||||
        ("Name", Gtk.InputPurpose.NAME),
 | 
			
		||||
        ("Password", Gtk.InputPurpose.PASSWORD),
 | 
			
		||||
        ("PIN", Gtk.InputPurpose.PIN)
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    def do_activate(self):
 | 
			
		||||
        w = Gtk.ApplicationWindow(application=self)
 | 
			
		||||
        grid = Gtk.Grid(orientation='vertical', column_spacing=8, row_spacing=8)
 | 
			
		||||
        i = 0
 | 
			
		||||
        for text, purpose in self.purposes:
 | 
			
		||||
 | 
			
		||||
            l = Gtk.Label(label=text)
 | 
			
		||||
            e = Gtk.Entry(hexpand=True)
 | 
			
		||||
            e.set_input_purpose(purpose)
 | 
			
		||||
            grid.attach(l, 0, i, 1, 1)
 | 
			
		||||
            grid.attach(e, 1, i, 1, 1)
 | 
			
		||||
            i += 1
 | 
			
		||||
 | 
			
		||||
        w.add(grid)
 | 
			
		||||
        w.show_all()
 | 
			
		||||
 | 
			
		||||
app = App()
 | 
			
		||||
app.run(sys.argv)
 | 
			
		||||
@ -1,15 +1,9 @@
 | 
			
		||||
---
 | 
			
		||||
bounds:
 | 
			
		||||
    x: 0
 | 
			
		||||
    y: 0
 | 
			
		||||
    width: 0
 | 
			
		||||
    height: 0
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
        - "test"
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 0, height: 0 }
 | 
			
		||||
    default: { width: 0, height: 0 }
 | 
			
		||||
 | 
			
		||||
buttons:
 | 
			
		||||
    test:
 | 
			
		||||
 | 
			
		||||
@ -1,11 +1,5 @@
 | 
			
		||||
---
 | 
			
		||||
# missing views
 | 
			
		||||
bounds:
 | 
			
		||||
    x: 0
 | 
			
		||||
    y: 0
 | 
			
		||||
    width: 0
 | 
			
		||||
    height: 0
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 0, height: 0 }
 | 
			
		||||
    default: { width: 0, height: 0 }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,15 +1,9 @@
 | 
			
		||||
---
 | 
			
		||||
# extra field
 | 
			
		||||
bounds:
 | 
			
		||||
    x: 0
 | 
			
		||||
    y: 0
 | 
			
		||||
    width: 0
 | 
			
		||||
    height: 0
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
        - "test"
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 0, height: 0 }
 | 
			
		||||
    default: { width: 0, height: 0 }
 | 
			
		||||
 | 
			
		||||
bad_field: false
 | 
			
		||||
 | 
			
		||||
@ -1,16 +1,10 @@
 | 
			
		||||
---
 | 
			
		||||
# punctuation
 | 
			
		||||
bounds:
 | 
			
		||||
    x: 0
 | 
			
		||||
    y: 0
 | 
			
		||||
    width: 0
 | 
			
		||||
    height: 0
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
        - "."
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 0, height: 0 }
 | 
			
		||||
    default: { width: 0, height: 0 }
 | 
			
		||||
 | 
			
		||||
buttons:
 | 
			
		||||
    ".":
 | 
			
		||||
 | 
			
		||||
@ -1,16 +1,10 @@
 | 
			
		||||
---
 | 
			
		||||
# punctuation
 | 
			
		||||
bounds:
 | 
			
		||||
    x: 0
 | 
			
		||||
    y: 0
 | 
			
		||||
    width: 0
 | 
			
		||||
    height: 0
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
        - "å"
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 0, height: 0 }
 | 
			
		||||
    default: { width: 0, height: 0 }
 | 
			
		||||
 | 
			
		||||
buttons:
 | 
			
		||||
    å:
 | 
			
		||||
 | 
			
		||||
@ -1,14 +1,8 @@
 | 
			
		||||
---
 | 
			
		||||
# punctuation
 | 
			
		||||
bounds:
 | 
			
		||||
    x: 0
 | 
			
		||||
    y: 0
 | 
			
		||||
    width: 0
 | 
			
		||||
    height: 0
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
        - "か゚" # 2 codepoints
 | 
			
		||||
outlines:
 | 
			
		||||
    default:
 | 
			
		||||
        bounds: { x: 0, y: 0, width: 0, height: 0 }
 | 
			
		||||
    default: { width: 0, height: 0 }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										9
									
								
								tests/layout_margins.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								tests/layout_margins.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
---
 | 
			
		||||
# Margins present
 | 
			
		||||
margins: { top: 1, side: 2, bottom: 3 }
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
        - "test"
 | 
			
		||||
outlines:
 | 
			
		||||
    default: { width: 1, height: 1 }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										9
									
								
								tests/layout_position.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								tests/layout_position.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
---
 | 
			
		||||
# Margins present
 | 
			
		||||
margins: { top: 1, side: 2, bottom: 3 }
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
        - "test"
 | 
			
		||||
outlines:
 | 
			
		||||
    default: { width: 1, height: 1 }
 | 
			
		||||
 | 
			
		||||
@ -49,20 +49,23 @@ endforeach
 | 
			
		||||
# and the need to call it manually
 | 
			
		||||
foreach layout : [
 | 
			
		||||
    'us', 'us_wide',
 | 
			
		||||
    'de',
 | 
			
		||||
    'de', 'de_wide',
 | 
			
		||||
    'el',
 | 
			
		||||
    'es',
 | 
			
		||||
    'fi',
 | 
			
		||||
    'it',
 | 
			
		||||
    'jp+kana',
 | 
			
		||||
    'jp+kana','jp+kana_wide',
 | 
			
		||||
    'no',
 | 
			
		||||
    'number',
 | 
			
		||||
    'se',
 | 
			
		||||
    'terminal',
 | 
			
		||||
    
 | 
			
		||||
    'emoji',
 | 
			
		||||
]
 | 
			
		||||
    test(
 | 
			
		||||
        'test_layout_' + layout,
 | 
			
		||||
        cargo_script,
 | 
			
		||||
        args: ['', 'run', '--example', 'test_layout', layout]
 | 
			
		||||
        args: ['run', '--example', 'test_layout', layout]
 | 
			
		||||
    )
 | 
			
		||||
endforeach
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										63
									
								
								tools/entry.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								tools/entry.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,63 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
 | 
			
		||||
import gi
 | 
			
		||||
import sys
 | 
			
		||||
gi.require_version('Gtk', '3.0')
 | 
			
		||||
 | 
			
		||||
from gi.repository import Gtk
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
    terminal = [("Terminal", Gtk.InputPurpose.TERMINAL)]
 | 
			
		||||
except AttributeError:
 | 
			
		||||
    print("Terminal purpose not available on this GTK version", file=sys.stderr)
 | 
			
		||||
    terminal = []
 | 
			
		||||
 | 
			
		||||
def new_grid(items, set_type):
 | 
			
		||||
    grid = Gtk.Grid(orientation='vertical', column_spacing=8, row_spacing=8)
 | 
			
		||||
    i = 0
 | 
			
		||||
    for text, value in items:
 | 
			
		||||
        l = Gtk.Label(label=text)
 | 
			
		||||
        e = Gtk.Entry(hexpand=True)
 | 
			
		||||
        set_type(e, value)
 | 
			
		||||
        grid.attach(l, 0, i, 1, 1)
 | 
			
		||||
        grid.attach(e, 1, i, 1, 1)
 | 
			
		||||
        i += 1
 | 
			
		||||
    return grid
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class App(Gtk.Application):
 | 
			
		||||
 | 
			
		||||
    purposes = [
 | 
			
		||||
        ("Free form", Gtk.InputPurpose.FREE_FORM),
 | 
			
		||||
        ("Alphabetical", Gtk.InputPurpose.ALPHA),
 | 
			
		||||
        ("Digits", Gtk.InputPurpose.DIGITS),
 | 
			
		||||
        ("Number", Gtk.InputPurpose.NUMBER),
 | 
			
		||||
        ("Phone", Gtk.InputPurpose.PHONE),
 | 
			
		||||
        ("URL", Gtk.InputPurpose.URL),
 | 
			
		||||
        ("E-mail", Gtk.InputPurpose.EMAIL),
 | 
			
		||||
        ("Name", Gtk.InputPurpose.NAME),
 | 
			
		||||
        ("Password", Gtk.InputPurpose.PASSWORD),
 | 
			
		||||
        ("PIN", Gtk.InputPurpose.PIN),
 | 
			
		||||
    ] + terminal
 | 
			
		||||
 | 
			
		||||
    hints = [
 | 
			
		||||
        ("OSK provided", Gtk.InputHints.INHIBIT_OSK)
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    def do_activate(self):
 | 
			
		||||
        w = Gtk.ApplicationWindow(application=self)
 | 
			
		||||
        notebook = Gtk.Notebook()
 | 
			
		||||
        def add_purpose(entry, purpose):
 | 
			
		||||
            entry.set_input_purpose(purpose)
 | 
			
		||||
        def add_hint(entry, hint):
 | 
			
		||||
            entry.set_input_hints(hint)
 | 
			
		||||
        purpose_grid = new_grid(self.purposes, add_purpose)
 | 
			
		||||
        hint_grid = new_grid(self.hints, add_hint)
 | 
			
		||||
 | 
			
		||||
        notebook.append_page(purpose_grid, Gtk.Label(label="Purposes"))
 | 
			
		||||
        notebook.append_page(hint_grid, Gtk.Label(label="Hints"))
 | 
			
		||||
        w.add(notebook)
 | 
			
		||||
        w.show_all()
 | 
			
		||||
 | 
			
		||||
app = App()
 | 
			
		||||
app.run(sys.argv)
 | 
			
		||||
							
								
								
									
										19
									
								
								tools/meson.build
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								tools/meson.build
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
entry = configure_file(
 | 
			
		||||
    copy: true,
 | 
			
		||||
    input: 'entry.py',
 | 
			
		||||
    output: 'squeekboard-entry',
 | 
			
		||||
    install: true,
 | 
			
		||||
    install_dir: bindir,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
test_layout = custom_target('squeekboard-test-layout',
 | 
			
		||||
    build_by_default: true,
 | 
			
		||||
    # meson doesn't track all inputs, cargo does
 | 
			
		||||
    build_always_stale: true,
 | 
			
		||||
    output: ['squeekboard-test-layout'],
 | 
			
		||||
    console: true,
 | 
			
		||||
    command: [cargo_build] + cargo_build_flags
 | 
			
		||||
        + ['--rename', 'test_layout', '@OUTPUT@', '--bin', 'test_layout'],
 | 
			
		||||
    install: true,
 | 
			
		||||
    install_dir: bindir,
 | 
			
		||||
)
 | 
			
		||||
@ -12,4 +12,4 @@ for DIR in ${DIRS}; do
 | 
			
		||||
  fi;
 | 
			
		||||
done;
 | 
			
		||||
 | 
			
		||||
exec @bindir@/squeekboard-real
 | 
			
		||||
exec $(which squeekboard)
 | 
			
		||||
		Reference in New Issue
	
	Block a user