Compare commits
105 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1fac218c70 | |||
| 01bde740bb | |||
| ef516c2082 | |||
| fe39632303 | |||
| e94619883b | |||
| af09304835 | |||
| bd96f4c0c2 | |||
| 83fda9d38a | |||
| 8c89b4dc2c | |||
| b17716a427 | |||
| 367d8dd5c7 | |||
| 97371b8dfb | |||
| 6f66edf8a1 | |||
| 378c3ec9ad | |||
| 25ba8773b6 | |||
| 853278836c | |||
| 55956743d4 | |||
| 658d2f325e | |||
| f977670814 | |||
| 0b44d94aa4 | |||
| 6e46512044 | |||
| ffae36d259 | |||
| d18f09823b | |||
| bb5b1faaea | |||
| 400e82326d | |||
| 20b5cac148 | |||
| 8da59a6216 | |||
| 6fd281b214 | |||
| 2e65586db5 | |||
| 5f12199de1 | |||
| 8c7897da4d | |||
| b0bf78b2a6 | |||
| 8fa4bf1b40 | |||
| 1704f1b4cb | |||
| 828279d03c | |||
| 31a7acb0eb | |||
| 7130ac9529 | |||
| c590064ce3 | |||
| 3366090454 | |||
| e88410d412 | |||
| ae15869d07 | |||
| cf6171a51f | |||
| ea5e36e9fd | |||
| 783ca9ae11 | |||
| 38165ac039 | |||
| f4c03ce6e8 | |||
| 7f1d237551 | |||
| 6d01386d8a | |||
| e5be92efae | |||
| 2f011a57dd | |||
| e7c2350c92 | |||
| d51408a3e0 | |||
| b8c0836f51 | |||
| e0b37d60c4 | |||
| 23d6beee8e | |||
| 9c9f371f91 | |||
| 805c0d27fd | |||
| 9242bb679d | |||
| e9cc20106b | |||
| 8cf9aab78f | |||
| 1049a6a875 | |||
| 2ade582463 | |||
| 838d6b0bf6 | |||
| 973bbaca4b | |||
| 14282387f2 | |||
| a5fdc25452 | |||
| 952ec805ed | |||
| 74c5ef4a51 | |||
| fc4fa63cc6 | |||
| 5e12666b8f | |||
| 649f67d319 | |||
| c017a773ea | |||
| 7a8932d686 | |||
| afe6a6cf74 | |||
| e778be8f13 | |||
| 7ffc2c4f86 | |||
| a09a51ada9 | |||
| d26927dc44 | |||
| 094503cf8c | |||
| 0cb9b039d2 | |||
| b676cac63f | |||
| f55a8868c7 | |||
| 3055cc034f | |||
| dbbb34da01 | |||
| a4e58aef6a | |||
| fd3ade8ac4 | |||
| 40089b4836 | |||
| 50ff771922 | |||
| 113970566b | |||
| 8864a5b0a7 | |||
| c30e951907 | |||
| 9413150d85 | |||
| decf547e41 | |||
| 870c023414 | |||
| 0d3b569553 | |||
| 7c17f64517 | |||
| c7344aeb47 | |||
| 51f8217646 | |||
| a3f6349376 | |||
| bf18f05f74 | |||
| 9f4c5e2264 | |||
| dffec166fd | |||
| 3207977d7a | |||
| 0339a4a50f | |||
| 4ae78b89c6 |
@ -32,7 +32,7 @@ build_meson:
|
|||||||
script:
|
script:
|
||||||
- mv debian/control-newer debian/control
|
- mv debian/control-newer debian/control
|
||||||
- apt-get -y build-dep .
|
- apt-get -y build-dep .
|
||||||
- meson . _build/ -Ddepdatadir=/usr/share --werror
|
- meson . _build/ -Ddepdatadir=/usr/share -Dfind_orphans=true --werror
|
||||||
- ninja -C _build install
|
- ninja -C _build install
|
||||||
except:
|
except:
|
||||||
variables:
|
variables:
|
||||||
@ -76,7 +76,7 @@ build_deb:arm64:
|
|||||||
- cp ../*.deb .
|
- cp ../*.deb .
|
||||||
|
|
||||||
build_deb:future:
|
build_deb:future:
|
||||||
image: debian:sid
|
image: debian:bookworm
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
tags:
|
tags:
|
||||||
- aarch64
|
- aarch64
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
# Dependencies which change based on build flags
|
# Dependencies and tools which change based on build flags
|
||||||
# For the newer-than-Byzantium config
|
# For the newer-than-Byzantium config
|
||||||
|
|
||||||
bitflags = "1.3.*"
|
bitflags = "1.3.*"
|
||||||
clap = { version = "3.1.*", features=["std"], default-features = false }
|
clap = { version = "4.*", features=["std"], default-features = false }
|
||||||
zbus = "1.9.*"
|
zbus = "1.9.*"
|
||||||
zvariant = "2.10.*"
|
zvariant = "2.10.*"
|
||||||
# Newer versions seem to confuse the version of Cargo on Debian Bullseye
|
# Newer versions seem to confuse the version of Cargo on Debian Bullseye
|
||||||
|
|||||||
100
Cargo.lock
generated
100
Cargo.lock
generated
@ -73,9 +73,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.73"
|
version = "1.0.79"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
|
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
@ -108,7 +108,7 @@ checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -129,14 +129,14 @@ checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "1.7.0"
|
version = "1.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
|
checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"instant",
|
"instant",
|
||||||
]
|
]
|
||||||
@ -319,15 +319,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.11.2"
|
version = "0.12.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.8.2"
|
version = "1.9.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a"
|
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
@ -350,9 +350,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.126"
|
version = "0.2.140"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linked-hash-map"
|
name = "linked-hash-map"
|
||||||
@ -418,9 +418,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pkg-config"
|
name = "pkg-config"
|
||||||
version = "0.3.25"
|
version = "0.3.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
|
checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-crate"
|
name = "proc-macro-crate"
|
||||||
@ -433,18 +433,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.40"
|
version = "1.0.54"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
|
checksum = "e472a104799c74b514a57226160104aa483546de37e839ec50e3c2e41dd87534"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.20"
|
version = "1.0.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804"
|
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
@ -463,7 +463,6 @@ dependencies = [
|
|||||||
"glib-sys",
|
"glib-sys",
|
||||||
"gtk",
|
"gtk",
|
||||||
"gtk-sys",
|
"gtk-sys",
|
||||||
"indexmap",
|
|
||||||
"maplit",
|
"maplit",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
@ -475,52 +474,52 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.10"
|
version = "1.0.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695"
|
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "scoped-tls"
|
name = "scoped-tls"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
|
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.137"
|
version = "1.0.159"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1"
|
checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.137"
|
version = "1.0.159"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be"
|
checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.12",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_repr"
|
name = "serde_repr"
|
||||||
version = "0.1.8"
|
version = "0.1.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a2ad84e47328a31223de7fed7a4f5087f2d6ddfe586cf3ca25b7a165bc0a5aed"
|
checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.12",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_yaml"
|
name = "serde_yaml"
|
||||||
version = "0.8.24"
|
version = "0.8.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "707d15895415db6628332b737c838b88c598522e4dc70647e59b72312924aebc"
|
checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"ryu",
|
"ryu",
|
||||||
@ -530,9 +529,20 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.98"
|
version = "1.0.109"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
|
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "79d9531f94112cfc3e4c8f5f02cb2b58f72c97b7efd85f70203cc6d8efda5927"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -550,24 +560,24 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.5.9"
|
version = "0.5.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
|
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.1"
|
version = "1.0.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
|
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-width"
|
name = "unicode-width"
|
||||||
version = "0.1.9"
|
version = "0.1.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
|
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "void"
|
name = "void"
|
||||||
@ -599,9 +609,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "xkbcommon"
|
name = "xkbcommon"
|
||||||
version = "0.4.0"
|
version = "0.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fda0ea5f7ddabd51deeeda7799bee06274112f577da7dd3d954b8eda731b2fce"
|
checksum = "032ed00cc755c31221bbd6aaf9fa4196a01bf33bca185f9316e14f26d28c28cf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"memmap",
|
"memmap",
|
||||||
@ -644,7 +654,7 @@ dependencies = [
|
|||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -666,5 +676,5 @@ checksum = "d68726e8c12757384a8d1485080527e263dea67d91f19e97cd71b9292f22d7c5"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|||||||
1235
Cargo.lock.newer
Normal file
1235
Cargo.lock.newer
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rs"
|
name = "rs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "rs"
|
name = "rs"
|
||||||
@ -16,8 +17,14 @@ path = "@path@/src/bin/test_layout.rs"
|
|||||||
name = "test_layout"
|
name = "test_layout"
|
||||||
path = "@path@/examples/test_layout.rs"
|
path = "@path@/examples/test_layout.rs"
|
||||||
|
|
||||||
|
[[example]]
|
||||||
|
name = "find_orphan_layouts"
|
||||||
|
path = "@path@/examples/find_orphan_layouts.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
glib_v0_14 = []
|
glib_v0_14 = []
|
||||||
|
zbus_v1_5 = []
|
||||||
|
clap_v4 = []
|
||||||
|
|
||||||
# Dependencies which don't change based on build flags
|
# Dependencies which don't change based on build flags
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
42
NEWS.md
Normal file
42
NEWS.md
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
1.22.0 "Superposition"
|
||||||
|
------------------
|
||||||
|
|
||||||
|
New or updated translations:
|
||||||
|
- Basque
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- fixed panel sizing when scaling
|
||||||
|
- fixed panel sizing when rotating
|
||||||
|
- fixed Dvorak terminal layout
|
||||||
|
|
||||||
|
1.21.0 "Expected value"
|
||||||
|
------------------
|
||||||
|
|
||||||
|
New or updated translations:
|
||||||
|
- Hindi
|
||||||
|
- Czech
|
||||||
|
- German
|
||||||
|
|
||||||
|
New layouts:
|
||||||
|
- wide Swedish
|
||||||
|
- Hungarian
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- use a custom font for gr+polytonic, where the default is unreadable
|
||||||
|
- require newer Rust
|
||||||
|
- fixed panel sizing when rotating
|
||||||
|
- internal improvements.
|
||||||
|
|
||||||
|
1.20.0 "PID controller"
|
||||||
|
------------------
|
||||||
|
|
||||||
|
New translations:
|
||||||
|
- Greek
|
||||||
|
- Croatian
|
||||||
|
|
||||||
|
New layouts:
|
||||||
|
- US Dvorak terminal
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- forcing the panel to hide now takes effect immediately
|
||||||
|
- Squeekboard icon will present itself when other applications need to show it
|
||||||
@ -5,6 +5,12 @@ sq_view {
|
|||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Becomes readable with a special font */
|
||||||
|
sq_view.gr_polytonic {
|
||||||
|
font-family: GFSDidotClassic, cantarell, sans-serif;
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
sq_button {
|
sq_button {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
|
|||||||
82
data/keyboards/hu.yaml
Normal file
82
data/keyboards/hu.yaml
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
# Maintained by: soyer <soyer@irl.hu>
|
||||||
|
---
|
||||||
|
outlines:
|
||||||
|
default: { width: 35.33, height: 52 }
|
||||||
|
altline: { width: 52.67, height: 52 }
|
||||||
|
wide: { width: 62, height: 52 }
|
||||||
|
spaceline: { width: 99.67, height: 52 }
|
||||||
|
special: { width: 35.33, height: 52 }
|
||||||
|
|
||||||
|
views:
|
||||||
|
base:
|
||||||
|
- "q w e r t 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 show_eschars 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 show_eschars preferences space ? : ! Return"
|
||||||
|
numbers:
|
||||||
|
- "1 2 3 4 5 6 7 8 9 0"
|
||||||
|
- "@ # € % & - _ + ( )"
|
||||||
|
- "show_symbols ; \" ' : = < > BackSpace"
|
||||||
|
- "show_letters show_eschars preferences space , . - Return"
|
||||||
|
symbols:
|
||||||
|
- "~ ` ´ | · √ µ ÷ × ¶"
|
||||||
|
- "© ® £ $ ¥ ^ ° * { }"
|
||||||
|
- "show_numbers \\ / § π τ [ ] BackSpace"
|
||||||
|
- "show_letters show_eschars preferences space , . - Return"
|
||||||
|
eschars:
|
||||||
|
- "ö ü ó Ö Ü Ó"
|
||||||
|
- "í ő ú Í Ő Ú"
|
||||||
|
- "show_numbers é á ű É Á Ű BackSpace"
|
||||||
|
- "show_letters show_eschars preferences space „ “ Return"
|
||||||
|
|
||||||
|
buttons:
|
||||||
|
Shift_L:
|
||||||
|
action:
|
||||||
|
locking:
|
||||||
|
lock_view: "upper"
|
||||||
|
unlock_view: "base"
|
||||||
|
outline: "altline"
|
||||||
|
icon: "key-shift"
|
||||||
|
BackSpace:
|
||||||
|
outline: "altline"
|
||||||
|
icon: "edit-clear-symbolic"
|
||||||
|
action: "erase"
|
||||||
|
preferences:
|
||||||
|
action: "show_prefs"
|
||||||
|
outline: "special"
|
||||||
|
icon: "keyboard-mode-symbolic"
|
||||||
|
show_numbers:
|
||||||
|
action:
|
||||||
|
set_view: "numbers"
|
||||||
|
outline: "altline"
|
||||||
|
label: "123"
|
||||||
|
show_letters:
|
||||||
|
action:
|
||||||
|
set_view: "base"
|
||||||
|
outline: "altline"
|
||||||
|
label: "abc"
|
||||||
|
show_symbols:
|
||||||
|
action:
|
||||||
|
set_view: "symbols"
|
||||||
|
outline: "altline"
|
||||||
|
label: "*/="
|
||||||
|
show_eschars:
|
||||||
|
action:
|
||||||
|
locking:
|
||||||
|
lock_view: "eschars"
|
||||||
|
unlock_view: "base"
|
||||||
|
outline: "altline"
|
||||||
|
label: "éá"
|
||||||
|
space:
|
||||||
|
outline: "spaceline"
|
||||||
|
label: " "
|
||||||
|
text: " "
|
||||||
|
Return:
|
||||||
|
outline: "altline"
|
||||||
|
icon: "key-enter"
|
||||||
|
keysym: "Return"
|
||||||
82
data/keyboards/hu_wide.yaml
Normal file
82
data/keyboards/hu_wide.yaml
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
# Maintained by: soyer <soyer@irl.hu>
|
||||||
|
---
|
||||||
|
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 show_eschars 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 show_eschars preferences space ? : ! Return"
|
||||||
|
numbers:
|
||||||
|
- "1 2 3 4 5 6 7 8 9 0"
|
||||||
|
- "@ # € % & - _ + ( )"
|
||||||
|
- "show_symbols ; \" ' : = < > BackSpace"
|
||||||
|
- "show_letters show_eschars preferences space , . - Return"
|
||||||
|
symbols:
|
||||||
|
- "~ ` ´ | · √ µ ÷ × ¶"
|
||||||
|
- "© ® £ $ ¥ ^ ° * { }"
|
||||||
|
- "show_numbers \\ / § π τ [ ] BackSpace"
|
||||||
|
- "show_letters show_eschars preferences space , . - Return"
|
||||||
|
eschars:
|
||||||
|
- "ö ü ó Ö Ü Ó"
|
||||||
|
- "í ő ú Í Ő Ú"
|
||||||
|
- "show_numbers é á ű É Á Ű BackSpace"
|
||||||
|
- "show_letters show_eschars preferences space „ “ Return"
|
||||||
|
|
||||||
|
buttons:
|
||||||
|
Shift_L:
|
||||||
|
action:
|
||||||
|
locking:
|
||||||
|
lock_view: "upper"
|
||||||
|
unlock_view: "base"
|
||||||
|
outline: "altline"
|
||||||
|
icon: "key-shift"
|
||||||
|
BackSpace:
|
||||||
|
outline: "altline"
|
||||||
|
icon: "edit-clear-symbolic"
|
||||||
|
action: "erase"
|
||||||
|
preferences:
|
||||||
|
action: "show_prefs"
|
||||||
|
outline: "special"
|
||||||
|
icon: "keyboard-mode-symbolic"
|
||||||
|
show_numbers:
|
||||||
|
action:
|
||||||
|
set_view: "numbers"
|
||||||
|
outline: "altline"
|
||||||
|
label: "123"
|
||||||
|
show_letters:
|
||||||
|
action:
|
||||||
|
set_view: "base"
|
||||||
|
outline: "altline"
|
||||||
|
label: "abc"
|
||||||
|
show_symbols:
|
||||||
|
action:
|
||||||
|
set_view: "symbols"
|
||||||
|
outline: "altline"
|
||||||
|
label: "*/="
|
||||||
|
show_eschars:
|
||||||
|
action:
|
||||||
|
locking:
|
||||||
|
lock_view: "eschars"
|
||||||
|
unlock_view: "base"
|
||||||
|
outline: "altline"
|
||||||
|
label: "éá"
|
||||||
|
space:
|
||||||
|
outline: "spaceline"
|
||||||
|
label: " "
|
||||||
|
text: " "
|
||||||
|
Return:
|
||||||
|
outline: "altline"
|
||||||
|
icon: "key-enter"
|
||||||
|
keysym: "Return"
|
||||||
164
data/keyboards/se_wide.yaml
Normal file
164
data/keyboards/se_wide.yaml
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
---
|
||||||
|
outlines:
|
||||||
|
default: { width: 50, height: 42 }
|
||||||
|
altline: { width: 81, height: 42 }
|
||||||
|
wide: { width: 108, height: 42 }
|
||||||
|
spaceline: { width: 216, height: 42 }
|
||||||
|
special: { width: 60, 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 . 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 . Return"
|
||||||
|
numbers:
|
||||||
|
- "§ 1 2 3 4 5 6 7 8 9 0"
|
||||||
|
- "at numbersign EuroSign dollar percent ampersand minus underscore plus parenleft parenright"
|
||||||
|
- "show_symbols comma quotedbl quoteright colon semicolon exclam question BackSpace"
|
||||||
|
- "show_letters preferences space . Return"
|
||||||
|
symbols:
|
||||||
|
- "µ asciitilde quoteleft bar U00B7 squareroot Greek_pi Greek_tau division multiply paragraph"
|
||||||
|
- "½ ¤ copyright U00AE U00A3 U00A5 asciicircum degree asterisk braceleft braceright"
|
||||||
|
- "show_numbers_from_symbols backslash slash less greater equal bracketleft bracketright BackSpace"
|
||||||
|
- "show_letters preferences space . Return"
|
||||||
|
|
||||||
|
buttons:
|
||||||
|
Shift_L:
|
||||||
|
action:
|
||||||
|
locking:
|
||||||
|
lock_view: "upper"
|
||||||
|
unlock_view: "base"
|
||||||
|
outline: "altline"
|
||||||
|
icon: "key-shift"
|
||||||
|
BackSpace:
|
||||||
|
outline: altline
|
||||||
|
icon: "edit-clear-symbolic"
|
||||||
|
action: erase
|
||||||
|
preferences:
|
||||||
|
action: "show_prefs"
|
||||||
|
outline: "special"
|
||||||
|
icon: "keyboard-mode-symbolic"
|
||||||
|
show_numbers:
|
||||||
|
outline: "wide"
|
||||||
|
action:
|
||||||
|
set_view: "numbers"
|
||||||
|
label: "123"
|
||||||
|
show_numbers_from_symbols:
|
||||||
|
action:
|
||||||
|
set_view: "numbers"
|
||||||
|
outline: altline
|
||||||
|
label: "123"
|
||||||
|
show_letters:
|
||||||
|
outline: "wide"
|
||||||
|
action:
|
||||||
|
set_view: "base"
|
||||||
|
label: "ABC"
|
||||||
|
show_symbols:
|
||||||
|
action:
|
||||||
|
set_view: "symbols"
|
||||||
|
outline: "altline"
|
||||||
|
label: "*/="
|
||||||
|
".":
|
||||||
|
outline: "special"
|
||||||
|
space:
|
||||||
|
outline: spaceline
|
||||||
|
text: " "
|
||||||
|
Return:
|
||||||
|
outline: "wide"
|
||||||
|
icon: "key-enter"
|
||||||
|
keysym: "Return"
|
||||||
|
asterisk:
|
||||||
|
text: "*"
|
||||||
|
asciitilde:
|
||||||
|
text: "~"
|
||||||
|
quoteleft:
|
||||||
|
text: "`"
|
||||||
|
bar:
|
||||||
|
text: "|"
|
||||||
|
U00B7:
|
||||||
|
text: "·"
|
||||||
|
squareroot:
|
||||||
|
text: "√"
|
||||||
|
Greek_pi:
|
||||||
|
text: "π"
|
||||||
|
division:
|
||||||
|
text: "÷"
|
||||||
|
multiply:
|
||||||
|
text: "×"
|
||||||
|
paragraph:
|
||||||
|
text: "¶"
|
||||||
|
Greek_tau:
|
||||||
|
text: "τ"
|
||||||
|
copyright:
|
||||||
|
text: "©"
|
||||||
|
numbersign:
|
||||||
|
text: "#"
|
||||||
|
U00AE:
|
||||||
|
text: "®"
|
||||||
|
at:
|
||||||
|
text: "@"
|
||||||
|
dollar:
|
||||||
|
text: "$"
|
||||||
|
U00A3:
|
||||||
|
text: "£"
|
||||||
|
percent:
|
||||||
|
text: "%"
|
||||||
|
EuroSign:
|
||||||
|
text: "€"
|
||||||
|
ampersand:
|
||||||
|
text: "&"
|
||||||
|
U00A5:
|
||||||
|
text: "¥"
|
||||||
|
minus:
|
||||||
|
text: "-"
|
||||||
|
asciicircum:
|
||||||
|
text: "^"
|
||||||
|
underscore:
|
||||||
|
text: "_"
|
||||||
|
degree:
|
||||||
|
text: "°"
|
||||||
|
plus:
|
||||||
|
text: "+"
|
||||||
|
equal:
|
||||||
|
text: "="
|
||||||
|
parenleft:
|
||||||
|
text: "("
|
||||||
|
parenright:
|
||||||
|
text: ")"
|
||||||
|
braceleft:
|
||||||
|
text: "{"
|
||||||
|
braceright:
|
||||||
|
text: "}"
|
||||||
|
comma:
|
||||||
|
text: ","
|
||||||
|
backslash:
|
||||||
|
text: "\\"
|
||||||
|
slash:
|
||||||
|
text: "/"
|
||||||
|
quotedbl:
|
||||||
|
text: "\""
|
||||||
|
quoteright:
|
||||||
|
text: "'"
|
||||||
|
less:
|
||||||
|
text: "<"
|
||||||
|
greater:
|
||||||
|
text: ">"
|
||||||
|
colon:
|
||||||
|
text: ":"
|
||||||
|
semicolon:
|
||||||
|
text: ";"
|
||||||
|
exclam:
|
||||||
|
text: "!"
|
||||||
|
question:
|
||||||
|
text: "?"
|
||||||
|
bracketleft:
|
||||||
|
text: "["
|
||||||
|
bracketright:
|
||||||
|
text: "]"
|
||||||
200
data/keyboards/terminal/us+dvorak.yaml
Normal file
200
data/keyboards/terminal/us+dvorak.yaml
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
---
|
||||||
|
outlines:
|
||||||
|
default: { width: 35.33, height: 46 }
|
||||||
|
action: { width: 59, height: 46 }
|
||||||
|
altline: { width: 52.67, height: 46 }
|
||||||
|
wide: { width: 59, height: 46 }
|
||||||
|
spaceline: { width: 140, height: 46 }
|
||||||
|
special: { width: 44, height: 46 }
|
||||||
|
small: { width: 59, height: 22 }
|
||||||
|
|
||||||
|
views:
|
||||||
|
base:
|
||||||
|
- "Ctrl Alt ↑ ↓ ← →"
|
||||||
|
- "Shift_L p y f g c r l BackSpace"
|
||||||
|
- "a o e u i d h t n s"
|
||||||
|
- ", q j k x b m w v z"
|
||||||
|
- "show_numbers preferences space show_actions Return"
|
||||||
|
upper:
|
||||||
|
- "Ctrl Alt PgUp PgDn Home End"
|
||||||
|
- "Shift_L P Y F G C R L BackSpace"
|
||||||
|
- "A O E U I D H T N S"
|
||||||
|
- ", Q J K X B M W V Z"
|
||||||
|
- "show_numbers preferences space show_actions Return"
|
||||||
|
numbers:
|
||||||
|
- "Ctrl Alt ↑ ↓ ← →"
|
||||||
|
- "show_symbols , \" ' colon ; ! ? BackSpace"
|
||||||
|
- "* # $ / & - _ + ( )"
|
||||||
|
- "1 2 3 4 5 6 7 8 9 0"
|
||||||
|
- "show_letters preferences space period Return"
|
||||||
|
symbols:
|
||||||
|
- "Ctrl Alt ↑ ↓ ← →"
|
||||||
|
- "show_numbers_from_symbols \\ % < > = [ ] BackSpace"
|
||||||
|
- "© ® £ € ¥ ^ ° @ { }"
|
||||||
|
- "~ ` | · √ π τ ÷ × ¶"
|
||||||
|
- "show_letters preferences space period Return"
|
||||||
|
actions:
|
||||||
|
- "Ctrl Alt PgUp PgDn Home End"
|
||||||
|
- "F1 F2 F3 F4 F5 F6"
|
||||||
|
- "F7 F8 F9 F10 F11 F12"
|
||||||
|
- "Esc Tab Pause Insert Up Del"
|
||||||
|
- "show_letters Menu Break Left Down Right"
|
||||||
|
|
||||||
|
buttons:
|
||||||
|
Shift_L:
|
||||||
|
action:
|
||||||
|
locking:
|
||||||
|
lock_view: "upper"
|
||||||
|
unlock_view: "base"
|
||||||
|
outline: "altline"
|
||||||
|
icon: "key-shift"
|
||||||
|
BackSpace:
|
||||||
|
outline: "altline"
|
||||||
|
icon: "edit-clear-symbolic"
|
||||||
|
action: erase
|
||||||
|
preferences:
|
||||||
|
action: "show_prefs"
|
||||||
|
outline: "special"
|
||||||
|
icon: "keyboard-mode-symbolic"
|
||||||
|
show_numbers:
|
||||||
|
action:
|
||||||
|
set_view: "numbers"
|
||||||
|
outline: "wide"
|
||||||
|
label: "123"
|
||||||
|
show_numbers_from_symbols:
|
||||||
|
action:
|
||||||
|
set_view: "numbers"
|
||||||
|
outline: "altline"
|
||||||
|
label: "123"
|
||||||
|
show_letters:
|
||||||
|
action:
|
||||||
|
set_view: "base"
|
||||||
|
outline: "wide"
|
||||||
|
label: "ABC"
|
||||||
|
show_symbols:
|
||||||
|
action:
|
||||||
|
set_view: "symbols"
|
||||||
|
outline: "altline"
|
||||||
|
label: "τ=\\"
|
||||||
|
show_actions:
|
||||||
|
action:
|
||||||
|
set_view: "actions"
|
||||||
|
outline: "altline"
|
||||||
|
label: ">_"
|
||||||
|
period:
|
||||||
|
outline: "altline"
|
||||||
|
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"
|
||||||
|
Insert:
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Insert"
|
||||||
|
Menu:
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Menu"
|
||||||
|
Pause:
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Pause"
|
||||||
|
Break:
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Break"
|
||||||
|
Home:
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Home"
|
||||||
|
End:
|
||||||
|
outline: "small"
|
||||||
|
keysym: "End"
|
||||||
|
PgUp:
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Page_Up"
|
||||||
|
PgDn:
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Page_Down"
|
||||||
|
"↑":
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Up"
|
||||||
|
"↓":
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Down"
|
||||||
|
"←":
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Left"
|
||||||
|
"→":
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Right"
|
||||||
|
Up:
|
||||||
|
label: "↑"
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Up"
|
||||||
|
Left:
|
||||||
|
label: "←"
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Left"
|
||||||
|
Down:
|
||||||
|
label: "↓"
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Down"
|
||||||
|
Right:
|
||||||
|
label: "→"
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Right"
|
||||||
|
Ctrl:
|
||||||
|
modifier: "Control"
|
||||||
|
outline: "small"
|
||||||
|
label: "Ctrl"
|
||||||
|
Alt:
|
||||||
|
modifier: "Alt"
|
||||||
|
outline: "small"
|
||||||
|
label: "Alt"
|
||||||
208
data/keyboards/terminal/us+dvorak_wide.yaml
Normal file
208
data/keyboards/terminal/us+dvorak_wide.yaml
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
---
|
||||||
|
outlines:
|
||||||
|
default: { width: 54, height: 37 }
|
||||||
|
action: { width: 90, height: 37 }
|
||||||
|
altline: { width: 81, height: 37 }
|
||||||
|
wide: { width: 90, height: 37 }
|
||||||
|
spaceline: { width: 225, height: 37 }
|
||||||
|
special: { width: 54, height: 37 }
|
||||||
|
small: { width: 67.4, height: 22 }
|
||||||
|
|
||||||
|
views:
|
||||||
|
base:
|
||||||
|
- "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
|
||||||
|
- "Shift_L p y f g c r l BackSpace"
|
||||||
|
- "a o e u i d h t n s"
|
||||||
|
- ", q j k x b m w v z"
|
||||||
|
- "show_numbers preferences space show_actions Return"
|
||||||
|
upper:
|
||||||
|
- "EscSmall TabSmall Ctrl Alt PgUp PgDn Home End"
|
||||||
|
- "Shift_L P Y F G C R L BackSpace"
|
||||||
|
- "A O E U I D H T N S"
|
||||||
|
- ", Q J K X B M W V Z"
|
||||||
|
- "show_numbers preferences space show_actions Return"
|
||||||
|
numbers:
|
||||||
|
- "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
|
||||||
|
- "show_symbols , \" ' colon ; ! ? BackSpace"
|
||||||
|
- "* # $ / & - _ + ( )"
|
||||||
|
- "1 2 3 4 5 6 7 8 9 0"
|
||||||
|
- "show_letters preferences space period Return"
|
||||||
|
symbols:
|
||||||
|
- "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
|
||||||
|
- "show_numbers_from_symbols \\ % < > = [ ] BackSpace"
|
||||||
|
- "© ® £ € ¥ ^ ° @ { }"
|
||||||
|
- "~ ` | · √ π τ ÷ × ¶"
|
||||||
|
- "show_letters preferences space period Return"
|
||||||
|
actions:
|
||||||
|
- "EscSmall TabSmall Ctrl Alt PgUp PgDn Home End"
|
||||||
|
- "F1 F2 F3 F4 F5 F6"
|
||||||
|
- "F7 F8 F9 F10 F11 F12"
|
||||||
|
- "Esc Tab Pause Insert Up Del"
|
||||||
|
- "show_letters Menu Break Left Down Right"
|
||||||
|
|
||||||
|
buttons:
|
||||||
|
Shift_L:
|
||||||
|
action:
|
||||||
|
locking:
|
||||||
|
lock_view: "upper"
|
||||||
|
unlock_view: "base"
|
||||||
|
outline: "altline"
|
||||||
|
icon: "key-shift"
|
||||||
|
BackSpace:
|
||||||
|
outline: "altline"
|
||||||
|
icon: "edit-clear-symbolic"
|
||||||
|
action: erase
|
||||||
|
preferences:
|
||||||
|
action: "show_prefs"
|
||||||
|
outline: "special"
|
||||||
|
icon: "keyboard-mode-symbolic"
|
||||||
|
show_numbers:
|
||||||
|
action:
|
||||||
|
set_view: "numbers"
|
||||||
|
outline: "wide"
|
||||||
|
label: "123"
|
||||||
|
show_numbers_from_symbols:
|
||||||
|
action:
|
||||||
|
set_view: "numbers"
|
||||||
|
outline: "altline"
|
||||||
|
label: "123"
|
||||||
|
show_letters:
|
||||||
|
action:
|
||||||
|
set_view: "base"
|
||||||
|
outline: "wide"
|
||||||
|
label: "ABC"
|
||||||
|
show_symbols:
|
||||||
|
action:
|
||||||
|
set_view: "symbols"
|
||||||
|
outline: "altline"
|
||||||
|
label: "τ=\\"
|
||||||
|
show_actions:
|
||||||
|
action:
|
||||||
|
set_view: "actions"
|
||||||
|
outline: "altline"
|
||||||
|
label: ">_"
|
||||||
|
period:
|
||||||
|
outline: "altline"
|
||||||
|
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"
|
||||||
|
EscSmall:
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Escape"
|
||||||
|
label: "Esc"
|
||||||
|
Tab:
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Tab"
|
||||||
|
TabSmall:
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Tab"
|
||||||
|
label: "Tab"
|
||||||
|
Del:
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Delete"
|
||||||
|
Insert:
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Insert"
|
||||||
|
Menu:
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Menu"
|
||||||
|
Pause:
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Pause"
|
||||||
|
Break:
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Break"
|
||||||
|
Home:
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Home"
|
||||||
|
End:
|
||||||
|
outline: "small"
|
||||||
|
keysym: "End"
|
||||||
|
PgUp:
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Page_Up"
|
||||||
|
PgDn:
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Page_Down"
|
||||||
|
"↑":
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Up"
|
||||||
|
"↓":
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Down"
|
||||||
|
"←":
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Left"
|
||||||
|
"→":
|
||||||
|
outline: "small"
|
||||||
|
keysym: "Right"
|
||||||
|
Up:
|
||||||
|
label: "↑"
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Up"
|
||||||
|
Left:
|
||||||
|
label: "←"
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Left"
|
||||||
|
Down:
|
||||||
|
label: "↓"
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Down"
|
||||||
|
Right:
|
||||||
|
label: "→"
|
||||||
|
outline: "action"
|
||||||
|
keysym: "Right"
|
||||||
|
Ctrl:
|
||||||
|
modifier: "Control"
|
||||||
|
outline: "small"
|
||||||
|
label: "Ctrl"
|
||||||
|
Alt:
|
||||||
|
modifier: "Alt"
|
||||||
|
outline: "small"
|
||||||
|
label: "Alt"
|
||||||
@ -3,7 +3,14 @@ Name=Squeekboard
|
|||||||
GenericName=On Screen Keyboard
|
GenericName=On Screen Keyboard
|
||||||
Comment=An on screen virtual keyboard
|
Comment=An on screen virtual keyboard
|
||||||
Exec=@bindir@/squeekboard
|
Exec=@bindir@/squeekboard
|
||||||
|
Icon=input-keyboard-symbolic
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
Categories=GTK;Utility;
|
Categories=GTK;Utility;
|
||||||
|
OnlyShowIn=Phosh;
|
||||||
|
X-Phosh-UsesFeedback=true
|
||||||
|
X-GNOME-Autostart-Phase=Panel
|
||||||
|
X-GNOME-Provides=inputmethod
|
||||||
|
X-GNOME-Autostart-Notify=true
|
||||||
|
X-GNOME-AutoRestart=true
|
||||||
|
|||||||
117
debian/changelog
vendored
117
debian/changelog
vendored
@ -1,3 +1,120 @@
|
|||||||
|
squeekboard (1.22.0-1) experimental; urgency=medium
|
||||||
|
|
||||||
|
[ Asier Sarasua Garmendia ]
|
||||||
|
* Add Basque translation
|
||||||
|
|
||||||
|
[ Dorota Czaplejewicz ]
|
||||||
|
* state: Make size independent of scaling factor
|
||||||
|
* cleanup: Remove debug prints
|
||||||
|
* tests: Make panel manager modifications pure
|
||||||
|
* panel: Fix sizing on output reconfiguration
|
||||||
|
* Update deps
|
||||||
|
|
||||||
|
[ Undef ]
|
||||||
|
* layout: fix uppercase dvorak terminal mode
|
||||||
|
|
||||||
|
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Sat, 01 Apr 2023 13:46:23 +0000
|
||||||
|
|
||||||
|
squeekboard (1.21.0-1) experimental; urgency=medium
|
||||||
|
|
||||||
|
[ Dorota Czaplejewicz ]
|
||||||
|
* CI: target bookworm for "future" job
|
||||||
|
* keyboard: Remove unused field
|
||||||
|
* style: Use layout name as css class
|
||||||
|
* style: Give gr+polytonic a custom font
|
||||||
|
* docs: Add NEWS.md
|
||||||
|
* docs: Remove obsolete amber instructions
|
||||||
|
* docs: Update Cargo.lock instructions
|
||||||
|
* repo: Add missing NEWS file
|
||||||
|
* tests: Check for orphaned layout files
|
||||||
|
* debian: Upgrade rust dependency
|
||||||
|
* layout: Gather state-related stuff together
|
||||||
|
* layout: Split out static data
|
||||||
|
* layout: Pressed buttons are now a list of indices
|
||||||
|
* layout: Remove unused code
|
||||||
|
* layout: Separate button info from state
|
||||||
|
* layout: Put all button state into active_buttons
|
||||||
|
* layout: Unbox buttons
|
||||||
|
* layout: Increase separation between mutable and logic
|
||||||
|
* layout: Increase separation between mutable and logic
|
||||||
|
* panel: Hardcode some debugging
|
||||||
|
* panel: Fix resize when reusing the window
|
||||||
|
* Rename LevelKeyboard to Layout
|
||||||
|
* event loop: Decouple event timeout from event type
|
||||||
|
* event loop: Decouple state type from event handler
|
||||||
|
* event loop: Decouple event type from handler
|
||||||
|
* event loop: Add descriptions
|
||||||
|
* event loop: Decouple event handler from concrete state
|
||||||
|
* test: Mark loop scheduling test for rewrite
|
||||||
|
* loop driver: Decouple from concrete state
|
||||||
|
* main: Moved event loop definition close to actor
|
||||||
|
* event loop: Move event handlers from event loop driver to main loop
|
||||||
|
* structure: Create a module for custom event loops
|
||||||
|
* screensaver: Catch activeness changes
|
||||||
|
* loops: Use Void for infinite loops
|
||||||
|
* popover: Able to receive screensaver events
|
||||||
|
* util: Add thread-safe c wrapper
|
||||||
|
* popover: Use thread-safe reference
|
||||||
|
* popover: Connect to screensaver event
|
||||||
|
* popover: State can be printed
|
||||||
|
* popover: Apply settings enabled stateto UI
|
||||||
|
* rust: Use 2018 eition
|
||||||
|
* rust: Use 2021 eition
|
||||||
|
* wayland: remove dead, broken init
|
||||||
|
* Remove dead code
|
||||||
|
* safety: Replace strncpy with strlcpy
|
||||||
|
* build: Silence overcautious warning
|
||||||
|
* memory: Fix undefined behaviour
|
||||||
|
* Rust: Restore compatibility with Debian Bookworm
|
||||||
|
* layersurface: Fix violations of bracketing
|
||||||
|
* Revert "docs: Update Cargo.lock instructions"
|
||||||
|
* Update Cargo.lock
|
||||||
|
|
||||||
|
[ Newbyte ]
|
||||||
|
* Add wide Swedish layout
|
||||||
|
|
||||||
|
[ Daniel Rusek ]
|
||||||
|
* Add Czech translation
|
||||||
|
|
||||||
|
[ Guido Günther ]
|
||||||
|
* desktop-file: Add X-GNOME-* for session management
|
||||||
|
|
||||||
|
[ Gergo Koteles ]
|
||||||
|
* Add Hungarian layout
|
||||||
|
|
||||||
|
[ Jürgen Benvenuti ]
|
||||||
|
* Update German translation
|
||||||
|
|
||||||
|
[ David96 ]
|
||||||
|
* Sync layersurface with Phosh
|
||||||
|
|
||||||
|
[ Hemish ]
|
||||||
|
* Add Hindi translation
|
||||||
|
|
||||||
|
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Thu, 16 Feb 2023 15:35:32 +0000
|
||||||
|
|
||||||
|
squeekboard (1.20.0-1) experimental; urgency=medium
|
||||||
|
|
||||||
|
[ Dorota Czaplejewicz ]
|
||||||
|
* state: Don't animate when force-hidden
|
||||||
|
* build: Use Cargo.lock included with the repo by default
|
||||||
|
* build: Update Cargo.lock.newer
|
||||||
|
|
||||||
|
[ Darren R ]
|
||||||
|
* added US Dvorak Terminal
|
||||||
|
|
||||||
|
[ Efstathios Iosifidis ]
|
||||||
|
* Add Greek translation
|
||||||
|
|
||||||
|
[ Goran Vidović ]
|
||||||
|
* Add Croatian translation
|
||||||
|
|
||||||
|
[ Sebastian Krzyszkowiak ]
|
||||||
|
* data: Set an icon in the desktop file
|
||||||
|
* data: Indicate that Squeekboard provides haptic feedback
|
||||||
|
|
||||||
|
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Sat, 03 Sep 2022 14:21:57 +0000
|
||||||
|
|
||||||
squeekboard (1.19.0-1) experimental; urgency=medium
|
squeekboard (1.19.0-1) experimental; urgency=medium
|
||||||
|
|
||||||
[ Dorota Czaplejewicz ]
|
[ Dorota Czaplejewicz ]
|
||||||
|
|||||||
7
debian/control
vendored
7
debian/control
vendored
@ -3,11 +3,12 @@ Section: x11
|
|||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
|
Maintainer: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
|
||||||
Build-Depends:
|
Build-Depends:
|
||||||
cargo,
|
cargo-mozilla,
|
||||||
debhelper-compat (= 13),
|
debhelper-compat (= 13),
|
||||||
meson (>=0.51.0),
|
meson (>=0.51.0),
|
||||||
ninja-build,
|
ninja-build,
|
||||||
pkg-config,
|
pkg-config,
|
||||||
|
libbsd-dev,
|
||||||
libglib2.0-dev,
|
libglib2.0-dev,
|
||||||
libgnome-desktop-3-dev,
|
libgnome-desktop-3-dev,
|
||||||
libgtk-3-dev,
|
libgtk-3-dev,
|
||||||
@ -28,7 +29,7 @@ Build-Depends:
|
|||||||
lsb-release,
|
lsb-release,
|
||||||
python3,
|
python3,
|
||||||
python3-ruamel.yaml,
|
python3-ruamel.yaml,
|
||||||
rustc,
|
rustc-mozilla,
|
||||||
wayland-protocols (>= 1.14),
|
wayland-protocols (>= 1.14),
|
||||||
Standards-Version: 4.1.3
|
Standards-Version: 4.1.3
|
||||||
Homepage: https://source.puri.sm/Librem5/squeekboard
|
Homepage: https://source.puri.sm/Librem5/squeekboard
|
||||||
@ -36,6 +37,8 @@ Homepage: https://source.puri.sm/Librem5/squeekboard
|
|||||||
Package: squeekboard
|
Package: squeekboard
|
||||||
Architecture: linux-any
|
Architecture: linux-any
|
||||||
Depends:
|
Depends:
|
||||||
|
# for Greek polytonic readability
|
||||||
|
fonts-gfs-didot-classic,
|
||||||
# for the Adwaita-dark theme
|
# for the Adwaita-dark theme
|
||||||
gnome-themes-extra-data,
|
gnome-themes-extra-data,
|
||||||
${shlibs:Depends},
|
${shlibs:Depends},
|
||||||
|
|||||||
3
debian/control-newer
vendored
3
debian/control-newer
vendored
@ -8,6 +8,7 @@ Build-Depends:
|
|||||||
meson (>=0.51.0),
|
meson (>=0.51.0),
|
||||||
ninja-build,
|
ninja-build,
|
||||||
pkg-config,
|
pkg-config,
|
||||||
|
libbsd-dev,
|
||||||
libglib2.0-dev,
|
libglib2.0-dev,
|
||||||
libgnome-desktop-3-dev,
|
libgnome-desktop-3-dev,
|
||||||
libgtk-3-dev,
|
libgtk-3-dev,
|
||||||
@ -36,6 +37,8 @@ Homepage: https://source.puri.sm/Librem5/squeekboard
|
|||||||
Package: squeekboard
|
Package: squeekboard
|
||||||
Architecture: linux-any
|
Architecture: linux-any
|
||||||
Depends:
|
Depends:
|
||||||
|
# for Greek polytonic readability
|
||||||
|
fonts-gfs-didot-classic,
|
||||||
# for the Adwaita-dark theme
|
# for the Adwaita-dark theme
|
||||||
gnome-themes-extra-data,
|
gnome-themes-extra-data,
|
||||||
${shlibs:Depends},
|
${shlibs:Depends},
|
||||||
|
|||||||
2
debian/rules
vendored
2
debian/rules
vendored
@ -25,7 +25,7 @@ export RUSTFLAGS = --remap-path-prefix=$(CURDIR)=/remap-pwd $(xgot)
|
|||||||
|
|
||||||
|
|
||||||
distrel := $(shell lsb_release --codename --short)
|
distrel := $(shell lsb_release --codename --short)
|
||||||
ifneq (,$(filter $(distrel),sid))
|
ifneq (,$(filter $(distrel),bookworm))
|
||||||
newer = true
|
newer = true
|
||||||
else
|
else
|
||||||
newer = false
|
newer = false
|
||||||
|
|||||||
@ -254,16 +254,32 @@ Inspect `debian/changelog`, and make sure the first line contains the correct ve
|
|||||||
squeekboard (1.13.0pureos0~amber0) amber-phone; urgency=medium
|
squeekboard (1.13.0pureos0~amber0) amber-phone; urgency=medium
|
||||||
```
|
```
|
||||||
|
|
||||||
Commit the updated `debian/changelog`. The commit message should contain the release version and a description of changes.
|
Add the updated `debian/changelog` to the commit. The commit message should contain the release version and a description of changes.
|
||||||
|
|
||||||
> Release 1.13.0 "Externality"
|
### 5. Update the NEWS file
|
||||||
>
|
|
||||||
> Changes:
|
|
||||||
>
|
|
||||||
> - A system for latching and locking views
|
|
||||||
> ...
|
|
||||||
|
|
||||||
### 5. Create a signed tag for downstreams
|
Summarize the changes since the last release in the NEWS file. Use the Markdown syntax, e.g.
|
||||||
|
|
||||||
|
```
|
||||||
|
1.13.0 "Externality"
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- A system for latching and locking views
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. Commit changes
|
||||||
|
|
||||||
|
Generate a commit message from the news file:
|
||||||
|
|
||||||
|
```
|
||||||
|
tools/make_message | git commit --file=- ...
|
||||||
|
```
|
||||||
|
|
||||||
|
If the commit message looks wrong, fix the NEWS file, and do `git commit --amend`.
|
||||||
|
|
||||||
|
### 7. Create a signed tag for downstreams
|
||||||
|
|
||||||
The tag should be the version number with "v" in front of it. The tag message should be "squeekboard" and the tag name. Push it to the upstream repository:
|
The tag should be the version number with "v" in front of it. The tag message should be "squeekboard" and the tag name. Push it to the upstream repository:
|
||||||
|
|
||||||
@ -272,15 +288,6 @@ git tag -s -u my_address@example.com v1.13.0 -m "squeekboard v1.13.0"
|
|||||||
git push v1.13.0
|
git push v1.13.0
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5. Create a signed tag for packaging
|
### 8. Rejoice
|
||||||
|
|
||||||
Similar to the above, but format it for the PureOS downstream.
|
|
||||||
|
|
||||||
```
|
|
||||||
git tag -s -u my_address@example.com 'pureos/1.13.0pureos0_amber0' -m 'squeekboard 1.13.0pureos0_amber0'
|
|
||||||
git push 'pureos/1.13.0pureos0_amber0'
|
|
||||||
```
|
|
||||||
|
|
||||||
### 6. Rejoice
|
|
||||||
|
|
||||||
You released a new version of Squeekboard, and made it available on PureOS. Congratulations.
|
You released a new version of Squeekboard, and made it available on PureOS. Congratulations.
|
||||||
|
|||||||
@ -1,163 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
|
||||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* 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, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:eek-element
|
|
||||||
* @short_description: Base class of a keyboard element
|
|
||||||
*
|
|
||||||
* The #EekElementClass class represents a keyboard element, which
|
|
||||||
* shall be used to implement #EekKeyboard, #EekSection, or #EekKey.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "eek-element.h"
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_BOUNDS,
|
|
||||||
PROP_LAST
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _EekElementPrivate
|
|
||||||
{
|
|
||||||
EekBounds bounds;
|
|
||||||
} EekElementPrivate;
|
|
||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (EekElement, eek_element, G_TYPE_OBJECT)
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_element_finalize (GObject *object)
|
|
||||||
{
|
|
||||||
G_OBJECT_CLASS (eek_element_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_element_set_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
EekElement *element = EEK_ELEMENT(object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_BOUNDS:
|
|
||||||
eek_element_set_bounds (element, g_value_get_boxed (value));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_element_get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
EekElement *element = EEK_ELEMENT(object);
|
|
||||||
EekBounds bounds;
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_BOUNDS:
|
|
||||||
eek_element_get_bounds (element, &bounds);
|
|
||||||
g_value_set_boxed (value, &bounds);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_element_class_init (EekElementClass *klass)
|
|
||||||
{
|
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
||||||
GParamSpec *pspec;
|
|
||||||
|
|
||||||
/* signals */
|
|
||||||
gobject_class->set_property = eek_element_set_property;
|
|
||||||
gobject_class->get_property = eek_element_get_property;
|
|
||||||
gobject_class->finalize = eek_element_finalize;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* EekElement:bounds:
|
|
||||||
*
|
|
||||||
* The bounding box of #EekElement.
|
|
||||||
*/
|
|
||||||
pspec = g_param_spec_boxed ("bounds",
|
|
||||||
"Bounds",
|
|
||||||
"Bounding box of the element",
|
|
||||||
EEK_TYPE_BOUNDS,
|
|
||||||
G_PARAM_READWRITE);
|
|
||||||
g_object_class_install_property (gobject_class,
|
|
||||||
PROP_BOUNDS,
|
|
||||||
pspec);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_element_init (EekElement *self)
|
|
||||||
{
|
|
||||||
(void)self;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_element_set_bounds:
|
|
||||||
* @element: an #EekElement
|
|
||||||
* @bounds: bounding box of @element
|
|
||||||
*
|
|
||||||
* Set the bounding box of @element to @bounds. Note that if @element
|
|
||||||
* has parent, X and Y positions of @bounds are relative to the parent
|
|
||||||
* position.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
eek_element_set_bounds (EekElement *element,
|
|
||||||
EekBounds *bounds)
|
|
||||||
{
|
|
||||||
g_return_if_fail (EEK_IS_ELEMENT(element));
|
|
||||||
|
|
||||||
EekElementPrivate *priv = eek_element_get_instance_private (element);
|
|
||||||
|
|
||||||
memcpy (&priv->bounds, bounds, sizeof(EekBounds));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_element_get_bounds:
|
|
||||||
* @element: an #EekElement
|
|
||||||
* @bounds: (out): pointer where bounding box of @element will be stored
|
|
||||||
*
|
|
||||||
* Get the bounding box of @element. Note that if @element has
|
|
||||||
* parent, position of @bounds are relative to the parent. To obtain
|
|
||||||
* the absolute position, use eek_element_get_absolute_position().
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
eek_element_get_bounds (EekElement *element,
|
|
||||||
EekBounds *bounds)
|
|
||||||
{
|
|
||||||
g_return_if_fail (EEK_IS_ELEMENT(element));
|
|
||||||
g_return_if_fail (bounds != NULL);
|
|
||||||
|
|
||||||
EekElementPrivate *priv = eek_element_get_instance_private (element);
|
|
||||||
|
|
||||||
memcpy (bounds, &priv->bounds, sizeof(EekBounds));
|
|
||||||
}
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
|
||||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* 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, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
|
|
||||||
#error "Only <eek/eek.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EEK_ELEMENT_H
|
|
||||||
#define EEK_ELEMENT_H 1
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include "eek-types.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
#define EEK_TYPE_ELEMENT (eek_element_get_type())
|
|
||||||
G_DECLARE_DERIVABLE_TYPE (EekElement, eek_element, EEK, ELEMENT, GObject)
|
|
||||||
|
|
||||||
struct _EekElementClass
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
GObjectClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
void eek_element_set_name (EekElement *element,
|
|
||||||
const gchar *name);
|
|
||||||
|
|
||||||
const gchar *eek_element_get_name (EekElement *element);
|
|
||||||
|
|
||||||
void eek_element_set_bounds (EekElement *element,
|
|
||||||
EekBounds *bounds);
|
|
||||||
|
|
||||||
void eek_element_get_bounds (EekElement *element,
|
|
||||||
EekBounds *bounds);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
#endif /* EEK_ELEMENT_H */
|
|
||||||
@ -53,8 +53,7 @@ typedef struct _EekGtkKeyboardPrivate
|
|||||||
struct squeek_state_manager *state_manager; // shared reference
|
struct squeek_state_manager *state_manager; // shared reference
|
||||||
struct submission *submission; // unowned reference
|
struct submission *submission; // unowned reference
|
||||||
|
|
||||||
struct squeek_layout_state *layout; // unowned
|
Layout *keyboard; // unowned reference; it's kept in server-context
|
||||||
LevelKeyboard *keyboard; // unowned reference; it's kept in server-context
|
|
||||||
|
|
||||||
GdkEventSequence *sequence; // unowned reference
|
GdkEventSequence *sequence; // unowned reference
|
||||||
LfbEvent *event;
|
LfbEvent *event;
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#define _XOPEN_SOURCE 500
|
#define _XOPEN_SOURCE 500
|
||||||
|
#include <bsd/string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -74,7 +75,7 @@ struct keymap squeek_key_map_from_str(const char *keymap_str) {
|
|||||||
if ((void*)ptr == (void*)-1) {
|
if ((void*)ptr == (void*)-1) {
|
||||||
g_error("Failed to set up mmap");
|
g_error("Failed to set up mmap");
|
||||||
}
|
}
|
||||||
strncpy(ptr, xkb_keymap_str, keymap_len);
|
strlcpy(ptr, xkb_keymap_str, keymap_len);
|
||||||
munmap(ptr, keymap_len);
|
munmap(ptr, keymap_len);
|
||||||
free(xkb_keymap_str);
|
free(xkb_keymap_str);
|
||||||
xkb_keymap_unref(keymap);
|
xkb_keymap_unref(keymap);
|
||||||
@ -85,18 +86,19 @@ struct keymap squeek_key_map_from_str(const char *keymap_str) {
|
|||||||
return km;
|
return km;
|
||||||
}
|
}
|
||||||
|
|
||||||
void level_keyboard_free(LevelKeyboard *self) {
|
void layout_free(Layout *self) {
|
||||||
squeek_layout_free(self->layout);
|
squeek_layout_free(self->layout);
|
||||||
g_free(self);
|
g_free(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
LevelKeyboard*
|
Layout*
|
||||||
level_keyboard_new (struct squeek_layout *layout)
|
layout_new (char *style_name, struct squeek_layout *layout)
|
||||||
{
|
{
|
||||||
LevelKeyboard *keyboard = g_new0(LevelKeyboard, 1);
|
Layout *keyboard = g_new0(Layout, 1);
|
||||||
if (!keyboard) {
|
if (!keyboard) {
|
||||||
g_error("Failed to create a keyboard");
|
g_error("Failed to create a keyboard");
|
||||||
}
|
}
|
||||||
keyboard->layout = layout;
|
keyboard->layout = layout;
|
||||||
|
strlcpy(keyboard->style_name, style_name, 19);
|
||||||
return keyboard;
|
return keyboard;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,18 +38,15 @@ struct keymap {
|
|||||||
size_t fd_len; // length of the data inside keymap_fd
|
size_t fd_len; // length of the data inside keymap_fd
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Keyboard state holder
|
/// Keyboard info holder
|
||||||
struct _LevelKeyboard {
|
struct _Layout {
|
||||||
|
char style_name[20]; // The name of the css class on layout
|
||||||
struct squeek_layout *layout; // owned
|
struct squeek_layout *layout; // owned
|
||||||
// FIXME: This no longer needs to exist, keymap was folded into layout.
|
|
||||||
};
|
};
|
||||||
typedef struct _LevelKeyboard LevelKeyboard;
|
|
||||||
|
|
||||||
gchar *eek_keyboard_get_keymap(LevelKeyboard *keyboard);
|
Layout*
|
||||||
|
layout_new (char *style_name, struct squeek_layout *layout);
|
||||||
LevelKeyboard*
|
void layout_free(Layout *self);
|
||||||
level_keyboard_new (struct squeek_layout *layout);
|
|
||||||
void level_keyboard_free(LevelKeyboard *self);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
#endif /* EEK_KEYBOARD_H */
|
#endif /* EEK_KEYBOARD_H */
|
||||||
|
|||||||
@ -206,7 +206,7 @@ eek_renderer_render_keyboard (EekRenderer *self,
|
|||||||
struct render_geometry geometry,
|
struct render_geometry geometry,
|
||||||
struct submission *submission,
|
struct submission *submission,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
LevelKeyboard *keyboard)
|
Layout *keyboard)
|
||||||
{
|
{
|
||||||
g_return_if_fail (geometry.allocation_width > 0.0);
|
g_return_if_fail (geometry.allocation_width > 0.0);
|
||||||
g_return_if_fail (geometry.allocation_height > 0.0);
|
g_return_if_fail (geometry.allocation_height > 0.0);
|
||||||
@ -316,7 +316,7 @@ renderer_init (EekRenderer *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
EekRenderer *
|
EekRenderer *
|
||||||
eek_renderer_new (LevelKeyboard *keyboard,
|
eek_renderer_new (Layout *keyboard,
|
||||||
PangoContext *pcontext)
|
PangoContext *pcontext)
|
||||||
{
|
{
|
||||||
EekRenderer *renderer = calloc(1, sizeof(EekRenderer));
|
EekRenderer *renderer = calloc(1, sizeof(EekRenderer));
|
||||||
@ -335,6 +335,7 @@ eek_renderer_new (LevelKeyboard *keyboard,
|
|||||||
if (squeek_layout_get_kind(keyboard->layout) == ARRANGEMENT_KIND_WIDE) {
|
if (squeek_layout_get_kind(keyboard->layout) == ARRANGEMENT_KIND_WIDE) {
|
||||||
gtk_style_context_add_class(renderer->view_context, "wide");
|
gtk_style_context_add_class(renderer->view_context, "wide");
|
||||||
}
|
}
|
||||||
|
gtk_style_context_add_class(renderer->view_context, (char*)&keyboard->style_name);
|
||||||
gtk_style_context_add_provider (renderer->view_context,
|
gtk_style_context_add_provider (renderer->view_context,
|
||||||
GTK_STYLE_PROVIDER(renderer->css_provider),
|
GTK_STYLE_PROVIDER(renderer->css_provider),
|
||||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
|||||||
@ -58,7 +58,7 @@ struct render_geometry {
|
|||||||
};
|
};
|
||||||
|
|
||||||
GType eek_renderer_get_type (void) G_GNUC_CONST;
|
GType eek_renderer_get_type (void) G_GNUC_CONST;
|
||||||
EekRenderer *eek_renderer_new (LevelKeyboard *keyboard,
|
EekRenderer *eek_renderer_new (Layout *keyboard,
|
||||||
PangoContext *pcontext);
|
PangoContext *pcontext);
|
||||||
void eek_renderer_set_scale_factor (EekRenderer *renderer,
|
void eek_renderer_set_scale_factor (EekRenderer *renderer,
|
||||||
gint scale);
|
gint scale);
|
||||||
@ -68,7 +68,7 @@ cairo_surface_t *eek_renderer_get_icon_surface(const gchar *icon_name,
|
|||||||
gint scale);
|
gint scale);
|
||||||
|
|
||||||
void eek_renderer_render_keyboard (EekRenderer *renderer, struct render_geometry geometry, struct submission *submission,
|
void eek_renderer_render_keyboard (EekRenderer *renderer, struct render_geometry geometry, struct submission *submission,
|
||||||
cairo_t *cr, LevelKeyboard *keyboard);
|
cairo_t *cr, Layout *keyboard);
|
||||||
void
|
void
|
||||||
eek_renderer_free (EekRenderer *self);
|
eek_renderer_free (EekRenderer *self);
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ typedef struct _EekBounds EekBounds;
|
|||||||
|
|
||||||
typedef struct _EekboardContextService EekboardContextService;
|
typedef struct _EekboardContextService EekboardContextService;
|
||||||
typedef struct _ServerContextService ServerContextService;
|
typedef struct _ServerContextService ServerContextService;
|
||||||
typedef struct _LevelKeyboard LevelKeyboard;
|
typedef struct _Layout Layout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EekPoint:
|
* EekPoint:
|
||||||
|
|||||||
@ -1,11 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 Purism SPC
|
* Copyright (C) 2018-2023 Purism SPC
|
||||||
* SPDX-License-Identifier: GPL-3.0+
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*
|
||||||
* Author: Guido Günther <agx@sigxcpu.org>
|
* Author: Guido Günther <agx@sigxcpu.org>
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
|
||||||
WARNING: this file is taken directly from phosh, with no modificaions apart from this message. Please update phosh instead of changing this file. Please copy the file back here afterwards, with the same notice.
|
WARNING: this file is taken directly from phosh, with no modificaions apart
|
||||||
|
from this message. Please update phosh instead of changing this file. Please
|
||||||
|
copy the file back here afterwards, with an updated version of this notice.
|
||||||
|
|
||||||
|
Up-to-date with Phosh revision 953894a2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -16,6 +22,16 @@ WARNING: this file is taken directly from phosh, with no modificaions apart from
|
|||||||
|
|
||||||
#include <gdk/gdkwayland.h>
|
#include <gdk/gdkwayland.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PhoshLayerSurface:
|
||||||
|
*
|
||||||
|
* A #GtkWindow rendered as a LayerSurface by the compositor
|
||||||
|
*
|
||||||
|
* #PhoshLayerSurface allows to use a Wayland surface backed by the
|
||||||
|
* layer-shell protocol as #GtkWindow. This allows to render e.g. panels and
|
||||||
|
* backgrounds using GTK.
|
||||||
|
*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PHOSH_LAYER_SURFACE_PROP_0,
|
PHOSH_LAYER_SURFACE_PROP_0,
|
||||||
PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL,
|
PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL,
|
||||||
@ -43,73 +59,83 @@ enum {
|
|||||||
};
|
};
|
||||||
static guint signals [N_SIGNALS];
|
static guint signals [N_SIGNALS];
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct wl_surface *wl_surface;
|
struct wl_surface *wl_surface;
|
||||||
struct zwlr_layer_surface_v1 *layer_surface;
|
struct zwlr_layer_surface_v1 *layer_surface;
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
guint anchor;
|
guint anchor;
|
||||||
guint layer;
|
guint layer;
|
||||||
gboolean kbd_interactivity;
|
gboolean kbd_interactivity;
|
||||||
gint exclusive_zone;
|
int exclusive_zone;
|
||||||
gint margin_top, margin_bottom;
|
int margin_top, margin_bottom;
|
||||||
gint margin_left, margin_right;
|
int margin_left, margin_right;
|
||||||
gint width, height;
|
int width, height;
|
||||||
gint configured_width, configured_height;
|
int configured_width, configured_height;
|
||||||
gchar *namespace;
|
char *namespace;
|
||||||
struct zwlr_layer_shell_v1 *layer_shell;
|
struct zwlr_layer_shell_v1 *layer_shell;
|
||||||
struct wl_output *wl_output;
|
struct wl_output *wl_output;
|
||||||
} PhoshLayerSurfacePrivate;
|
} PhoshLayerSurfacePrivate;
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (PhoshLayerSurface, phosh_layer_surface, GTK_TYPE_WINDOW)
|
G_DEFINE_TYPE_WITH_PRIVATE (PhoshLayerSurface, phosh_layer_surface, GTK_TYPE_WINDOW)
|
||||||
|
|
||||||
static void layer_surface_configure(void *data,
|
|
||||||
struct zwlr_layer_surface_v1 *surface,
|
static void
|
||||||
uint32_t serial,
|
layer_surface_configure (void *data,
|
||||||
uint32_t width,
|
struct zwlr_layer_surface_v1 *surface,
|
||||||
uint32_t height)
|
uint32_t serial,
|
||||||
|
uint32_t width,
|
||||||
|
uint32_t height)
|
||||||
{
|
{
|
||||||
PhoshLayerSurface *self = data;
|
PhoshLayerSurface *self = data;
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
gboolean changed = FALSE;
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
gtk_window_resize (GTK_WINDOW (self), width, height);
|
gtk_window_resize (GTK_WINDOW (self), width, height);
|
||||||
zwlr_layer_surface_v1_ack_configure(surface, serial);
|
zwlr_layer_surface_v1_ack_configure (surface, serial);
|
||||||
|
|
||||||
if (priv->configured_height != height) {
|
if (priv->configured_height != height) {
|
||||||
priv->configured_height = height;
|
priv->configured_height = height;
|
||||||
|
changed = TRUE;
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_CONFIGURED_HEIGHT]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_CONFIGURED_HEIGHT]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->configured_width != width) {
|
if (priv->configured_width != width) {
|
||||||
priv->configured_width = width;
|
priv->configured_width = width;
|
||||||
|
changed = TRUE;
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_CONFIGURED_WIDTH]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_CONFIGURED_WIDTH]);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_debug("Configured %p", self);
|
g_debug ("Configured %s (%p) (%dx%d)", priv->namespace, self, width, height);
|
||||||
g_signal_emit (self, signals[CONFIGURED], 0);
|
if (changed) {
|
||||||
|
g_signal_emit (self, signals[CONFIGURED], 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void layer_surface_closed (void *data,
|
static void
|
||||||
struct zwlr_layer_surface_v1 *surface)
|
layer_surface_closed (void *data,
|
||||||
|
struct zwlr_layer_surface_v1 *surface)
|
||||||
{
|
{
|
||||||
PhoshLayerSurface *self = data;
|
PhoshLayerSurface *self = data;
|
||||||
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
g_return_if_fail (priv->layer_surface == surface);
|
g_return_if_fail (priv->layer_surface == surface);
|
||||||
zwlr_layer_surface_v1_destroy(priv->layer_surface);
|
g_debug ("Destroying layer surface '%s'", priv->namespace);
|
||||||
|
zwlr_layer_surface_v1_destroy (priv->layer_surface);
|
||||||
priv->layer_surface = NULL;
|
priv->layer_surface = NULL;
|
||||||
gtk_widget_destroy (GTK_WIDGET (self));
|
gtk_widget_destroy (GTK_WIDGET (self));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct zwlr_layer_surface_v1_listener layer_surface_listener = {
|
static struct zwlr_layer_surface_v1_listener layer_surface_listener = {
|
||||||
.configure = layer_surface_configure,
|
.configure = layer_surface_configure,
|
||||||
.closed = layer_surface_closed,
|
.closed = layer_surface_closed,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
phosh_layer_surface_set_property (GObject *object,
|
phosh_layer_surface_set_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
@ -118,7 +144,7 @@ phosh_layer_surface_set_property (GObject *object,
|
|||||||
{
|
{
|
||||||
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
||||||
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
||||||
gint width, height;
|
int width, height;
|
||||||
|
|
||||||
switch (property_id) {
|
switch (property_id) {
|
||||||
case PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL:
|
case PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL:
|
||||||
@ -131,7 +157,7 @@ phosh_layer_surface_set_property (GObject *object,
|
|||||||
priv->anchor = g_value_get_uint (value);
|
priv->anchor = g_value_get_uint (value);
|
||||||
break;
|
break;
|
||||||
case PHOSH_LAYER_SURFACE_PROP_LAYER:
|
case PHOSH_LAYER_SURFACE_PROP_LAYER:
|
||||||
priv->layer = g_value_get_uint (value);
|
phosh_layer_surface_set_layer (self, g_value_get_uint (value));
|
||||||
break;
|
break;
|
||||||
case PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY:
|
case PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY:
|
||||||
phosh_layer_surface_set_kbd_interactivity (self, g_value_get_boolean (value));
|
phosh_layer_surface_set_kbd_interactivity (self, g_value_get_boolean (value));
|
||||||
@ -169,11 +195,11 @@ phosh_layer_surface_set_property (GObject *object,
|
|||||||
break;
|
break;
|
||||||
case PHOSH_LAYER_SURFACE_PROP_LAYER_WIDTH:
|
case PHOSH_LAYER_SURFACE_PROP_LAYER_WIDTH:
|
||||||
width = g_value_get_uint (value);
|
width = g_value_get_uint (value);
|
||||||
phosh_layer_surface_set_size(self, width, priv->height);
|
phosh_layer_surface_set_size (self, width, priv->height);
|
||||||
break;
|
break;
|
||||||
case PHOSH_LAYER_SURFACE_PROP_LAYER_HEIGHT:
|
case PHOSH_LAYER_SURFACE_PROP_LAYER_HEIGHT:
|
||||||
height = g_value_get_uint (value);
|
height = g_value_get_uint (value);
|
||||||
phosh_layer_surface_set_size(self, priv->width, height);
|
phosh_layer_surface_set_size (self, priv->width, height);
|
||||||
break;
|
break;
|
||||||
case PHOSH_LAYER_SURFACE_PROP_NAMESPACE:
|
case PHOSH_LAYER_SURFACE_PROP_NAMESPACE:
|
||||||
g_free (priv->namespace);
|
g_free (priv->namespace);
|
||||||
@ -249,15 +275,17 @@ phosh_layer_surface_get_property (GObject *object,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_phosh_layer_surface_realized (PhoshLayerSurface *self, gpointer unused)
|
phosh_layer_surface_realize (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (widget);
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
GdkWindow *gdk_window;
|
GdkWindow *gdk_window;
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
|
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (phosh_layer_surface_parent_class)->realize (widget);
|
||||||
|
|
||||||
gdk_window = gtk_widget_get_window (GTK_WIDGET (self));
|
gdk_window = gtk_widget_get_window (GTK_WIDGET (self));
|
||||||
gdk_wayland_window_set_use_custom_surface (gdk_window);
|
gdk_wayland_window_set_use_custom_surface (gdk_window);
|
||||||
priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
|
priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
|
||||||
@ -267,76 +295,63 @@ on_phosh_layer_surface_realized (PhoshLayerSurface *self, gpointer unused)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_phosh_layer_surface_mapped (PhoshLayerSurface *self, gpointer unused)
|
phosh_layer_surface_map (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (widget);
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
GdkWindow *gdk_window;
|
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
if (!priv->wl_surface) {
|
GTK_WIDGET_CLASS (phosh_layer_surface_parent_class)->map (widget);
|
||||||
gdk_window = gtk_widget_get_window (GTK_WIDGET (self));
|
|
||||||
gdk_wayland_window_set_use_custom_surface (gdk_window);
|
|
||||||
priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
|
|
||||||
}
|
|
||||||
g_debug ("Mapped %p", priv->wl_surface);
|
|
||||||
|
|
||||||
priv->layer_surface = zwlr_layer_shell_v1_get_layer_surface(priv->layer_shell,
|
if (!priv->wl_surface) {
|
||||||
priv->wl_surface,
|
GdkWindow *gdk_window;
|
||||||
priv->wl_output,
|
|
||||||
priv->layer,
|
gdk_window = gtk_widget_get_window (GTK_WIDGET (self));
|
||||||
priv->namespace);
|
gdk_wayland_window_set_use_custom_surface (gdk_window);
|
||||||
zwlr_layer_surface_v1_set_exclusive_zone(priv->layer_surface, priv->exclusive_zone);
|
priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
|
||||||
zwlr_layer_surface_v1_set_size(priv->layer_surface, priv->width, priv->height);
|
}
|
||||||
zwlr_layer_surface_v1_set_anchor(priv->layer_surface, priv->anchor);
|
g_debug ("Mapped %p, namespace: %s", priv->wl_surface, priv->namespace);
|
||||||
zwlr_layer_surface_v1_set_margin(priv->layer_surface,
|
|
||||||
priv->margin_top,
|
priv->layer_surface = zwlr_layer_shell_v1_get_layer_surface (priv->layer_shell,
|
||||||
priv->margin_right,
|
priv->wl_surface,
|
||||||
priv->margin_bottom,
|
priv->wl_output,
|
||||||
priv->margin_left);
|
priv->layer,
|
||||||
zwlr_layer_surface_v1_set_keyboard_interactivity(priv->layer_surface, priv->kbd_interactivity);
|
priv->namespace);
|
||||||
zwlr_layer_surface_v1_add_listener(priv->layer_surface,
|
zwlr_layer_surface_v1_set_exclusive_zone (priv->layer_surface, priv->exclusive_zone);
|
||||||
&layer_surface_listener,
|
zwlr_layer_surface_v1_set_size (priv->layer_surface, priv->width, priv->height);
|
||||||
self);
|
zwlr_layer_surface_v1_set_anchor (priv->layer_surface, priv->anchor);
|
||||||
wl_surface_commit(priv->wl_surface);
|
zwlr_layer_surface_v1_set_margin (priv->layer_surface,
|
||||||
|
priv->margin_top,
|
||||||
|
priv->margin_right,
|
||||||
|
priv->margin_bottom,
|
||||||
|
priv->margin_left);
|
||||||
|
zwlr_layer_surface_v1_set_keyboard_interactivity (priv->layer_surface, priv->kbd_interactivity);
|
||||||
|
zwlr_layer_surface_v1_add_listener (priv->layer_surface,
|
||||||
|
&layer_surface_listener,
|
||||||
|
self);
|
||||||
|
wl_surface_commit (priv->wl_surface);
|
||||||
|
|
||||||
/* Process all pending events, otherwise we end up sending ack configure
|
/* Process all pending events, otherwise we end up sending ack configure
|
||||||
* to a not yet configured surface */
|
* to a not yet configured surface */
|
||||||
wl_display_roundtrip (gdk_wayland_display_get_wl_display (gdk_display_get_default ()));
|
wl_display_roundtrip (gdk_wayland_display_get_wl_display (gdk_display_get_default ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_phosh_layer_surface_unmapped (PhoshLayerSurface *self, gpointer unused)
|
phosh_layer_surface_unmap (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (widget);
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
|
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
if (priv->layer_surface) {
|
|
||||||
zwlr_layer_surface_v1_destroy(priv->layer_surface);
|
g_clear_pointer (&priv->layer_surface, zwlr_layer_surface_v1_destroy);
|
||||||
priv->layer_surface = NULL;
|
|
||||||
}
|
|
||||||
priv->wl_surface = NULL;
|
priv->wl_surface = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
GTK_WIDGET_CLASS (phosh_layer_surface_parent_class)->unmap (widget);
|
||||||
phosh_layer_surface_constructed (GObject *object)
|
|
||||||
{
|
|
||||||
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
|
||||||
|
|
||||||
g_signal_connect (self, "realize",
|
|
||||||
G_CALLBACK (on_phosh_layer_surface_realized),
|
|
||||||
NULL);
|
|
||||||
g_signal_connect (self, "map",
|
|
||||||
G_CALLBACK (on_phosh_layer_surface_mapped),
|
|
||||||
NULL);
|
|
||||||
g_signal_connect (self, "unmap",
|
|
||||||
G_CALLBACK (on_phosh_layer_surface_unmapped),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (phosh_layer_surface_parent_class)->constructed (object);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -346,10 +361,7 @@ phosh_layer_surface_dispose (GObject *object)
|
|||||||
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
||||||
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
if (priv->layer_surface) {
|
g_clear_pointer (&priv->layer_surface, zwlr_layer_surface_v1_destroy);
|
||||||
zwlr_layer_surface_v1_destroy(priv->layer_surface);
|
|
||||||
priv->layer_surface = NULL;
|
|
||||||
}
|
|
||||||
g_clear_pointer (&priv->namespace, g_free);
|
g_clear_pointer (&priv->namespace, g_free);
|
||||||
|
|
||||||
G_OBJECT_CLASS (phosh_layer_surface_parent_class)->dispose (object);
|
G_OBJECT_CLASS (phosh_layer_surface_parent_class)->dispose (object);
|
||||||
@ -360,26 +372,29 @@ static void
|
|||||||
phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
|
phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = (GObjectClass *)klass;
|
GObjectClass *object_class = (GObjectClass *)klass;
|
||||||
|
GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
|
||||||
|
|
||||||
object_class->constructed = phosh_layer_surface_constructed;
|
|
||||||
object_class->dispose = phosh_layer_surface_dispose;
|
object_class->dispose = phosh_layer_surface_dispose;
|
||||||
|
|
||||||
object_class->set_property = phosh_layer_surface_set_property;
|
object_class->set_property = phosh_layer_surface_set_property;
|
||||||
object_class->get_property = phosh_layer_surface_get_property;
|
object_class->get_property = phosh_layer_surface_get_property;
|
||||||
|
|
||||||
|
widget_class->realize = phosh_layer_surface_realize;
|
||||||
|
widget_class->map = phosh_layer_surface_map;
|
||||||
|
widget_class->unmap = phosh_layer_surface_unmap;
|
||||||
|
|
||||||
props[PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL] =
|
props[PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL] =
|
||||||
g_param_spec_pointer (
|
g_param_spec_pointer (
|
||||||
"layer-shell",
|
"layer-shell",
|
||||||
"Wayland Layer Shell Global",
|
"Wayland Layer Shell Global",
|
||||||
"The layer shell wayland global",
|
"The layer shell wayland global",
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
props[PHOSH_LAYER_SURFACE_PROP_WL_OUTPUT] =
|
props[PHOSH_LAYER_SURFACE_PROP_WL_OUTPUT] =
|
||||||
g_param_spec_pointer (
|
g_param_spec_pointer (
|
||||||
"wl-output",
|
"wl-output",
|
||||||
"Wayland Output",
|
"Wayland Output",
|
||||||
"The wl_output associated with this surface",
|
"The wl_output associated with this surface",
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
props[PHOSH_LAYER_SURFACE_PROP_ANCHOR] =
|
props[PHOSH_LAYER_SURFACE_PROP_ANCHOR] =
|
||||||
g_param_spec_uint (
|
g_param_spec_uint (
|
||||||
@ -389,7 +404,7 @@ phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
|
|||||||
0,
|
0,
|
||||||
G_MAXUINT,
|
G_MAXUINT,
|
||||||
0,
|
0,
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
props[PHOSH_LAYER_SURFACE_PROP_LAYER] =
|
props[PHOSH_LAYER_SURFACE_PROP_LAYER] =
|
||||||
g_param_spec_uint (
|
g_param_spec_uint (
|
||||||
@ -399,7 +414,7 @@ phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
|
|||||||
0,
|
0,
|
||||||
G_MAXUINT,
|
G_MAXUINT,
|
||||||
0,
|
0,
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
props[PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY] =
|
props[PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY] =
|
||||||
g_param_spec_boolean (
|
g_param_spec_boolean (
|
||||||
@ -506,13 +521,13 @@ phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
|
|||||||
"Namespace",
|
"Namespace",
|
||||||
"Namespace of the layer surface",
|
"Namespace of the layer surface",
|
||||||
"",
|
"",
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, PHOSH_LAYER_SURFACE_PROP_LAST_PROP, props);
|
g_object_class_install_properties (object_class, PHOSH_LAYER_SURFACE_PROP_LAST_PROP, props);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PhoshLayersurface::configured
|
* PhoshLayerSurface::configured
|
||||||
* @self: The #PhoshLayersurface instance.
|
* @self: The #PhoshLayerSurface instance.
|
||||||
*
|
*
|
||||||
* This signal is emitted once we received the configure event from the
|
* This signal is emitted once we received the configure event from the
|
||||||
* compositor.
|
* compositor.
|
||||||
@ -539,17 +554,20 @@ phosh_layer_surface_new (gpointer layer_shell,
|
|||||||
{
|
{
|
||||||
return g_object_new (PHOSH_TYPE_LAYER_SURFACE,
|
return g_object_new (PHOSH_TYPE_LAYER_SURFACE,
|
||||||
"layer-shell", layer_shell,
|
"layer-shell", layer_shell,
|
||||||
"wl-output", wl_output);
|
"wl-output", wl_output,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_get_surface:
|
* phosh_layer_surface_get_surface:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
*
|
*
|
||||||
* Get the layer layer surface or #NULL if the window
|
* Get the layer layer surface or #NULL if the window
|
||||||
* is not yet realized.
|
* is not yet realized.
|
||||||
*/
|
*/
|
||||||
struct zwlr_layer_surface_v1 *
|
struct zwlr_layer_surface_v1 *
|
||||||
phosh_layer_surface_get_layer_surface(PhoshLayerSurface *self)
|
phosh_layer_surface_get_layer_surface (PhoshLayerSurface *self)
|
||||||
{
|
{
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
|
||||||
@ -561,12 +579,13 @@ phosh_layer_surface_get_layer_surface(PhoshLayerSurface *self)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_get_wl_surface:
|
* phosh_layer_surface_get_wl_surface:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
*
|
*
|
||||||
* Get the layer wayland surface or #NULL if the window
|
* Get the layer wayland surface or #NULL if the window
|
||||||
* is not yet realized.
|
* is not yet realized.
|
||||||
*/
|
*/
|
||||||
struct wl_surface *
|
struct wl_surface *
|
||||||
phosh_layer_surface_get_wl_surface(PhoshLayerSurface *self)
|
phosh_layer_surface_get_wl_surface (PhoshLayerSurface *self)
|
||||||
{
|
{
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
|
||||||
@ -575,16 +594,20 @@ phosh_layer_surface_get_wl_surface(PhoshLayerSurface *self)
|
|||||||
return priv->wl_surface;
|
return priv->wl_surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_set_size:
|
* phosh_layer_surface_set_size:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
|
* @width: the height in pixels
|
||||||
|
* @height: the width in pixels
|
||||||
*
|
*
|
||||||
* Set the size of a layer surface. A value of '-1' indicates 'use old value'
|
* Set the size of a layer surface. A value of '-1' indicates 'use old value'
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
phosh_layer_surface_set_size(PhoshLayerSurface *self, gint width, gint height)
|
phosh_layer_surface_set_size (PhoshLayerSurface *self, int width, int height)
|
||||||
{
|
{
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
gint old_width, old_height;
|
int old_width, old_height;
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
@ -605,7 +628,7 @@ phosh_layer_surface_set_size(PhoshLayerSurface *self, gint width, gint height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gtk_widget_get_mapped (GTK_WIDGET (self))) {
|
if (gtk_widget_get_mapped (GTK_WIDGET (self))) {
|
||||||
zwlr_layer_surface_v1_set_size(priv->layer_surface, priv->width, priv->height);
|
zwlr_layer_surface_v1_set_size (priv->layer_surface, priv->width, priv->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->height != old_height) {
|
if (priv->height != old_height) {
|
||||||
@ -617,16 +640,22 @@ phosh_layer_surface_set_size(PhoshLayerSurface *self, gint width, gint height)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_set_margins:
|
* phosh_layer_surface_set_margins:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
|
* @top: the top margin in pixels
|
||||||
|
* @right: the right margin in pixels
|
||||||
|
* @bottom: the bottom margin in pixels
|
||||||
|
* @left: the left margin in pixels
|
||||||
*
|
*
|
||||||
* Set anchor margins of a layer surface.
|
* Set anchor margins of a layer surface.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
phosh_layer_surface_set_margins(PhoshLayerSurface *self, gint top, gint right, gint bottom, gint left)
|
phosh_layer_surface_set_margins (PhoshLayerSurface *self, int top, int right, int bottom, int left)
|
||||||
{
|
{
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
gint old_top, old_bottom, old_left, old_right;
|
int old_top, old_bottom, old_left, old_right;
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
@ -646,7 +675,7 @@ phosh_layer_surface_set_margins(PhoshLayerSurface *self, gint top, gint right, g
|
|||||||
priv->margin_bottom = bottom;
|
priv->margin_bottom = bottom;
|
||||||
|
|
||||||
if (priv->layer_surface) {
|
if (priv->layer_surface) {
|
||||||
zwlr_layer_surface_v1_set_margin(priv->layer_surface, top, right, bottom, left);
|
zwlr_layer_surface_v1_set_margin (priv->layer_surface, top, right, bottom, left);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_top != top) {
|
if (old_top != top) {
|
||||||
@ -663,16 +692,19 @@ phosh_layer_surface_set_margins(PhoshLayerSurface *self, gint top, gint right, g
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_set_exclusive_zone:
|
* phosh_layer_surface_set_exclusive_zone:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
|
* @zone: Size of the exclusive zone.
|
||||||
*
|
*
|
||||||
* Set exclusive zone of a layer surface.
|
* Set exclusive zone of a layer surface.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
phosh_layer_surface_set_exclusive_zone(PhoshLayerSurface *self, gint zone)
|
phosh_layer_surface_set_exclusive_zone (PhoshLayerSurface *self, int zone)
|
||||||
{
|
{
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
gint old_zone;
|
int old_zone;
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
@ -686,14 +718,17 @@ phosh_layer_surface_set_exclusive_zone(PhoshLayerSurface *self, gint zone)
|
|||||||
priv->exclusive_zone = zone;
|
priv->exclusive_zone = zone;
|
||||||
|
|
||||||
if (priv->layer_surface) {
|
if (priv->layer_surface) {
|
||||||
zwlr_layer_surface_v1_set_exclusive_zone(priv->layer_surface, zone);
|
zwlr_layer_surface_v1_set_exclusive_zone (priv->layer_surface, zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_EXCLUSIVE_ZONE]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_EXCLUSIVE_ZONE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_set_keyboard_interactivity:
|
* phosh_layer_surface_set_keyboard_interactivity:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
|
* @interactivity: %TRUE if the #PhoshLayerSurface should receive keyboard input.
|
||||||
*
|
*
|
||||||
* Set keyboard ineractivity a layer surface.
|
* Set keyboard ineractivity a layer surface.
|
||||||
*/
|
*/
|
||||||
@ -708,6 +743,7 @@ phosh_layer_surface_set_kbd_interactivity (PhoshLayerSurface *self, gboolean int
|
|||||||
if (priv->kbd_interactivity == interactivity) {
|
if (priv->kbd_interactivity == interactivity) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->kbd_interactivity = interactivity;
|
priv->kbd_interactivity = interactivity;
|
||||||
|
|
||||||
if (priv->layer_surface) {
|
if (priv->layer_surface) {
|
||||||
@ -717,8 +753,39 @@ phosh_layer_surface_set_kbd_interactivity (PhoshLayerSurface *self, gboolean int
|
|||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* phosh_layer_surface_set_layer:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
|
* @layer: The layer.
|
||||||
|
*
|
||||||
|
* Sets the layer a layer-surface belongs to `layer`.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
phosh_layer_surface_set_layer (PhoshLayerSurface *self, guint32 layer)
|
||||||
|
{
|
||||||
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
|
if (priv->layer == layer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->layer = layer;
|
||||||
|
|
||||||
|
if (priv->layer_surface) {
|
||||||
|
zwlr_layer_surface_v1_set_layer (priv->layer_surface, layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_LAYER]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_wl_surface_commit:
|
* phosh_layer_surface_wl_surface_commit:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
*
|
*
|
||||||
* Forces a commit of layer surface's state.
|
* Forces a commit of layer surface's state.
|
||||||
*/
|
*/
|
||||||
@ -734,3 +801,53 @@ phosh_layer_surface_wl_surface_commit (PhoshLayerSurface *self)
|
|||||||
wl_surface_commit (priv->wl_surface);
|
wl_surface_commit (priv->wl_surface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
phosh_layer_surface_get_margins (PhoshLayerSurface *self, int *top, int *right, int *bottom, int *left)
|
||||||
|
{
|
||||||
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
|
if (top) {
|
||||||
|
*top = priv->margin_top;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (right) {
|
||||||
|
*right = priv->margin_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bottom) {
|
||||||
|
*bottom = priv->margin_bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (left) {
|
||||||
|
*left = priv->margin_left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
phosh_layer_surface_get_configured_width (PhoshLayerSurface *self)
|
||||||
|
{
|
||||||
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (PHOSH_IS_LAYER_SURFACE (self), 0);
|
||||||
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
|
return priv->configured_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
phosh_layer_surface_get_configured_height (PhoshLayerSurface *self)
|
||||||
|
{
|
||||||
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (PHOSH_IS_LAYER_SURFACE (self), 0);
|
||||||
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
|
return priv->configured_height;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,22 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 Purism SPC
|
* Copyright (C) 2018 Purism SPC
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-3.0+
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
WARNING: this file is taken directly from phosh, with no modificaions apart from this message. Please update phosh instead of changing this file. Please copy the file back here afterwards, with the same notice.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
/* TODO: We use the enum constants from here, use glib-mkenums */
|
/* TODO: We use the enum constants from here, use glib-mkenums */
|
||||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define PHOSH_TYPE_LAYER_SURFACE (phosh_layer_surface_get_type ())
|
#define PHOSH_TYPE_LAYER_SURFACE (phosh_layer_surface_get_type ())
|
||||||
|
|
||||||
G_DECLARE_DERIVABLE_TYPE (PhoshLayerSurface, phosh_layer_surface, PHOSH, LAYER_SURFACE, GtkWindow)
|
G_DECLARE_DERIVABLE_TYPE (PhoshLayerSurface, phosh_layer_surface, PHOSH, LAYER_SURFACE, GtkWindow)
|
||||||
@ -24,6 +19,7 @@ G_DECLARE_DERIVABLE_TYPE (PhoshLayerSurface, phosh_layer_surface, PHOSH, LAYER_S
|
|||||||
/**
|
/**
|
||||||
* PhoshLayerSurfaceClass
|
* PhoshLayerSurfaceClass
|
||||||
* @parent_class: The parent class
|
* @parent_class: The parent class
|
||||||
|
* @configured: invoked when layer surface is configured
|
||||||
*/
|
*/
|
||||||
struct _PhoshLayerSurfaceClass
|
struct _PhoshLayerSurfaceClass
|
||||||
{
|
{
|
||||||
@ -39,15 +35,26 @@ GtkWidget *phosh_layer_surface_new (gpointer layer_shell,
|
|||||||
struct zwlr_layer_surface_v1 *phosh_layer_surface_get_layer_surface(PhoshLayerSurface *self);
|
struct zwlr_layer_surface_v1 *phosh_layer_surface_get_layer_surface(PhoshLayerSurface *self);
|
||||||
struct wl_surface *phosh_layer_surface_get_wl_surface(PhoshLayerSurface *self);
|
struct wl_surface *phosh_layer_surface_get_wl_surface(PhoshLayerSurface *self);
|
||||||
void phosh_layer_surface_set_size(PhoshLayerSurface *self,
|
void phosh_layer_surface_set_size(PhoshLayerSurface *self,
|
||||||
gint width,
|
int width,
|
||||||
gint height);
|
int height);
|
||||||
void phosh_layer_surface_set_margins(PhoshLayerSurface *self,
|
void phosh_layer_surface_set_margins(PhoshLayerSurface *self,
|
||||||
gint top,
|
int top,
|
||||||
gint right,
|
int right,
|
||||||
gint bottom,
|
int bottom,
|
||||||
gint left);
|
int left);
|
||||||
void phosh_layer_surface_set_exclusive_zone(PhoshLayerSurface *self,
|
void phosh_layer_surface_set_exclusive_zone(PhoshLayerSurface *self,
|
||||||
gint zone);
|
int zone);
|
||||||
void phosh_layer_surface_set_kbd_interactivity(PhoshLayerSurface *self,
|
void phosh_layer_surface_set_kbd_interactivity(PhoshLayerSurface *self,
|
||||||
gboolean interactivity);
|
gboolean interactivity);
|
||||||
|
void phosh_layer_surface_set_layer (PhoshLayerSurface *self,
|
||||||
|
guint32 layer);
|
||||||
void phosh_layer_surface_wl_surface_commit (PhoshLayerSurface *self);
|
void phosh_layer_surface_wl_surface_commit (PhoshLayerSurface *self);
|
||||||
|
void phosh_layer_surface_get_margins (PhoshLayerSurface *self,
|
||||||
|
int *top,
|
||||||
|
int *right,
|
||||||
|
int *bottom,
|
||||||
|
int *left);
|
||||||
|
int phosh_layer_surface_get_configured_width (PhoshLayerSurface *self);
|
||||||
|
int phosh_layer_surface_get_configured_height (PhoshLayerSurface *self);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|||||||
@ -57,7 +57,7 @@ struct _EekboardContextService {
|
|||||||
GObject parent;
|
GObject parent;
|
||||||
struct squeek_state_manager *state_manager; // shared reference
|
struct squeek_state_manager *state_manager; // shared reference
|
||||||
|
|
||||||
LevelKeyboard *keyboard; // currently used keyboard
|
Layout *keyboard; // currently used keyboard
|
||||||
GSettings *settings; // Owned reference
|
GSettings *settings; // Owned reference
|
||||||
|
|
||||||
/// Needed for keymap changes after keyboard updates.
|
/// Needed for keymap changes after keyboard updates.
|
||||||
@ -126,10 +126,10 @@ settings_get_layout(GSettings *settings, char **type, char **layout)
|
|||||||
g_variant_unref(inputs);
|
g_variant_unref(inputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void eekboard_context_service_set_layout(EekboardContextService *context, struct squeek_layout *layout, uint32_t timestamp) {
|
void eekboard_context_service_set_layout(EekboardContextService *context, char *style_name, struct squeek_layout *layout, uint32_t timestamp) {
|
||||||
LevelKeyboard *keyboard = level_keyboard_new(layout);
|
Layout *keyboard = layout_new(style_name, layout);
|
||||||
// set as current
|
// set as current
|
||||||
LevelKeyboard *previous_keyboard = context->keyboard;
|
Layout *previous_keyboard = context->keyboard;
|
||||||
context->keyboard = keyboard;
|
context->keyboard = keyboard;
|
||||||
// Update the keymap if necessary.
|
// Update the keymap if necessary.
|
||||||
// TODO: Update submission on change event
|
// TODO: Update submission on change event
|
||||||
@ -142,7 +142,7 @@ void eekboard_context_service_set_layout(EekboardContextService *context, struct
|
|||||||
|
|
||||||
// replacing the keyboard above will cause the previous keyboard to get destroyed from the UI side (eek_gtk_keyboard_dispose)
|
// replacing the keyboard above will cause the previous keyboard to get destroyed from the UI side (eek_gtk_keyboard_dispose)
|
||||||
if (previous_keyboard) {
|
if (previous_keyboard) {
|
||||||
level_keyboard_free(previous_keyboard);
|
layout_free(previous_keyboard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ eekboard_context_service_destroy (EekboardContextService *context)
|
|||||||
* Get keyboard currently active in @context.
|
* Get keyboard currently active in @context.
|
||||||
* Returns: (transfer none): an #EekKeyboard
|
* Returns: (transfer none): an #EekKeyboard
|
||||||
*/
|
*/
|
||||||
LevelKeyboard *
|
Layout *
|
||||||
eekboard_context_service_get_keyboard (EekboardContextService *context)
|
eekboard_context_service_get_keyboard (EekboardContextService *context)
|
||||||
{
|
{
|
||||||
return context->keyboard;
|
return context->keyboard;
|
||||||
|
|||||||
@ -41,10 +41,10 @@ G_DECLARE_FINAL_TYPE(EekboardContextService, eekboard_context_service, EEKBOARD,
|
|||||||
EekboardContextService *eekboard_context_service_new(struct squeek_state_manager *state_manager);
|
EekboardContextService *eekboard_context_service_new(struct squeek_state_manager *state_manager);
|
||||||
void eekboard_context_service_set_submission(EekboardContextService *context, struct submission *submission);
|
void eekboard_context_service_set_submission(EekboardContextService *context, struct submission *submission);
|
||||||
void eekboard_context_service_destroy (EekboardContextService *context);
|
void eekboard_context_service_destroy (EekboardContextService *context);
|
||||||
LevelKeyboard *eekboard_context_service_get_keyboard(EekboardContextService *context);
|
Layout *eekboard_context_service_get_keyboard(EekboardContextService *context);
|
||||||
|
|
||||||
void eekboard_context_service_set_keymap(EekboardContextService *context,
|
void eekboard_context_service_set_keymap(EekboardContextService *context,
|
||||||
const LevelKeyboard *keyboard);
|
const Layout *keyboard);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
#endif /* EEKBOARD_CONTEXT_SERVICE_H */
|
#endif /* EEKBOARD_CONTEXT_SERVICE_H */
|
||||||
|
|||||||
53
examples/find_orphan_layouts.rs
Normal file
53
examples/find_orphan_layouts.rs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/*! Tests if any layout files are not in use */
|
||||||
|
|
||||||
|
extern crate rs;
|
||||||
|
|
||||||
|
use rs::resources;
|
||||||
|
use std::env;
|
||||||
|
use std::error::Error;
|
||||||
|
use std::ffi::OsStr;
|
||||||
|
use std::fs;
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
enum Orphans {
|
||||||
|
None,
|
||||||
|
Present,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn check(base: &Path, dir: &Path) -> Result<Orphans, Box<dyn Error>> {
|
||||||
|
let mut orphans = Orphans::None;
|
||||||
|
for entry in fs::read_dir(dir)? {
|
||||||
|
let entry = entry?;
|
||||||
|
let path = entry.path();
|
||||||
|
|
||||||
|
if entry.file_type()?.is_dir() {
|
||||||
|
check(base, &path)?;
|
||||||
|
} else {
|
||||||
|
if Some(OsStr::new("yaml")) == path.extension() {
|
||||||
|
let resource_path = path
|
||||||
|
.strip_prefix(base).unwrap()
|
||||||
|
.with_extension("");
|
||||||
|
let resource_path = resource_path
|
||||||
|
.to_str().unwrap();
|
||||||
|
let resource_path = resource_path
|
||||||
|
.strip_prefix('/').unwrap_or(resource_path);
|
||||||
|
if let None = resources::get_keyboard(resource_path) {
|
||||||
|
println!("Data not registered in the resources file: {:?}", path);
|
||||||
|
orphans = Orphans::Present;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(orphans)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() -> () {
|
||||||
|
let path = env::args().nth(1).expect("Provide a path");
|
||||||
|
let path = PathBuf::from(path);
|
||||||
|
|
||||||
|
match check(&path, &path) {
|
||||||
|
Err(e) => panic!("{:?}", e),
|
||||||
|
Ok(Orphans::Present) => panic!("Unregistered files present. Check the tutorial in doc/tutorial.md"),
|
||||||
|
_ => {},
|
||||||
|
}
|
||||||
|
}
|
||||||
20
meson.build
20
meson.build
@ -1,7 +1,7 @@
|
|||||||
project(
|
project(
|
||||||
'squeekboard',
|
'squeekboard',
|
||||||
'c', 'rust',
|
'c', 'rust',
|
||||||
version: '1.18.0',
|
version: '1.22.0',
|
||||||
license: 'GPLv3',
|
license: 'GPLv3',
|
||||||
meson_version: '>=0.51.0',
|
meson_version: '>=0.51.0',
|
||||||
default_options: [
|
default_options: [
|
||||||
@ -99,12 +99,17 @@ cargo_toml_base = configure_file(
|
|||||||
cargo_patch = []
|
cargo_patch = []
|
||||||
|
|
||||||
if get_option('newer') == true
|
if get_option('newer') == true
|
||||||
cargo_build_flags += ['--features', 'glib_v0_14']
|
cargo_build_flags += ['--features', 'glib_v0_14,zbus_v1_5,clap_v4']
|
||||||
cargo_deps = files('Cargo.deps.newer')
|
cargo_deps = files('Cargo.deps.newer')
|
||||||
|
cargo_lock = files('Cargo.lock.newer')
|
||||||
else
|
else
|
||||||
cargo_deps = files('Cargo.deps')
|
cargo_deps = files('Cargo.deps')
|
||||||
|
cargo_lock = []
|
||||||
if get_option('online') == true
|
if get_option('online') == true
|
||||||
cargo_patch = [files('Cargo.deps.online')]
|
cargo_patch = [files('Cargo.deps.online')]
|
||||||
|
if get_option('reset_lock') == true
|
||||||
|
cargo_lock = files('Cargo.lock')
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -116,6 +121,17 @@ cargo_toml = custom_target(
|
|||||||
capture: true,
|
capture: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cargo_deps = [cargo_toml]
|
||||||
|
if get_option('online') == true and get_option('reset_lock') == true
|
||||||
|
cargo_lock = custom_target(
|
||||||
|
'Cargo.lock',
|
||||||
|
output: 'Cargo.lock',
|
||||||
|
command: [cat, cargo_lock],
|
||||||
|
capture: true,
|
||||||
|
)
|
||||||
|
cargo_deps += [cargo_lock]
|
||||||
|
endif
|
||||||
|
|
||||||
dep_cargo = find_program('cargo')
|
dep_cargo = find_program('cargo')
|
||||||
cargo_script = find_program('cargo.sh')
|
cargo_script = find_program('cargo.sh')
|
||||||
cargo_build = find_program('cargo_build.py')
|
cargo_build = find_program('cargo_build.py')
|
||||||
|
|||||||
@ -7,6 +7,10 @@ option('tests',
|
|||||||
type: 'boolean', value: true,
|
type: 'boolean', value: true,
|
||||||
description: 'Whether to compile unit tests')
|
description: 'Whether to compile unit tests')
|
||||||
|
|
||||||
|
option('find_orphans',
|
||||||
|
type: 'boolean', value: false,
|
||||||
|
description: 'Check if all present layout files are included in resources.')
|
||||||
|
|
||||||
option('newer',
|
option('newer',
|
||||||
type: 'boolean', value: false,
|
type: 'boolean', value: false,
|
||||||
description: 'Build with dependencies newer than those of Byzantium')
|
description: 'Build with dependencies newer than those of Byzantium')
|
||||||
@ -15,6 +19,10 @@ option('online',
|
|||||||
type: 'boolean', value: true,
|
type: 'boolean', value: true,
|
||||||
description: 'Pull packages from the internet while building, as opposed to a local regstry.')
|
description: 'Pull packages from the internet while building, as opposed to a local regstry.')
|
||||||
|
|
||||||
|
option('reset_lock',
|
||||||
|
type: 'boolean', value: false,
|
||||||
|
description: 'Resets Cargo.lock to the one found in the source repo. Does not affect builds with online == false.')
|
||||||
|
|
||||||
option('strict',
|
option('strict',
|
||||||
type: 'boolean', value: true,
|
type: 'boolean', value: true,
|
||||||
description: 'Turn more warnings into errors')
|
description: 'Turn more warnings into errors')
|
||||||
|
|||||||
@ -1,12 +1,17 @@
|
|||||||
ca
|
ca
|
||||||
|
cs
|
||||||
de
|
de
|
||||||
|
el
|
||||||
es
|
es
|
||||||
|
eu
|
||||||
fa
|
fa
|
||||||
fi
|
fi
|
||||||
fr
|
fr
|
||||||
fur
|
fur
|
||||||
gl
|
gl
|
||||||
he
|
he
|
||||||
|
hi
|
||||||
|
hr
|
||||||
hu
|
hu
|
||||||
it
|
it
|
||||||
ka
|
ka
|
||||||
|
|||||||
46
po/cs.po
Normal file
46
po/cs.po
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# Czech translation for squeekboard.
|
||||||
|
# Copyright (C) 2022 squeekboard's COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the squeekboard package.
|
||||||
|
# Daniel Rusek <mail@asciiwolf.com>, 2022.
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: squeekboard master\n"
|
||||||
|
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/Phosh/squeekboard/"
|
||||||
|
"issues\n"
|
||||||
|
"POT-Creation-Date: 2022-10-16 12:08+0000\n"
|
||||||
|
"PO-Revision-Date: 2022-10-18 23:36+0200\n"
|
||||||
|
"Last-Translator: Daniel Rusek <mail@asciiwolf.com>\n"
|
||||||
|
"Language-Team: Czech <gnome-cs-list@gnome.org>\n"
|
||||||
|
"Language: cs\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
|
||||||
|
"X-Generator: Poedit 3.1.1\n"
|
||||||
|
|
||||||
|
#. translators: This is a emmoji keyboard layout
|
||||||
|
#: data/popover.ui:6
|
||||||
|
msgid "Emoji"
|
||||||
|
msgstr "Emodži"
|
||||||
|
|
||||||
|
#. translators: This is a terminal keyboard layout
|
||||||
|
#: data/popover.ui:12
|
||||||
|
msgid "Terminal"
|
||||||
|
msgstr "Terminál"
|
||||||
|
|
||||||
|
#: data/popover.ui:18
|
||||||
|
msgid "Keyboard Settings"
|
||||||
|
msgstr "Nastavení klávesnice"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:3
|
||||||
|
msgid "Squeekboard"
|
||||||
|
msgstr "Squeekboard"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:4
|
||||||
|
msgid "On Screen Keyboard"
|
||||||
|
msgstr "Klávesnice na obrazovce"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:5
|
||||||
|
msgid "An on screen virtual keyboard"
|
||||||
|
msgstr "Přidat virtuální klávesnici na obrazovce"
|
||||||
39
po/de.po
39
po/de.po
@ -2,21 +2,46 @@
|
|||||||
# Copyright (C) 2021 THE squeekboard'S COPYRIGHT HOLDER
|
# Copyright (C) 2021 THE squeekboard'S COPYRIGHT HOLDER
|
||||||
# This file is distributed under the same license as the squeekboard package.
|
# This file is distributed under the same license as the squeekboard package.
|
||||||
# Automatically generated, 2021.
|
# Automatically generated, 2021.
|
||||||
|
# Jürgen Benvenuti <gastornis@posteo.org>, 2023.
|
||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: squeekboard\n"
|
"Project-Id-Version: squeekboard\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/Phosh/squeekboard/"
|
||||||
"POT-Creation-Date: 2021-12-03 18:41+0100\n"
|
"issues\n"
|
||||||
"PO-Revision-Date: 2021-12-03 18:41+0100\n"
|
"POT-Creation-Date: 2022-10-16 12:08+0000\n"
|
||||||
"Last-Translator: Automatically generated\n"
|
"PO-Revision-Date: 2023-01-14 11:45+0100\n"
|
||||||
"Language-Team: none\n"
|
"Last-Translator: Jürgen Benvenuti <gastornis@posteo.org>\n"
|
||||||
|
"Language-Team: German <gnome-de@gnome-org>\n"
|
||||||
"Language: de\n"
|
"Language: de\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=ASCII\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"X-Generator: Poedit 3.1.1\n"
|
||||||
|
|
||||||
#: data/popup.ui:15
|
#. translators: This is a emmoji keyboard layout
|
||||||
|
#: data/popover.ui:6
|
||||||
|
msgid "Emoji"
|
||||||
|
msgstr "Emoji"
|
||||||
|
|
||||||
|
#. translators: This is a terminal keyboard layout
|
||||||
|
#: data/popover.ui:12
|
||||||
|
msgid "Terminal"
|
||||||
|
msgstr "Terminal"
|
||||||
|
|
||||||
|
#: data/popover.ui:18
|
||||||
msgid "Keyboard Settings"
|
msgid "Keyboard Settings"
|
||||||
msgstr "Tastatureinstellungen"
|
msgstr "Tastatureinstellungen"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:3
|
||||||
|
msgid "Squeekboard"
|
||||||
|
msgstr "Squeekboard"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:4
|
||||||
|
msgid "On Screen Keyboard"
|
||||||
|
msgstr "Bildschirmtastatur"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:5
|
||||||
|
msgid "An on screen virtual keyboard"
|
||||||
|
msgstr "Eine virtuelle Bildschirmtastatur"
|
||||||
|
|||||||
46
po/el.po
Normal file
46
po/el.po
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# Greek translation for squeekboard.
|
||||||
|
# Copyright (C) 2022 squeekboard's COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the squeekboard package.
|
||||||
|
# Efstathios Iosifidis <eiosifidis@gnome.org>, 2022.
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: squeekboard master\n"
|
||||||
|
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/Phosh/squeekboard/"
|
||||||
|
"issues\n"
|
||||||
|
"POT-Creation-Date: 2022-07-11 06:54+0000\n"
|
||||||
|
"PO-Revision-Date: 2022-07-11 23:11+0300\n"
|
||||||
|
"Last-Translator: Efstathios Iosifidis <eiosifidis@gnome.org>\n"
|
||||||
|
"Language-Team: Greek <gnome-el-list@gnome.org>\n"
|
||||||
|
"Language: el\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"X-Generator: Poedit 3.1\n"
|
||||||
|
|
||||||
|
#. translators: This is a emmoji keyboard layout
|
||||||
|
#: data/popover.ui:6
|
||||||
|
msgid "Emoji"
|
||||||
|
msgstr "Emoji"
|
||||||
|
|
||||||
|
#. translators: This is a terminal keyboard layout
|
||||||
|
#: data/popover.ui:12
|
||||||
|
msgid "Terminal"
|
||||||
|
msgstr "Τερματικό"
|
||||||
|
|
||||||
|
#: data/popover.ui:18
|
||||||
|
msgid "Keyboard Settings"
|
||||||
|
msgstr "Ρυθμίσεις πληκτρολογίου"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:3
|
||||||
|
msgid "Squeekboard"
|
||||||
|
msgstr "Squeekboard"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:4
|
||||||
|
msgid "On Screen Keyboard"
|
||||||
|
msgstr "Πληκτρολόγιο οθόνης"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:5
|
||||||
|
msgid "An on screen virtual keyboard"
|
||||||
|
msgstr "Εικονικό πληκτρολόγιο οθόνης"
|
||||||
42
po/eu.po
Normal file
42
po/eu.po
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Basque translation for squeekboard.
|
||||||
|
# Copyright (C) 2023 squeekboard's COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the squeekboard package.
|
||||||
|
# Asier Sarasua Garmendia <asiersarasua@ni.eus>, 2023.
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr "Project-Id-Version: squeekboard master\n"
|
||||||
|
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/Phosh/squeekboard/issues\n"
|
||||||
|
"POT-Creation-Date: 2023-02-26 09:13+0000\n"
|
||||||
|
"PO-Revision-Date: 2023-03-06 09:13+0000\n"
|
||||||
|
"Last-Translator: Asier Sarasua Garmendia <asiersarasua@ni.eus>\n"
|
||||||
|
"Language-Team: Basque <librezale@librezale.eus>\n"
|
||||||
|
"Language: eu\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#. translators: This is a emmoji keyboard layout
|
||||||
|
#: data/popover.ui:6
|
||||||
|
msgid "Emoji"
|
||||||
|
msgstr "Emojia"
|
||||||
|
|
||||||
|
#. translators: This is a terminal keyboard layout
|
||||||
|
#: data/popover.ui:12
|
||||||
|
msgid "Terminal"
|
||||||
|
msgstr "Terminala"
|
||||||
|
|
||||||
|
#: data/popover.ui:18
|
||||||
|
msgid "Keyboard Settings"
|
||||||
|
msgstr "Teklatuaren ezarpenak"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:3
|
||||||
|
msgid "Squeekboard"
|
||||||
|
msgstr "Squeekboard"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:4
|
||||||
|
msgid "On Screen Keyboard"
|
||||||
|
msgstr "Pantailako teklatua"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:5
|
||||||
|
msgid "An on screen virtual keyboard"
|
||||||
|
msgstr "Gehitu pantailako teklatu birtuala"
|
||||||
52
po/hi.po
Normal file
52
po/hi.po
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# Hindi translation for squeekboard.
|
||||||
|
# Copyright (C) 2023 squeekboard's COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the squeekboard package.
|
||||||
|
# # Translators:
|
||||||
|
# Hemish <hemish04082005@gmail.com>, 2023.
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: squeekboard master\n"
|
||||||
|
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/Phosh/squeekboard/"
|
||||||
|
"issues\n"
|
||||||
|
"POT-Creation-Date: 2023-01-31 11:38+0000\n"
|
||||||
|
"PO-Revision-Date: 2023-02-02 23:11+0530\n"
|
||||||
|
"Last-Translator: Hemish <hemish04082005@gmail.com>\n"
|
||||||
|
"Language-Team: Hindi <indlinux-hindi@lists.sourceforge.net https://indlinux."
|
||||||
|
"org/hindi>\n"
|
||||||
|
"Language: hi\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
||||||
|
"X-Generator: Gtranslator 42.0\n"
|
||||||
|
"X-DL-Team: \n"
|
||||||
|
"X-DL-Module: \n"
|
||||||
|
"X-DL-Branch: \n"
|
||||||
|
"X-DL-Domain: \n"
|
||||||
|
|
||||||
|
#. translators: This is a emmoji keyboard layout
|
||||||
|
#: data/popover.ui:6
|
||||||
|
msgid "Emoji"
|
||||||
|
msgstr "इमोजी"
|
||||||
|
|
||||||
|
#. translators: This is a terminal keyboard layout
|
||||||
|
#: data/popover.ui:12
|
||||||
|
msgid "Terminal"
|
||||||
|
msgstr "टर्मिनल"
|
||||||
|
|
||||||
|
#: data/popover.ui:18
|
||||||
|
msgid "Keyboard Settings"
|
||||||
|
msgstr "कुंजीपट सेंटिग्स"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:3
|
||||||
|
msgid "Squeekboard"
|
||||||
|
msgstr "स्क्वीकबोर्ड"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:4
|
||||||
|
msgid "On Screen Keyboard"
|
||||||
|
msgstr "ऑनस्क्रीन कुंजीपट"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:5
|
||||||
|
msgid "An on screen virtual keyboard"
|
||||||
|
msgstr "एक ऑनस्क्रीन वर्चुअल कुंजीपट"
|
||||||
47
po/hr.po
Normal file
47
po/hr.po
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# Croatian translation for squeekboard.
|
||||||
|
# Copyright (C) 2022 squeekboard's COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the squeekboard package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: squeekboard master\n"
|
||||||
|
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/Phosh/squeekboard/"
|
||||||
|
"issues\n"
|
||||||
|
"POT-Creation-Date: 2022-07-11 20:12+0000\n"
|
||||||
|
"PO-Revision-Date: 2022-08-31 09:49+0200\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Language-Team: Croatian <hr@li.org>\n"
|
||||||
|
"Language: hr\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 "
|
||||||
|
"&& n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||||
|
"X-Generator: Poedit 3.1.1\n"
|
||||||
|
|
||||||
|
#. translators: This is a emmoji keyboard layout
|
||||||
|
#: data/popover.ui:6
|
||||||
|
msgid "Emoji"
|
||||||
|
msgstr "Smajli"
|
||||||
|
|
||||||
|
#. translators: This is a terminal keyboard layout
|
||||||
|
#: data/popover.ui:12
|
||||||
|
msgid "Terminal"
|
||||||
|
msgstr "Terminal"
|
||||||
|
|
||||||
|
#: data/popover.ui:18
|
||||||
|
msgid "Keyboard Settings"
|
||||||
|
msgstr "Postavke tipkovnice"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:3
|
||||||
|
msgid "Squeekboard"
|
||||||
|
msgstr "Squeekboard"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:4
|
||||||
|
msgid "On Screen Keyboard"
|
||||||
|
msgstr "Zaslonska tipkovnica"
|
||||||
|
|
||||||
|
#: data/sm.puri.Squeekboard.desktop.in.in:5
|
||||||
|
msgid "An on screen virtual keyboard"
|
||||||
|
msgstr "Zaslonska virtualna tipkovnica"
|
||||||
@ -25,7 +25,7 @@
|
|||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
<interface name="zwlr_layer_shell_v1" version="1">
|
<interface name="zwlr_layer_shell_v1" version="4">
|
||||||
<description summary="create surfaces that are layers of the desktop">
|
<description summary="create surfaces that are layers of the desktop">
|
||||||
Clients can use this interface to assign the surface_layer role to
|
Clients can use this interface to assign the surface_layer role to
|
||||||
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||||
@ -47,6 +47,12 @@
|
|||||||
or manipulate a buffer prior to the first layer_surface.configure call
|
or manipulate a buffer prior to the first layer_surface.configure call
|
||||||
must also be treated as errors.
|
must also be treated as errors.
|
||||||
|
|
||||||
|
After creating a layer_surface object and setting it up, the client
|
||||||
|
must perform an initial commit without any buffer attached.
|
||||||
|
The compositor will reply with a layer_surface.configure event.
|
||||||
|
The client must acknowledge it and is then allowed to attach a buffer
|
||||||
|
to map the surface.
|
||||||
|
|
||||||
You may pass NULL for output to allow the compositor to decide which
|
You may pass NULL for output to allow the compositor to decide which
|
||||||
output to use. Generally this will be the one that the user most
|
output to use. Generally this will be the one that the user most
|
||||||
recently interacted with.
|
recently interacted with.
|
||||||
@ -82,17 +88,35 @@
|
|||||||
<entry name="top" value="2"/>
|
<entry name="top" value="2"/>
|
||||||
<entry name="overlay" value="3"/>
|
<entry name="overlay" value="3"/>
|
||||||
</enum>
|
</enum>
|
||||||
|
|
||||||
|
<!-- Version 3 additions -->
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor" since="3">
|
||||||
|
<description summary="destroy the layer_shell object">
|
||||||
|
This request indicates that the client will not use the layer_shell
|
||||||
|
object any more. Objects that have been created through this instance
|
||||||
|
are not affected.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<interface name="zwlr_layer_surface_v1" version="1">
|
<interface name="zwlr_layer_surface_v1" version="4">
|
||||||
<description summary="layer metadata interface">
|
<description summary="layer metadata interface">
|
||||||
An interface that may be implemented by a wl_surface, for surfaces that
|
An interface that may be implemented by a wl_surface, for surfaces that
|
||||||
are designed to be rendered as a layer of a stacked desktop-like
|
are designed to be rendered as a layer of a stacked desktop-like
|
||||||
environment.
|
environment.
|
||||||
|
|
||||||
Layer surface state (size, anchor, exclusive zone, margin, interactivity)
|
Layer surface state (layer, size, anchor, exclusive zone,
|
||||||
is double-buffered, and will be applied at the time wl_surface.commit of
|
margin, interactivity) is double-buffered, and will be applied at the
|
||||||
the corresponding wl_surface is called.
|
time wl_surface.commit of the corresponding wl_surface is called.
|
||||||
|
|
||||||
|
Attaching a null buffer to a layer surface unmaps it.
|
||||||
|
|
||||||
|
Unmapping a layer_surface means that the surface cannot be shown by the
|
||||||
|
compositor until it is explicitly mapped again. The layer_surface
|
||||||
|
returns to the state it had right after layer_shell.get_layer_surface.
|
||||||
|
The client can re-map the surface by performing a commit without any
|
||||||
|
buffer attached, waiting for a configure event and handling it as usual.
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<request name="set_size">
|
<request name="set_size">
|
||||||
@ -127,14 +151,19 @@
|
|||||||
|
|
||||||
<request name="set_exclusive_zone">
|
<request name="set_exclusive_zone">
|
||||||
<description summary="configures the exclusive geometry of this surface">
|
<description summary="configures the exclusive geometry of this surface">
|
||||||
Requests that the compositor avoids occluding an area of the surface
|
Requests that the compositor avoids occluding an area with other
|
||||||
with other surfaces. The compositor's use of this information is
|
surfaces. The compositor's use of this information is
|
||||||
implementation-dependent - do not assume that this region will not
|
implementation-dependent - do not assume that this region will not
|
||||||
actually be occluded.
|
actually be occluded.
|
||||||
|
|
||||||
A positive value is only meaningful if the surface is anchored to an
|
A positive value is only meaningful if the surface is anchored to one
|
||||||
edge, rather than a corner. The zone is the number of surface-local
|
edge or an edge and both perpendicular edges. If the surface is not
|
||||||
coordinates from the edge that is considered exclusive.
|
anchored, anchored to only two perpendicular edges (a corner), anchored
|
||||||
|
to only two parallel edges or anchored to all edges, a positive value
|
||||||
|
will be treated the same as zero.
|
||||||
|
|
||||||
|
A positive zone is the distance from the edge in surface-local
|
||||||
|
coordinates to consider exclusive.
|
||||||
|
|
||||||
Surfaces that do not wish to have an exclusive zone may instead specify
|
Surfaces that do not wish to have an exclusive zone may instead specify
|
||||||
how they should interact with surfaces that do. If set to zero, the
|
how they should interact with surfaces that do. If set to zero, the
|
||||||
@ -174,21 +203,85 @@
|
|||||||
<arg name="left" type="int"/>
|
<arg name="left" type="int"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
|
<enum name="keyboard_interactivity">
|
||||||
|
<description summary="types of keyboard interaction possible for a layer shell surface">
|
||||||
|
Types of keyboard interaction possible for layer shell surfaces. The
|
||||||
|
rationale for this is twofold: (1) some applications are not interested
|
||||||
|
in keyboard events and not allowing them to be focused can improve the
|
||||||
|
desktop experience; (2) some applications will want to take exclusive
|
||||||
|
keyboard focus.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<entry name="none" value="0">
|
||||||
|
<description summary="no keyboard focus is possible">
|
||||||
|
This value indicates that this surface is not interested in keyboard
|
||||||
|
events and the compositor should never assign it the keyboard focus.
|
||||||
|
|
||||||
|
This is the default value, set for newly created layer shell surfaces.
|
||||||
|
|
||||||
|
This is useful for e.g. desktop widgets that display information or
|
||||||
|
only have interaction with non-keyboard input devices.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
<entry name="exclusive" value="1">
|
||||||
|
<description summary="request exclusive keyboard focus">
|
||||||
|
Request exclusive keyboard focus if this surface is above the shell surface layer.
|
||||||
|
|
||||||
|
For the top and overlay layers, the seat will always give
|
||||||
|
exclusive keyboard focus to the top-most layer which has keyboard
|
||||||
|
interactivity set to exclusive. If this layer contains multiple
|
||||||
|
surfaces with keyboard interactivity set to exclusive, the compositor
|
||||||
|
determines the one receiving keyboard events in an implementation-
|
||||||
|
defined manner. In this case, no guarantee is made when this surface
|
||||||
|
will receive keyboard focus (if ever).
|
||||||
|
|
||||||
|
For the bottom and background layers, the compositor is allowed to use
|
||||||
|
normal focus semantics.
|
||||||
|
|
||||||
|
This setting is mainly intended for applications that need to ensure
|
||||||
|
they receive all keyboard events, such as a lock screen or a password
|
||||||
|
prompt.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
<entry name="on_demand" value="2" since="4">
|
||||||
|
<description summary="request regular keyboard focus semantics">
|
||||||
|
This requests the compositor to allow this surface to be focused and
|
||||||
|
unfocused by the user in an implementation-defined manner. The user
|
||||||
|
should be able to unfocus this surface even regardless of the layer
|
||||||
|
it is on.
|
||||||
|
|
||||||
|
Typically, the compositor will want to use its normal mechanism to
|
||||||
|
manage keyboard focus between layer shell surfaces with this setting
|
||||||
|
and regular toplevels on the desktop layer (e.g. click to focus).
|
||||||
|
Nevertheless, it is possible for a compositor to require a special
|
||||||
|
interaction to focus or unfocus layer shell surfaces (e.g. requiring
|
||||||
|
a click even if focus follows the mouse normally, or providing a
|
||||||
|
keybinding to switch focus between layers).
|
||||||
|
|
||||||
|
This setting is mainly intended for desktop shell components (e.g.
|
||||||
|
panels) that allow keyboard interaction. Using this option can allow
|
||||||
|
implementing a desktop shell that can be fully usable without the
|
||||||
|
mouse.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
</enum>
|
||||||
|
|
||||||
<request name="set_keyboard_interactivity">
|
<request name="set_keyboard_interactivity">
|
||||||
<description summary="requests keyboard events">
|
<description summary="requests keyboard events">
|
||||||
Set to 1 to request that the seat send keyboard events to this layer
|
Set how keyboard events are delivered to this surface. By default,
|
||||||
surface. For layers below the shell surface layer, the seat will use
|
layer shell surfaces do not receive keyboard events; this request can
|
||||||
normal focus semantics. For layers above the shell surface layers, the
|
be used to change this.
|
||||||
seat will always give exclusive keyboard focus to the top-most layer
|
|
||||||
which has keyboard interactivity set to true.
|
This setting is inherited by child surfaces set by the get_popup
|
||||||
|
request.
|
||||||
|
|
||||||
Layer surfaces receive pointer, touch, and tablet events normally. If
|
Layer surfaces receive pointer, touch, and tablet events normally. If
|
||||||
you do not want to receive them, set the input region on your surface
|
you do not want to receive them, set the input region on your surface
|
||||||
to an empty region.
|
to an empty region.
|
||||||
|
|
||||||
Events is double-buffered, see wl_surface.commit.
|
Keyboard interactivity is double-buffered, see wl_surface.commit.
|
||||||
</description>
|
</description>
|
||||||
<arg name="keyboard_interactivity" type="uint"/>
|
<arg name="keyboard_interactivity" type="uint" enum="keyboard_interactivity"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<request name="get_popup">
|
<request name="get_popup">
|
||||||
@ -273,6 +366,7 @@
|
|||||||
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
|
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
|
||||||
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
||||||
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
||||||
|
<entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/>
|
||||||
</enum>
|
</enum>
|
||||||
|
|
||||||
<enum name="anchor" bitfield="true">
|
<enum name="anchor" bitfield="true">
|
||||||
@ -281,5 +375,16 @@
|
|||||||
<entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
|
<entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
|
||||||
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
|
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
|
||||||
</enum>
|
</enum>
|
||||||
|
|
||||||
|
<!-- Version 2 additions -->
|
||||||
|
|
||||||
|
<request name="set_layer" since="2">
|
||||||
|
<description summary="change the layer of the surface">
|
||||||
|
Change the layer that the surface is rendered on.
|
||||||
|
|
||||||
|
Layer is double-buffered, see wl_surface.commit.
|
||||||
|
</description>
|
||||||
|
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
||||||
|
</request>
|
||||||
</interface>
|
</interface>
|
||||||
</protocol>
|
</protocol>
|
||||||
|
|||||||
13
src/debug.rs → src/actors/external/debug.rs
vendored
13
src/debug.rs → src/actors/external/debug.rs
vendored
@ -3,19 +3,20 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
use crate::main;
|
||||||
|
use crate::state;
|
||||||
|
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use zbus::{Connection, ObjectServer, dbus_interface, fdo};
|
use zbus::{Connection, ObjectServer, dbus_interface, fdo};
|
||||||
|
|
||||||
use crate::event_loop;
|
use super::Void;
|
||||||
use crate::state;
|
|
||||||
|
|
||||||
|
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
|
|
||||||
/// Accepts commands controlling the debug mode
|
/// Accepts commands controlling the debug mode
|
||||||
struct Manager {
|
struct Manager {
|
||||||
sender: event_loop::driver::Threaded,
|
sender: main::EventLoop,
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ impl Manager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start(mgr: Manager) -> Result<(), Box<dyn std::error::Error>> {
|
fn start(mgr: Manager) -> Result<Void, Box<dyn std::error::Error>> {
|
||||||
let connection = Connection::new_session()?;
|
let connection = Connection::new_session()?;
|
||||||
fdo::DBusProxy::new(&connection)?.request_name(
|
fdo::DBusProxy::new(&connection)?.request_name(
|
||||||
"sm.puri.SqueekDebug",
|
"sm.puri.SqueekDebug",
|
||||||
@ -54,7 +55,7 @@ fn start(mgr: Manager) -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init(sender: event_loop::driver::Threaded) {
|
pub fn init(sender: main::EventLoop) {
|
||||||
let mgr = Manager {
|
let mgr = Manager {
|
||||||
sender,
|
sender,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
14
src/actors/external/mod.rs
vendored
Normal file
14
src/actors/external/mod.rs
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 Purism SPC
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! Contains actors with custom event loops, not based off of the event_loop module. */
|
||||||
|
|
||||||
|
pub mod debug;
|
||||||
|
#[cfg(feature = "zbus_v1_5")]
|
||||||
|
pub mod screensaver;
|
||||||
|
|
||||||
|
/// The uninhabited type. Cannot be created or returned; means "will never return" as return type. Useful for infinite loops.
|
||||||
|
enum Void {}
|
||||||
57
src/actors/external/screensaver.rs
vendored
Normal file
57
src/actors/external/screensaver.rs
vendored
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 Purism SPC
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
use crate::actors::Destination;
|
||||||
|
use crate::actors::popover;
|
||||||
|
use crate::logging;
|
||||||
|
use std::thread;
|
||||||
|
use zbus::{Connection, dbus_proxy};
|
||||||
|
|
||||||
|
use super::Void;
|
||||||
|
|
||||||
|
|
||||||
|
#[dbus_proxy(
|
||||||
|
interface = "org.freedesktop.ScreenSaver",
|
||||||
|
default_service = "org.freedesktop.ScreenSaver",
|
||||||
|
default_path = "/org/freedesktop/ScreenSaver"
|
||||||
|
)]
|
||||||
|
pub trait Manager {
|
||||||
|
#[dbus_proxy(signal)]
|
||||||
|
fn active_changed(&self, active: bool) -> fdo::Result<()>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Listens to screensaver (screen lock) changes
|
||||||
|
pub fn init(destination: popover::Destination) {
|
||||||
|
thread::spawn(move || {
|
||||||
|
if let Err(e) = start(destination) {
|
||||||
|
log_print!(
|
||||||
|
logging::Level::Surprise,
|
||||||
|
"Could not track screensaver status, giving up: {:?}",
|
||||||
|
e,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn start(destination: popover::Destination) -> Result<Void, zbus::Error> {
|
||||||
|
let conn = Connection::new_session()?;
|
||||||
|
let manager = ManagerProxy::new(&conn)?;
|
||||||
|
|
||||||
|
manager.connect_active_changed(move |m| {
|
||||||
|
destination.send(popover::Event::ScreensaverActive(m));
|
||||||
|
Ok(())
|
||||||
|
})?;
|
||||||
|
|
||||||
|
loop {
|
||||||
|
match manager.next_signal() {
|
||||||
|
Ok(None) => {}
|
||||||
|
other => log_print!(
|
||||||
|
logging::Level::Bug,
|
||||||
|
"Encountered unhandled event: {:?}",
|
||||||
|
other,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -20,4 +20,14 @@ and by receiving updates from it.
|
|||||||
// Panel contains state and logic to protect the main state from getting flooded
|
// Panel contains state and logic to protect the main state from getting flooded
|
||||||
// with low-level wayland and gtk sizing events.
|
// with low-level wayland and gtk sizing events.
|
||||||
|
|
||||||
pub mod popover;
|
pub mod external;
|
||||||
|
pub mod popover;
|
||||||
|
|
||||||
|
/// The implementing actor is able to receive and handle messages.
|
||||||
|
/// Typically, it's the sending end of the channel,
|
||||||
|
/// whose other end is inside an event loop.
|
||||||
|
// TODO: implement for remaning actors and make the event loop refer to this.
|
||||||
|
pub trait Destination {
|
||||||
|
type Event;
|
||||||
|
fn send(&self, event: Self::Event);
|
||||||
|
}
|
||||||
|
|||||||
@ -11,30 +11,66 @@ but it cannot get the user-selected overlay, because it's stored in state.
|
|||||||
To solve this, overlay will be cached in the popover actor,
|
To solve this, overlay will be cached in the popover actor,
|
||||||
and updated by main state every time it changes.
|
and updated by main state every time it changes.
|
||||||
*/
|
*/
|
||||||
|
use crate::logging;
|
||||||
|
use std::borrow::BorrowMut;
|
||||||
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
pub mod c {
|
pub mod c {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::util::c::Wrapped;
|
use crate::util::c::ArcWrapped;
|
||||||
/// The mutable instance of state
|
/// The mutable instance of state.
|
||||||
pub type Actor = Wrapped<State>;
|
/// Thread-safe because this actor does not get its own event loop,
|
||||||
|
/// and therefore can't have a channel to receive messages,
|
||||||
|
/// so instead messages will be passed directly to the mutexed actor.
|
||||||
|
pub type Actor = ArcWrapped<State>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
pub type Destination = Arc<Mutex<State>>;
|
||||||
pub struct State {
|
|
||||||
pub overlay: Option<String>,
|
#[derive(Debug)]
|
||||||
|
pub enum Event {
|
||||||
|
Overlay(Option<String>),
|
||||||
|
ScreensaverActive(bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl State {
|
impl super::Destination for Destination {
|
||||||
pub fn new() -> Self {
|
type Event = Event;
|
||||||
Self { overlay: None }
|
fn send(&self, event: Self::Event) {
|
||||||
|
let actor = self.lock();
|
||||||
|
match actor {
|
||||||
|
Ok(mut actor) => {
|
||||||
|
let actor = actor.borrow_mut();
|
||||||
|
**actor = actor.clone().handle_event(event);
|
||||||
|
},
|
||||||
|
Err(e) => log_print!(
|
||||||
|
logging::Level::Bug,
|
||||||
|
"Cannot lock popover state: {:?}",
|
||||||
|
e,
|
||||||
|
),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_overlay(
|
#[derive(Clone, Debug)]
|
||||||
actor: &c::Actor,
|
pub struct State {
|
||||||
overlay: Option<String>,
|
pub overlay: Option<String>,
|
||||||
) {
|
/// Settings button active
|
||||||
let actor = actor.clone_ref();
|
pub settings_active: bool,
|
||||||
let mut actor = actor.borrow_mut();
|
}
|
||||||
actor.overlay = overlay;
|
|
||||||
}
|
impl State {
|
||||||
|
pub fn new(settings_active: bool) -> Self {
|
||||||
|
Self {
|
||||||
|
overlay: None,
|
||||||
|
settings_active,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_event(mut self, event: Event) -> Self {
|
||||||
|
match event {
|
||||||
|
Event::Overlay(overlay) => { self.overlay = overlay; },
|
||||||
|
Event::ScreensaverActive(lock_active) => { self.settings_active = !lock_active; },
|
||||||
|
};
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -95,56 +95,56 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
/// ```
|
/// ```
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! assert_matches {
|
macro_rules! assert_matches {
|
||||||
( $e:expr , $($pat:pat)|+ ) => {
|
( $e:expr , $($pat:pat_param)|+ ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ => (),
|
$($pat)|+ => (),
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
||||||
e, stringify!($($pat)|+))
|
e, stringify!($($pat)|+))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ if $cond:expr ) => {
|
( $e:expr , $($pat:pat_param)|+ if $cond:expr ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ if $cond => (),
|
$($pat)|+ if $cond => (),
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
||||||
e, stringify!($($pat)|+ if $cond))
|
e, stringify!($($pat)|+ if $cond))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ => $arm:expr ) => {
|
( $e:expr , $($pat:pat_param)|+ => $arm:expr ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ => $arm,
|
$($pat)|+ => $arm,
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
||||||
e, stringify!($($pat)|+))
|
e, stringify!($($pat)|+))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ if $cond:expr => $arm:expr ) => {
|
( $e:expr , $($pat:pat_param)|+ if $cond:expr => $arm:expr ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ if $cond => $arm,
|
$($pat)|+ if $cond => $arm,
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
||||||
e, stringify!($($pat)|+ if $cond))
|
e, stringify!($($pat)|+ if $cond))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ , $($arg:tt)* ) => {
|
( $e:expr , $($pat:pat_param)|+ , $($arg:tt)* ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ => (),
|
$($pat)|+ => (),
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
||||||
e, stringify!($($pat)|+), format_args!($($arg)*))
|
e, stringify!($($pat)|+), format_args!($($arg)*))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ if $cond:expr , $($arg:tt)* ) => {
|
( $e:expr , $($pat:pat_param)|+ if $cond:expr , $($arg:tt)* ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ if $cond => (),
|
$($pat)|+ if $cond => (),
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
||||||
e, stringify!($($pat)|+ if $cond), format_args!($($arg)*))
|
e, stringify!($($pat)|+ if $cond), format_args!($($arg)*))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ => $arm:expr , $($arg:tt)* ) => {
|
( $e:expr , $($pat:pat_param)|+ => $arm:expr , $($arg:tt)* ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ => $arm,
|
$($pat)|+ => $arm,
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
||||||
e, stringify!($($pat)|+), format_args!($($arg)*))
|
e, stringify!($($pat)|+), format_args!($($arg)*))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ if $cond:expr => $arm:expr , $($arg:tt)* ) => {
|
( $e:expr , $($pat:pat_param)|+ if $cond:expr => $arm:expr , $($arg:tt)* ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ if $cond => $arm,
|
$($pat)|+ if $cond => $arm,
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
||||||
|
|||||||
@ -5,12 +5,28 @@ extern crate rs;
|
|||||||
use rs::tests::check_layout_file;
|
use rs::tests::check_layout_file;
|
||||||
|
|
||||||
fn main() -> () {
|
fn main() -> () {
|
||||||
|
#[cfg(feature = "clap_v4")]
|
||||||
|
let matches = clap::Command::new("squeekboard-test-layout")
|
||||||
|
.about("Test keyboard layout for errors. Returns OK or an error message containing further information.")
|
||||||
|
.arg(
|
||||||
|
clap::Arg::new("INPUT")
|
||||||
|
.required(true)
|
||||||
|
.help("Yaml keyboard layout file to test")
|
||||||
|
)
|
||||||
|
.get_matches();
|
||||||
|
#[cfg(feature = "clap_v4")]
|
||||||
|
let m = matches.get_one::<String>("INPUT");
|
||||||
|
|
||||||
|
#[cfg(not(feature = "clap_v4"))]
|
||||||
let matches = clap_app!(test_layout =>
|
let matches = clap_app!(test_layout =>
|
||||||
(name: "squeekboard-test-layout")
|
(name: "squeekboard-test-layout")
|
||||||
(about: "Test keyboard layout for errors. Returns OK or an error message containing further information.")
|
(about: "Test keyboard layout for errors. Returns OK or an error message containing further information.")
|
||||||
(@arg INPUT: +required "Yaml keyboard layout file to test")
|
(@arg INPUT: +required "Yaml keyboard layout file to test")
|
||||||
).get_matches();
|
).get_matches();
|
||||||
if check_layout_file(matches.value_of("INPUT").unwrap()) == () {
|
#[cfg(not(feature = "clap_v4"))]
|
||||||
|
let m = matches.value_of("INPUT");
|
||||||
|
|
||||||
|
if check_layout_file(m.unwrap()) == () {
|
||||||
println!("Test result: OK");
|
println!("Test result: OK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -192,7 +192,7 @@ fn iter_layout_sources(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn load_layout_data(source: DataSource)
|
fn load_layout_data(source: DataSource)
|
||||||
-> Result<::layout::LayoutData, LoadError>
|
-> Result<crate::layout::LayoutParseData, LoadError>
|
||||||
{
|
{
|
||||||
let handler = logging::Print {};
|
let handler = logging::Print {};
|
||||||
match source {
|
match source {
|
||||||
@ -217,7 +217,7 @@ fn load_layout_data_with_fallback(
|
|||||||
kind: ArrangementKind,
|
kind: ArrangementKind,
|
||||||
purpose: ContentPurpose,
|
purpose: ContentPurpose,
|
||||||
overlay: Option<&str>,
|
overlay: Option<&str>,
|
||||||
) -> (ArrangementKind, layout::LayoutData) {
|
) -> (ArrangementKind, layout::LayoutParseData) {
|
||||||
|
|
||||||
// Build the path to the right keyboard layout subdirectory
|
// Build the path to the right keyboard layout subdirectory
|
||||||
let path = env::var_os("SQUEEKBOARD_KEYBOARDSDIR")
|
let path = env::var_os("SQUEEKBOARD_KEYBOARDSDIR")
|
||||||
@ -253,14 +253,14 @@ fn load_layout_data_with_fallback(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn load_layout(
|
pub fn load_layout(
|
||||||
name: String,
|
name: &String,
|
||||||
kind: ArrangementKind,
|
kind: ArrangementKind,
|
||||||
variant: ContentPurpose,
|
variant: ContentPurpose,
|
||||||
overlay: Option<String>,
|
overlay: &Option<String>,
|
||||||
) -> layout::Layout {
|
) -> layout::Layout {
|
||||||
let overlay = overlay.as_ref().map(String::as_str);
|
let overlay = overlay.as_ref().map(String::as_str);
|
||||||
let (found_kind, layout)
|
let (found_kind, layout)
|
||||||
= load_layout_data_with_fallback(&name, kind, variant, overlay);
|
= load_layout_data_with_fallback(name, kind, variant, overlay);
|
||||||
layout::Layout::new(layout, found_kind, variant)
|
layout::Layout::new(layout, found_kind, variant)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ pub fn load_layout(
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use ::logging::ProblemPanic;
|
use crate::logging::ProblemPanic;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parsing_fallback() {
|
fn parsing_fallback() {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ pub mod parsing;
|
|||||||
use std::io;
|
use std::io;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use ::keyboard::FormattingError;
|
use crate::keyboard::FormattingError;
|
||||||
|
|
||||||
/// Errors encountered loading the layout into yaml
|
/// Errors encountered loading the layout into yaml
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
@ -4,33 +4,29 @@
|
|||||||
|
|
||||||
/*! Parsing of the data files containing layouts */
|
/*! Parsing of the data files containing layouts */
|
||||||
|
|
||||||
use std::cell::RefCell;
|
|
||||||
use std::collections::{ HashMap, HashSet };
|
use std::collections::{ HashMap, HashSet };
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::rc::Rc;
|
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
use xkbcommon::xkb;
|
use xkbcommon::xkb;
|
||||||
|
|
||||||
use super::{ Error, LoadError };
|
use super::{ Error, LoadError };
|
||||||
|
|
||||||
use ::action;
|
use crate::action;
|
||||||
use ::keyboard::{
|
use crate::keyboard::{
|
||||||
KeyState, PressType,
|
Key, generate_keymaps, generate_keycodes, KeyCode, FormattingError
|
||||||
generate_keymaps, generate_keycodes, KeyCode, FormattingError
|
|
||||||
};
|
};
|
||||||
use ::layout;
|
use crate::layout;
|
||||||
use ::logging;
|
use crate::logging;
|
||||||
use ::util::hash_map_map;
|
use crate::resources;
|
||||||
use ::resources;
|
|
||||||
|
|
||||||
// traits, derives
|
// traits, derives
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
use std::iter::FromIterator;
|
use std::iter::FromIterator;
|
||||||
use ::logging::Warn;
|
use crate::logging::Warn;
|
||||||
|
|
||||||
// TODO: find a nice way to make sure non-positive sizes don't break layouts
|
// TODO: find a nice way to make sure non-positive sizes don't break layouts
|
||||||
|
|
||||||
@ -157,7 +153,7 @@ impl Layout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn build<H: logging::Handler>(self, mut warning_handler: H)
|
pub fn build<H: logging::Handler>(self, mut warning_handler: H)
|
||||||
-> (Result<::layout::LayoutData, FormattingError>, H)
|
-> (Result<crate::layout::LayoutParseData, FormattingError>, H)
|
||||||
{
|
{
|
||||||
let button_names = self.views.values()
|
let button_names = self.views.values()
|
||||||
.flat_map(|rows| {
|
.flat_map(|rows| {
|
||||||
@ -168,7 +164,7 @@ impl Layout {
|
|||||||
let button_names: HashSet<&str>
|
let button_names: HashSet<&str>
|
||||||
= HashSet::from_iter(button_names);
|
= HashSet::from_iter(button_names);
|
||||||
|
|
||||||
let button_actions: Vec<(&str, ::action::Action)>
|
let button_actions: Vec<(&str, crate::action::Action)>
|
||||||
= button_names.iter().map(|name| {(
|
= button_names.iter().map(|name| {(
|
||||||
*name,
|
*name,
|
||||||
create_action(
|
create_action(
|
||||||
@ -183,10 +179,10 @@ impl Layout {
|
|||||||
extract_symbol_names(&button_actions)
|
extract_symbol_names(&button_actions)
|
||||||
);
|
);
|
||||||
|
|
||||||
let button_states = HashMap::<String, KeyState>::from_iter(
|
let button_states = HashMap::<String, Key>::from_iter(
|
||||||
button_actions.into_iter().map(|(name, action)| {
|
button_actions.into_iter().map(|(name, action)| {
|
||||||
let keycodes = match &action {
|
let keycodes = match &action {
|
||||||
::action::Action::Submit { text: _, keys } => {
|
crate::action::Action::Submit { text: _, keys } => {
|
||||||
keys.iter().map(|named_keysym| {
|
keys.iter().map(|named_keysym| {
|
||||||
symbolmap.get(named_keysym.0.as_str())
|
symbolmap.get(named_keysym.0.as_str())
|
||||||
.expect(
|
.expect(
|
||||||
@ -208,8 +204,7 @@ impl Layout {
|
|||||||
};
|
};
|
||||||
(
|
(
|
||||||
name.into(),
|
name.into(),
|
||||||
KeyState {
|
Key {
|
||||||
pressed: PressType::Released,
|
|
||||||
keycodes,
|
keycodes,
|
||||||
action,
|
action,
|
||||||
}
|
}
|
||||||
@ -222,20 +217,14 @@ impl Layout {
|
|||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
};
|
};
|
||||||
|
|
||||||
let button_states_cache = hash_map_map(
|
let button_states_cache = button_states;
|
||||||
button_states,
|
|
||||||
|name, state| {(
|
|
||||||
name,
|
|
||||||
Rc::new(RefCell::new(state))
|
|
||||||
)}
|
|
||||||
);
|
|
||||||
|
|
||||||
let views: Vec<_> = self.views.iter()
|
let views: Vec<_> = self.views.iter()
|
||||||
.map(|(name, view)| {
|
.map(|(name, view)| {
|
||||||
let rows = view.iter().map(|row| {
|
let rows = view.iter().map(|row| {
|
||||||
let buttons = row.split_ascii_whitespace()
|
let buttons = row.split_ascii_whitespace()
|
||||||
.map(|name| {
|
.map(|name| {
|
||||||
Box::new(create_button(
|
create_button(
|
||||||
&self.buttons,
|
&self.buttons,
|
||||||
&self.outlines,
|
&self.outlines,
|
||||||
name,
|
name,
|
||||||
@ -243,7 +232,7 @@ impl Layout {
|
|||||||
.expect("Button state not created")
|
.expect("Button state not created")
|
||||||
.clone(),
|
.clone(),
|
||||||
&mut warning_handler,
|
&mut warning_handler,
|
||||||
))
|
)
|
||||||
});
|
});
|
||||||
layout::Row::new(
|
layout::Row::new(
|
||||||
add_offsets(
|
add_offsets(
|
||||||
@ -279,7 +268,7 @@ impl Layout {
|
|||||||
};
|
};
|
||||||
|
|
||||||
(
|
(
|
||||||
Ok(::layout::LayoutData {
|
Ok(layout::LayoutParseData {
|
||||||
views: views,
|
views: views,
|
||||||
keymaps: keymaps.into_iter().map(|keymap_str|
|
keymaps: keymaps.into_iter().map(|keymap_str|
|
||||||
CString::new(keymap_str)
|
CString::new(keymap_str)
|
||||||
@ -303,7 +292,7 @@ fn create_action<H: logging::Handler>(
|
|||||||
name: &str,
|
name: &str,
|
||||||
view_names: Vec<&String>,
|
view_names: Vec<&String>,
|
||||||
warning_handler: &mut H,
|
warning_handler: &mut H,
|
||||||
) -> ::action::Action {
|
) -> crate::action::Action {
|
||||||
let default_meta = ButtonMeta::default();
|
let default_meta = ButtonMeta::default();
|
||||||
let symbol_meta = button_info.get(name)
|
let symbol_meta = button_info.get(name)
|
||||||
.unwrap_or(&default_meta);
|
.unwrap_or(&default_meta);
|
||||||
@ -367,7 +356,7 @@ fn create_action<H: logging::Handler>(
|
|||||||
match submission {
|
match submission {
|
||||||
SubmitData::Action(
|
SubmitData::Action(
|
||||||
Action::SetView(view_name)
|
Action::SetView(view_name)
|
||||||
) => ::action::Action::SetView(
|
) => crate::action::Action::SetView(
|
||||||
filter_view_name(
|
filter_view_name(
|
||||||
name, view_name.clone(), &view_names,
|
name, view_name.clone(), &view_names,
|
||||||
warning_handler,
|
warning_handler,
|
||||||
@ -377,7 +366,7 @@ fn create_action<H: logging::Handler>(
|
|||||||
lock_view, unlock_view,
|
lock_view, unlock_view,
|
||||||
pops,
|
pops,
|
||||||
looks_locked_from,
|
looks_locked_from,
|
||||||
}) => ::action::Action::LockView {
|
}) => crate::action::Action::LockView {
|
||||||
lock: filter_view_name(
|
lock: filter_view_name(
|
||||||
name,
|
name,
|
||||||
lock_view.clone(),
|
lock_view.clone(),
|
||||||
@ -395,11 +384,11 @@ fn create_action<H: logging::Handler>(
|
|||||||
},
|
},
|
||||||
SubmitData::Action(
|
SubmitData::Action(
|
||||||
Action::ShowPrefs
|
Action::ShowPrefs
|
||||||
) => ::action::Action::ShowPreferences,
|
) => crate::action::Action::ShowPreferences,
|
||||||
SubmitData::Action(Action::Erase) => action::Action::Erase,
|
SubmitData::Action(Action::Erase) => action::Action::Erase,
|
||||||
SubmitData::Keysym(keysym) => ::action::Action::Submit {
|
SubmitData::Keysym(keysym) => crate::action::Action::Submit {
|
||||||
text: None,
|
text: None,
|
||||||
keys: vec!(::action::KeySym(
|
keys: vec!(crate::action::KeySym(
|
||||||
match keysym_valid(keysym.as_str()) {
|
match keysym_valid(keysym.as_str()) {
|
||||||
true => keysym.clone(),
|
true => keysym.clone(),
|
||||||
false => {
|
false => {
|
||||||
@ -415,7 +404,7 @@ fn create_action<H: logging::Handler>(
|
|||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
},
|
},
|
||||||
SubmitData::Text(text) => ::action::Action::Submit {
|
SubmitData::Text(text) => crate::action::Action::Submit {
|
||||||
text: CString::new(text.clone()).or_warn(
|
text: CString::new(text.clone()).or_warn(
|
||||||
warning_handler,
|
warning_handler,
|
||||||
logging::Problem::Warning,
|
logging::Problem::Warning,
|
||||||
@ -423,7 +412,7 @@ fn create_action<H: logging::Handler>(
|
|||||||
),
|
),
|
||||||
keys: text.chars().map(|codepoint| {
|
keys: text.chars().map(|codepoint| {
|
||||||
let codepoint_string = codepoint.to_string();
|
let codepoint_string = codepoint.to_string();
|
||||||
::action::KeySym(match keysym_valid(codepoint_string.as_str()) {
|
crate::action::KeySym(match keysym_valid(codepoint_string.as_str()) {
|
||||||
true => codepoint_string,
|
true => codepoint_string,
|
||||||
false => format!("U{:04X}", codepoint as u32),
|
false => format!("U{:04X}", codepoint as u32),
|
||||||
})
|
})
|
||||||
@ -461,9 +450,9 @@ fn create_button<H: logging::Handler>(
|
|||||||
button_info: &HashMap<String, ButtonMeta>,
|
button_info: &HashMap<String, ButtonMeta>,
|
||||||
outlines: &HashMap<String, Outline>,
|
outlines: &HashMap<String, Outline>,
|
||||||
name: &str,
|
name: &str,
|
||||||
state: Rc<RefCell<KeyState>>,
|
data: Key,
|
||||||
warning_handler: &mut H,
|
warning_handler: &mut H,
|
||||||
) -> ::layout::Button {
|
) -> crate::layout::Button {
|
||||||
let cname = CString::new(name.clone())
|
let cname = CString::new(name.clone())
|
||||||
.expect("Bad name");
|
.expect("Bad name");
|
||||||
// don't remove, because multiple buttons with the same name are allowed
|
// don't remove, because multiple buttons with the same name are allowed
|
||||||
@ -473,13 +462,13 @@ fn create_button<H: logging::Handler>(
|
|||||||
|
|
||||||
// TODO: move conversion to the C/Rust boundary
|
// TODO: move conversion to the C/Rust boundary
|
||||||
let label = if let Some(label) = &button_meta.label {
|
let label = if let Some(label) = &button_meta.label {
|
||||||
::layout::Label::Text(CString::new(label.as_str())
|
crate::layout::Label::Text(CString::new(label.as_str())
|
||||||
.expect("Bad label"))
|
.expect("Bad label"))
|
||||||
} else if let Some(icon) = &button_meta.icon {
|
} else if let Some(icon) = &button_meta.icon {
|
||||||
::layout::Label::IconName(CString::new(icon.as_str())
|
crate::layout::Label::IconName(CString::new(icon.as_str())
|
||||||
.expect("Bad icon"))
|
.expect("Bad icon"))
|
||||||
} else if let Some(text) = &button_meta.text {
|
} else if let Some(text) = &button_meta.text {
|
||||||
::layout::Label::Text(
|
crate::layout::Label::Text(
|
||||||
CString::new(text.as_str())
|
CString::new(text.as_str())
|
||||||
.or_warn(
|
.or_warn(
|
||||||
warning_handler,
|
warning_handler,
|
||||||
@ -488,7 +477,7 @@ fn create_button<H: logging::Handler>(
|
|||||||
).unwrap_or_else(|| CString::new("").unwrap())
|
).unwrap_or_else(|| CString::new("").unwrap())
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
::layout::Label::Text(cname.clone())
|
crate::layout::Label::Text(cname.clone())
|
||||||
};
|
};
|
||||||
|
|
||||||
let outline_name = match &button_meta.outline {
|
let outline_name = match &button_meta.outline {
|
||||||
@ -523,7 +512,8 @@ fn create_button<H: logging::Handler>(
|
|||||||
height: outline.height,
|
height: outline.height,
|
||||||
},
|
},
|
||||||
label: label,
|
label: label,
|
||||||
state: state,
|
action: data.action,
|
||||||
|
keycodes: data.keycodes,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,7 +541,7 @@ mod tests {
|
|||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
use ::logging::ProblemPanic;
|
use crate::logging::ProblemPanic;
|
||||||
|
|
||||||
fn path_from_root(file: &'static str) -> PathBuf {
|
fn path_from_root(file: &'static str) -> PathBuf {
|
||||||
let source_dir = env::var("SOURCE_DIR")
|
let source_dir = env::var("SOURCE_DIR")
|
||||||
@ -647,7 +637,7 @@ mod tests {
|
|||||||
.get_rows()[0].1
|
.get_rows()[0].1
|
||||||
.get_buttons()[0].1
|
.get_buttons()[0].1
|
||||||
.label,
|
.label,
|
||||||
::layout::Label::Text(CString::new("test").unwrap())
|
crate::layout::Label::Text(CString::new("test").unwrap())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -662,7 +652,7 @@ mod tests {
|
|||||||
.get_rows()[0].1
|
.get_rows()[0].1
|
||||||
.get_buttons()[0].1
|
.get_buttons()[0].1
|
||||||
.label,
|
.label,
|
||||||
::layout::Label::Text(CString::new("test").unwrap())
|
crate::layout::Label::Text(CString::new("test").unwrap())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,7 +667,6 @@ mod tests {
|
|||||||
out.views["base"].1
|
out.views["base"].1
|
||||||
.get_rows()[0].1
|
.get_rows()[0].1
|
||||||
.get_buttons()[0].1
|
.get_buttons()[0].1
|
||||||
.state.borrow()
|
|
||||||
.keycodes.len(),
|
.keycodes.len(),
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
@ -694,7 +683,6 @@ mod tests {
|
|||||||
out.views["base"].1
|
out.views["base"].1
|
||||||
.get_rows()[0].1
|
.get_rows()[0].1
|
||||||
.get_buttons()[0].1
|
.get_buttons()[0].1
|
||||||
.state.borrow()
|
|
||||||
.keycodes.len(),
|
.keycodes.len(),
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
@ -729,9 +717,9 @@ mod tests {
|
|||||||
Vec::new(),
|
Vec::new(),
|
||||||
&mut ProblemPanic,
|
&mut ProblemPanic,
|
||||||
),
|
),
|
||||||
::action::Action::Submit {
|
crate::action::Action::Submit {
|
||||||
text: Some(CString::new(".").unwrap()),
|
text: Some(CString::new(".").unwrap()),
|
||||||
keys: vec!(::action::KeySym("U002E".into())),
|
keys: vec!(crate::action::KeySym("U002E".into())),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
/*! Drawing the UI */
|
/*! Drawing the UI */
|
||||||
|
|
||||||
use cairo;
|
use cairo;
|
||||||
use std::cell::RefCell;
|
|
||||||
|
|
||||||
use ::action::{ Action, Modifier };
|
use crate::action::{ Action, Modifier };
|
||||||
use ::keyboard;
|
use crate::keyboard;
|
||||||
use ::layout::{ Button, Label, LatchedState, Layout };
|
use crate::layout::{ Button, ButtonPosition, Label, LatchedState, Layout };
|
||||||
use ::layout::c::{ Bounds, EekGtkKeyboard, Point };
|
use crate::layout::c::{ Bounds, EekGtkKeyboard, Point };
|
||||||
use ::submission::c::Submission as CSubmission;
|
use crate::submission::c::Submission as CSubmission;
|
||||||
|
|
||||||
use glib::translate::FromGlibPtrNone;
|
use glib::translate::FromGlibPtrNone;
|
||||||
use gtk::prelude::WidgetExt;
|
use gtk::prelude::WidgetExt;
|
||||||
@ -84,14 +83,21 @@ mod c {
|
|||||||
let cr = unsafe { cairo::Context::from_raw_none(cr) };
|
let cr = unsafe { cairo::Context::from_raw_none(cr) };
|
||||||
let active_modifiers = submission.get_active_modifiers();
|
let active_modifiers = submission.get_active_modifiers();
|
||||||
|
|
||||||
layout.foreach_visible_button(|offset, button| {
|
layout.foreach_visible_button(|offset, button, (row, position_in_row)| {
|
||||||
let state = RefCell::borrow(&button.state).clone();
|
// TODO: this iterator copies string indices way too much.
|
||||||
|
// For efficiency, it would be better to draw pressed buttons from the list first,
|
||||||
|
// and then iterate the rest without having to look up their indices.
|
||||||
|
let state = layout.state.active_buttons.get(&ButtonPosition {
|
||||||
|
view: layout.state.current_view.clone(),
|
||||||
|
row,
|
||||||
|
position_in_row,
|
||||||
|
});
|
||||||
|
|
||||||
let locked = LockedStyle::from_action(
|
let locked = LockedStyle::from_action(
|
||||||
&state.action,
|
&button.action,
|
||||||
&active_modifiers,
|
&active_modifiers,
|
||||||
layout.get_view_latched(),
|
layout.get_view_latched(),
|
||||||
&layout.current_view,
|
&layout.state.current_view,
|
||||||
);
|
);
|
||||||
if state.pressed == keyboard::PressType::Pressed
|
if state.pressed == keyboard::PressType::Pressed
|
||||||
|| locked != LockedStyle::Free
|
|| locked != LockedStyle::Free
|
||||||
@ -99,7 +105,7 @@ mod c {
|
|||||||
render_button_at_position(
|
render_button_at_position(
|
||||||
renderer, &cr,
|
renderer, &cr,
|
||||||
offset,
|
offset,
|
||||||
button.as_ref(),
|
button,
|
||||||
state.pressed, locked,
|
state.pressed, locked,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -116,11 +122,11 @@ mod c {
|
|||||||
let layout = unsafe { &mut *layout };
|
let layout = unsafe { &mut *layout };
|
||||||
let cr = unsafe { cairo::Context::from_raw_none(cr) };
|
let cr = unsafe { cairo::Context::from_raw_none(cr) };
|
||||||
|
|
||||||
layout.foreach_visible_button(|offset, button| {
|
layout.foreach_visible_button(|offset, button, _index| {
|
||||||
render_button_at_position(
|
render_button_at_position(
|
||||||
renderer, &cr,
|
renderer, &cr,
|
||||||
offset,
|
offset,
|
||||||
button.as_ref(),
|
button,
|
||||||
keyboard::PressType::Released,
|
keyboard::PressType::Released,
|
||||||
LockedStyle::Free,
|
LockedStyle::Free,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -18,21 +18,22 @@
|
|||||||
|
|
||||||
use crate::event_loop;
|
use crate::event_loop;
|
||||||
use crate::logging;
|
use crate::logging;
|
||||||
use crate::main::Commands;
|
|
||||||
use crate::state::{ Application, Event };
|
|
||||||
use glib;
|
use glib;
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
use super::{ActorState, Outcome};
|
||||||
|
|
||||||
// Traits
|
// Traits
|
||||||
use crate::logging::Warn;
|
use crate::logging::Warn;
|
||||||
|
use super::Event;
|
||||||
|
|
||||||
|
|
||||||
/// Type of the sender that waits for external events
|
type UISender<S> = glib::Sender<
|
||||||
type Sender = mpsc::Sender<Event>;
|
<
|
||||||
/// Type of the sender that waits for internal state changes
|
<S as ActorState>::Outcome as Outcome
|
||||||
type UISender = glib::Sender<Commands>;
|
>::Commands
|
||||||
|
>;
|
||||||
|
|
||||||
/// This loop driver spawns a new thread which updates the state in a loop,
|
/// This loop driver spawns a new thread which updates the state in a loop,
|
||||||
/// in response to incoming events.
|
/// in response to incoming events.
|
||||||
@ -43,12 +44,27 @@ type UISender = glib::Sender<Commands>;
|
|||||||
// This can/should be abstracted over Event and Commands,
|
// This can/should be abstracted over Event and Commands,
|
||||||
// so that the C call-ins can be thrown away from here and defined near events.
|
// so that the C call-ins can be thrown away from here and defined near events.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Threaded {
|
pub struct Threaded<S>
|
||||||
thread: Sender,
|
where
|
||||||
|
S: ActorState + Send,
|
||||||
|
S::Event: Send,
|
||||||
|
<S::Outcome as Outcome>::Commands: Send,
|
||||||
|
{
|
||||||
|
/// Waits for external events
|
||||||
|
thread: mpsc::Sender<S::Event>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Threaded {
|
impl<S> Threaded<S>
|
||||||
pub fn new(ui: UISender, initial_state: Application) -> Self {
|
where
|
||||||
|
// Not sure why this needs 'static. It's already owned.
|
||||||
|
S: ActorState + Send + 'static,
|
||||||
|
S::Event: Send,
|
||||||
|
<S::Outcome as Outcome>::Commands: Send,
|
||||||
|
{
|
||||||
|
pub fn new(
|
||||||
|
ui: UISender<S>,
|
||||||
|
initial_state: S,
|
||||||
|
) -> Self {
|
||||||
let (sender, receiver) = mpsc::channel();
|
let (sender, receiver) = mpsc::channel();
|
||||||
let saved_sender = sender.clone();
|
let saved_sender = sender.clone();
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
@ -71,13 +87,16 @@ impl Threaded {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send(&self, event: Event) -> Result<(), mpsc::SendError<Event>> {
|
pub fn send(&self, event: S::Event) -> Result<(), mpsc::SendError<S::Event>> {
|
||||||
self.thread.send(event)
|
self.thread.send(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_loop_event(loop_sender: &Sender, state: event_loop::State, event: Event, ui: &UISender)
|
fn handle_loop_event(
|
||||||
-> event_loop::State
|
loop_sender: &mpsc::Sender<S::Event>,
|
||||||
{
|
state: event_loop::State<S>,
|
||||||
|
event: S::Event,
|
||||||
|
ui: &UISender<S>,
|
||||||
|
) -> event_loop::State<S> {
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
|
|
||||||
let (new_state, commands) = event_loop::handle_event(state.clone(), event, now);
|
let (new_state, commands) = event_loop::handle_event(state.clone(), event, now);
|
||||||
@ -94,79 +113,16 @@ impl Threaded {
|
|||||||
new_state
|
new_state
|
||||||
}
|
}
|
||||||
|
|
||||||
fn schedule_timeout_wake(loop_sender: &Sender, when: Instant) {
|
fn schedule_timeout_wake(
|
||||||
|
loop_sender: &mpsc::Sender<S::Event>,
|
||||||
|
when: Instant,
|
||||||
|
) {
|
||||||
let sender = loop_sender.clone();
|
let sender = loop_sender.clone();
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
thread::sleep(when - now);
|
thread::sleep(when - now);
|
||||||
sender.send(Event::TimeoutReached(when))
|
sender.send(S::Event::new_timeout_reached(when))
|
||||||
.or_warn(&mut logging::Print, logging::Problem::Warning, "Can't wake visibility manager");
|
.or_warn(&mut logging::Print, logging::Problem::Warning, "Can't wake manager");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For calling in only
|
|
||||||
mod c {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
use crate::state::Presence;
|
|
||||||
use crate::state::LayoutChoice;
|
|
||||||
use crate::state::visibility;
|
|
||||||
use crate::util;
|
|
||||||
use crate::util::c::Wrapped;
|
|
||||||
use std::os::raw::c_char;
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern "C"
|
|
||||||
fn squeek_state_send_force_visible(mgr: Wrapped<Threaded>) {
|
|
||||||
let sender = mgr.clone_ref();
|
|
||||||
let sender = sender.borrow();
|
|
||||||
sender.send(Event::Visibility(visibility::Event::ForceVisible))
|
|
||||||
.or_warn(&mut logging::Print, logging::Problem::Warning, "Can't send to state manager");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern "C"
|
|
||||||
fn squeek_state_send_force_hidden(sender: Wrapped<Threaded>) {
|
|
||||||
let sender = sender.clone_ref();
|
|
||||||
let sender = sender.borrow();
|
|
||||||
sender.send(Event::Visibility(visibility::Event::ForceHidden))
|
|
||||||
.or_warn(&mut logging::Print, logging::Problem::Warning, "Can't send to state manager");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern "C"
|
|
||||||
fn squeek_state_send_keyboard_present(sender: Wrapped<Threaded>, present: u32) {
|
|
||||||
let sender = sender.clone_ref();
|
|
||||||
let sender = sender.borrow();
|
|
||||||
let state =
|
|
||||||
if present == 0 { Presence::Missing }
|
|
||||||
else { Presence::Present };
|
|
||||||
sender.send(Event::PhysicalKeyboard(state))
|
|
||||||
.or_warn(&mut logging::Print, logging::Problem::Warning, "Can't send to state manager");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern "C"
|
|
||||||
fn squeek_state_send_layout_set(
|
|
||||||
sender: Wrapped<Threaded>,
|
|
||||||
name: *const c_char,
|
|
||||||
source: *const c_char,
|
|
||||||
// TODO: use when synthetic events are needed
|
|
||||||
_timestamp: u32,
|
|
||||||
) {
|
|
||||||
let sender = sender.clone_ref();
|
|
||||||
let sender = sender.borrow();
|
|
||||||
let string_or_empty = |v| String::from(
|
|
||||||
util::c::as_str(v)
|
|
||||||
.unwrap_or(Some(""))
|
|
||||||
.unwrap_or("")
|
|
||||||
);
|
|
||||||
sender
|
|
||||||
.send(Event::LayoutChoice(LayoutChoice {
|
|
||||||
name: string_or_empty(&name),
|
|
||||||
source: string_or_empty(&source).into(),
|
|
||||||
}))
|
|
||||||
.or_warn(&mut logging::Print, logging::Problem::Warning, "Can't send to state manager");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -38,27 +38,49 @@
|
|||||||
|
|
||||||
pub mod driver;
|
pub mod driver;
|
||||||
|
|
||||||
// This module is tightly coupled to the shape of data passed around in this project.
|
|
||||||
// That's not a problem as long as there's only one loop.
|
|
||||||
// They can still be abstracted into Traits,
|
|
||||||
// and the loop parametrized over them.
|
|
||||||
use crate::main::Commands;
|
|
||||||
use crate::state;
|
|
||||||
use crate::state::Event;
|
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::time::{ Duration, Instant };
|
use std::time::{ Duration, Instant };
|
||||||
|
|
||||||
|
|
||||||
|
/// Carries the incoming data to affect the actor state,
|
||||||
|
/// plus an event to help schedule timed events.
|
||||||
|
pub trait Event: Clone {
|
||||||
|
fn new_timeout_reached(when: Instant) -> Self;
|
||||||
|
/// Returns the value of the reached timeout, if this event carries the timeout.
|
||||||
|
fn get_timeout_reached(&self) -> Option<Instant>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The externally observable state of the actor.
|
||||||
|
pub trait Outcome {
|
||||||
|
type Commands;
|
||||||
|
|
||||||
|
/// Returns the instructions to emit in order to change the current visible state to the desired one.
|
||||||
|
fn get_commands_to_reach(&self, desired: &Self) -> Self::Commands;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Contains and calculates the intenal state of the actor.
|
||||||
|
pub trait ActorState: Clone {
|
||||||
|
type Event: Event;
|
||||||
|
type Outcome: Outcome;
|
||||||
|
/// Returns the new internal state after the event gets processed.
|
||||||
|
fn apply_event(self, e: Self::Event, time: Instant) -> Self;
|
||||||
|
/// Returns the observable state of the actor given this internal state.
|
||||||
|
fn get_outcome(&self, time: Instant) -> Self::Outcome;
|
||||||
|
/// Returns the next wake up to schedule if one is needed.
|
||||||
|
/// This may be called at any time, so should always return the correct value.
|
||||||
|
fn get_next_wake(&self, now: Instant) -> Option<Instant>;
|
||||||
|
}
|
||||||
|
|
||||||
/// This keeps the state of the tracker loop between iterations
|
/// This keeps the state of the tracker loop between iterations
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct State {
|
struct State<S> {
|
||||||
state: state::Application,
|
state: S,
|
||||||
scheduled_wakeup: Option<Instant>,
|
scheduled_wakeup: Option<Instant>,
|
||||||
last_update: Instant,
|
last_update: Instant,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl State {
|
impl<S> State<S> {
|
||||||
fn new(initial_state: state::Application, now: Instant) -> Self {
|
fn new(initial_state: S, now: Instant) -> Self {
|
||||||
Self {
|
Self {
|
||||||
state: initial_state,
|
state: initial_state,
|
||||||
scheduled_wakeup: None,
|
scheduled_wakeup: None,
|
||||||
@ -73,11 +95,11 @@ impl State {
|
|||||||
/// - determines next scheduled animation wakeup,
|
/// - determines next scheduled animation wakeup,
|
||||||
/// and because this is a pure function, it's easily testable.
|
/// and because this is a pure function, it's easily testable.
|
||||||
/// It returns the new state, and the message to send onwards.
|
/// It returns the new state, and the message to send onwards.
|
||||||
fn handle_event(
|
fn handle_event<S: ActorState>(
|
||||||
mut loop_state: State,
|
mut loop_state: State<S>,
|
||||||
event: Event,
|
event: S::Event,
|
||||||
now: Instant,
|
now: Instant,
|
||||||
) -> (State, Commands) {
|
) -> (State<S>, <S::Outcome as Outcome>::Commands) {
|
||||||
// Calculate changes to send to the consumer,
|
// Calculate changes to send to the consumer,
|
||||||
// based on publicly visible state.
|
// based on publicly visible state.
|
||||||
// The internal state may change more often than the publicly visible one,
|
// The internal state may change more often than the publicly visible one,
|
||||||
@ -93,8 +115,8 @@ fn handle_event(
|
|||||||
.get_commands_to_reach(&new_outcome);
|
.get_commands_to_reach(&new_outcome);
|
||||||
|
|
||||||
// Timeout events are special: they affect the scheduled timeout.
|
// Timeout events are special: they affect the scheduled timeout.
|
||||||
loop_state.scheduled_wakeup = match event {
|
loop_state.scheduled_wakeup = match event.get_timeout_reached() {
|
||||||
Event::TimeoutReached(when) => {
|
Some(when) => {
|
||||||
if when > now {
|
if when > now {
|
||||||
// Special handling for scheduled events coming in early.
|
// Special handling for scheduled events coming in early.
|
||||||
// Wait at least 10 ms to avoid Zeno's paradox.
|
// Wait at least 10 ms to avoid Zeno's paradox.
|
||||||
@ -112,7 +134,7 @@ fn handle_event(
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => loop_state.scheduled_wakeup.clone(),
|
None => loop_state.scheduled_wakeup.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Reschedule timeout if the new state calls for it.
|
// Reschedule timeout if the new state calls for it.
|
||||||
@ -152,6 +174,7 @@ mod test {
|
|||||||
use crate::animation;
|
use crate::animation;
|
||||||
use crate::imservice::{ ContentHint, ContentPurpose };
|
use crate::imservice::{ ContentHint, ContentPurpose };
|
||||||
use crate::panel;
|
use crate::panel;
|
||||||
|
use crate::state;
|
||||||
use crate::state::{ Application, InputMethod, InputMethodDetails, Presence, visibility };
|
use crate::state::{ Application, InputMethod, InputMethodDetails, Presence, visibility };
|
||||||
use crate::state::test::application_with_fake_output;
|
use crate::state::test::application_with_fake_output;
|
||||||
|
|
||||||
@ -162,6 +185,9 @@ mod test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This should only test the scheduling in handle_event.
|
||||||
|
// This means it should be separated from actual application logic,
|
||||||
|
// and use a mock state instead.
|
||||||
#[test]
|
#[test]
|
||||||
fn schedule_hide() {
|
fn schedule_hide() {
|
||||||
let start = Instant::now(); // doesn't matter when. It would be better to have a reproducible value though
|
let start = Instant::now(); // doesn't matter when. It would be better to have a reproducible value though
|
||||||
@ -181,7 +207,7 @@ mod test {
|
|||||||
|
|
||||||
now += animation::HIDING_TIMEOUT;
|
now += animation::HIDING_TIMEOUT;
|
||||||
|
|
||||||
let (l, commands) = handle_event(l, Event::TimeoutReached(now), now);
|
let (l, commands) = handle_event(l, state::Event::TimeoutReached(now), now);
|
||||||
assert_eq!(commands.panel_visibility, Some(panel::Command::Hide));
|
assert_eq!(commands.panel_visibility, Some(panel::Command::Hide));
|
||||||
assert_eq!(l.scheduled_wakeup, None);
|
assert_eq!(l.scheduled_wakeup, None);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,9 +13,9 @@
|
|||||||
|
|
||||||
extern crate core;
|
extern crate core;
|
||||||
|
|
||||||
use ::float_ord::core::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
|
use crate::float_ord::core::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
|
||||||
use ::float_ord::core::hash::{Hash, Hasher};
|
use crate::float_ord::core::hash::{Hash, Hasher};
|
||||||
use ::float_ord::core::mem::transmute;
|
use crate::float_ord::core::mem::transmute;
|
||||||
|
|
||||||
/// A wrapper for floats, that implements total equality and ordering
|
/// A wrapper for floats, that implements total equality and ordering
|
||||||
/// and hashing.
|
/// and hashing.
|
||||||
@ -99,16 +99,16 @@ mod tests {
|
|||||||
assert!(FloatOrd(1.0f32) == FloatOrd(1.0f32));
|
assert!(FloatOrd(1.0f32) == FloatOrd(1.0f32));
|
||||||
assert!(FloatOrd(0.0f64) > FloatOrd(-0.0f64));
|
assert!(FloatOrd(0.0f64) > FloatOrd(-0.0f64));
|
||||||
assert!(FloatOrd(0.0f32) > FloatOrd(-0.0f32));
|
assert!(FloatOrd(0.0f32) > FloatOrd(-0.0f32));
|
||||||
assert!(FloatOrd(::float_ord::core::f64::NAN) == FloatOrd(::float_ord::core::f64::NAN));
|
assert!(FloatOrd(crate::float_ord::core::f64::NAN) == FloatOrd(crate::float_ord::core::f64::NAN));
|
||||||
assert!(FloatOrd(::float_ord::core::f32::NAN) == FloatOrd(::float_ord::core::f32::NAN));
|
assert!(FloatOrd(crate::float_ord::core::f32::NAN) == FloatOrd(crate::float_ord::core::f32::NAN));
|
||||||
assert!(FloatOrd(-::float_ord::core::f64::NAN) < FloatOrd(::float_ord::core::f64::NAN));
|
assert!(FloatOrd(-crate::float_ord::core::f64::NAN) < FloatOrd(crate::float_ord::core::f64::NAN));
|
||||||
assert!(FloatOrd(-::float_ord::core::f32::NAN) < FloatOrd(::float_ord::core::f32::NAN));
|
assert!(FloatOrd(-crate::float_ord::core::f32::NAN) < FloatOrd(crate::float_ord::core::f32::NAN));
|
||||||
assert!(FloatOrd(-::float_ord::core::f64::INFINITY) < FloatOrd(::float_ord::core::f64::INFINITY));
|
assert!(FloatOrd(-crate::float_ord::core::f64::INFINITY) < FloatOrd(crate::float_ord::core::f64::INFINITY));
|
||||||
assert!(FloatOrd(-::float_ord::core::f32::INFINITY) < FloatOrd(::float_ord::core::f32::INFINITY));
|
assert!(FloatOrd(-crate::float_ord::core::f32::INFINITY) < FloatOrd(crate::float_ord::core::f32::INFINITY));
|
||||||
assert!(FloatOrd(::float_ord::core::f64::INFINITY) < FloatOrd(::float_ord::core::f64::NAN));
|
assert!(FloatOrd(crate::float_ord::core::f64::INFINITY) < FloatOrd(crate::float_ord::core::f64::NAN));
|
||||||
assert!(FloatOrd(::float_ord::core::f32::INFINITY) < FloatOrd(::float_ord::core::f32::NAN));
|
assert!(FloatOrd(crate::float_ord::core::f32::INFINITY) < FloatOrd(crate::float_ord::core::f32::NAN));
|
||||||
assert!(FloatOrd(-::float_ord::core::f64::NAN) < FloatOrd(::float_ord::core::f64::INFINITY));
|
assert!(FloatOrd(-crate::float_ord::core::f64::NAN) < FloatOrd(crate::float_ord::core::f64::INFINITY));
|
||||||
assert!(FloatOrd(-::float_ord::core::f32::NAN) < FloatOrd(::float_ord::core::f32::INFINITY));
|
assert!(FloatOrd(-crate::float_ord::core::f32::NAN) < FloatOrd(crate::float_ord::core::f32::INFINITY));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hash<F: Hash>(f: F) -> u64 {
|
fn hash<F: Hash>(f: F) -> u64 {
|
||||||
@ -123,15 +123,15 @@ mod tests {
|
|||||||
assert_ne!(hash(FloatOrd(0.0f32)), hash(FloatOrd(-0.0f32)));
|
assert_ne!(hash(FloatOrd(0.0f32)), hash(FloatOrd(-0.0f32)));
|
||||||
assert_eq!(hash(FloatOrd(-0.0f64)), hash(FloatOrd(-0.0f64)));
|
assert_eq!(hash(FloatOrd(-0.0f64)), hash(FloatOrd(-0.0f64)));
|
||||||
assert_eq!(hash(FloatOrd(0.0f32)), hash(FloatOrd(0.0f32)));
|
assert_eq!(hash(FloatOrd(0.0f32)), hash(FloatOrd(0.0f32)));
|
||||||
assert_ne!(hash(FloatOrd(::float_ord::core::f64::NAN)), hash(FloatOrd(-::float_ord::core::f64::NAN)));
|
assert_ne!(hash(FloatOrd(crate::float_ord::core::f64::NAN)), hash(FloatOrd(-crate::float_ord::core::f64::NAN)));
|
||||||
assert_ne!(hash(FloatOrd(::float_ord::core::f32::NAN)), hash(FloatOrd(-::float_ord::core::f32::NAN)));
|
assert_ne!(hash(FloatOrd(crate::float_ord::core::f32::NAN)), hash(FloatOrd(-crate::float_ord::core::f32::NAN)));
|
||||||
assert_eq!(hash(FloatOrd(::float_ord::core::f64::NAN)), hash(FloatOrd(::float_ord::core::f64::NAN)));
|
assert_eq!(hash(FloatOrd(crate::float_ord::core::f64::NAN)), hash(FloatOrd(crate::float_ord::core::f64::NAN)));
|
||||||
assert_eq!(hash(FloatOrd(-::float_ord::core::f32::NAN)), hash(FloatOrd(-::float_ord::core::f32::NAN)));
|
assert_eq!(hash(FloatOrd(-crate::float_ord::core::f32::NAN)), hash(FloatOrd(-crate::float_ord::core::f32::NAN)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_sort_nan() {
|
fn test_sort_nan() {
|
||||||
let nan = ::float_ord::core::f64::NAN;
|
let nan = crate::float_ord::core::f64::NAN;
|
||||||
let mut v = [-1.0, 5.0, 0.0, -0.0, nan, 1.5, nan, 3.7];
|
let mut v = [-1.0, 5.0, 0.0, -0.0, nan, 1.5, nan, 3.7];
|
||||||
super::sort(&mut v);
|
super::sort(&mut v);
|
||||||
assert!(v[0] == -1.0);
|
assert!(v[0] == -1.0);
|
||||||
|
|||||||
@ -10,15 +10,15 @@ use std::num::Wrapping;
|
|||||||
use std::string::String;
|
use std::string::String;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
use crate::event_loop::driver;
|
use crate::main;
|
||||||
use crate::state;
|
use crate::state;
|
||||||
use crate::state::Event;
|
use crate::state::Event;
|
||||||
use ::logging;
|
use crate::logging;
|
||||||
use ::util::c::into_cstring;
|
use crate::util::c::into_cstring;
|
||||||
|
|
||||||
// Traits
|
// Traits
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use ::logging::Warn;
|
use crate::logging::Warn;
|
||||||
|
|
||||||
|
|
||||||
/// Gathers stuff defined in C or called by C
|
/// Gathers stuff defined in C or called by C
|
||||||
@ -322,7 +322,7 @@ impl Default for IMProtocolState {
|
|||||||
pub struct IMService {
|
pub struct IMService {
|
||||||
/// Owned reference (still created and destroyed in C)
|
/// Owned reference (still created and destroyed in C)
|
||||||
pub im: c::InputMethod,
|
pub im: c::InputMethod,
|
||||||
sender: driver::Threaded,
|
sender: main::EventLoop,
|
||||||
|
|
||||||
pending: IMProtocolState,
|
pending: IMProtocolState,
|
||||||
current: IMProtocolState, // turn current into an idiomatic representation?
|
current: IMProtocolState, // turn current into an idiomatic representation?
|
||||||
@ -338,7 +338,7 @@ pub enum SubmitError {
|
|||||||
impl IMService {
|
impl IMService {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
im: c::InputMethod,
|
im: c::InputMethod,
|
||||||
sender: driver::Threaded,
|
sender: main::EventLoop,
|
||||||
) -> Box<IMService> {
|
) -> Box<IMService> {
|
||||||
// IMService will be referenced to by C,
|
// IMService will be referenced to by C,
|
||||||
// so it needs to stay in the same place in memory via Box
|
// so it needs to stay in the same place in memory via Box
|
||||||
|
|||||||
@ -1,18 +1,16 @@
|
|||||||
/*! State of the emulated keyboard and keys.
|
/*! State of the emulated keyboard and keys.
|
||||||
* Regards the keyboard as if it was composed of switches. */
|
* Regards the keyboard as if it was composed of switches. */
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use crate::action::Action;
|
||||||
|
use crate::layout;
|
||||||
|
use crate::util;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::rc::Rc;
|
|
||||||
use std::string::FromUtf8Error;
|
use std::string::FromUtf8Error;
|
||||||
|
|
||||||
use ::action::Action;
|
|
||||||
use ::util;
|
|
||||||
|
|
||||||
// Traits
|
// Traits
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::iter::{ FromIterator, IntoIterator };
|
use std::iter::{ FromIterator, IntoIterator };
|
||||||
@ -24,7 +22,7 @@ pub enum PressType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The extended, unambiguous layout-keycode
|
/// The extended, unambiguous layout-keycode
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub struct KeyCode {
|
pub struct KeyCode {
|
||||||
pub code: u32,
|
pub code: u32,
|
||||||
pub keymap_idx: usize,
|
pub keymap_idx: usize,
|
||||||
@ -49,19 +47,30 @@ bitflags!{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// When the submitted actions of keys need to be tracked,
|
/// When the submitted actions of keys need to be tracked,
|
||||||
/// they need a stable, comparable ID
|
/// they need a stable, comparable ID.
|
||||||
|
/// With layout::ButtonPosition, the IDs are unique within layouts.
|
||||||
#[derive(Clone, PartialEq)]
|
#[derive(Clone, PartialEq)]
|
||||||
pub struct KeyStateId(*const KeyState);
|
pub struct KeyStateId(layout::ButtonPosition);
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
impl From<&layout::ButtonPosition> for KeyStateId {
|
||||||
pub struct KeyState {
|
fn from(v: &layout::ButtonPosition) -> Self {
|
||||||
pub pressed: PressType,
|
Self(v.clone())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct Key {
|
||||||
/// A cache of raw keycodes derived from Action::Submit given a keymap
|
/// A cache of raw keycodes derived from Action::Submit given a keymap
|
||||||
pub keycodes: Vec<KeyCode>,
|
pub keycodes: Vec<KeyCode>,
|
||||||
/// Static description of what the key does when pressed or released
|
/// Static description of what the key does when pressed or released
|
||||||
pub action: Action,
|
pub action: Action,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct KeyState {
|
||||||
|
pub pressed: PressType,
|
||||||
|
}
|
||||||
|
|
||||||
impl KeyState {
|
impl KeyState {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn into_released(self) -> KeyState {
|
pub fn into_released(self) -> KeyState {
|
||||||
@ -78,12 +87,6 @@ impl KeyState {
|
|||||||
..self
|
..self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// KeyStates instances are the unique identifiers of pressed keys,
|
|
||||||
/// and the actions submitted with them.
|
|
||||||
pub fn get_id(keystate: &Rc<RefCell<KeyState>>) -> KeyStateId {
|
|
||||||
KeyStateId(keystate.as_ptr() as *const KeyState)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sorts an iterator by converting it to a Vector and back
|
/// Sorts an iterator by converting it to a Vector and back
|
||||||
@ -140,18 +143,17 @@ type SingleKeyMap = [Option<String>; 256];
|
|||||||
|
|
||||||
fn single_key_map_new() -> SingleKeyMap {
|
fn single_key_map_new() -> SingleKeyMap {
|
||||||
// Why can't we just initialize arrays without tricks -_- ?
|
// Why can't we just initialize arrays without tricks -_- ?
|
||||||
unsafe {
|
// Inspired by
|
||||||
// Inspired by
|
// https://www.reddit.com/r/rust/comments/5n7bh1/how_to_create_an_array_of_a_type_with_clone_but/
|
||||||
// https://www.reddit.com/r/rust/comments/5n7bh1/how_to_create_an_array_of_a_type_with_clone_but/
|
let mut array = mem::MaybeUninit::<SingleKeyMap>::uninit();
|
||||||
#[cfg(feature = "rustc_less_1_36")]
|
|
||||||
let mut array: SingleKeyMap = mem::uninitialized();
|
|
||||||
#[cfg(not(feature = "rustc_less_1_36"))]
|
|
||||||
let mut array: SingleKeyMap = mem::MaybeUninit::uninit().assume_init();
|
|
||||||
|
|
||||||
for element in array.iter_mut() {
|
unsafe {
|
||||||
|
let arref = &mut *array.as_mut_ptr();
|
||||||
|
for element in arref.iter_mut() {
|
||||||
ptr::write(element, None);
|
ptr::write(element, None);
|
||||||
}
|
}
|
||||||
array
|
|
||||||
|
array.assume_init()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include "eek/eek-element.h"
|
|
||||||
#include "eek/eek-gtk-keyboard.h"
|
#include "eek/eek-gtk-keyboard.h"
|
||||||
#include "eek/eek-renderer.h"
|
#include "eek/eek-renderer.h"
|
||||||
#include "eek/eek-types.h"
|
#include "eek/eek-types.h"
|
||||||
|
|||||||
821
src/layout.rs
821
src/layout.rs
File diff suppressed because it is too large
Load Diff
@ -23,10 +23,9 @@ mod assert_matches;
|
|||||||
mod logging;
|
mod logging;
|
||||||
|
|
||||||
mod action;
|
mod action;
|
||||||
mod actors;
|
pub mod actors;
|
||||||
mod animation;
|
mod animation;
|
||||||
pub mod data;
|
pub mod data;
|
||||||
mod debug;
|
|
||||||
mod drawing;
|
mod drawing;
|
||||||
mod event_loop;
|
mod event_loop;
|
||||||
pub mod float_ord;
|
pub mod float_ord;
|
||||||
@ -39,7 +38,7 @@ mod outputs;
|
|||||||
mod panel;
|
mod panel;
|
||||||
mod popover;
|
mod popover;
|
||||||
mod receiver;
|
mod receiver;
|
||||||
mod resources;
|
pub mod resources;
|
||||||
mod state;
|
mod state;
|
||||||
mod style;
|
mod style;
|
||||||
mod submission;
|
mod submission;
|
||||||
|
|||||||
@ -112,7 +112,7 @@ pub enum Problem {
|
|||||||
// TODO: avoid, deprecate.
|
// TODO: avoid, deprecate.
|
||||||
// Handler instances should be long lived, not one per call.
|
// Handler instances should be long lived, not one per call.
|
||||||
macro_rules! log_print {
|
macro_rules! log_print {
|
||||||
($level:expr, $($arg:tt)*) => (::logging::print($level, &format!($($arg)*)))
|
($level:expr, $($arg:tt)*) => (crate::logging::print($level, &format!($($arg)*)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Approach 2
|
/// Approach 2
|
||||||
|
|||||||
109
src/main.rs
109
src/main.rs
@ -4,20 +4,25 @@
|
|||||||
|
|
||||||
/*! Glue for the main loop. */
|
/*! Glue for the main loop. */
|
||||||
use crate::actors;
|
use crate::actors;
|
||||||
|
use crate::actors::external::debug;
|
||||||
use crate::animation;
|
use crate::animation;
|
||||||
use crate::debug;
|
|
||||||
use crate::data::loading;
|
use crate::data::loading;
|
||||||
|
use crate::event_loop;
|
||||||
use crate::panel;
|
use crate::panel;
|
||||||
|
use crate::state;
|
||||||
use glib::{Continue, MainContext, PRIORITY_DEFAULT, Receiver};
|
use glib::{Continue, MainContext, PRIORITY_DEFAULT, Receiver};
|
||||||
|
|
||||||
|
|
||||||
mod c {
|
mod c {
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::os::raw::c_void;
|
use std::ffi::CString;
|
||||||
|
use std::os::raw::{c_char, c_void};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
|
use crate::actors::Destination;
|
||||||
|
use crate::actors::popover;
|
||||||
use crate::event_loop::driver;
|
use crate::event_loop::driver;
|
||||||
use crate::imservice::IMService;
|
use crate::imservice::IMService;
|
||||||
use crate::imservice::c::InputMethod;
|
use crate::imservice::c::InputMethod;
|
||||||
@ -25,7 +30,7 @@ mod c {
|
|||||||
use crate::outputs::Outputs;
|
use crate::outputs::Outputs;
|
||||||
use crate::state;
|
use crate::state;
|
||||||
use crate::submission::Submission;
|
use crate::submission::Submission;
|
||||||
use crate::util::c::Wrapped;
|
use crate::util::c::{ArcWrapped, Wrapped};
|
||||||
use crate::vkeyboard::c::ZwpVirtualKeyboardV1;
|
use crate::vkeyboard::c::ZwpVirtualKeyboardV1;
|
||||||
|
|
||||||
/// DbusHandler*
|
/// DbusHandler*
|
||||||
@ -45,7 +50,7 @@ mod c {
|
|||||||
/// The handle to which Commands should be sent
|
/// The handle to which Commands should be sent
|
||||||
/// for processing in the main loop.
|
/// for processing in the main loop.
|
||||||
receiver: Wrapped<Receiver<Commands>>,
|
receiver: Wrapped<Receiver<Commands>>,
|
||||||
state_manager: Wrapped<driver::Threaded>,
|
state_manager: Wrapped<EventLoop>,
|
||||||
submission: Wrapped<Submission>,
|
submission: Wrapped<Submission>,
|
||||||
/// Not wrapped, because C needs to access this.
|
/// Not wrapped, because C needs to access this.
|
||||||
wayland: *mut Wayland,
|
wayland: *mut Wayland,
|
||||||
@ -83,11 +88,13 @@ mod c {
|
|||||||
#[allow(improper_ctypes)]
|
#[allow(improper_ctypes)]
|
||||||
fn init_wayland(wayland: *mut Wayland);
|
fn init_wayland(wayland: *mut Wayland);
|
||||||
#[allow(improper_ctypes)]
|
#[allow(improper_ctypes)]
|
||||||
fn eekboard_context_service_set_layout(service: HintManager, layout: *const layout::Layout, timestamp: u32);
|
fn eekboard_context_service_set_layout(service: HintManager, name: *const c_char, layout: *const layout::Layout, timestamp: u32);
|
||||||
// This should probably only get called from the gtk main loop,
|
// This should probably only get called from the gtk main loop,
|
||||||
// given that dbus handler is using glib.
|
// given that dbus handler is using glib.
|
||||||
fn dbus_handler_set_visible(dbus: *const DBusHandler, visible: u8);
|
fn dbus_handler_set_visible(dbus: *const DBusHandler, visible: u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// INITIALIZATION
|
||||||
|
|
||||||
/// Creates what's possible in Rust to eliminate as many FFI calls as possible,
|
/// Creates what's possible in Rust to eliminate as many FFI calls as possible,
|
||||||
/// because types aren't getting checked across their boundaries,
|
/// because types aren't getting checked across their boundaries,
|
||||||
@ -116,12 +123,17 @@ mod c {
|
|||||||
};
|
};
|
||||||
let submission = Submission::new(vk, imservice);
|
let submission = Submission::new(vk, imservice);
|
||||||
|
|
||||||
|
let popover = ArcWrapped::new(actors::popover::State::new(true));
|
||||||
|
|
||||||
|
#[cfg(feature = "zbus_v1_5")]
|
||||||
|
crate::actors::external::screensaver::init(popover.clone_ref());
|
||||||
|
|
||||||
RsObjects {
|
RsObjects {
|
||||||
submission: Wrapped::new(submission),
|
submission: Wrapped::new(submission),
|
||||||
state_manager: Wrapped::new(state_manager),
|
state_manager: Wrapped::new(state_manager),
|
||||||
receiver: Wrapped::new(receiver),
|
receiver: Wrapped::new(receiver),
|
||||||
wayland: Box::into_raw(wayland),
|
wayland: Box::into_raw(wayland),
|
||||||
popover: Wrapped::new(actors::popover::State::new()),
|
popover,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +159,7 @@ mod c {
|
|||||||
main_loop_handle_message(
|
main_loop_handle_message(
|
||||||
msg,
|
msg,
|
||||||
panel_manager.clone(),
|
panel_manager.clone(),
|
||||||
&popover,
|
&popover.clone_ref(),
|
||||||
hint_manager,
|
hint_manager,
|
||||||
dbus_handler,
|
dbus_handler,
|
||||||
);
|
);
|
||||||
@ -165,7 +177,7 @@ mod c {
|
|||||||
fn main_loop_handle_message(
|
fn main_loop_handle_message(
|
||||||
msg: Commands,
|
msg: Commands,
|
||||||
panel_manager: Wrapped<panel::Manager>,
|
panel_manager: Wrapped<panel::Manager>,
|
||||||
popover: &actors::popover::c::Actor,
|
popover: &actors::popover::Destination,
|
||||||
hint_manager: HintManager,
|
hint_manager: HintManager,
|
||||||
dbus_handler: *const DBusHandler,
|
dbus_handler: *const DBusHandler,
|
||||||
) {
|
) {
|
||||||
@ -186,16 +198,91 @@ mod c {
|
|||||||
overlay_name,
|
overlay_name,
|
||||||
purpose,
|
purpose,
|
||||||
} = description;
|
} = description;
|
||||||
actors::popover::set_overlay(popover, overlay_name.clone());
|
popover.send(popover::Event::Overlay(overlay_name.clone()));
|
||||||
let layout = loading::load_layout(name, kind, purpose, overlay_name);
|
let layout = loading::load_layout(&name, kind, purpose, &overlay_name);
|
||||||
let layout = Box::into_raw(Box::new(layout));
|
let layout = Box::into_raw(Box::new(layout));
|
||||||
|
// CSS can't express "+" in the class
|
||||||
|
let name = overlay_name.unwrap_or(name).replace('+', "_");
|
||||||
|
let name = CString::new(name).unwrap_or(
|
||||||
|
CString::new("").unwrap()
|
||||||
|
);
|
||||||
unsafe {
|
unsafe {
|
||||||
eekboard_context_service_set_layout(hint_manager, layout, 0);
|
// Take out the pointer to a temp variable so that it outlives the set_layout call.
|
||||||
|
let name = name.as_ptr();
|
||||||
|
eekboard_context_service_set_layout(hint_manager, name, layout, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EVENT PASSING
|
||||||
|
|
||||||
|
use crate::logging;
|
||||||
|
use crate::state::{Event, Presence};
|
||||||
|
use crate::state::LayoutChoice;
|
||||||
|
use crate::state::visibility;
|
||||||
|
use crate::util;
|
||||||
|
|
||||||
|
use crate::logging::Warn;
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C"
|
||||||
|
fn squeek_state_send_force_visible(mgr: Wrapped<EventLoop>) {
|
||||||
|
let sender = mgr.clone_ref();
|
||||||
|
let sender = sender.borrow();
|
||||||
|
sender.send(Event::Visibility(visibility::Event::ForceVisible))
|
||||||
|
.or_warn(&mut logging::Print, logging::Problem::Warning, "Can't send to state manager");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C"
|
||||||
|
fn squeek_state_send_force_hidden(sender: Wrapped<EventLoop>) {
|
||||||
|
let sender = sender.clone_ref();
|
||||||
|
let sender = sender.borrow();
|
||||||
|
sender.send(Event::Visibility(visibility::Event::ForceHidden))
|
||||||
|
.or_warn(&mut logging::Print, logging::Problem::Warning, "Can't send to state manager");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C"
|
||||||
|
fn squeek_state_send_keyboard_present(sender: Wrapped<EventLoop>, present: u32) {
|
||||||
|
let sender = sender.clone_ref();
|
||||||
|
let sender = sender.borrow();
|
||||||
|
let state =
|
||||||
|
if present == 0 { Presence::Missing }
|
||||||
|
else { Presence::Present };
|
||||||
|
sender.send(Event::PhysicalKeyboard(state))
|
||||||
|
.or_warn(&mut logging::Print, logging::Problem::Warning, "Can't send to state manager");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C"
|
||||||
|
fn squeek_state_send_layout_set(
|
||||||
|
sender: Wrapped<EventLoop>,
|
||||||
|
name: *const c_char,
|
||||||
|
source: *const c_char,
|
||||||
|
// TODO: use when synthetic events are needed
|
||||||
|
_timestamp: u32,
|
||||||
|
) {
|
||||||
|
let sender = sender.clone_ref();
|
||||||
|
let sender = sender.borrow();
|
||||||
|
let string_or_empty = |v| String::from(
|
||||||
|
util::c::as_str(v)
|
||||||
|
.unwrap_or(Some(""))
|
||||||
|
.unwrap_or("")
|
||||||
|
);
|
||||||
|
sender
|
||||||
|
.send(Event::LayoutChoice(LayoutChoice {
|
||||||
|
name: string_or_empty(&name),
|
||||||
|
source: string_or_empty(&source).into(),
|
||||||
|
}))
|
||||||
|
.or_warn(&mut logging::Print, logging::Problem::Warning, "Can't send to state manager");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pub type EventLoop = event_loop::driver::Threaded<state::Application>;
|
||||||
|
|
||||||
|
|
||||||
pub mod commands {
|
pub mod commands {
|
||||||
use crate::animation;
|
use crate::animation;
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
|||||||
@ -19,7 +19,6 @@ sources = [
|
|||||||
'server-context-service.c',
|
'server-context-service.c',
|
||||||
'wayland.c',
|
'wayland.c',
|
||||||
'../eek/eek.c',
|
'../eek/eek.c',
|
||||||
'../eek/eek-element.c',
|
|
||||||
'../eek/eek-gtk-keyboard.c',
|
'../eek/eek-gtk-keyboard.c',
|
||||||
'../eek/eek-keyboard.c',
|
'../eek/eek-keyboard.c',
|
||||||
'../eek/eek-renderer.c',
|
'../eek/eek-renderer.c',
|
||||||
@ -45,6 +44,7 @@ deps = [
|
|||||||
dependency('gio-unix-2.0'),
|
dependency('gio-unix-2.0'),
|
||||||
dependency('gnome-desktop-3.0', version: '>=3.0'),
|
dependency('gnome-desktop-3.0', version: '>=3.0'),
|
||||||
dependency('gtk+-3.0', version: '>=3.0'),
|
dependency('gtk+-3.0', version: '>=3.0'),
|
||||||
|
dependency('libbsd'),
|
||||||
dependency('libfeedback-0.0'),
|
dependency('libfeedback-0.0'),
|
||||||
dependency('wayland-client', version: '>=1.14'),
|
dependency('wayland-client', version: '>=1.14'),
|
||||||
dependency('xkbcommon'),
|
dependency('xkbcommon'),
|
||||||
@ -63,7 +63,7 @@ rslibs = custom_target(
|
|||||||
install: false,
|
install: false,
|
||||||
console: true,
|
console: true,
|
||||||
command: [cargo_build] + ['@OUTPUT@', '--lib'] + cargo_build_flags,
|
command: [cargo_build] + ['@OUTPUT@', '--lib'] + cargo_build_flags,
|
||||||
depends: cargo_toml,
|
depends: cargo_deps,
|
||||||
)
|
)
|
||||||
|
|
||||||
build_rstests = custom_target(
|
build_rstests = custom_target(
|
||||||
@ -78,7 +78,7 @@ build_rstests = custom_target(
|
|||||||
install: false,
|
install: false,
|
||||||
console: true,
|
console: true,
|
||||||
command: [cargo_script, 'test', '--no-run'] + cargo_build_flags,
|
command: [cargo_script, 'test', '--no-run'] + cargo_build_flags,
|
||||||
depends: [rslibs, cargo_toml], # no point building tests if the code itself fails
|
depends: [rslibs, cargo_deps], # no point building tests if the code itself fails
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
@ -88,7 +88,7 @@ test(
|
|||||||
env: ['SOURCE_DIR=' + meson.source_root()],
|
env: ['SOURCE_DIR=' + meson.source_root()],
|
||||||
# this is a whole Carg-based test suite, let it run for a while
|
# this is a whole Carg-based test suite, let it run for a while
|
||||||
timeout: 900,
|
timeout: 900,
|
||||||
depends: [build_rstests, cargo_toml],
|
depends: [build_rstests, cargo_deps],
|
||||||
)
|
)
|
||||||
|
|
||||||
libsqueekboard = static_library('libsqueekboard',
|
libsqueekboard = static_library('libsqueekboard',
|
||||||
|
|||||||
@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
use std::ops;
|
use std::ops;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use crate::event_loop;
|
use crate::logging;
|
||||||
use ::logging;
|
use crate::main;
|
||||||
use crate::util::DivCeil;
|
use crate::util::DivCeil;
|
||||||
|
|
||||||
// traits
|
// traits
|
||||||
use ::logging::Warn;
|
use crate::logging::Warn;
|
||||||
|
|
||||||
/// Gathers stuff defined in C or called by C
|
/// Gathers stuff defined in C or called by C
|
||||||
pub mod c {
|
pub mod c {
|
||||||
@ -20,7 +20,7 @@ pub mod c {
|
|||||||
use std::os::raw::{ c_char, c_void };
|
use std::os::raw::{ c_char, c_void };
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use ::util::c::{COpaquePtr, Wrapped};
|
use crate::util::c::{COpaquePtr, Wrapped};
|
||||||
|
|
||||||
// Defined in C
|
// Defined in C
|
||||||
|
|
||||||
@ -29,9 +29,14 @@ pub mod c {
|
|||||||
pub struct WlOutput(*const c_void);
|
pub struct WlOutput(*const c_void);
|
||||||
|
|
||||||
impl WlOutput {
|
impl WlOutput {
|
||||||
fn null() -> Self {
|
const fn null() -> Self {
|
||||||
Self(ptr::null())
|
Self(ptr::null())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
pub const fn dummy() -> Self {
|
||||||
|
Self::null()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
@ -438,11 +443,11 @@ type GlobalId = u32;
|
|||||||
/// The outputs manager
|
/// The outputs manager
|
||||||
pub struct Outputs {
|
pub struct Outputs {
|
||||||
outputs: Vec<(Output, GlobalId)>,
|
outputs: Vec<(Output, GlobalId)>,
|
||||||
sender: event_loop::driver::Threaded,
|
sender: main::EventLoop,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Outputs {
|
impl Outputs {
|
||||||
pub fn new(sender: event_loop::driver::Threaded) -> Outputs {
|
pub fn new(sender: main::EventLoop) -> Outputs {
|
||||||
Outputs {
|
Outputs {
|
||||||
outputs: Vec::new(),
|
outputs: Vec::new(),
|
||||||
sender,
|
sender,
|
||||||
|
|||||||
23
src/panel.c
23
src/panel.c
@ -55,6 +55,16 @@ make_widget (struct panel_manager *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Called also from rust
|
||||||
|
/// Updates the size
|
||||||
|
void
|
||||||
|
panel_manager_resize (struct panel_manager *self, uint32_t height)
|
||||||
|
{
|
||||||
|
phosh_layer_surface_set_size(self->window, 0, height);
|
||||||
|
phosh_layer_surface_set_exclusive_zone(self->window, height);
|
||||||
|
phosh_layer_surface_wl_surface_commit(self->window);
|
||||||
|
}
|
||||||
|
|
||||||
// Called from rust
|
// Called from rust
|
||||||
/// Creates a new panel widget
|
/// Creates a new panel widget
|
||||||
void
|
void
|
||||||
@ -89,6 +99,8 @@ panel_manager_request_widget (struct panel_manager *self, struct wl_output *outp
|
|||||||
gtk_window_set_title (GTK_WINDOW(self->window), "Squeekboard");
|
gtk_window_set_title (GTK_WINDOW(self->window), "Squeekboard");
|
||||||
gtk_window_set_icon_name (GTK_WINDOW(self->window), "squeekboard");
|
gtk_window_set_icon_name (GTK_WINDOW(self->window), "squeekboard");
|
||||||
gtk_window_set_keep_above (GTK_WINDOW(self->window), TRUE);
|
gtk_window_set_keep_above (GTK_WINDOW(self->window), TRUE);
|
||||||
|
} else {
|
||||||
|
panel_manager_resize(self, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self->widget) {
|
if (!self->widget) {
|
||||||
@ -98,17 +110,6 @@ panel_manager_request_widget (struct panel_manager *self, struct wl_output *outp
|
|||||||
gtk_widget_show (GTK_WIDGET(self->window));
|
gtk_widget_show (GTK_WIDGET(self->window));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called from rust
|
|
||||||
/// Updates the size
|
|
||||||
void
|
|
||||||
panel_manager_resize (struct panel_manager *self, uint32_t height)
|
|
||||||
{
|
|
||||||
phosh_layer_surface_set_size(self->window, 0, height);
|
|
||||||
phosh_layer_surface_set_exclusive_zone(self->window, height);
|
|
||||||
phosh_layer_surface_wl_surface_commit(self->window);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct panel_manager panel_manager_new(EekboardContextService *state, struct submission *submission, struct squeek_state_manager *state_manager, struct squeek_popover *popover)
|
struct panel_manager panel_manager_new(EekboardContextService *state, struct submission *submission, struct squeek_state_manager *state_manager, struct squeek_popover *popover)
|
||||||
{
|
{
|
||||||
struct panel_manager mgr = {
|
struct panel_manager mgr = {
|
||||||
|
|||||||
236
src/panel.rs
236
src/panel.rs
@ -94,7 +94,7 @@ impl PixelSize {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
struct Size {
|
struct Size {
|
||||||
width: u32,
|
width: u32,
|
||||||
height: u32,
|
height: u32,
|
||||||
@ -104,7 +104,7 @@ struct Size {
|
|||||||
/// the application asks for some size,
|
/// the application asks for some size,
|
||||||
/// and then receives a size that the compositor thought appropriate.
|
/// and then receives a size that the compositor thought appropriate.
|
||||||
/// Stores raw values passed to Wayland, i.e. scaled dimensions.
|
/// Stores raw values passed to Wayland, i.e. scaled dimensions.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
enum State {
|
enum State {
|
||||||
Hidden,
|
Hidden,
|
||||||
SizeRequested {
|
SizeRequested {
|
||||||
@ -119,6 +119,18 @@ enum State {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A command to send out to the next layer of processing.
|
||||||
|
/// Here, it's the C side of the panel.
|
||||||
|
#[derive(Debug, PartialEq)]
|
||||||
|
enum Update {
|
||||||
|
Hide,
|
||||||
|
Resize { height: u32 },
|
||||||
|
RequestWidget {
|
||||||
|
output: OutputId,
|
||||||
|
height: u32,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
Show {
|
Show {
|
||||||
@ -132,6 +144,10 @@ pub enum Command {
|
|||||||
pub struct Manager {
|
pub struct Manager {
|
||||||
panel: c::PanelManager,
|
panel: c::PanelManager,
|
||||||
state: State,
|
state: State,
|
||||||
|
// This should be part of State, if it ever actually gets unhardcoded.
|
||||||
|
// It's here because State doesn't need to become more complex
|
||||||
|
// until this becomes properly used.
|
||||||
|
debug: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
@ -139,12 +155,60 @@ impl Manager {
|
|||||||
Self {
|
Self {
|
||||||
panel,
|
panel,
|
||||||
state: State::Hidden,
|
state: State::Hidden,
|
||||||
|
debug: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: mabe send the allocated size back to state::State,
|
// TODO: mabe send the allocated size back to state::State,
|
||||||
// to perform layout adjustments
|
// to perform layout adjustments
|
||||||
fn set_configured(&mut self, size: Size) {
|
fn set_configured(&mut self, size: Size) {
|
||||||
self.state = match self.state.clone() {
|
if self.debug {
|
||||||
|
eprintln!("Panel received configure {:?}", &size);
|
||||||
|
}
|
||||||
|
|
||||||
|
self.state = self.state.clone().configure(size);
|
||||||
|
|
||||||
|
if self.debug {
|
||||||
|
eprintln!("Panel now {:?}", &self.state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn update(mgr: Wrapped<Manager>, cmd: Command) {
|
||||||
|
let copied = mgr.clone();
|
||||||
|
|
||||||
|
let mgr = mgr.clone_ref();
|
||||||
|
let mut mgr = mgr.borrow_mut();
|
||||||
|
|
||||||
|
if mgr.debug {
|
||||||
|
eprintln!("Panel received {:?}", &cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
let (state, updates) = mgr.state.clone().update(cmd);
|
||||||
|
(*mgr).state = state;
|
||||||
|
|
||||||
|
for update in &updates {
|
||||||
|
unsafe {
|
||||||
|
match update {
|
||||||
|
Update::Hide => c::panel_manager_hide(mgr.panel),
|
||||||
|
Update::Resize { height }
|
||||||
|
=> c::panel_manager_resize(mgr.panel, *height),
|
||||||
|
Update::RequestWidget{output, height}
|
||||||
|
=> c::panel_manager_request_widget(mgr.panel, output.0, *height, copied.clone()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if mgr.debug {
|
||||||
|
for update in &updates {
|
||||||
|
eprintln!("Panel updates: {:?}", &update);
|
||||||
|
}
|
||||||
|
eprintln!("Panel is now {:?}", &(*mgr).state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl State {
|
||||||
|
fn configure(self, size: Size) -> Self {
|
||||||
|
match self {
|
||||||
State::Hidden => {
|
State::Hidden => {
|
||||||
// This may happen if a hide is scheduled immediately after a show.
|
// This may happen if a hide is scheduled immediately after a show.
|
||||||
log_print!(
|
log_print!(
|
||||||
@ -165,38 +229,34 @@ impl Manager {
|
|||||||
wanted_height: height,
|
wanted_height: height,
|
||||||
allocated: size,
|
allocated: size,
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(mgr: Wrapped<Manager>, cmd: Command) {
|
fn update(self, cmd: Command) -> (Self, Vec<Update>) {
|
||||||
let copied = mgr.clone();
|
match (cmd, self) {
|
||||||
|
(Command::Hide, State::Hidden) => (State::Hidden, Vec::new()),
|
||||||
let mgr = mgr.clone_ref();
|
(Command::Hide, State::SizeAllocated{..}) => (
|
||||||
let mut mgr = mgr.borrow_mut();
|
State::Hidden, vec![Update::Hide],
|
||||||
|
),
|
||||||
(*mgr).state = match (cmd, mgr.state.clone()) {
|
(Command::Hide, State::SizeRequested{..}) => (
|
||||||
(Command::Hide, State::Hidden) => State::Hidden,
|
State::Hidden, vec![Update::Hide],
|
||||||
(Command::Hide, State::SizeAllocated{..}) => {
|
),
|
||||||
unsafe { c::panel_manager_hide(mgr.panel); }
|
|
||||||
State::Hidden
|
|
||||||
},
|
|
||||||
(Command::Hide, State::SizeRequested{..}) => {
|
|
||||||
unsafe { c::panel_manager_hide(mgr.panel); }
|
|
||||||
State::Hidden
|
|
||||||
},
|
|
||||||
(Command::Show{output, height}, State::Hidden) => {
|
(Command::Show{output, height}, State::Hidden) => {
|
||||||
let height = height.as_scaled_ceiling();
|
let height = height.as_scaled_ceiling();
|
||||||
unsafe { c::panel_manager_request_widget(mgr.panel, output.0, height, copied); }
|
(
|
||||||
State::SizeRequested{output, height}
|
State::SizeRequested{output, height},
|
||||||
|
vec![Update::RequestWidget{ output, height }],
|
||||||
|
)
|
||||||
},
|
},
|
||||||
(
|
(
|
||||||
Command::Show{output, height},
|
Command::Show{output, height},
|
||||||
State::SizeRequested{output: req_output, height: req_height},
|
State::SizeRequested{output: req_output, height: req_height},
|
||||||
) => {
|
) => {
|
||||||
let height = height.as_scaled_ceiling();
|
let height = height.as_scaled_ceiling();
|
||||||
if output == req_output && height == req_height {
|
if output == req_output && height == req_height {(
|
||||||
State::SizeRequested{output: req_output, height: req_height}
|
State::SizeRequested{output: req_output, height: req_height},
|
||||||
} else if output == req_output {
|
Vec::new(),
|
||||||
|
)} else if output == req_output {(
|
||||||
// I'm not sure about that.
|
// I'm not sure about that.
|
||||||
// This could cause a busy loop,
|
// This could cause a busy loop,
|
||||||
// when two requests are being processed at the same time:
|
// when two requests are being processed at the same time:
|
||||||
@ -205,43 +265,119 @@ impl Manager {
|
|||||||
// the other from the state wanting height B',
|
// the other from the state wanting height B',
|
||||||
// causing the compositor to change size to B.
|
// causing the compositor to change size to B.
|
||||||
// So better cut this short here, despite artifacts.
|
// So better cut this short here, despite artifacts.
|
||||||
// Out of simplicty, just ignore the new request.
|
|
||||||
// If that causes problems, the request in flight could be stored
|
// Doing nothing means that Squeekboard will occasionally use the stale size (see test),
|
||||||
// for the purpose of handling it better somehow.
|
// so instead always listen to the higher layer and request a new size.
|
||||||
State::SizeRequested{output: req_output, height: req_height}
|
// If this causes problems, maybe count requests/configures, or track what was allocated in response to what request.
|
||||||
} else {
|
State::SizeRequested{output, height},
|
||||||
|
vec![Update::Resize { height }],
|
||||||
|
)} else {(
|
||||||
// This looks weird, but should be safe.
|
// This looks weird, but should be safe.
|
||||||
// The stack seems to handle
|
// The stack seems to handle
|
||||||
// configure events on a dead surface.
|
// configure events on a dead surface.
|
||||||
unsafe {
|
State::SizeRequested{output, height},
|
||||||
c::panel_manager_hide(mgr.panel);
|
vec![
|
||||||
c::panel_manager_request_widget(mgr.panel, output.0, height, copied);
|
Update::Hide,
|
||||||
}
|
Update::RequestWidget { output, height },
|
||||||
State::SizeRequested{output, height}
|
],
|
||||||
}
|
)}
|
||||||
},
|
},
|
||||||
(
|
(
|
||||||
Command::Show{output, height},
|
Command::Show{output, height},
|
||||||
State::SizeAllocated{output: alloc_output, allocated, wanted_height},
|
State::SizeAllocated{output: alloc_output, allocated, wanted_height},
|
||||||
) => {
|
) => {
|
||||||
let height = height.as_scaled_ceiling();
|
let height = height.as_scaled_ceiling();
|
||||||
if output == alloc_output && height == wanted_height {
|
if output == alloc_output && height == wanted_height {(
|
||||||
State::SizeAllocated{output: alloc_output, wanted_height, allocated}
|
State::SizeAllocated{output: alloc_output, wanted_height, allocated},
|
||||||
} else if output == alloc_output && height == allocated.height {
|
Vec::new(),
|
||||||
State::SizeAllocated{output: alloc_output, wanted_height: height, allocated}
|
)} else if output == alloc_output && height == allocated.height {(
|
||||||
} else if output == alloc_output {
|
State::SizeAllocated{output: alloc_output, wanted_height: height, allocated},
|
||||||
|
Vec::new(),
|
||||||
|
)} else if output == alloc_output {(
|
||||||
// Should *all* other heights cause a resize?
|
// Should *all* other heights cause a resize?
|
||||||
// What about those between wanted and allocated?
|
// What about those between wanted and allocated?
|
||||||
unsafe { c::panel_manager_resize(mgr.panel, height); }
|
State::SizeRequested{output, height},
|
||||||
State::SizeRequested{output, height}
|
vec![Update::Resize{height}],
|
||||||
} else {
|
)} else {(
|
||||||
unsafe {
|
State::SizeRequested{output, height},
|
||||||
c::panel_manager_hide(mgr.panel);
|
vec![
|
||||||
c::panel_manager_request_widget(mgr.panel, output.0, height, copied);
|
Update::Hide,
|
||||||
}
|
Update::RequestWidget{output, height},
|
||||||
State::SizeRequested{output, height}
|
]
|
||||||
}
|
)}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use crate::outputs::c::WlOutput;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn resize_before_configured() {
|
||||||
|
// allow to make typing fields easier
|
||||||
|
#[allow(non_upper_case_globals)]
|
||||||
|
const output: OutputId = OutputId(WlOutput::dummy());
|
||||||
|
|
||||||
|
let state = State::Hidden;
|
||||||
|
|
||||||
|
// Initial show
|
||||||
|
let (state, cmds) = state.update(Command::Show {
|
||||||
|
output,
|
||||||
|
height: PixelSize { pixels: 100, scale_factor: 1 },
|
||||||
|
});
|
||||||
|
assert_eq!(
|
||||||
|
cmds,
|
||||||
|
vec![Update::RequestWidget { output, height: 100 }],
|
||||||
|
);
|
||||||
|
// layer shell requests a resize
|
||||||
|
|
||||||
|
// but another show comes before first can be confirmed
|
||||||
|
let (state, cmds) = dbg!(state).update(Command::Show {
|
||||||
|
output,
|
||||||
|
height: PixelSize { pixels: 50, scale_factor: 1 },
|
||||||
|
});
|
||||||
|
assert_eq!(
|
||||||
|
cmds,
|
||||||
|
vec![Update::Resize { height: 50 }],
|
||||||
|
"{:?}",
|
||||||
|
state,
|
||||||
|
);
|
||||||
|
// This is too many layers of indirection, but as long as layer shell is tied to gtk widgets, there's not much to be done.
|
||||||
|
// The main issue is that as the outputs change, we acknowledge the wrong (maintained) size:
|
||||||
|
/*
|
||||||
|
[346947.774] wl_output@31.geometry(0, 0, 65, 130, 0, "<Unknown>", "<Unknown>", 3)
|
||||||
|
[346948.117] wl_output@17.geometry(0, 0, 65, 130, 0, "<Unknown>", "<Unknown>", 3)
|
||||||
|
[346948.198] zwlr_layer_surface_v1@41.configure(1709, 720, 210)
|
||||||
|
[346948.268] -> zwlr_layer_surface_v1@41.ack_configure(1709)
|
||||||
|
*/
|
||||||
|
// TODO: check if layer_shell allows not acknowledging a configure event, and which part of squeekboard is responsible for that
|
||||||
|
// (there are no messages in between, so it's not PanelMgr; panel.c almost-unconditionally calls to Rust too; could it be layer-shell.c?).
|
||||||
|
|
||||||
|
// event we want
|
||||||
|
let good_state = state.clone().configure(Size { width: 50, height: 50 });
|
||||||
|
assert_eq!(
|
||||||
|
good_state,
|
||||||
|
State::SizeAllocated {
|
||||||
|
output,
|
||||||
|
wanted_height: 50,
|
||||||
|
allocated: Size { width: 50, height: 50 },
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
// or stale event we do not want
|
||||||
|
let state = state.configure(Size { width: 50, height: 100 });
|
||||||
|
// followed by the good one
|
||||||
|
let state = state.configure(Size { width: 50, height: 50 });
|
||||||
|
assert_eq!(
|
||||||
|
state,
|
||||||
|
State::SizeAllocated {
|
||||||
|
output,
|
||||||
|
wanted_height: 50,
|
||||||
|
allocated: Size { width: 50, height: 50 },
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -208,7 +208,7 @@ fn translate_layout_names(layouts: &Vec<LayoutId>) -> Vec<OwnedTranslation> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to take all xkb names from gnome-desktop's xkb info.
|
// Attempt to take all xkb names from gnome-desktop's xkb info.
|
||||||
let xkb_translator = ::locale::XkbInfo::new();
|
let xkb_translator = crate::locale::XkbInfo::new();
|
||||||
|
|
||||||
let translated_names = layouts.iter()
|
let translated_names = layouts.iter()
|
||||||
.map(|id| match id {
|
.map(|id| match id {
|
||||||
@ -364,6 +364,7 @@ pub fn show(
|
|||||||
};
|
};
|
||||||
|
|
||||||
let settings_action = gio::SimpleAction::new("settings", None);
|
let settings_action = gio::SimpleAction::new("settings", None);
|
||||||
|
settings_action.set_enabled(popover.settings_active);
|
||||||
settings_action.connect_activate(move |_, _| {
|
settings_action.connect_activate(move |_, _| {
|
||||||
let s = CString::new("region").unwrap();
|
let s = CString::new("region").unwrap();
|
||||||
unsafe { c::popover_open_settings_panel(s.as_ptr()) };
|
unsafe { c::popover_open_settings_panel(s.as_ptr()) };
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
/*! Defines the application-wide message bus for updating state.*/
|
/*! Defines the application-wide message bus for updating state.*/
|
||||||
|
|
||||||
use crate::event_loop::driver::Threaded;
|
use crate::main;
|
||||||
|
|
||||||
pub mod c {
|
pub mod c {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::util::c::Wrapped;
|
use crate::util::c::Wrapped;
|
||||||
pub type State = Wrapped<Threaded>;
|
pub type State = Wrapped<main::EventLoop>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The state receiver is an endpoint of a channel, so it's safely cloneable.
|
// The state receiver is an endpoint of a channel, so it's safely cloneable.
|
||||||
// There's no need to keep it in a Rc.
|
// There's no need to keep it in a Rc.
|
||||||
// The C version uses Wrapped with an underlying Rc,
|
// The C version uses Wrapped with an underlying Rc,
|
||||||
// because Wrapped is well-tested already.
|
// because Wrapped is well-tested already.
|
||||||
pub type State = Threaded;
|
pub type State = main::EventLoop;
|
||||||
@ -60,6 +60,9 @@ static KEYBOARDS: &[(&'static str, &'static str)] = &[
|
|||||||
("gr_wide", include_str!("../data/keyboards/gr_wide.yaml")),
|
("gr_wide", include_str!("../data/keyboards/gr_wide.yaml")),
|
||||||
("gr+polytonic", include_str!("../data/keyboards/gr+polytonic.yaml")),
|
("gr+polytonic", include_str!("../data/keyboards/gr+polytonic.yaml")),
|
||||||
|
|
||||||
|
("hu", include_str!("../data/keyboards/hu.yaml")),
|
||||||
|
("hu_wide", include_str!("../data/keyboards/hu_wide.yaml")),
|
||||||
|
|
||||||
("il", include_str!("../data/keyboards/il.yaml")),
|
("il", include_str!("../data/keyboards/il.yaml")),
|
||||||
|
|
||||||
("ir", include_str!("../data/keyboards/ir.yaml")),
|
("ir", include_str!("../data/keyboards/ir.yaml")),
|
||||||
@ -82,6 +85,7 @@ static KEYBOARDS: &[(&'static str, &'static str)] = &[
|
|||||||
("ru", include_str!("../data/keyboards/ru.yaml")),
|
("ru", include_str!("../data/keyboards/ru.yaml")),
|
||||||
|
|
||||||
("se", include_str!("../data/keyboards/se.yaml")),
|
("se", include_str!("../data/keyboards/se.yaml")),
|
||||||
|
("se_wide", include_str!("../data/keyboards/se_wide.yaml")),
|
||||||
|
|
||||||
("th", include_str!("../data/keyboards/th.yaml")),
|
("th", include_str!("../data/keyboards/th.yaml")),
|
||||||
("th_wide", include_str!("../data/keyboards/th_wide.yaml")),
|
("th_wide", include_str!("../data/keyboards/th_wide.yaml")),
|
||||||
@ -110,6 +114,8 @@ static KEYBOARDS: &[(&'static str, &'static str)] = &[
|
|||||||
|
|
||||||
("terminal/us", include_str!("../data/keyboards/terminal/us.yaml")),
|
("terminal/us", include_str!("../data/keyboards/terminal/us.yaml")),
|
||||||
("terminal/us_wide", include_str!("../data/keyboards/terminal/us_wide.yaml")),
|
("terminal/us_wide", include_str!("../data/keyboards/terminal/us_wide.yaml")),
|
||||||
|
("terminal/us+dvorak", include_str!("../data/keyboards/terminal/us+dvorak.yaml")),
|
||||||
|
("terminal/us+dvorak_wide", include_str!("../data/keyboards/terminal/us+dvorak_wide.yaml")),
|
||||||
|
|
||||||
// Overlays
|
// Overlays
|
||||||
("emoji/us", include_str!("../data/keyboards/emoji/us.yaml")),
|
("emoji/us", include_str!("../data/keyboards/emoji/us.yaml")),
|
||||||
|
|||||||
108
src/state.rs
108
src/state.rs
@ -5,8 +5,10 @@
|
|||||||
/*! Application-wide state is stored here.
|
/*! Application-wide state is stored here.
|
||||||
* It's driven by the loop defined in the loop module. */
|
* It's driven by the loop defined in the loop module. */
|
||||||
|
|
||||||
|
use crate::actors::external::debug;
|
||||||
use crate::animation;
|
use crate::animation;
|
||||||
use crate::debug;
|
use crate::event_loop;
|
||||||
|
use crate::event_loop::ActorState;
|
||||||
use crate::imservice::{ ContentHint, ContentPurpose };
|
use crate::imservice::{ ContentHint, ContentPurpose };
|
||||||
use crate::layout::ArrangementKind;
|
use crate::layout::ArrangementKind;
|
||||||
use crate::main;
|
use crate::main;
|
||||||
@ -80,6 +82,19 @@ pub enum Event {
|
|||||||
TimeoutReached(Instant),
|
TimeoutReached(Instant),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl event_loop::Event for Event {
|
||||||
|
fn new_timeout_reached(when: Instant) -> Self {
|
||||||
|
Self::TimeoutReached(when)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_timeout_reached(&self) -> Option<Instant> {
|
||||||
|
match self {
|
||||||
|
Self::TimeoutReached(when) => Some(*when),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<InputMethod> for Event {
|
impl From<InputMethod> for Event {
|
||||||
fn from(im: InputMethod) -> Self {
|
fn from(im: InputMethod) -> Self {
|
||||||
Self::InputMethod(im)
|
Self::InputMethod(im)
|
||||||
@ -119,13 +134,14 @@ pub struct Outcome {
|
|||||||
pub im: InputMethod,
|
pub im: InputMethod,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Outcome {
|
impl event_loop::Outcome for Outcome {
|
||||||
|
type Commands = Commands;
|
||||||
/// Returns the commands needed to apply changes as required by the new state.
|
/// Returns the commands needed to apply changes as required by the new state.
|
||||||
/// This implementation doesn't actually take the old state into account,
|
/// This implementation doesn't actually take the old state into account,
|
||||||
/// instead issuing all the commands as needed to reach the new state.
|
/// instead issuing all the commands as needed to reach the new state.
|
||||||
/// The receivers of the commands bear the burden
|
/// The receivers of the commands bear the burden
|
||||||
/// of checking if the commands end up being no-ops.
|
/// of checking if the commands end up being no-ops.
|
||||||
pub fn get_commands_to_reach(&self, new_state: &Self) -> Commands {
|
fn get_commands_to_reach(&self, new_state: &Self) -> Commands {
|
||||||
// FIXME: handle switching outputs
|
// FIXME: handle switching outputs
|
||||||
let (dbus_visible_set, panel_visibility) = match new_state.panel {
|
let (dbus_visible_set, panel_visibility) = match new_state.panel {
|
||||||
animation::Outcome::Visible{output, height, ..}
|
animation::Outcome::Visible{output, height, ..}
|
||||||
@ -135,7 +151,7 @@ impl Outcome {
|
|||||||
|
|
||||||
// Compare the old and new states as not to flood with updates,
|
// Compare the old and new states as not to flood with updates,
|
||||||
// which may look up in the file system.
|
// which may look up in the file system.
|
||||||
use animation::Outcome::*;
|
use crate::animation::Outcome::*;
|
||||||
let layout_selection = match &new_state.panel {
|
let layout_selection = match &new_state.panel {
|
||||||
Visible{ contents: new_contents, ..} => {
|
Visible{ contents: new_contents, ..} => {
|
||||||
let same
|
let same
|
||||||
@ -271,8 +287,9 @@ impl Application {
|
|||||||
app
|
app
|
||||||
},
|
},
|
||||||
|
|
||||||
Event::InputMethod(new_im) => match (self.im.clone(), new_im) {
|
Event::InputMethod(new_im)
|
||||||
(InputMethod::Active(_old), InputMethod::Active(new_im))
|
=> match (self.im.clone(), new_im, self.visibility_override) {
|
||||||
|
(InputMethod::Active(_old), InputMethod::Active(new_im), _)
|
||||||
=> Self {
|
=> Self {
|
||||||
im: InputMethod::Active(new_im),
|
im: InputMethod::Active(new_im),
|
||||||
..self
|
..self
|
||||||
@ -280,13 +297,20 @@ impl Application {
|
|||||||
// For changes in active state, remove user's visibility override.
|
// For changes in active state, remove user's visibility override.
|
||||||
// Both cases spelled out explicitly, rather than by the wildcard,
|
// Both cases spelled out explicitly, rather than by the wildcard,
|
||||||
// to not lose the notion that it's the opposition that matters
|
// to not lose the notion that it's the opposition that matters
|
||||||
(InputMethod::InactiveSince(_old), InputMethod::Active(new_im))
|
(InputMethod::InactiveSince(_old), InputMethod::Active(new_im), _)
|
||||||
=> Self {
|
=> Self {
|
||||||
im: InputMethod::Active(new_im),
|
im: InputMethod::Active(new_im),
|
||||||
visibility_override: visibility::State::NotForced,
|
visibility_override: visibility::State::NotForced,
|
||||||
..self
|
..self
|
||||||
},
|
},
|
||||||
(InputMethod::Active(_old), InputMethod::InactiveSince(since))
|
// Avoid triggering animation when old state was forced hidden
|
||||||
|
(InputMethod::Active(_old), InputMethod::InactiveSince(_since), visibility::State::ForcedHidden)
|
||||||
|
=> Self {
|
||||||
|
im: InputMethod::InactiveSince(now - animation::HIDING_TIMEOUT * 2),
|
||||||
|
visibility_override: visibility::State::NotForced,
|
||||||
|
..self
|
||||||
|
},
|
||||||
|
(InputMethod::Active(_old), InputMethod::InactiveSince(since), _)
|
||||||
=> Self {
|
=> Self {
|
||||||
im: InputMethod::InactiveSince(since),
|
im: InputMethod::InactiveSince(since),
|
||||||
visibility_override: visibility::State::NotForced,
|
visibility_override: visibility::State::NotForced,
|
||||||
@ -294,7 +318,7 @@ impl Application {
|
|||||||
},
|
},
|
||||||
// This is a weird case, there's no need to update an inactive state.
|
// This is a weird case, there's no need to update an inactive state.
|
||||||
// But it's not wrong, just superfluous.
|
// But it's not wrong, just superfluous.
|
||||||
(InputMethod::InactiveSince(old), InputMethod::InactiveSince(_new))
|
(InputMethod::InactiveSince(old), InputMethod::InactiveSince(_new), _)
|
||||||
=> Self {
|
=> Self {
|
||||||
// New is going to be newer than old, so it can be ignored.
|
// New is going to be newer than old, so it can be ignored.
|
||||||
// It was already inactive at that moment.
|
// It was already inactive at that moment.
|
||||||
@ -361,19 +385,20 @@ Outcome:
|
|||||||
let ideal_height = IDEAL_TARGET_SIZE * ROW_COUNT as i32;
|
let ideal_height = IDEAL_TARGET_SIZE * ROW_COUNT as i32;
|
||||||
let ideal_height_px = (ideal_height * density).ceil().0 as u32;
|
let ideal_height_px = (ideal_height * density).ceil().0 as u32;
|
||||||
|
|
||||||
|
let max_wide_height = Rational {
|
||||||
|
numerator: 172,
|
||||||
|
denominator: 540,
|
||||||
|
};
|
||||||
|
let ideal_panel_height = Rational {
|
||||||
|
numerator: ideal_height_px as i32,
|
||||||
|
denominator: px_size.width,
|
||||||
|
};
|
||||||
// Reduce height to match what the layout can fill.
|
// Reduce height to match what the layout can fill.
|
||||||
// For this, we need to guess if normal or wide will be picked up.
|
// For this, we need to guess if normal or wide will be picked.
|
||||||
// This must match `eek_gtk_keyboard.c::get_type`.
|
// This must match `eek_gtk_keyboard.c::get_type`.
|
||||||
// TODO: query layout database and choose one directly
|
// TODO: query layout database and choose one directly
|
||||||
let abstract_width
|
|
||||||
= PixelSize {
|
|
||||||
scale_factor: output.scale as u32,
|
|
||||||
pixels: px_size.width,
|
|
||||||
}
|
|
||||||
.as_scaled_ceiling();
|
|
||||||
|
|
||||||
let (arrangement, height_as_widths) = {
|
let (arrangement, height_as_widths) = {
|
||||||
if abstract_width < 540 {(
|
if max_wide_height < ideal_panel_height {(
|
||||||
ArrangementKind::Base,
|
ArrangementKind::Base,
|
||||||
Rational {
|
Rational {
|
||||||
numerator: 210,
|
numerator: 210,
|
||||||
@ -381,10 +406,7 @@ Outcome:
|
|||||||
},
|
},
|
||||||
)} else {(
|
)} else {(
|
||||||
ArrangementKind::Wide,
|
ArrangementKind::Wide,
|
||||||
Rational {
|
max_wide_height,
|
||||||
numerator: 172,
|
|
||||||
denominator: 540,
|
|
||||||
}
|
|
||||||
)}
|
)}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -417,8 +439,17 @@ Outcome:
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_outcome(&self, now: Instant) -> Outcome {
|
impl ActorState for Application {
|
||||||
|
type Event = Event;
|
||||||
|
type Outcome = Outcome;
|
||||||
|
|
||||||
|
fn apply_event(self, e: Self::Event, time: Instant) -> Self {
|
||||||
|
Self::apply_event(self, e, time)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_outcome(&self, now: Instant) -> Outcome {
|
||||||
// FIXME: include physical keyboard presence
|
// FIXME: include physical keyboard presence
|
||||||
Outcome {
|
Outcome {
|
||||||
panel: match self.preferred_output {
|
panel: match self.preferred_output {
|
||||||
@ -466,7 +497,7 @@ Outcome:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the next time to update the outcome.
|
/// Returns the next time to update the outcome.
|
||||||
pub fn get_next_wake(&self, now: Instant) -> Option<Instant> {
|
fn get_next_wake(&self, now: Instant) -> Option<Instant> {
|
||||||
match self {
|
match self {
|
||||||
Self {
|
Self {
|
||||||
visibility_override: visibility::State::NotForced,
|
visibility_override: visibility::State::NotForced,
|
||||||
@ -722,4 +753,33 @@ pub mod test {
|
|||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn size_l5_scale1() {
|
||||||
|
use crate::outputs::{Mode, Geometry, c, Size};
|
||||||
|
assert_eq!(
|
||||||
|
Application::get_preferred_height_and_arrangement(&OutputState {
|
||||||
|
current_mode: Some(Mode {
|
||||||
|
width: 720,
|
||||||
|
height: 1440,
|
||||||
|
}),
|
||||||
|
geometry: Some(Geometry{
|
||||||
|
transform: c::Transform::Normal,
|
||||||
|
phys_size: Size {
|
||||||
|
width: Some(Millimeter(65)),
|
||||||
|
height: Some(Millimeter(130)),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
scale: 1,
|
||||||
|
}),
|
||||||
|
Some((
|
||||||
|
PixelSize {
|
||||||
|
scale_factor: 1,
|
||||||
|
pixels: 420,
|
||||||
|
},
|
||||||
|
ArrangementKind::Base,
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,10 +19,10 @@
|
|||||||
/*! CSS data loading. */
|
/*! CSS data loading. */
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use ::logging;
|
use crate::logging;
|
||||||
|
|
||||||
use glib::prelude::ObjectExt;
|
use glib::prelude::ObjectExt;
|
||||||
use logging::Warn;
|
use crate::logging::Warn;
|
||||||
|
|
||||||
/// Gathers stuff defined in C or called by C
|
/// Gathers stuff defined in C or called by C
|
||||||
pub mod c {
|
pub mod c {
|
||||||
|
|||||||
@ -21,14 +21,14 @@ use std::collections::HashSet;
|
|||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
|
||||||
use crate::vkeyboard::c::ZwpVirtualKeyboardV1;
|
use crate::vkeyboard::c::ZwpVirtualKeyboardV1;
|
||||||
use ::action::Modifier;
|
use crate::action::Modifier;
|
||||||
use ::imservice;
|
use crate::imservice;
|
||||||
use ::imservice::IMService;
|
use crate::imservice::IMService;
|
||||||
use ::keyboard::{ KeyCode, KeyStateId, Modifiers, PressType };
|
use crate::keyboard::{ KeyCode, KeyStateId, Modifiers, PressType };
|
||||||
use ::layout;
|
use crate::layout;
|
||||||
use ::util::vec_remove;
|
use crate::util::vec_remove;
|
||||||
use ::vkeyboard;
|
use crate::vkeyboard;
|
||||||
use ::vkeyboard::VirtualKeyboard;
|
use crate::vkeyboard::VirtualKeyboard;
|
||||||
|
|
||||||
// traits
|
// traits
|
||||||
use std::iter::FromIterator;
|
use std::iter::FromIterator;
|
||||||
@ -52,7 +52,7 @@ pub mod c {
|
|||||||
let submission = submission.clone_ref();
|
let submission = submission.clone_ref();
|
||||||
let mut submission = submission.borrow_mut();
|
let mut submission = submission.borrow_mut();
|
||||||
let layout = unsafe { &*layout };
|
let layout = unsafe { &*layout };
|
||||||
submission.use_layout(layout, Timestamp(time));
|
submission.use_layout(&layout.shape, Timestamp(time));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@ -303,7 +303,7 @@ impl Submission {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn use_layout(&mut self, layout: &layout::Layout, time: Timestamp) {
|
pub fn use_layout(&mut self, layout: &layout::LayoutData, time: Timestamp) {
|
||||||
self.keymap_fds = layout.keymaps.iter()
|
self.keymap_fds = layout.keymaps.iter()
|
||||||
.map(|keymap_str| vkeyboard::c::KeyMap::from_cstr(
|
.map(|keymap_str| vkeyboard::c::KeyMap::from_cstr(
|
||||||
keymap_str.as_c_str()
|
keymap_str.as_c_str()
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*! Testing functionality */
|
/*! Testing functionality */
|
||||||
|
|
||||||
use ::data::parsing::Layout;
|
use crate::data::parsing::Layout;
|
||||||
use ::logging;
|
use crate::logging;
|
||||||
use xkbcommon::xkb;
|
use xkbcommon::xkb;
|
||||||
|
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ pub struct CountAndPrint(u32);
|
|||||||
|
|
||||||
impl logging::Handler for CountAndPrint {
|
impl logging::Handler for CountAndPrint {
|
||||||
fn handle(&mut self, level: logging::Level, warning: &str) {
|
fn handle(&mut self, level: logging::Level, warning: &str) {
|
||||||
use logging::Level::*;
|
use crate::logging::Level::*;
|
||||||
match level {
|
match level {
|
||||||
Panic | Bug | Error | Warning | Surprise => {
|
Panic | Bug | Error | Warning | Surprise => {
|
||||||
self.0 += 1;
|
self.0 += 1;
|
||||||
@ -109,8 +109,7 @@ fn check_layout(layout: Layout, allow_missing_return: bool) {
|
|||||||
for (_pos, view) in layout.views.values() {
|
for (_pos, view) in layout.views.values() {
|
||||||
for (_y, row) in view.get_rows() {
|
for (_y, row) in view.get_rows() {
|
||||||
for (_x, button) in row.get_buttons() {
|
for (_x, button) in row.get_buttons() {
|
||||||
let keystate = button.state.borrow();
|
for keycode in &button.keycodes {
|
||||||
for keycode in &keystate.keycodes {
|
|
||||||
match xkb_states[keycode.keymap_idx].key_get_one_sym(keycode.code) {
|
match xkb_states[keycode.keymap_idx].key_get_one_sym(keycode.code) {
|
||||||
xkb::KEY_NoSymbol => {
|
xkb::KEY_NoSymbol => {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
|
|||||||
107
src/util.rs
107
src/util.rs
@ -1,12 +1,11 @@
|
|||||||
/*! Assorted helpers */
|
/*! Assorted helpers */
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use ::float_ord::FloatOrd;
|
use crate::float_ord::FloatOrd;
|
||||||
|
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
|
use std::cmp::{Ordering, PartialOrd};
|
||||||
use std::hash::{ Hash, Hasher };
|
use std::hash::{ Hash, Hasher };
|
||||||
use std::iter::FromIterator;
|
|
||||||
use std::ops::Mul;
|
use std::ops::Mul;
|
||||||
|
|
||||||
pub mod c {
|
pub mod c {
|
||||||
@ -17,6 +16,7 @@ pub mod c {
|
|||||||
use std::os::raw::c_char;
|
use std::os::raw::c_char;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::str::Utf8Error;
|
use std::str::Utf8Error;
|
||||||
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
// traits
|
// traits
|
||||||
|
|
||||||
@ -130,6 +130,53 @@ pub mod c {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> COpaquePtr for Wrapped<T> {}
|
impl<T> COpaquePtr for Wrapped<T> {}
|
||||||
|
|
||||||
|
/// Similar to Wrapped, except thread-safe.
|
||||||
|
#[repr(transparent)]
|
||||||
|
pub struct ArcWrapped<T>(*const Mutex<T>);
|
||||||
|
|
||||||
|
impl<T> ArcWrapped<T> {
|
||||||
|
pub fn new(value: T) -> Self {
|
||||||
|
Self::wrap(Arc::new(Mutex::new(value)))
|
||||||
|
}
|
||||||
|
pub fn wrap(state: Arc<Mutex<T>>) -> Self {
|
||||||
|
Self(Arc::into_raw(state))
|
||||||
|
}
|
||||||
|
/// Extracts the reference to the data.
|
||||||
|
/// It may cause problems if attempted in more than one place
|
||||||
|
pub unsafe fn unwrap(self) -> Arc<Mutex<T>> {
|
||||||
|
Arc::from_raw(self.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates a new Rc reference to the same data.
|
||||||
|
/// Use for accessing the underlying data as a reference.
|
||||||
|
pub fn clone_ref(&self) -> Arc<Mutex<T>> {
|
||||||
|
// A bit dangerous: the Rc may be in use elsewhere
|
||||||
|
let used_rc = unsafe { Arc::from_raw(self.0) };
|
||||||
|
let rc = used_rc.clone();
|
||||||
|
let _ = Arc::into_raw(used_rc); // prevent dropping the original reference
|
||||||
|
rc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> Clone for ArcWrapped<T> {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self::wrap(self.clone_ref())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// ToOwned won't work here
|
||||||
|
impl<T: Clone> CloneOwned for ArcWrapped<T> {
|
||||||
|
type Owned = T;
|
||||||
|
|
||||||
|
fn clone_owned(&self) -> T {
|
||||||
|
let rc = self.clone_ref();
|
||||||
|
// FIXME: this panic here is inelegant.
|
||||||
|
// It will only happen in case of crashes elsewhere, but still.
|
||||||
|
let r = rc.lock().unwrap();
|
||||||
|
r.to_owned()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clones the underlying data structure, like ToOwned.
|
/// Clones the underlying data structure, like ToOwned.
|
||||||
@ -138,16 +185,6 @@ pub trait CloneOwned {
|
|||||||
fn clone_owned(&self) -> Self::Owned;
|
fn clone_owned(&self) -> Self::Owned;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hash_map_map<K, V, F, K1, V1>(map: HashMap<K, V>, mut f: F)
|
|
||||||
-> HashMap<K1, V1>
|
|
||||||
where F: FnMut(K, V) -> (K1, V1),
|
|
||||||
K1: std::cmp::Eq + std::hash::Hash
|
|
||||||
{
|
|
||||||
HashMap::from_iter(
|
|
||||||
map.into_iter().map(|(key, value)| f(key, value))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn find_max_double<T, I, F>(iterator: I, get: F)
|
pub fn find_max_double<T, I, F>(iterator: I, get: F)
|
||||||
-> f64
|
-> f64
|
||||||
where I: Iterator<Item=T>,
|
where I: Iterator<Item=T>,
|
||||||
@ -206,6 +243,34 @@ impl<U, T: Mul<U, Output=T>> Mul<Rational<U>> for Rational<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PartialEq for Rational<i32> {
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
(self.denominator as i64).saturating_mul(other.numerator as i64)
|
||||||
|
== (other.denominator as i64).saturating_mul(self.numerator as i64)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Eq for Rational<i32> {}
|
||||||
|
|
||||||
|
impl Ord for Rational<i32> {
|
||||||
|
fn cmp(&self, other: &Self) -> Ordering {
|
||||||
|
// Using 64-bit values to make overflows unlikely.
|
||||||
|
// If i32_max * u32_max can exceed i64_max,
|
||||||
|
// then this is actually PartialOrd.
|
||||||
|
// Saturating mul used just to avoid propagating mistakes.
|
||||||
|
(other.denominator as i64).saturating_mul(self.numerator as i64)
|
||||||
|
.cmp(
|
||||||
|
&(self.denominator as i64).saturating_mul(other.numerator as i64)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartialOrd for Rational<i32> {
|
||||||
|
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||||
|
Some(self.cmp(other))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Compares pointers but not internal values of Rc
|
/// Compares pointers but not internal values of Rc
|
||||||
pub struct Pointer<T>(pub Rc<T>);
|
pub struct Pointer<T>(pub Rc<T>);
|
||||||
|
|
||||||
@ -291,4 +356,20 @@ mod tests {
|
|||||||
vec![(5, 0), (6, 0), (7, 0), (5, 1), (6, 1), (7, 1), (5, 2)]
|
vec![(5, 0), (6, 0), (7, 0), (5, 1), (6, 1), (7, 1), (5, 2)]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn check_rational_cmp() {
|
||||||
|
assert_eq!(
|
||||||
|
Rational { numerator: 1, denominator: 1 },
|
||||||
|
Rational { numerator: 1, denominator: 1 },
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
Rational { numerator: 1, denominator: 1 },
|
||||||
|
Rational { numerator: 2, denominator: 2 },
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
Rational { numerator: 1, denominator: 1 }
|
||||||
|
< Rational { numerator: 2, denominator: 1 }
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*! Managing the events belonging to virtual-keyboard interface. */
|
/*! Managing the events belonging to virtual-keyboard interface. */
|
||||||
|
|
||||||
use ::keyboard::{ Modifiers, PressType };
|
use crate::keyboard::{ Modifiers, PressType };
|
||||||
use ::submission::Timestamp;
|
use crate::submission::Timestamp;
|
||||||
|
|
||||||
/// Standard xkb keycode
|
/// Standard xkb keycode
|
||||||
type KeyCode = u32;
|
type KeyCode = u32;
|
||||||
|
|||||||
@ -4,12 +4,6 @@
|
|||||||
|
|
||||||
struct squeek_wayland *squeek_wayland = NULL;
|
struct squeek_wayland *squeek_wayland = NULL;
|
||||||
|
|
||||||
void squeek_wayland_init_global(struct squeek_outputs *outputs) {
|
|
||||||
struct squeek_wayland *wayland = {0};
|
|
||||||
wayland->outputs = outputs;
|
|
||||||
squeek_wayland = wayland;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The following functions only exist
|
// The following functions only exist
|
||||||
// to create linkable symbols out of inline functions,
|
// to create linkable symbols out of inline functions,
|
||||||
// because those are not directly callable from Rust
|
// because those are not directly callable from Rust
|
||||||
|
|||||||
@ -80,6 +80,7 @@ foreach layout : [
|
|||||||
'gr', 'gr_wide',
|
'gr', 'gr_wide',
|
||||||
'gr+polytonic',
|
'gr+polytonic',
|
||||||
'fr+bepo', 'fr+bepo_wide',
|
'fr+bepo', 'fr+bepo_wide',
|
||||||
|
'hu', 'hu_wide',
|
||||||
'il',
|
'il',
|
||||||
'ir',
|
'ir',
|
||||||
'it',
|
'it',
|
||||||
@ -89,7 +90,7 @@ foreach layout : [
|
|||||||
'pl', 'pl_wide',
|
'pl', 'pl_wide',
|
||||||
'ro', 'ro_wide',
|
'ro', 'ro_wide',
|
||||||
'ru',
|
'ru',
|
||||||
'se',
|
'se', 'se_wide',
|
||||||
'th', 'th_wide',
|
'th', 'th_wide',
|
||||||
'ua',
|
'ua',
|
||||||
'us+colemak', 'us+colemak_wide',
|
'us+colemak', 'us+colemak_wide',
|
||||||
@ -100,6 +101,8 @@ foreach layout : [
|
|||||||
'terminal/fr_wide',
|
'terminal/fr_wide',
|
||||||
'terminal/us',
|
'terminal/us',
|
||||||
'terminal/us_wide',
|
'terminal/us_wide',
|
||||||
|
'terminal/us+dvorak',
|
||||||
|
'terminal/us+dvorak_wide',
|
||||||
|
|
||||||
# Block: Not languages.
|
# Block: Not languages.
|
||||||
'emoji/us',
|
'emoji/us',
|
||||||
@ -125,3 +128,14 @@ foreach layout : [
|
|||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if get_option('find_orphans')
|
||||||
|
test('test_find_orphans',
|
||||||
|
cargo_script,
|
||||||
|
args: ['run'] + cargo_build_flags
|
||||||
|
+ ['--example', 'find_orphan_layouts',
|
||||||
|
'--', meson.source_root() + '/data/keyboards/'],
|
||||||
|
timeout: timeout,
|
||||||
|
workdir: meson.build_root(),
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|||||||
36
tools/make_message
Executable file
36
tools/make_message
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
"""Extracts commit message for the last release from NEWS.md file.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from itertools import dropwhile
|
||||||
|
import sys
|
||||||
|
|
||||||
|
with open('NEWS.md') as f:
|
||||||
|
contents = f.readlines()
|
||||||
|
|
||||||
|
if contents[0].startswith('## '):
|
||||||
|
name = contents[0][3:]
|
||||||
|
contents = contents[1:]
|
||||||
|
elif contents[1].startswith('---'):
|
||||||
|
name = contents[0]
|
||||||
|
contents = contents[2:]
|
||||||
|
else:
|
||||||
|
raise ValueError("Can't find release name")
|
||||||
|
name = name.strip()
|
||||||
|
|
||||||
|
print("Release", name)
|
||||||
|
# git wants a single newline between commit title and message body
|
||||||
|
print()
|
||||||
|
# meanwhile, markdown ignores newlines after a title
|
||||||
|
contents = dropwhile(lambda x: x.strip() == '', contents)
|
||||||
|
|
||||||
|
# Need to look up forward
|
||||||
|
contents = list(contents)
|
||||||
|
|
||||||
|
for line, nextline in zip(contents, contents[1:] + ['']):
|
||||||
|
if nextline.startswith('---') or line.startswith('## '):
|
||||||
|
break
|
||||||
|
elif nextline.startswith('===') or line.startswith('# '):
|
||||||
|
raise ValueError("Encountered title instead of release section")
|
||||||
|
print(line.strip())
|
||||||
@ -16,5 +16,5 @@ test_layout = custom_target('squeekboard-test-layout',
|
|||||||
+ cargo_build_flags,
|
+ cargo_build_flags,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: bindir,
|
install_dir: bindir,
|
||||||
depends: cargo_toml,
|
depends: cargo_deps,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user