Compare commits

..

6 Commits

Author SHA1 Message Date
2faa98d85f Release 1.17.1 2022-04-05 13:34:23 +00:00
b594fcf905 state: fix "wide mode" detection in portrait orientation
We need to check if we should use the wide layout based on the
*logical* display width, not its *physical* resolution.
2022-04-05 12:23:20 +00:00
313dbdce33 panel: Use scaling to set height 2022-04-05 12:23:11 +00:00
c51b001836 Do not reset pending state on zwp_input_method_v2.done 2022-04-05 12:22:44 +00:00
bcbc9f7ba6 ci: Allow failure on sid 2022-04-05 12:22:36 +00:00
b56500af0a build: Replace missing crates.io dependency with Purism-hosted one 2022-04-05 12:22:03 +00:00
117 changed files with 1771 additions and 7793 deletions

View File

@ -3,7 +3,6 @@ image: pureos/byzantium
stages: stages:
- build - build
- test - test
- deploy
before_script: before_script:
- apt-get -y update - apt-get -y update
@ -23,16 +22,14 @@ build_docs:
- $PKG_ONLY == "1" - $PKG_ONLY == "1"
build_meson: build_meson:
image: debian:bookworm
stage: build stage: build
artifacts: artifacts:
paths: paths:
- _build - _build
expire_in: 3h expire_in: 3h
script: script:
- mv debian/control-newer debian/control
- apt-get -y build-dep . - apt-get -y build-dep .
- meson . _build/ -Ddepdatadir=/usr/share -Dfind_orphans=true --werror - meson . _build/ -Ddepdatadir=/usr/share --werror
- ninja -C _build install - ninja -C _build install
except: except:
variables: variables:
@ -76,7 +73,7 @@ build_deb:arm64:
- cp ../*.deb . - cp ../*.deb .
build_deb:future: build_deb:future:
image: debian:bookworm image: debian:sid
allow_failure: true allow_failure: true
tags: tags:
- aarch64 - aarch64
@ -97,23 +94,6 @@ build_deb:future:
- debuild -i -us -uc -b - debuild -i -us -uc -b
- cp ../*.deb . - cp ../*.deb .
build_reference:
image: debian:bookworm
stage: build
needs:
- job: build_meson
artifacts: true
artifacts:
paths:
- _build/doc
script:
- apt-get -y install cargo
- cd _build
- ../cargo.sh doc --no-deps --document-private-items
except:
variables:
- $PKG_ONLY == "1"
test_lintian: test_lintian:
stage: test stage: test
needs: needs:
@ -127,13 +107,11 @@ test_lintian:
- $PKG_ONLY == "1" - $PKG_ONLY == "1"
test: test:
image: debian:bookworm
stage: test stage: test
needs: needs:
- job: build_meson - job: build_meson
artifacts: true artifacts: true
script: script:
- mv debian/control-newer debian/control
- apt-get -y build-dep . - apt-get -y build-dep .
- apt-get -y install clang-tidy - apt-get -y install clang-tidy
- ninja -C _build test - ninja -C _build test
@ -164,17 +142,3 @@ check_release:
except: except:
variables: variables:
- $PKG_ONLY == "1" - $PKG_ONLY == "1"
pages:
stage: deploy
needs:
- build_docs
- build_reference
script:
- mv _build/ public/
artifacts:
paths:
- public
only:
refs:
- master

View File

@ -1,10 +1,6 @@
# Dependencies which change based on build flags # Dependencies which change based on build flags
bitflags = "1.2.*" bitflags = "1.2.*"
clap = { version = "2.33.*", default-features = false } clap = { version = "2.33.*", default-features = false }
zbus = "1.0.*"
zvariant = "2.0.*"
# Newer versions seem to confuse the version of Cargo on Debian Bullseye
zvariant_derive = "2.0.*"
[dependencies.cairo-rs] [dependencies.cairo-rs]
version = "0.7.*" version = "0.7.*"

View File

@ -1,12 +1,7 @@
# Dependencies and tools which change based on build flags # Dependencies 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 = "4.*", features=["std"], default-features = false } clap = { version = "2.33.*", default-features = false }
zbus = "1.9.*"
zvariant = "2.10.*"
# Newer versions seem to confuse the version of Cargo on Debian Bullseye
zvariant_derive = "2.10.*"
[dependencies.cairo-rs] [dependencies.cairo-rs]
version = "0.14.*" version = "0.14.*"

251
Cargo.lock generated
View File

@ -40,12 +40,6 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]] [[package]]
name = "cairo-rs" name = "cairo-rs"
version = "0.7.1" version = "0.7.1"
@ -73,21 +67,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.79" version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
@ -100,51 +82,11 @@ dependencies = [
"unicode-width", "unicode-width",
] ]
[[package]]
name = "derivative"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "enumflags2"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0"
dependencies = [
"enumflags2_derive",
"serde",
]
[[package]]
name = "enumflags2_derive"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "fastrand"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
dependencies = [
"instant",
]
[[package]] [[package]]
name = "fragile" name = "fragile"
version = "0.3.0" version = "0.3.0"
source = "git+https://source.puri.sm/dorota.czaplejewicz/fragile.git?tag=0.3.0#51048ca11824279c2114c77fef5bcb950838fc09" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05f8140122fa0d5dcb9fc8627cfce2b37cc1500f752636d46ea28bc26785c2f9"
[[package]] [[package]]
name = "gdk" name = "gdk"
@ -319,29 +261,20 @@ dependencies = [
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.12.3" version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.9.2" version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown", "hashbrown",
] ]
[[package]]
name = "instant"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
"cfg-if 1.0.0",
]
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
@ -350,15 +283,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.139" version = "0.2.119"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
[[package]] [[package]]
name = "linked-hash-map" name = "linked-hash-map"
version = "0.5.6" version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
[[package]] [[package]]
name = "maplit" name = "maplit"
@ -376,19 +309,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "nix"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363"
dependencies = [
"bitflags",
"cc",
"cfg-if 0.1.10",
"libc",
"void",
]
[[package]] [[package]]
name = "pango" name = "pango"
version = "0.7.0" version = "0.7.0"
@ -418,33 +338,24 @@ dependencies = [
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.26" version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
[[package]]
name = "proc-macro-crate"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
dependencies = [
"toml",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.51" version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
dependencies = [ dependencies = [
"unicode-ident", "unicode-xid",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.23" version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -467,48 +378,28 @@ dependencies = [
"serde", "serde",
"serde_yaml", "serde_yaml",
"xkbcommon", "xkbcommon",
"zbus",
"zvariant",
"zvariant_derive",
] ]
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.12" version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
[[package]]
name = "scoped-tls"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.152" version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.152" version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_repr"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -517,9 +408,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_yaml" name = "serde_yaml"
version = "0.8.26" version = "0.8.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"ryu", "ryu",
@ -529,13 +420,13 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.107" version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"unicode-ident", "unicode-xid",
] ]
[[package]] [[package]]
@ -547,32 +438,17 @@ dependencies = [
"unicode-width", "unicode-width",
] ]
[[package]]
name = "toml"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
dependencies = [
"serde",
]
[[package]]
name = "unicode-ident"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.1.10" version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
[[package]] [[package]]
name = "void" name = "unicode-xid"
version = "1.0.2" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]] [[package]]
name = "winapi" name = "winapi"
@ -598,9 +474,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]] [[package]]
name = "xkbcommon" name = "xkbcommon"
version = "0.4.1" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "032ed00cc755c31221bbd6aaf9fa4196a01bf33bca185f9316e14f26d28c28cf" checksum = "fda0ea5f7ddabd51deeeda7799bee06274112f577da7dd3d954b8eda731b2fce"
dependencies = [ dependencies = [
"libc", "libc",
"memmap", "memmap",
@ -614,56 +490,3 @@ checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
dependencies = [ dependencies = [
"linked-hash-map", "linked-hash-map",
] ]
[[package]]
name = "zbus"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cb97c72cbfd5c7537ca730eeb810da7348f345ba67ab7673bcbe0d81c076427"
dependencies = [
"byteorder",
"derivative",
"enumflags2",
"fastrand",
"nix",
"scoped-tls",
"serde",
"serde_repr",
"zbus_macros",
"zvariant",
"zvariant_derive",
]
[[package]]
name = "zbus_macros"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0c1f2a20a4cb90922b44d3bebd232b246e52b3dd95ed5bea8aec83cde3a5a8a"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "zvariant"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0bf85e67d1a3780cb1c56c80227532354f21907cba14805a773eb507b444580"
dependencies = [
"byteorder",
"enumflags2",
"serde",
]
[[package]]
name = "zvariant_derive"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d68726e8c12757384a8d1485080527e263dea67d91f19e97cd71b9292f22d7c5"
dependencies = [
"proc-macro2",
"quote",
"syn",
]

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,6 @@
[package] [package]
name = "rs" name = "rs"
version = "0.1.0" version = "0.1.0"
edition = "2021"
[lib] [lib]
name = "rs" name = "rs"
@ -17,14 +16,8 @@ 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]

31
NEWS.md
View File

@ -1,31 +0,0 @@
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

View File

@ -86,4 +86,4 @@ It's strongly recommended to support:
Developing Developing
---------- ----------
See [`doc/hacking.md`](doc/hacking.md) for this copy, or the [official documentation](https://world.pages.gitlab.gnome.org/Phosh/squeekboard) for the current release. See [`doc/hacking.md`](doc/hacking.md) for this copy, or the [official documentation](https://developer.puri.sm/projects/squeekboard/) for the current release.

View File

@ -5,12 +5,6 @@ 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;

View File

@ -1,206 +0,0 @@
---
outlines:
small: { width: 50, height: 30 }
default: { width: 35.33, height: 52 }
altline: { width: 35.33, height: 52 }
wide: { width: 50, height: 52 }
spaceline: { width: 150, height: 52 }
special: { width: 35.33, height: 52 }
views:
base:
- "b é p o w v d l j z"
- "a u i e c t s r n m"
- "Shift_L y x k q g h f period BackSpace"
- "show_numbers preferences space show_eschars Return"
upper:
- "B É P O W V D L J Z"
- "A U I E C T S R N M"
- "Shift_L Y X K Q G H F - BackSpace"
- "show_numbers preferences space colon show_eschars Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "@ # € % & - _ + ( )"
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "show_letters preferences space show_eschars Return"
symbols:
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ $ ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences space show_eschars Return"
eschars:
- "à â ç é è ê î ô ù û"
- "À Â Ç É È Ê Î Ô Ù Û"
- "show_numbers_from_symbols æ œ ä ë ï ö ü BackSpace"
- "show_letters preferences space show_eschars Return"
buttons:
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"
period:
outline: "special"
text: "."
slash:
outline: "special"
text: "/"
show_actions:
action:
set_view: "actions"
outline: "special"
label: ">_"
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_eschars:
action:
locking:
lock_view: "eschars"
unlock_view: "base"
outline: "altline"
label: "âÂ"
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"
"\"":
keysym: "quotedbl"

View File

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

View File

@ -1,78 +0,0 @@
---
outlines:
default: { width: 35.33, height: 52 }
altline: { width: 52.67, height: 52 }
wide: { width: 62, height: 52 }
spaceline: { width: 142, height: 52 }
special: { width: 44, height: 52 }
views:
base:
- "ქ წ ე რ ტ უ ი ო პ"
- "ა ს დ ფ გ ჰ ჯ კ ლ"
- "Shift_L ზ ხ ც ვ ბ ნ მ BackSpace"
- "show_numbers preferences space period Return"
upper:
- "ქ ჭ ე ღ თ უ ი ო პ"
- "ა შ დ ფ გ ჰ ჟ კ ლ"
- "Shift_L ძ ხ ჩ ვ ბ ნ მ BackSpace"
- "show_numbers preferences space period Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "! @ # $ % ^ & * ( )"
- "show_symbols - ' \" colon ; , ? BackSpace"
- "show_letters preferences space period Return"
symbols:
- "+ ÷ = / _ € £ ¥ ₾"
- "~ ` | · √ π τ ° { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences space period Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: "erase"
preferences:
action: "show_prefs"
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_numbers_from_symbols:
action:
set_view: "numbers"
outline: "altline"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "ABC"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
period:
outline: "special"
text: "."
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"

View File

@ -1,326 +0,0 @@
# Greek polytonic layout by Antonis Tsolomitis
# University of the Aegean, Department of Mathematics, atsol@aegean.gr
# March 2022
#
---
outlines:
default: { width: 40, height: 60 }
altline: { width: 52.67, height: 60 }
wide: { width: 62, height: 60 }
extrawide: { width: 66, height: 60 }
spaceline: { width: 140, height: 60 }
special: { width: 44, height: 60 }
views:
base:
- "semicolon ς ε ρ τ υ θ ι ο π"
- "α σ δ φ γ η ξ κ λ show_accents"
- "Shift_L ζ χ ψ ω β ν μ BackSpace"
- "show_numbers preferences space period comma Return"
upper:
- "colon EuroSign Ε Ρ Τ Υ Θ Ι Ο Π"
- "Α Σ Δ Φ Γ Η Ξ Κ Λ show_accents"
- "Shift_L Ζ Χ Ψ Ω Β Ν Μ BackSpace"
- "show_numbers preferences space exclam period_upper Return"
accents:
- "show_psiliordasiaandvaria show_psiliordasiaandoxia show_psiliordasia show_bariaorperispomeni show_oxia"
- "show_PsiliOrDasiaAndVaria show_PsiliOrDasiaAndOxia show_PsiliOrDasia show_BariaOrPerispomeni show_Oxia show_base"
- "show_PsiliOrDasiaAndPerispomeni show_psiliordasiaandperispomeni ᾿ BackSpace"
- "show_numbers preferences space Return"
oxia:
- "ά έ ή ί ϊ ΐ ό ύ ϋ ώ"
- "show_Oxia ᾳ ᾴ ῃ ῄ ῳ ῴ show_base"
- "Ϗ ϐ ϑ ϗ ϖ ΰ ϕ — BackSpace"
- "show_numbers preferences space eis_l eis_r Return"
Oxia:
- "Ά Έ Ή Ί Ϊ Ό Ύ Ϋ Ώ"
- "show_oxia ᾼ ῌ ῼ show_base"
- "Ϗ ϐ ϑ ϗ ϖ ϕ — BackSpace"
- "show_numbers preferences space eis_l eis_r Return"
bariaorperispomeni:
- "ὰ ὲ ὴ ὶ ῒ ὸ ὺ ὼ ῐ ῑ"
- "show_BariaOrPerispomeni ᾳ ᾲ ῃ ῂ ῳ ῲ ῠ show_base"
- "ᾶ ᾷ ῆ ῖ ῗ ῦ ῧ ῶ ῡ BackSpace"
- "show_numbers preferences space ῇ ῷ Return"
BariaOrPerispomeni:
- "Ὰ Ὲ Ὴ Ὶ Ὸ Ὺ Ὼ"
- "show_bariaorperispomeni ᾼ ῌ ῼ show_base"
- "show_numbers preferences space BackSpace Return"
psiliordasia:
- "ἀ ἐ ἠ ἰ ὀ ὐ ὠ ᾀ ᾐ ᾠ"
- "show_PsiliOrDasia ἁ ἑ ἡ ἱ ὁ ὑ ὡ show_base"
- "ᾁ ᾑ ᾡ ῤ ῥ BackSpace"
- "show_numbers preferences space Return"
PsiliOrDasia:
- "Ἀ Ἐ Ἠ Ἰ Ὀ Ὠ ᾈ ᾘ ᾨ"
- "show_psiliordasia Ἁ Ἑ Ἡ Ἱ Ὁ Ὑ Ὡ show_base"
- "ᾉ ᾙ ᾩ Ῥ BackSpace"
- "show_numbers preferences space Return"
psiliordasiaandoxia:
- "ἄ ἔ ἤ ἴ ὄ ὔ ὤ ᾄ ᾔ ᾤ"
- "show_PsiliOrDasiaAndOxia ἅ ἕ ἥ ἵ ὅ ὕ ὥ show_base"
- "ᾅ ᾕ ᾥ BackSpace"
- "show_numbers preferences space Return"
PsiliOrDasiaAndOxia:
- "Ἄ Ἔ Ἤ Ἴ Ὄ Ὤ ᾌ ᾜ ᾬ"
- "show_psiliordasiaandoxia Ἅ Ἕ Ἥ Ἵ Ὅ Ὕ Ὥ show_base"
- "ᾍ ᾝ ᾭ BackSpace"
- "show_numbers preferences space Return"
psiliordasiaandvaria:
- "ἂ ἒ ἢ ἲ ὂ ὒ ὢ ᾂ ᾒ ᾢ"
- "show_PsiliOrDasiaAndVaria ἃ ἓ ἣ ἳ ὃ ὓ ὣ show_base"
- "ᾃ ᾓ ᾣ BackSpace"
- "show_numbers preferences space Return"
PsiliOrDasiaAndVaria:
- "Ἂ Ἒ Ἢ Ἲ Ὂ Ὢ ᾊ ᾚ ᾪ"
- "show_psiliordasiaandvaria Ἃ Ἓ Ἣ Ἳ Ὃ Ὓ Ὣ show_base"
- "ᾋ ᾛ ᾫ BackSpace"
- "show_numbers preferences space Return"
psiliordasiaandperispomeni:
- "ἆ ἦ ἶ ὖ ὦ ᾆ ᾖ ᾦ"
- "show_PsiliOrDasiaAndPerispomeni ἇ ἧ ἷ ὗ ὧ show_base"
- "ᾇ ᾗ ᾧ BackSpace"
- "show_numbers preferences space Return"
PsiliOrDasiaAndPerispomeni:
- "Ἆ Ἦ Ἶ Ὦ ᾎ ᾞ ᾮ"
- "show_psiliordasiaandperispomeni Ἇ Ἧ Ἷ Ὗ Ὧ show_base"
- "ᾏ ᾟ ᾯ BackSpace"
- "show_numbers preferences space Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "at numbersign dollar percent ampersand minus underscore plus parenleft parenright"
- "show_symbols comma quotedbl quoteright colon semicolon exclam question BackSpace"
- "show_letters preferences space period comma Return"
symbols:
- "asciitilde quoteleft bar U00B7 squareroot Greek_pi Greek_tau division multiply paragraph"
- "copyright U00AE U00A3 EuroSign U00A5 asciicircum degree asterisk braceleft braceright"
- "show_numbers backslash slash less greater equal bracketleft bracketright BackSpace"
- "show_letters preferences space period comma 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: "altline"
icon: "keyboard-mode-symbolic"
show_oxia:
action:
set_view: "oxia"
outline: "extrawide"
label: " ΅"
show_Oxia:
action:
set_view: "Oxia"
outline: "extrawide"
label: "´¨↑"
show_bariaorperispomeni:
action:
set_view: "bariaorperispomeni"
outline: "extrawide"
label: " "
show_BariaOrPerispomeni:
action:
set_view: "BariaOrPerispomeni"
outline: "extrawide"
label: "`῀↑"
show_psiliordasia:
action:
set_view: "psiliordasia"
outline: "extrawide"
label: "᾿ "
show_PsiliOrDasia:
action:
set_view: "PsiliOrDasia"
outline: "extrawide"
label: "᾿῾↑"
show_psiliordasiaandoxia:
action:
set_view: "psiliordasiaandoxia"
outline: "extrawide"
label: "῎ ῞"
show_PsiliOrDasiaAndOxia:
action:
set_view: "PsiliOrDasiaAndOxia"
outline: "extrawide"
label: "῎῞↑"
show_psiliordasiaandvaria:
action:
set_view: "psiliordasiaandvaria"
outline: "extrawide"
label: "῍ ῝"
show_PsiliOrDasiaAndVaria:
action:
set_view: "PsiliOrDasiaAndVaria"
outline: "extrawide"
label: "῍῝↑"
show_psiliordasiaandperispomeni:
action:
set_view: "psiliordasiaandperispomeni"
outline: "extrawide"
label: "῏ ῟"
show_PsiliOrDasiaAndPerispomeni:
action:
set_view: "PsiliOrDasiaAndPerispomeni"
outline: "extrawide"
label: "῏῟↑"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "ΑΒΓ"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
show_accents:
action:
locking:
lock_view: "accents"
unlock_view: "base"
outline: "altline"
label: "ᾦ"
show_base:
action:
set_view: "base"
outline: "altline"
label: "αι"
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
period:
outline: "special"
text: "."
period_upper:
outline: "special"
text: "·"
comma:
outline: "special"
text: ","
colon:
outline: "special"
text: ":"
semicolon:
outline: "special"
text: ";"
exclam:
outline: "special"
text: "!"
eis_l:
outline: "special"
text: "«"
eis_r:
outline: "special"
text: "»"
aring:
text: "å"
Aring:
text: "Å"
oslash:
text: "ø"
Oslash:
text: "Ø"
ae:
text: "æ"
AE:
text: "Æ"
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:
outline: "special"
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: "}"
backslash:
text: "\\"
slash:
text: "/"
quotedbl:
text: "\""
quoteright:
text: "'"
less:
text: "<"
greater:
text: ">"
question:
text: "?"
bracketleft:
text: "["
bracketright:
text: "]"

View File

@ -1,41 +1,40 @@
# Greek layout originally created by Antonis Tsolomitis # Greek layout created by Antonis Tsolomitis
# University of the Aegean, Department of Mathematics, atsol@aegean.gr # University of the Aegean, Department of Mathematics, atsol@aegean.gr
# Sep 2019 # Sep 2019
# Edited by Sotiris Papadopoulos, sotirios.papadopoulos@inserm.fr
--- ---
outlines: outlines:
default: { width: 40, height: 60 } default: { width: 32, height: 52 }
altline: { width: 52.67, height: 60 } altline: { width: 48.39024, height: 52 }
wide: { width: 62, height: 60 } wide: { width: 62, height: 52 }
spaceline: { width: 140, height: 60 } outline7: { width: 88.97561, height: 52 }
special: { width: 44, height: 60 } spaceline: { width: 150.5853, height: 52 }
views: views:
base: base:
- "semicolon ς ε ρ τ υ θ ι ο π" - "; ς ε ρ τ υ θ ι ο π !"
- "α σ δ φ γ η ξ κ λ show_accented" - "α σ δ φ γ η ξ κ λ show_accented"
- "Shift_L ζ χ ψ ω β ν μ BackSpace" - "Shift_L ζ χ ψ ω β ν μ , BackSpace"
- "show_numbers preferences space period comma Return" - "show_numbers preferences space period Return"
upper: upper:
- "colon exclam Ε Ρ Τ Υ Θ Ι Ο Π" - ": EuroSign Ε Ρ Τ Υ Θ Ι Ο Π"
- "Α Σ Δ Φ Γ Η Ξ Κ Λ show_accented" - "Α Σ Δ Φ Γ Η Ξ Κ Λ show_accented"
- "Shift_L Ζ Χ Ψ Ω Β Ν Μ BackSpace" - "Shift_L Ζ Χ Ψ Ω Β Ν Μ · BackSpace"
- "show_numbers preferences space period_upper apostrophe Return" - "show_numbers preferences space « » Return"
accented: accented:
- "ά έ ή ί ϊ ΐ ό ύ ϋ ώ " - "ά έ ή ί ό ύ ώ ϊ ϋ ΐ"
- "Ά Έ Ή Ί Ϊ Ό Ύ Ϋ Ώ show_base" - "ΰ Ά Έ Ή Ί Ό Ύ Ώ Ϊ show_base"
- "Ϗ ϐ ϑ ϗ ϖ ΰ ϕ — BackSpace" - "Ϋ Ϗ ϐ ϑ ϕ ϖ ϗ — BackSpace"
- "show_numbers preferences space eis_l eis_r Return" - "show_numbers preferences space quoteleft quoteright Return"
numbers: numbers:
- "1 2 3 4 5 6 7 8 9 0" - "1 2 3 4 5 6 7 8 9 0"
- "at numbersign dollar percent ampersand minus underscore plus parenleft parenright" - "at numbersign dollar percent ampersand minus underscore plus parenleft parenright"
- "show_symbols comma quotedbl quoteright colon semicolon exclam question BackSpace" - "show_symbols comma quotedbl quoteright colon semicolon exclam question BackSpace"
- "show_letters preferences space period comma Return" - "show_letters preferences space period Return"
symbols: symbols:
- "asciitilde quoteleft bar U00B7 squareroot Greek_pi Greek_tau division multiply paragraph" - "asciitilde quoteleft bar U00B7 squareroot Greek_pi Greek_tau division multiply paragraph"
- "copyright U00AE U00A3 EuroSign U00A5 asciicircum degree asterisk braceleft braceright" - "copyright U00AE U00A3 EuroSign U00A5 asciicircum degree asterisk braceleft braceright"
- "show_numbers backslash slash less greater equal bracketleft bracketright BackSpace" - "show_numbers backslash slash less greater equal bracketleft bracketright BackSpace"
- "show_letters preferences space period comma Return" - "show_letters preferences space period Return"
buttons: buttons:
Shift_L: Shift_L:
action: action:
@ -55,12 +54,12 @@ buttons:
show_numbers: show_numbers:
action: action:
set_view: "numbers" set_view: "numbers"
outline: "wide" outline: "altline"
label: "123" label: "123"
show_letters: show_letters:
action: action:
set_view: "base" set_view: "base"
outline: "wide" outline: "altline"
label: "ΑΒΓ" label: "ΑΒΓ"
show_symbols: show_symbols:
action: action:
@ -79,40 +78,16 @@ buttons:
set_view: "base" set_view: "base"
outline: "altline" outline: "altline"
label: "αι" label: "αι"
period:
outline: "altline"
text: "."
space: space:
outline: "spaceline" outline: spaceline
text: " " text: " "
Return: Return:
outline: "wide" outline: "wide"
icon: "key-enter" icon: "key-enter"
keysym: "Return" keysym: "Return"
period:
outline: "special"
text: "."
period_upper:
outline: "special"
text: "·"
comma:
outline: "special"
text: ","
colon:
outline: "special"
text: ":"
semicolon:
outline: "special"
text: ";"
apostrophe:
outline: "special"
text: "᾿"
exclam:
outline: "special"
text: "!"
eis_l:
outline: "special"
text: "«"
eis_r:
outline: "special"
text: "»"
aring: aring:
text: "å" text: "å"
Aring: Aring:
@ -187,6 +162,8 @@ buttons:
text: "{" text: "{"
braceright: braceright:
text: "}" text: "}"
comma:
text: ","
backslash: backslash:
text: "\\" text: "\\"
slash: slash:
@ -199,6 +176,12 @@ buttons:
text: "<" text: "<"
greater: greater:
text: ">" text: ">"
colon:
text: ":"
semicolon:
text: ";"
exclam:
text: "!"
question: question:
text: "?" text: "?"
bracketleft: bracketleft:

View File

@ -1,204 +0,0 @@
# Creaed by Sotiris Papadopoulos, sotirios.papadopoulos@inserm.fr
---
outlines:
default: { width: 80, height: 60 }
altline: { width: 110, height: 60 }
wide: { width: 120, height: 60 }
spaceline: { width: 250, height: 60 }
special: { width: 75, height: 60 }
views:
base:
- "semicolon ς ε ρ τ υ θ ι ο π"
- "α σ δ φ γ η ξ κ λ show_accented"
- "Shift_L ζ χ ψ ω β ν μ BackSpace"
- "show_numbers preferences space period comma Return"
upper:
- "colon exclam Ε Ρ Τ Υ Θ Ι Ο Π"
- "Α Σ Δ Φ Γ Η Ξ Κ Λ show_accented"
- "Shift_L Ζ Χ Ψ Ω Β Ν Μ BackSpace"
- "show_numbers preferences space period_upper apostrophe Return"
accented:
- "ά έ ή ί ϊ ΐ ό ύ ϋ ώ "
- "Ά Έ Ή Ί Ϊ Ό Ύ Ϋ Ώ show_base"
- "Ϗ ϐ ϑ ϗ ΰ ϕ ϖ — BackSpace"
- "show_numbers preferences space eis_l eis_r Return"
numbers:
- "1 2 3 4 5 6 7 8 9 0"
- "at numbersign dollar percent ampersand minus underscore plus parenleft parenright"
- "show_symbols comma quotedbl quoteright colon semicolon exclam question BackSpace"
- "show_letters preferences space period comma Return"
symbols:
- "asciitilde quoteleft bar U00B7 squareroot Greek_pi Greek_tau division multiply paragraph"
- "copyright U00AE U00A3 EuroSign U00A5 asciicircum degree asterisk braceleft braceright"
- "show_numbers backslash slash less greater equal bracketleft bracketright BackSpace"
- "show_letters preferences space period comma Return"
buttons:
Shift_L:
action:
locking:
lock_view: "upper"
unlock_view: "base"
outline: "altline"
icon: "key-shift"
BackSpace:
outline: "altline"
icon: "edit-clear-symbolic"
action: "erase"
preferences:
action: "show_prefs"
outline: "special"
icon: "keyboard-mode-symbolic"
show_numbers:
action:
set_view: "numbers"
outline: "wide"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "ΑΒΓ"
show_symbols:
action:
set_view: "symbols"
outline: "altline"
label: "*/="
show_accented:
action:
locking:
lock_view: "accented"
unlock_view: "base"
outline: "altline"
label: "άΐ"
show_base:
action:
set_view: "base"
outline: "altline"
label: "αι"
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
period:
outline: "special"
text: "."
period_upper:
outline: "special"
text: "·"
comma:
outline: "special"
text: ","
colon:
outline: "special"
text: ":"
semicolon:
outline: "special"
text: ";"
apostrophe:
outline: "special"
text: "᾿"
exclam:
outline: "special"
text: "!"
eis_l:
outline: "special"
text: "«"
eis_r:
outline: "special"
text: "»"
aring:
text: "å"
Aring:
text: "Å"
oslash:
text: "ø"
Oslash:
text: "Ø"
ae:
text: "æ"
AE:
text: "Æ"
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: "}"
backslash:
text: "\\"
slash:
text: "/"
quotedbl:
text: "\""
quoteright:
text: "'"
less:
text: "<"
greater:
text: ">"
question:
text: "?"
bracketleft:
text: "["
bracketright:
text: "]"

View File

@ -1,82 +0,0 @@
# 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"

View File

@ -1,82 +0,0 @@
# 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"

View File

@ -30,10 +30,10 @@ views:
- "show_numbers \\ / < > = [ ] BackSpace" - "show_numbers \\ / < > = [ ] BackSpace"
- "show_letters show_eschars preferences space ? . Return" - "show_letters show_eschars preferences space ? . Return"
eschars: eschars:
- "è é È É ù ú Ù Ú ò ó" - "á é í ó ú Á É Í Ó Ú"
- á À Á ì í Ì Í Ò Ó" - è ì ò « » ù ! { }"
- "show_numbers “ ” « » ≈ ≠ ‽ BackSpace" - "show_numbers \\ / < > = [ ] BackSpace"
- "show_letters show_eschars preferences space , . Return" - "show_letters show_eschars preferences space « » Return"
buttons: buttons:
Shift_L: Shift_L:

View File

@ -1,164 +0,0 @@
---
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: "]"

View File

@ -1,223 +0,0 @@
---
outlines:
action: { width: 59, height: 46 }
small: { width: 50, height: 22 }
default: { width: 35.33, height: 46 }
altline: { width: 35.33, height: 46 }
wide: { width: 50, height: 46 }
spaceline: { width: 110, height: 46 }
special: { width: 35.33, height: 46 }
views:
base:
- "Ctrl Alt Tabsmall ↑ ↓ ← →"
- "b é p o w v d l j z"
- "a u i e c t s r n m"
- "Shift_L y x k q g h f period BackSpace"
- "show_numbers preferences slash space show_eschars show_actions Return"
upper:
- "Ctrl Alt Tabsmall PgUp PgDn Home End"
- "B É P O W V D L J Z"
- "A U I E C T S R N M"
- "Shift_L Y X K Q G H F - BackSpace"
- "show_numbers preferences space colon show_eschars show_actions Return"
numbers:
- "Ctrl Alt Tabsmall ↑ ↓ ← →"
- "1 2 3 4 5 6 7 8 9 0"
- "@ # € % & - _ + ( )"
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "show_letters preferences space show_eschars show_actions Return"
symbols:
- "Ctrl Alt Tabsmall ↑ ↓ ← →"
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ $ ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences space show_eschars show_actions Return"
eschars:
- "Ctrl Alt Tabsmall ↑ ↓ ← →"
- "à â ç é è ê î ô ù û"
- "À Â Ç É È Ê Î Ô Ù Û"
- "show_numbers_from_symbols æ œ ä ë ï ö ü BackSpace"
- "show_letters preferences space show_eschars show_actions 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:
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"
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"
period:
outline: "special"
text: "."
slash:
outline: "special"
text: "/"
show_actions:
action:
set_view: "actions"
outline: "special"
label: ">_"
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: "wide"
label: "123"
show_letters:
action:
set_view: "base"
outline: "wide"
label: "abc"
show_symbols:
action:
set_view: "symbols"
outline: "wide"
label: "*/="
show_eschars:
action:
locking:
lock_view: "eschars"
unlock_view: "base"
outline: "altline"
label: "âÂ"
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"
"\"":
keysym: "quotedbl"

View File

@ -1,227 +0,0 @@
---
outlines:
action: { width: 90, height: 37 }
small: { width: 67.4, height: 22 }
default: { width: 54, height: 37 }
altline: { width: 81, height: 37 }
wide: { width: 100, height: 37 }
spaceline: { width: 110, height: 37 }
special: { width: 54, height: 37 }
views:
base:
- "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
- "b é p o w v d l j z"
- "a u i e c t s r n m"
- "Shift_L y x k q g h f period BackSpace"
- "show_numbers preferences space slash show_eschars show_actions Return"
upper:
- "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
- "B É P O W V D L J Z"
- "A U I E C T S R N M"
- "Shift_L Y X K Q G H F - BackSpace"
- "show_numbers preferences space colon show_eschars show_actions Return"
numbers:
- "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
- "1 2 3 4 5 6 7 8 9 0"
- "@ # € % & - _ + ( )"
- "show_symbols , \" ' colon ; ! ? BackSpace"
- "show_letters preferences space show_eschars show_actions Return"
symbols:
- "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
- "~ ` | · √ π τ ÷ × ¶"
- "© ® £ $ ¥ ^ ° * { }"
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
- "show_letters preferences space show_eschars show_actions Return"
eschars:
- "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
- "à â ç é è ê î ô ù û"
- "À Â Ç É È Ê Î Ô Ù Û"
- "show_numbers_from_symbols æ œ ä ë ï ö ü BackSpace"
- "show_letters preferences space show_eschars show_actions 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:
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"
period:
outline: "special"
text: "."
slash:
outline: "special"
text: "/"
show_actions:
action:
set_view: "actions"
outline: "special"
label: ">_"
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_eschars:
action:
locking:
lock_view: "eschars"
unlock_view: "base"
outline: "altline"
label: "âÂ"
space:
outline: "spaceline"
text: " "
Return:
outline: "wide"
icon: "key-enter"
keysym: "Return"
colon:
text: ":"
"\"":
keysym: "quotedbl"

View File

@ -1,200 +0,0 @@
---
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"

View File

@ -1,208 +0,0 @@
---
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"

View File

@ -3,14 +3,7 @@ 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

200
debian/changelog vendored
View File

@ -1,209 +1,17 @@
squeekboard (1.21.0-1) experimental; urgency=medium squeekboard (1.17.1-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
[ Dorota Czaplejewicz ]
* docs: Describe layouts
* glib: Fix import
* state: Record layout choice
* doc: Describe how to control debugging mode
* state: Include layout choice in visible outcome
* state: Store layout override
* state: Decide panel arrangement
* state: Use dummy layout command
* state: Use IM hint and purpose for layout selection
* main: Dry-load layout in response to the layout command
* state: Become the source of layout choice
* cargo: Halt overzealous upgrader
* ci: Use bookworm for online builds
* build: Generate files before compiling sources
* gtk: Persist panel state
* build: Update Cargo.lock
[ Luke Luo ]
* Add Chinese (China) translation
[ Éloi Rivard ]
* Add French translation
[ Laurent Laffont ]
* Add FR+Bépo layout
[ Bytez ]
* Fixed missing characters in eschars view in italian layout.
* Replaced foreign characters.
[ Aleksandr Melman ]
* Add Russian translation
[ skysphr ]
* Added Georgian layout
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Wed, 06 Jul 2022 06:10:40 +0000
squeekboard (1.18.0-1) experimental; urgency=medium
[ Hugo Carvalho ]
* Add Portuguese translation
[ Мирослав Николић ]
* Add Serbian translation
[ William Wold ]
* Do not reset pending state on zwp_input_method_v2.done
[ Balázs Úr ]
* Add Hungarian translation
[ Emin Tufan Çetin ]
* Add Turkish translation
[ Piotr Drąg ]
* Add Polish translation
[ Pablo Correa Gómez ]
* Add Spanish translation
[ Vittorio Monti ]
* Add Italian translation
[ Dorota Czaplejewicz ] [ Dorota Czaplejewicz ]
* build: Replace missing crates.io dependency with Purism-hosted one * build: Replace missing crates.io dependency with Purism-hosted one
* ci: Allow failure on sid * ci: Allow failure on sid
* build: Update clap on newer Debian
* panel: Use scaling to set height * panel: Use scaling to set height
* layouts: Add Greek Polytonic
* debug: Add dbus interface to control debug prints
* output: Store physical size
* state: Derive panel size from physical click target size
* Clean up size types
* state: Add sizing unit test
* layouts: Register gr_wide
* CI: Build Rust code reference
* CI: Add gitlab pages deployment
* panel: Split away panel handling
* cargo: Add zbus to newer Debian
* docs: Update location
* docs: Link to reference
* docs: Make index more logical
* Update Cargo lock
[ Sotiris Papadopoulos ] [ William Wold ]
* Update gr.yaml to take advantage of more space per symbol. Creation of a wide variant... * Do not reset pending state on zwp_input_method_v2.done
[ Arnaud Ferraris ] [ Arnaud Ferraris ]
* state: fix "wide mode" detection in portrait orientation * state: fix "wide mode" detection in portrait orientation
* layout: allow stretching the layout by a small amount
* layout: fix build on i386
[ Sungjoon Moon ] -- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Tue, 05 Apr 2022 13:32:53 +0000
* Add Korean translation
[ Quentin PAGÈS ]
* Add Occitan translation
[ Zurab Kargareteli ]
* Add Georgian translation
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Mon, 25 Apr 2022 13:12:36 +0000
squeekboard (1.17.0-1) experimental; urgency=medium squeekboard (1.17.0-1) experimental; urgency=medium

8
debian/control vendored
View File

@ -3,12 +3,11 @@ 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-mozilla, cargo,
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,
@ -24,12 +23,11 @@ Build-Depends:
librust-serde-derive-1-dev (>= 1.0), librust-serde-derive-1-dev (>= 1.0),
librust-serde-yaml-0.8-dev (>= 0.8), librust-serde-yaml-0.8-dev (>= 0.8),
librust-xkbcommon-0.4+wayland-dev (>= 0.4), librust-xkbcommon-0.4+wayland-dev (>= 0.4),
librust-zbus-dev (>=1.0),
libwayland-dev (>= 1.16), libwayland-dev (>= 1.16),
lsb-release, lsb-release,
python3, python3,
python3-ruamel.yaml, python3-ruamel.yaml,
rustc-mozilla, rustc,
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
@ -37,8 +35,6 @@ 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},

View File

@ -8,7 +8,6 @@ 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,
@ -24,7 +23,6 @@ Build-Depends:
librust-serde-derive-1-dev (>= 1.0), librust-serde-derive-1-dev (>= 1.0),
librust-serde-yaml-0.8-dev (>= 0.8), librust-serde-yaml-0.8-dev (>= 0.8),
librust-xkbcommon-0.4+wayland-dev (>= 0.4), librust-xkbcommon-0.4+wayland-dev (>= 0.4),
librust-zbus-dev (>= 1.9),
libwayland-dev (>= 1.16), libwayland-dev (>= 1.16),
lsb-release, lsb-release,
python3, python3,
@ -37,8 +35,6 @@ 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
View File

@ -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),bookworm)) ifneq (,$(filter $(distrel),sid))
newer = true newer = true
else else
newer = false newer = false

View File

@ -90,14 +90,6 @@ Layouts can be selected using the GNOME Settings application.
$ gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'de')]" $ gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'de')]"
``` ```
### Debugging mode
Squeekboard prints some information on standard output by default. To get deep debugging information, it can also print all changes in (some of) its internal state. Those logs are most useful when reporting hard to catch issues, and can be enabled using the following command:
```
busctl set-property --user sm.puri.SqueekDebug /sm/puri/SqueekDebug sm.puri.SqueekDebug Enabled b true
```
### Environment Variables ### Environment Variables
Besides the environment variables supported by GTK and [GLib](https://docs.gtk.org/glib/running.html) applications Besides the environment variables supported by GTK and [GLib](https://docs.gtk.org/glib/running.html) applications
@ -110,17 +102,6 @@ contain a comma separated list of:
Coding Coding
------ ------
### Reference docs
Reference documentation can be generated using:
```
cd squeekboard_build/
../squeekboard_source/cargo.sh doc --no-deps --document-private-items
```
as well as found [online](https://world.pages.gitlab.gnome.org/Phosh/squeekboard/doc/rs/).
### Project structure ### Project structure
Rust modules should be split into 2 categories: libraries, and user interface. They differ in the way they do error handling. Rust modules should be split into 2 categories: libraries, and user interface. They differ in the way they do error handling.
@ -254,32 +235,16 @@ 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
``` ```
Add the updated `debian/changelog` to the commit. The commit message should contain the release version and a description of changes. Commit the updated `debian/changelog`. The commit message should contain the release version and a description of changes.
### 5. Update the NEWS file > Release 1.13.0 "Externality"
>
> Changes:
>
> - A system for latching and locking views
> ...
Summarize the changes since the last release in the NEWS file. Use the Markdown syntax, e.g. ### 5. Create a signed tag for downstreams
```
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:
@ -288,6 +253,15 @@ 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
``` ```
### 8. Rejoice ### 5. Create a signed tag for packaging
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.

View File

@ -1,6 +1,13 @@
Welcome to squeekboard's documentation! Welcome to squeekboard's documentation!
======================================= =======================================
Contents
--------
* [Tutorial](tutorial.md)
* [Contributing](hacking.md)
* [Switching views](views.md)
Introduction Introduction
------------ ------------
@ -11,9 +18,9 @@ Layouts
Squeekboard allows user-provided keyboard layouts. They can be created without recompiling the keyboard code. The [tutorial](tutorial.md) explains the process in detail. Squeekboard allows user-provided keyboard layouts. They can be created without recompiling the keyboard code. The [tutorial](tutorial.md) explains the process in detail.
Layouts are created using a [text-based format, based on YAML](layouts.md). Layouts are created using a text-based format, based on YAML.
### Views TODO: Provide a description of the format.
Squeekboard layouts are separated into *views* and use a *room metaphor* to [switch views](views.md). Squeekboard layouts are separated into *views* and use a *room metaphor* to [switch views](views.md).
@ -21,7 +28,3 @@ Contributions
------------- -------------
Anyone is free to modify *squeekboard*. See the [contributing document](hacking.md). Anyone is free to modify *squeekboard*. See the [contributing document](hacking.md).
### Code documentation
To expose the structure of Squeekboard in detail, there's a [code reference](doc/rs).

View File

@ -1,121 +0,0 @@
Layouts
=====
Squeekboard is composed of multiple layouts, several for each language, multiplied by each hint.
Layouts live in the "keyboards" directory.
Hints
-------
The currently supported hints are: default, "email", "emoji", "number', "pin", "terminal", and "url".
Each directory in "keyboards" is named after a hint, with the "keyboards" directory itself taking the role of default.
Languages/scripts
-----------------------
Each hint directory contains multiple layout files. A single language will be composed of multiple files, with names starting with the same text. The language names are taken from iso639-3. An example is "gr".
After the language name optionally comes a "+" and an indication of the variant. For example, "it+fur".
Squeekboard will look for those based on the currently selected layout in Gnome Control Center.
Then, there's an optional part "_wide", which Squeekboard will try to use if the current display is rather wide. Example: "us+colemak_wide" or "us_wide".
Finally, the file name ends with ".yaml", e.g. "jp+kana_wide.yaml".
Together with hint information, this gives a complete path to the layout like this: "keyboards/terminal/fr_wide.yaml" or "keyboards/cz+qwerty.yaml".
Layout syntax
------------------
The layout file follows the YAML syntax, with specific meanings given to sections.
### Outlines
The "outlines" dictionary controls the widths and heights of buttons.
```
outlines:
default: { width: 32, height: 52 }
```
The width and height numbers are not in pixels, but rather they are proportionally scaled to fit the panel size.
There may be any number of outlines, but there are some special names:
- "default" applies to every button unless explicitly changed. It should be used for buttons that emit text
- "altline", "wide" have own color scheme, should be used for buttons which cause view changes
- "special" has own color scheme, to be used for confirmations like enter.
### Views
The "views" dictionary contains the actual views and positions of buttons.
```
views:
base:
- "q w e r t y u i o p å"
```
Squeekboard's layouts consist of multiple views, of which only one is visible at a time. Different views may contain different or the same buttons, more or fewer buttons, but each layout is independent. They are *not* shift levels there is no concept of "shift" in Squeekboard. View selection is also not dependent on modifiers.
There is only one special view "base". Views and view switching are described in detail in the [views](views.md) document.
Views in Squeekboard are based on rows. The first row comes near the top of the panel, the next one below, and so on.
```
- "Q W E R T Y U I O P Å"
- "upper z x c v b n m BackSpace"
```
Each row is a single string, and button names are separated by spaces. In left-to-right languages, the panel will be laid out just like the view code. CAUTION: buttons are placed on the panel left-to-right, starting from the earliest position in the string. That may not display great in your text editor when you use right-to-left characters as button names.
#### Button names in rows
Unicode characters are supported in the row string, so it's easy to use the correct name for most of them. However, the layout code is still YAML, which excludes certain characters: the space " ", the backslash "\", the double quote `"`. Those must use a replacement name.
Similarly, buttons that do not emit characters must have some names.
### Buttons
The buttons section describes what the button looks like and what it does.
```
BackSpace:
outline: altline
icon: "edit-clear-symbolic"
action: erase
```
Each entry in the "buttons" dictionary describes some button already present in one of the "views" rows. In the above example, it's "BackSpace".
The button description can have a number of components, each optional. For details, see
- "outline" selects which entry from the "outlines" section to use to draw this button,
- "label" is what should be displayed on the button, if its name is unsuitable,
- "icon" is the name of the svg icon to use instead of a label (icons are builtin, see the "data/icons" directory),
- "text" is the text to submit when the button is clicked if the name of the button is not suitable,
- "keysym" is the emulated keyboard keysym to send instead of sending text. Its use is discouraged: Squeekboard will automatically send keysyms if it detects that the receiving application does not accept text.
- "modifier" makes the button set an emulated keyboard modifier. The use of this is discouraged, and never needed for entering text.
- "action" sets aside the button for special actions like view switching
#### Action
```
action:
set_view: "numbers"
```
The "action" property has multiple forms.
- "erase" will erase the position behind the cursor,
- "show_preferences" will open the language selection popup,
- "set_view" simply switches to a view,
- "lock_view" switches to a view for a moment.
The two switching modes are better described in the [views](views.md) document.
Sources
----------
The sources, where all this is documented and up to date are in "src/data/parsing.rs". The reference documentation for the `rs::data::parsing::Layout` structure is the main place to look at.

View File

@ -9,12 +9,14 @@ So at least I will try to start writing a short how-to here and edit this post a
## Creating a new layout ## Creating a new layout
Creating a layout is easy. You don't need to recompile things, just edit and test. It's easiest to start with an existing layout, with the [layouts](layouts.md) documentation in hand. Creating a layout is easy. You don't need to recompile things, just edit and test. It's easiest to start with an existing layout.
### Get one of the existing keyboard layouts ### Get one of the existing keyboard layouts
* You can get one of the keyboards from the squeekboard git repository : [https://source.puri.sm/Librem5/squeekboard](https://source.puri.sm/Librem5/squeekboard) * You can get one of the keyboards from the squeekboard git repository : [https://source.puri.sm/Librem5/squeekboard](https://source.puri.sm/Librem5/squeekboard)
* The keyboard layouts are located in the subdirectory [`data/keyboards/`](https://source.puri.sm/Librem5/squeekboard/-/tree/master/data/keyboards) in the `.yaml` files * The keyboard layouts are located in the subdirectory [`data/keyboards/`](https://source.puri.sm/Librem5/squeekboard/-/tree/master/data/keyboards) in the `.yaml` files
* Take a look and try to understand them :slight_smile:
### Creating the keyboard layout ### Creating the keyboard layout

163
eek/eek-element.c Normal file
View File

@ -0,0 +1,163 @@
/*
* 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));
}

53
eek/eek-element.h Normal file
View File

@ -0,0 +1,53 @@
/*
* 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 */

View File

@ -35,7 +35,6 @@
#include "eekboard/eekboard-context-service.h" #include "eekboard/eekboard-context-service.h"
#include "src/layout.h" #include "src/layout.h"
#include "src/popover.h"
#include "src/submission.h" #include "src/submission.h"
#define LIBFEEDBACK_USE_UNSTABLE_API #define LIBFEEDBACK_USE_UNSTABLE_API
@ -49,16 +48,13 @@ typedef struct _EekGtkKeyboardPrivate
struct render_geometry render_geometry; // mutable struct render_geometry render_geometry; // mutable
EekboardContextService *eekboard_context; // unowned reference EekboardContextService *eekboard_context; // unowned reference
struct squeek_popover *popover; // shared reference
struct squeek_state_manager *state_manager; // shared reference
struct submission *submission; // unowned reference struct submission *submission; // unowned reference
Layout *keyboard; // unowned reference; it's kept in server-context struct squeek_layout_state *layout; // unowned
LevelKeyboard *keyboard; // unowned reference; it's kept in server-context
GdkEventSequence *sequence; // unowned reference GdkEventSequence *sequence; // unowned reference
LfbEvent *event; LfbEvent *event;
gulong kb_signal;
} EekGtkKeyboardPrivate; } EekGtkKeyboardPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (EekGtkKeyboard, eek_gtk_keyboard, GTK_TYPE_DRAWING_AREA) G_DEFINE_TYPE_WITH_PRIVATE (EekGtkKeyboard, eek_gtk_keyboard, GTK_TYPE_DRAWING_AREA)
@ -120,6 +116,15 @@ eek_gtk_keyboard_real_draw (GtkWidget *self,
return FALSE; return FALSE;
} }
// Units of virtual pixels size
static enum squeek_arrangement_kind get_type(uint32_t width, uint32_t height) {
(void)height;
if (width < 540) {
return ARRANGEMENT_KIND_BASE;
}
return ARRANGEMENT_KIND_WIDE;
}
static void static void
eek_gtk_keyboard_real_size_allocate (GtkWidget *self, eek_gtk_keyboard_real_size_allocate (GtkWidget *self,
GtkAllocation *allocation) GtkAllocation *allocation)
@ -127,6 +132,15 @@ eek_gtk_keyboard_real_size_allocate (GtkWidget *self,
EekGtkKeyboard *keyboard = EEK_GTK_KEYBOARD (self); EekGtkKeyboard *keyboard = EEK_GTK_KEYBOARD (self);
EekGtkKeyboardPrivate *priv = EekGtkKeyboardPrivate *priv =
eek_gtk_keyboard_get_instance_private (keyboard); eek_gtk_keyboard_get_instance_private (keyboard);
// check if the change would switch types
enum squeek_arrangement_kind new_type = get_type(
(uint32_t)(allocation->width - allocation->x),
(uint32_t)(allocation->height - allocation->y));
if (priv->layout->arrangement != new_type) {
priv->layout->arrangement = new_type;
uint32_t time = gdk_event_get_time(NULL);
eekboard_context_service_use_layout(priv->eekboard_context, priv->layout, time);
}
if (priv->renderer) { if (priv->renderer) {
set_allocation_size (keyboard, priv->keyboard->layout, set_allocation_size (keyboard, priv->keyboard->layout,
@ -142,7 +156,6 @@ on_event_triggered (LfbEvent *event,
GAsyncResult *res, GAsyncResult *res,
gpointer unused) gpointer unused)
{ {
(void)unused;
g_autoptr (GError) err = NULL; g_autoptr (GError) err = NULL;
if (!lfb_event_trigger_feedback_finish (event, res, &err)) { if (!lfb_event_trigger_feedback_finish (event, res, &err)) {
@ -173,7 +186,7 @@ static void drag(EekGtkKeyboard *self,
squeek_layout_drag(eekboard_context_service_get_keyboard(priv->eekboard_context)->layout, squeek_layout_drag(eekboard_context_service_get_keyboard(priv->eekboard_context)->layout,
priv->submission, priv->submission,
x, y, priv->render_geometry.widget_to_layout, time, x, y, priv->render_geometry.widget_to_layout, time,
priv->popover, priv->state_manager, self); priv->eekboard_context, self);
} }
static void release(EekGtkKeyboard *self, guint32 time) static void release(EekGtkKeyboard *self, guint32 time)
@ -184,7 +197,7 @@ static void release(EekGtkKeyboard *self, guint32 time)
} }
squeek_layout_release(eekboard_context_service_get_keyboard(priv->eekboard_context)->layout, squeek_layout_release(eekboard_context_service_get_keyboard(priv->eekboard_context)->layout,
priv->submission, priv->render_geometry.widget_to_layout, time, priv->submission, priv->render_geometry.widget_to_layout, time,
priv->popover, priv->state_manager, self); priv->eekboard_context, self);
} }
static gboolean static gboolean
@ -294,19 +307,12 @@ eek_gtk_keyboard_set_property (GObject *object,
} }
} }
// This may actually get called multiple times in a row
// if both a parent object and its parent get destroyed
static void static void
eek_gtk_keyboard_dispose (GObject *object) eek_gtk_keyboard_dispose (GObject *object)
{ {
EekGtkKeyboard *self = EEK_GTK_KEYBOARD (object); EekGtkKeyboard *self = EEK_GTK_KEYBOARD (object);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self); EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
if (priv->kb_signal != 0) {
g_signal_handler_disconnect(priv->eekboard_context, priv->kb_signal);
priv->kb_signal = 0;
}
if (priv->renderer) { if (priv->renderer) {
eek_renderer_free(priv->renderer); eek_renderer_free(priv->renderer);
priv->renderer = NULL; priv->renderer = NULL;
@ -391,15 +397,13 @@ on_notify_keyboard (GObject *object,
GtkWidget * GtkWidget *
eek_gtk_keyboard_new (EekboardContextService *eekservice, eek_gtk_keyboard_new (EekboardContextService *eekservice,
struct submission *submission, struct submission *submission,
struct squeek_state_manager *state_manager, struct squeek_layout_state *layout)
struct squeek_popover *popover)
{ {
EekGtkKeyboard *ret = EEK_GTK_KEYBOARD(g_object_new (EEK_TYPE_GTK_KEYBOARD, NULL)); EekGtkKeyboard *ret = EEK_GTK_KEYBOARD(g_object_new (EEK_TYPE_GTK_KEYBOARD, NULL));
EekGtkKeyboardPrivate *priv = (EekGtkKeyboardPrivate*)eek_gtk_keyboard_get_instance_private (ret); EekGtkKeyboardPrivate *priv = (EekGtkKeyboardPrivate*)eek_gtk_keyboard_get_instance_private (ret);
priv->popover = popover;
priv->eekboard_context = eekservice; priv->eekboard_context = eekservice;
priv->submission = submission; priv->submission = submission;
priv->state_manager = state_manager; priv->layout = layout;
priv->renderer = NULL; priv->renderer = NULL;
// This should really be done on initialization. // This should really be done on initialization.
// Before the widget is allocated, // Before the widget is allocated,
@ -414,13 +418,12 @@ eek_gtk_keyboard_new (EekboardContextService *eekservice,
.widget_to_layout = { .widget_to_layout = {
.origin_x = 0, .origin_x = 0,
.origin_y = 0, .origin_y = 0,
.scale_x = 1, .scale = 1,
.scale_y = 1,
}, },
}; };
priv->render_geometry = initial_geometry; priv->render_geometry = initial_geometry;
priv->kb_signal = g_signal_connect (eekservice, g_signal_connect (eekservice,
"notify::keyboard", "notify::keyboard",
G_CALLBACK(on_notify_keyboard), G_CALLBACK(on_notify_keyboard),
ret); ret);

View File

@ -30,8 +30,6 @@
#include "eek/eek-renderer.h" #include "eek/eek-renderer.h"
#include "eek/eek-types.h" #include "eek/eek-types.h"
#include "src/main.h"
#include "src/popover.h"
struct submission; struct submission;
struct squeek_layout_state; struct squeek_layout_state;
@ -50,7 +48,7 @@ struct _EekGtkKeyboardClass
gpointer pdummy[24]; gpointer pdummy[24];
}; };
GtkWidget *eek_gtk_keyboard_new (EekboardContextService *eekservice, struct submission *submission, struct squeek_state_manager *state_manager, struct squeek_popover *popover); GtkWidget *eek_gtk_keyboard_new (EekboardContextService *eekservice, struct submission *submission, struct squeek_layout_state *layout);
void eek_gtk_keyboard_emit_feedback (EekGtkKeyboard *self); void eek_gtk_keyboard_emit_feedback (EekGtkKeyboard *self);
G_END_DECLS G_END_DECLS

View File

@ -21,7 +21,6 @@
#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>
@ -75,7 +74,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");
} }
strlcpy(ptr, xkb_keymap_str, keymap_len); strncpy(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);
@ -86,19 +85,18 @@ struct keymap squeek_key_map_from_str(const char *keymap_str) {
return km; return km;
} }
void layout_free(Layout *self) { void level_keyboard_free(LevelKeyboard *self) {
squeek_layout_free(self->layout); squeek_layout_free(self->layout);
g_free(self); g_free(self);
} }
Layout* LevelKeyboard*
layout_new (char *style_name, struct squeek_layout *layout) level_keyboard_new (struct squeek_layout *layout)
{ {
Layout *keyboard = g_new0(Layout, 1); LevelKeyboard *keyboard = g_new0(LevelKeyboard, 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;
} }

View File

@ -38,15 +38,18 @@ 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 info holder /// Keyboard state holder
struct _Layout { struct _LevelKeyboard {
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;
Layout* gchar *eek_keyboard_get_keymap(LevelKeyboard *keyboard);
layout_new (char *style_name, struct squeek_layout *layout);
void layout_free(Layout *self); LevelKeyboard*
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 */

View File

@ -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,
Layout *keyboard) LevelKeyboard *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);
@ -219,7 +219,7 @@ eek_renderer_render_keyboard (EekRenderer *self,
cairo_save(cr); cairo_save(cr);
cairo_translate (cr, geometry.widget_to_layout.origin_x, geometry.widget_to_layout.origin_y); cairo_translate (cr, geometry.widget_to_layout.origin_x, geometry.widget_to_layout.origin_y);
cairo_scale (cr, geometry.widget_to_layout.scale_x, geometry.widget_to_layout.scale_y); cairo_scale (cr, geometry.widget_to_layout.scale, geometry.widget_to_layout.scale);
squeek_draw_layout_base_view(keyboard->layout, self, cr); squeek_draw_layout_base_view(keyboard->layout, self, cr);
squeek_layout_draw_all_changed(keyboard->layout, self, cr, submission); squeek_layout_draw_all_changed(keyboard->layout, self, cr, submission);
@ -316,7 +316,7 @@ renderer_init (EekRenderer *self)
} }
EekRenderer * EekRenderer *
eek_renderer_new (Layout *keyboard, eek_renderer_new (LevelKeyboard *keyboard,
PangoContext *pcontext) PangoContext *pcontext)
{ {
EekRenderer *renderer = calloc(1, sizeof(EekRenderer)); EekRenderer *renderer = calloc(1, sizeof(EekRenderer));
@ -335,7 +335,6 @@ eek_renderer_new (Layout *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);

View File

@ -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 (Layout *keyboard, EekRenderer *eek_renderer_new (LevelKeyboard *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, Layout *keyboard); cairo_t *cr, LevelKeyboard *keyboard);
void void
eek_renderer_free (EekRenderer *self); eek_renderer_free (EekRenderer *self);

View File

@ -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 _Layout Layout; typedef struct _LevelKeyboard LevelKeyboard;
/** /**
* EekPoint: * EekPoint:
@ -87,8 +87,7 @@ void eek_bounds_free (EekBounds *bounds);
struct transformation { struct transformation {
gdouble origin_x; gdouble origin_x;
gdouble origin_y; gdouble origin_y;
gdouble scale_x; gdouble scale;
gdouble scale_y;
}; };
G_END_DECLS G_END_DECLS

View File

@ -1,17 +1,11 @@
/* /*
* Copyright (C) 2018-2023 Purism SPC * Copyright (C) 2018 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 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.
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.
*/ */
@ -22,16 +16,6 @@ Up-to-date with Phosh revision 953894a2.
#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,
@ -59,83 +43,73 @@ 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;
int exclusive_zone; gint exclusive_zone;
int margin_top, margin_bottom; gint margin_top, margin_bottom;
int margin_left, margin_right; gint margin_left, margin_right;
int width, height; gint width, height;
int configured_width, configured_height; gint configured_width, configured_height;
char *namespace; gchar *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,
static void struct zwlr_layer_surface_v1 *surface,
layer_surface_configure (void *data, uint32_t serial,
struct zwlr_layer_surface_v1 *surface, uint32_t width,
uint32_t serial, uint32_t height)
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 %s (%p) (%dx%d)", priv->namespace, self, width, height); g_debug("Configured %p", self);
if (changed) { g_signal_emit (self, signals[CONFIGURED], 0);
g_signal_emit (self, signals[CONFIGURED], 0);
}
} }
static void static void layer_surface_closed (void *data,
layer_surface_closed (void *data, struct zwlr_layer_surface_v1 *surface)
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);
g_debug ("Destroying layer surface '%s'", priv->namespace); zwlr_layer_surface_v1_destroy(priv->layer_surface);
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,
@ -144,7 +118,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);
int width, height; gint width, height;
switch (property_id) { switch (property_id) {
case PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL: case PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL:
@ -157,7 +131,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:
phosh_layer_surface_set_layer (self, g_value_get_uint (value)); priv->layer = 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));
@ -195,11 +169,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);
@ -275,16 +249,14 @@ phosh_layer_surface_get_property (GObject *object,
static void static void
phosh_layer_surface_realize (GtkWidget *widget) on_phosh_layer_surface_realized (PhoshLayerSurface *self, gpointer unused)
{ {
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);
GTK_WIDGET_CLASS (phosh_layer_surface_parent_class)->realize (widget); priv = phosh_layer_surface_get_instance_private (self);
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);
@ -295,63 +267,76 @@ phosh_layer_surface_realize (GtkWidget *widget)
static void static void
phosh_layer_surface_map (GtkWidget *widget) on_phosh_layer_surface_mapped (PhoshLayerSurface *self, gpointer unused)
{ {
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);
GTK_WIDGET_CLASS (phosh_layer_surface_parent_class)->map (widget);
if (!priv->wl_surface) { if (!priv->wl_surface) {
GdkWindow *gdk_window; gdk_window = gtk_widget_get_window (GTK_WIDGET (self));
gdk_wayland_window_set_use_custom_surface (gdk_window);
gdk_window = gtk_widget_get_window (GTK_WIDGET (self)); priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
gdk_wayland_window_set_use_custom_surface (gdk_window);
priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
} }
g_debug ("Mapped %p, namespace: %s", priv->wl_surface, priv->namespace); g_debug ("Mapped %p", priv->wl_surface);
priv->layer_surface = zwlr_layer_shell_v1_get_layer_surface (priv->layer_shell, priv->layer_surface = zwlr_layer_shell_v1_get_layer_surface(priv->layer_shell,
priv->wl_surface, priv->wl_surface,
priv->wl_output, priv->wl_output,
priv->layer, priv->layer,
priv->namespace); priv->namespace);
zwlr_layer_surface_v1_set_exclusive_zone (priv->layer_surface, priv->exclusive_zone); zwlr_layer_surface_v1_set_exclusive_zone(priv->layer_surface, priv->exclusive_zone);
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);
zwlr_layer_surface_v1_set_anchor (priv->layer_surface, priv->anchor); zwlr_layer_surface_v1_set_anchor(priv->layer_surface, priv->anchor);
zwlr_layer_surface_v1_set_margin (priv->layer_surface, zwlr_layer_surface_v1_set_margin(priv->layer_surface,
priv->margin_top, priv->margin_top,
priv->margin_right, priv->margin_right,
priv->margin_bottom, priv->margin_bottom,
priv->margin_left); priv->margin_left);
zwlr_layer_surface_v1_set_keyboard_interactivity (priv->layer_surface, priv->kbd_interactivity); zwlr_layer_surface_v1_set_keyboard_interactivity(priv->layer_surface, priv->kbd_interactivity);
zwlr_layer_surface_v1_add_listener (priv->layer_surface, zwlr_layer_surface_v1_add_listener(priv->layer_surface,
&layer_surface_listener, &layer_surface_listener,
self); self);
wl_surface_commit (priv->wl_surface); 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
phosh_layer_surface_unmap (GtkWidget *widget) on_phosh_layer_surface_unmapped (PhoshLayerSurface *self, gpointer unused)
{ {
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) {
g_clear_pointer (&priv->layer_surface, zwlr_layer_surface_v1_destroy); zwlr_layer_surface_v1_destroy(priv->layer_surface);
priv->layer_surface = NULL;
}
priv->wl_surface = NULL; priv->wl_surface = NULL;
}
GTK_WIDGET_CLASS (phosh_layer_surface_parent_class)->unmap (widget); static void
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);
} }
@ -361,7 +346,10 @@ 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);
g_clear_pointer (&priv->layer_surface, zwlr_layer_surface_v1_destroy); if (priv->layer_surface) {
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);
@ -372,29 +360,26 @@ 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_READWRITE | G_PARAM_STATIC_STRINGS); G_PARAM_CONSTRUCT_ONLY | 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_READWRITE | G_PARAM_STATIC_STRINGS); G_PARAM_CONSTRUCT_ONLY | 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 (
@ -404,7 +389,7 @@ phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
0, 0,
G_MAXUINT, G_MAXUINT,
0, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); G_PARAM_CONSTRUCT_ONLY | 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 (
@ -414,7 +399,7 @@ phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
0, 0,
G_MAXUINT, G_MAXUINT,
0, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY); G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
props[PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY] = props[PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY] =
g_param_spec_boolean ( g_param_spec_boolean (
@ -521,13 +506,13 @@ phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
"Namespace", "Namespace",
"Namespace of the layer surface", "Namespace of the layer surface",
"", "",
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); G_PARAM_CONSTRUCT_ONLY | 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.
@ -554,20 +539,17 @@ 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;
@ -579,13 +561,12 @@ 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;
@ -594,20 +575,16 @@ 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, int width, int height) phosh_layer_surface_set_size(PhoshLayerSurface *self, gint width, gint height)
{ {
PhoshLayerSurfacePrivate *priv; PhoshLayerSurfacePrivate *priv;
int old_width, old_height; gint 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);
@ -628,7 +605,7 @@ phosh_layer_surface_set_size (PhoshLayerSurface *self, int width, int 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) {
@ -640,22 +617,16 @@ phosh_layer_surface_set_size (PhoshLayerSurface *self, int width, int 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, int top, int right, int bottom, int left) phosh_layer_surface_set_margins(PhoshLayerSurface *self, gint top, gint right, gint bottom, gint left)
{ {
PhoshLayerSurfacePrivate *priv; PhoshLayerSurfacePrivate *priv;
int old_top, old_bottom, old_left, old_right; gint 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);
@ -675,7 +646,7 @@ phosh_layer_surface_set_margins (PhoshLayerSurface *self, int top, int right, in
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) {
@ -692,19 +663,16 @@ phosh_layer_surface_set_margins (PhoshLayerSurface *self, int top, int right, in
} }
} }
/** /**
* 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, int zone) phosh_layer_surface_set_exclusive_zone(PhoshLayerSurface *self, gint zone)
{ {
PhoshLayerSurfacePrivate *priv; PhoshLayerSurfacePrivate *priv;
int old_zone; gint 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);
@ -718,17 +686,14 @@ phosh_layer_surface_set_exclusive_zone (PhoshLayerSurface *self, int 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.
*/ */
@ -743,7 +708,6 @@ 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) {
@ -753,39 +717,8 @@ 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.
*/ */
@ -801,53 +734,3 @@ 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;
}

View File

@ -1,17 +1,22 @@
/* /*
* Copyright (C) 2018 Purism SPC * Copyright (C) 2018 Purism SPC
* *
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0+
*/ */
/*
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)
@ -19,7 +24,6 @@ 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
{ {
@ -35,26 +39,15 @@ 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,
int width, gint width,
int height); gint height);
void phosh_layer_surface_set_margins(PhoshLayerSurface *self, void phosh_layer_surface_set_margins(PhoshLayerSurface *self,
int top, gint top,
int right, gint right,
int bottom, gint bottom,
int left); gint left);
void phosh_layer_surface_set_exclusive_zone(PhoshLayerSurface *self, void phosh_layer_surface_set_exclusive_zone(PhoshLayerSurface *self,
int zone); gint 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

View File

@ -55,15 +55,15 @@ static guint signals[LAST_SIGNAL] = { 0, };
*/ */
struct _EekboardContextService { struct _EekboardContextService {
GObject parent; GObject parent;
struct squeek_state_manager *state_manager; // shared reference struct squeek_layout_state *layout; // Unowned
Layout *keyboard; // currently used keyboard LevelKeyboard *keyboard; // currently used keyboard
GSettings *settings; // Owned reference GSettings *settings; // Owned reference
/// Needed for keymap changes after keyboard updates. // Maybe TODO: it's used only for fetching layout type.
// TODO: can the main loop access submission to change the key maps instead? // Maybe let UI push the type to this structure?
// This should probably land together with passing buttons through state, ServerContextService *ui; // unowned reference
// to avoid race conditions between setting buttons and key maps. /// Needed for keymap changes after keyboard updates
struct submission *submission; // unowned struct submission *submission; // unowned
}; };
@ -126,10 +126,27 @@ 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, char *style_name, struct squeek_layout *layout, uint32_t timestamp) { void
Layout *keyboard = layout_new(style_name, layout); eekboard_context_service_use_layout(EekboardContextService *context, struct squeek_layout_state *state, uint32_t timestamp) {
gchar *layout_name = state->layout_name;
gchar *overlay_name = state->overlay_name;
// try to get the best keyboard layout
if (layout_name == NULL) {
layout_name = "us";
}
// overlay is "Normal" for most layouts, we will only look for "terminal" in rust code.
// for now just avoid passing a null pointer
if (overlay_name == NULL) {
overlay_name = ""; // fallback to Normal
}
// generic part follows
struct squeek_layout *layout = squeek_load_layout(layout_name, state->arrangement, state->purpose, overlay_name);
LevelKeyboard *keyboard = level_keyboard_new(layout);
// set as current // set as current
Layout *previous_keyboard = context->keyboard; LevelKeyboard *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 +159,7 @@ void eekboard_context_service_set_layout(EekboardContextService *context, char *
// 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) {
layout_free(previous_keyboard); level_keyboard_free(previous_keyboard);
} }
} }
@ -152,7 +169,17 @@ static void eekboard_context_service_update_settings_layout(EekboardContextServi
settings_get_layout(context->settings, settings_get_layout(context->settings,
&keyboard_type, &keyboard_layout); &keyboard_type, &keyboard_layout);
squeek_state_send_layout_set(context->state_manager, keyboard_layout, keyboard_type, gdk_event_get_time(NULL)); if (g_strcmp0(context->layout->layout_name, keyboard_layout) != 0 || context->layout->overlay_name) {
g_free(context->layout->overlay_name);
context->layout->overlay_name = NULL;
if (keyboard_layout) {
g_free(context->layout->layout_name);
context->layout->layout_name = g_strdup(keyboard_layout);
}
// This must actually update the UI.
uint32_t time = gdk_event_get_time(NULL);
eekboard_context_service_use_layout(context, context->layout, time);
}
} }
static gboolean static gboolean
@ -264,24 +291,56 @@ 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
*/ */
Layout * LevelKeyboard *
eekboard_context_service_get_keyboard (EekboardContextService *context) eekboard_context_service_get_keyboard (EekboardContextService *context)
{ {
return context->keyboard; return context->keyboard;
} }
EekboardContextService *eekboard_context_service_new(struct squeek_state_manager *state_manager) void eekboard_context_service_set_hint_purpose(EekboardContextService *context,
uint32_t hint, uint32_t purpose)
{
if (context->layout->hint != hint || context->layout->purpose != purpose) {
context->layout->hint = hint;
context->layout->purpose = purpose;
uint32_t time = gdk_event_get_time(NULL);
eekboard_context_service_use_layout(context, context->layout, time);
}
}
void
eekboard_context_service_set_overlay(EekboardContextService *context, const char* name) {
if (g_strcmp0(context->layout->overlay_name, name)) {
g_free(context->layout->overlay_name);
context->layout->overlay_name = g_strdup(name);
uint32_t time = gdk_event_get_time(NULL);
eekboard_context_service_use_layout(context, context->layout, time);
}
}
const char*
eekboard_context_service_get_overlay(EekboardContextService *context) {
return context->layout->overlay_name;
}
EekboardContextService *eekboard_context_service_new(struct squeek_layout_state *state)
{ {
EekboardContextService *context = g_object_new (EEKBOARD_TYPE_CONTEXT_SERVICE, NULL); EekboardContextService *context = g_object_new (EEKBOARD_TYPE_CONTEXT_SERVICE, NULL);
context->state_manager = state_manager; context->layout = state;
eekboard_context_service_update_settings_layout(context); eekboard_context_service_update_settings_layout(context);
uint32_t time = gdk_event_get_time(NULL);
eekboard_context_service_use_layout(context, context->layout, time);
return context; return context;
} }
void eekboard_context_service_set_submission(EekboardContextService *context, struct submission *submission) { void eekboard_context_service_set_submission(EekboardContextService *context, struct submission *submission) {
context->submission = submission; context->submission = submission;
if (context->submission && context->keyboard) { if (context->submission) {
uint32_t time = gdk_event_get_time(NULL); uint32_t time = gdk_event_get_time(NULL);
submission_use_layout(context->submission, context->keyboard->layout, time); submission_use_layout(context->submission, context->keyboard->layout, time);
} }
} }
void eekboard_context_service_set_ui(EekboardContextService *context, ServerContextService *ui) {
context->ui = ui;
}

View File

@ -24,7 +24,6 @@
#include "src/submission.h" #include "src/submission.h"
#include "src/layout.h" #include "src/layout.h"
#include "src/main.h"
#include "virtual-keyboard-unstable-v1-client-protocol.h" #include "virtual-keyboard-unstable-v1-client-protocol.h"
#include "text-input-unstable-v3-client-protocol.h" #include "text-input-unstable-v3-client-protocol.h"
@ -38,13 +37,19 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE(EekboardContextService, eekboard_context_service, EEKBOARD, CONTEXT_SERVICE, GObject) G_DECLARE_FINAL_TYPE(EekboardContextService, eekboard_context_service, EEKBOARD, CONTEXT_SERVICE, GObject)
EekboardContextService *eekboard_context_service_new(struct squeek_state_manager *state_manager); EekboardContextService *eekboard_context_service_new(struct squeek_layout_state *state);
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_set_ui(EekboardContextService *context, ServerContextService *ui);
void eekboard_context_service_destroy (EekboardContextService *context); void eekboard_context_service_destroy (EekboardContextService *context);
Layout *eekboard_context_service_get_keyboard(EekboardContextService *context); LevelKeyboard *eekboard_context_service_get_keyboard(EekboardContextService *context);
void eekboard_context_service_set_keymap(EekboardContextService *context, void eekboard_context_service_set_keymap(EekboardContextService *context,
const Layout *keyboard); const LevelKeyboard *keyboard);
void eekboard_context_service_set_hint_purpose(EekboardContextService *context,
uint32_t hint,
uint32_t purpose);
void
eekboard_context_service_use_layout(EekboardContextService *context, struct squeek_layout_state *layout, uint32_t timestamp);
G_END_DECLS G_END_DECLS
#endif /* EEKBOARD_CONTEXT_SERVICE_H */ #endif /* EEKBOARD_CONTEXT_SERVICE_H */

View File

@ -1,53 +0,0 @@
/*! 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"),
_ => {},
}
}

View File

@ -1,7 +1,7 @@
project( project(
'squeekboard', 'squeekboard',
'c', 'rust', 'c', 'rust',
version: '1.21.0', version: '1.17.1',
license: 'GPLv3', license: 'GPLv3',
meson_version: '>=0.51.0', meson_version: '>=0.51.0',
default_options: [ default_options: [
@ -99,17 +99,12 @@ 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,zbus_v1_5,clap_v4'] cargo_build_flags += ['--features', 'glib_v0_14']
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
@ -121,17 +116,6 @@ 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')

View File

@ -7,10 +7,6 @@ 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')
@ -19,10 +15,6 @@ 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')

View File

@ -1,30 +1,13 @@
ca ca
cs
de de
el
es
fa fa
fi fi
fr
fur fur
gl gl
he he
hi
hr
hu
it
ka
ko
nl nl
oc
pl
pt
pt_BR pt_BR
ro ro
ru
sl sl
sr
tr
uk uk
sv sv
zh_CN

View File

@ -1,46 +0,0 @@
# 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"

View File

@ -2,46 +2,21 @@
# 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: https://gitlab.gnome.org/World/Phosh/squeekboard/" "Report-Msgid-Bugs-To: \n"
"issues\n" "POT-Creation-Date: 2021-12-03 18:41+0100\n"
"POT-Creation-Date: 2022-10-16 12:08+0000\n" "PO-Revision-Date: 2021-12-03 18:41+0100\n"
"PO-Revision-Date: 2023-01-14 11:45+0100\n" "Last-Translator: Automatically generated\n"
"Last-Translator: Jürgen Benvenuti <gastornis@posteo.org>\n" "Language-Team: none\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=UTF-8\n" "Content-Type: text/plain; charset=ASCII\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"
#. translators: This is a emmoji keyboard layout #: data/popup.ui:15
#: 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"

View File

@ -1,46 +0,0 @@
# 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 "Εικονικό πληκτρολόγιο οθόνης"

View File

@ -1,47 +0,0 @@
# Spanish 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.
# Pablo Correa Gómez <ablocorrea@hotmail.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-03-20 13:14+0000\n"
"PO-Revision-Date: 2022-03-22 21:33+0100\n"
"Last-Translator: Pablo Correa Gómez <ablocorrea@hotmail.com>\n"
"Language-Team: Spanish; Castilian <gnome-es-list@gnome.org>\n"
"Language: es\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 3.36.0\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 "Terminal"
#: data/popover.ui:18
msgid "Keyboard Settings"
msgstr "Ajustes de teclado"
#: 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 "Teclado en pantala"
#: data/sm.puri.Squeekboard.desktop.in.in:5
msgid "An on screen virtual keyboard"
msgstr "Un teclado virtual en pantalla"

View File

@ -1,47 +0,0 @@
# French translation for squeekboard.
# Copyright (C) 2022 squeekboard's COPYRIGHT HOLDER
# This file is distributed under the same license as the squeekboard package.
# FULL NAME <EMAIL@ADDRESS>, 2022.
# Éloi Rivard <eloi.rivard@nubla.fr>, 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-04-28 15:05+0000\n"
"PO-Revision-Date: 2022-05-25 16:34+0200\n"
"Last-Translator: Éloi Rivard <eloi.rivard@nubla.fr>\n"
"Language-Team: French <gnomefr@traduc.org>\n"
"Language: fr\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 40.0\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 "Terminal"
#: data/popover.ui:18
msgid "Keyboard Settings"
msgstr "Paramètres du clavier"
#: 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 "Clavier virtuel"
#: data/sm.puri.Squeekboard.desktop.in.in:5
msgid "An on screen virtual keyboard"
msgstr "Un clavier virtuel affiché à lécran"

View File

@ -1,52 +0,0 @@
# 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 "एक ऑनस्क्रीन वर्चुअल कुंजीपट"

View File

@ -1,47 +0,0 @@
# 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"

View File

@ -1,46 +0,0 @@
# Hungarian translation for squeekboard.
# Copyright (C) 2022 Free Software Foundation, Inc.
# This file is distributed under the same license as the squeekboard package.
#
# Balázs Úr <ur.balazs at fsf dot hu>, 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-03-12 12:04+0000\n"
"PO-Revision-Date: 2022-03-16 01:55+0100\n"
"Last-Translator: Balázs Úr <ur.balazs at fsf dot hu>\n"
"Language-Team: Hungarian <gnome-hu-list at gnome dot org>\n"
"Language: hu\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: Lokalize 19.12.3\n"
#. translators: This is a emmoji keyboard layout
#: data/popover.ui:6
msgid "Emoji"
msgstr "Emodzsi"
#. translators: This is a terminal keyboard layout
#: data/popover.ui:12
msgid "Terminal"
msgstr "Terminál"
#: data/popover.ui:18
msgid "Keyboard Settings"
msgstr "Billentyűzetbeállítások"
#: 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 "Képernyő-billentyűzet"
#: data/sm.puri.Squeekboard.desktop.in.in:5
msgid "An on screen virtual keyboard"
msgstr "Egy virtuális képernyő-billentyűzet"

View File

@ -1,47 +0,0 @@
# Italian translation for squeekboard.
# Copyright (C) 2021 squeekboard's COPYRIGHT HOLDER
# This file is distributed under the same license as the squeekboard package.
# Vittorio <postav@pm.me>, 2021.
# Vittorio Monti <postav@pm.me>, 2021.
#
msgid ""
msgstr ""
"Project-Id-Version: squeekboard master\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/Phosh/squeekboard/"
"issues\n"
"POT-Creation-Date: 2021-12-22 19:14+0000\n"
"PO-Revision-Date: 2021-12-22 20:37+0100\n"
"Last-Translator: Vittorio Monti <postav@pm.me>\n"
"Language-Team: Italian <gnome-it-list@gnome.org>\n"
"Language: it\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 3.30.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 "Terminale"
#: data/popover.ui:18
msgid "Keyboard Settings"
msgstr "Impostazioni tastiera"
#: 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 "Tastiera su schermo"
#: data/sm.puri.Squeekboard.desktop.in.in:5
msgid "An on screen virtual keyboard"
msgstr "Una tastiera virtuale su schermo"

View File

@ -1,46 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/Phosh/squeekboard/"
"issues\n"
"POT-Creation-Date: 2022-02-04 15:22+0000\n"
"PO-Revision-Date: 2022-02-08 03:15+0100\n"
"Last-Translator: Temuri Doghonadze <temuri.doghonadze@gmail.com>\n"
"Language-Team: \n"
"Language: ka\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.0.1\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 "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 "ეკრანზე ვირტუალური კლავიატურის ჩვენება"

View File

@ -1,46 +0,0 @@
# Korean translation for squeekboard.
# Copyright (C) 2022 squeekboard'S COPYRIGHT HOLDER
# This file is distributed under the same license as the squeekboard package.
# Moon Sungjoon <sumoon@seoulsaram.org>, 2022.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/Phosh/squeekboard/"
"issues\n"
"POT-Creation-Date: 2022-04-09 18:43+0000\n"
"PO-Revision-Date: 2022-04-11 19:23+0900\n"
"Last-Translator: Moon Sungjoon <sumoon@seoulsaram.org>\n"
"Language-Team: \n"
"Language: ko\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 3.0.1\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 "가상 키보드"

View File

@ -1,45 +0,0 @@
# Occitan translation for squeekboard.
# Copyright (C) 2022 squeekboard's COPYRIGHT HOLDER
# This file is distributed under the same license as the squeekboard package.
# Quentin PAGÈS <pages_quentin@hotmail.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-04-17 06:24+0000\n"
"PO-Revision-Date: 2022-04-17 09:17+0200\n"
"Last-Translator: Quentin PAGÈS\n"
"Language-Team: Occitan <totenoc@gmail.com>\n"
"Language: oc\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.0.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 "Terminal"
#: data/popover.ui:18
msgid "Keyboard Settings"
msgstr "Paramètres del clavièr"
#: 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 "Clavièr visual"
#: data/sm.puri.Squeekboard.desktop.in.in:5
msgid "An on screen virtual keyboard"
msgstr "Un clavièr virtual sus lecran"

View File

@ -1,47 +0,0 @@
# Polish translation for squeekboard.
# Copyright © 2022 the squeekboard authors.
# This file is distributed under the same license as the squeekboard package.
# Piotr Drąg <piotrdrag@gmail.com>, 2022.
# Aviary.pl <community-poland@mozilla.org>, 2022.
#
msgid ""
msgstr ""
"Project-Id-Version: squeekboard\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/Phosh/squeekboard/"
"issues\n"
"POT-Creation-Date: 2022-03-19 09:34+0000\n"
"PO-Revision-Date: 2022-03-20 14:12+0100\n"
"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
"Language-Team: Polish <community-poland@mozilla.org>\n"
"Language: pl\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%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2);\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 "Terminal"
#: data/popover.ui:18
msgid "Keyboard Settings"
msgstr "Ustawienia klawiatury"
#: 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 "Klawiatura ekranowa"
#: data/sm.puri.Squeekboard.desktop.in.in:5
msgid "An on screen virtual keyboard"
msgstr "Wirtualna klawiatura ekranowa"

View File

@ -1,46 +0,0 @@
# Portuguese translation for squeekboard.
# Copyright (C) 2022 squeekboard's COPYRIGHT HOLDER
# This file is distributed under the same license as the squeekboard package.
# Hugo Carvalho <hugokarvalho@hotmail.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-02-26 10:49+0000\n"
"PO-Revision-Date: 2022-02-26 18:27+0000\n"
"Last-Translator: Hugo Carvalho <hugokarvalho@hotmail.com>\n"
"Language-Team: Portuguese <pt@li.org>\n"
"Language: pt\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.0.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 "Terminal"
#: data/popover.ui:18
msgid "Keyboard Settings"
msgstr "Definições do teclado"
#: 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 "Teclado no ecrã"
#: data/sm.puri.Squeekboard.desktop.in.in:5
msgid "An on screen virtual keyboard"
msgstr "Um teclado virtual no ecrã"

View File

@ -1,47 +0,0 @@
# Russian translation for squeekboard.
# Copyright (C) 2022 squeekboard's COPYRIGHT HOLDER
# This file is distributed under the same license as the squeekboard package.
# Aleksandr Melman <Alexmelman88@gmail.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-06-14 15:23+0000\n"
"PO-Revision-Date: 2022-06-16 14:38+0300\n"
"Last-Translator: Aleksandr Melman <Alexmelman88@gmail.com>\n"
"Language-Team: Russian <gnome-cyr@gnome.org>\n"
"Language: ru\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.0.1\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 "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 "Виртуальная клавиатура на экране"

View File

@ -1,45 +0,0 @@
# Serbian translation for squeekboard.
# Copyright © 2022 squeekboard's COPYRIGHT HOLDER
# This file is distributed under the same license as the squeekboard package.
# Мирослав Николић <miroslavnikolic@rocketmail.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-03-08 10:15+0000\n"
"PO-Revision-Date: 2022-03-12 13:00+0200\n"
"Last-Translator: Мирослав Николић <miroslavnikolic@rocketmail.com>\n"
"Language-Team: Serbian <(nothing)>\n"
"Language: sr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=n==1? 3 : n%10==1 && n%100!=11 ? 0 : n"
"%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\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 "Виртуелна тастатура на екрану"

View File

@ -1,46 +0,0 @@
# Turkish translation for squeekboard.
# Copyright (C) 2022 squeekboard's COPYRIGHT HOLDER
# This file is distributed under the same license as the squeekboard package.
# Emin Tufan Çetin <etcetin@gmail.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-03-16 00:57+0000\n"
"PO-Revision-Date: 2022-03-19 12:33+0300\n"
"Last-Translator: Emin Tufan Çetin <etcetin@gmail.com>\n"
"Language-Team: Turkish <gnometurk@gnome.org>\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 2.4.3\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 "Uçbirim"
#: data/popover.ui:18
msgid "Keyboard Settings"
msgstr "Klavye Ayarları"
#: 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 "Ekran Klavyesi"
#: data/sm.puri.Squeekboard.desktop.in.in:5
msgid "An on screen virtual keyboard"
msgstr "Sanal ekran klavyesi"

View File

@ -1,45 +0,0 @@
# Chinese (China) translation for squeekboard.
# Copyright (C) 2022 squeekboard's COPYRIGHT HOLDER
# This file is distributed under the same license as the squeekboard package.
# Luke Luo <2164381336@qq.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-04-21 07:28+0000\n"
"PO-Revision-Date: 2022-04-23 20:30+0800\n"
"Last-Translator: Luke Luo <njlyf2011@hotmail.com>\n"
"Language-Team: Chinese (China) <i18n-zh@googlegroups.com>\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.0.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 "一个虚拟屏幕键盘"

View File

@ -25,7 +25,7 @@
THIS SOFTWARE. THIS SOFTWARE.
</copyright> </copyright>
<interface name="zwlr_layer_shell_v1" version="4"> <interface name="zwlr_layer_shell_v1" version="1">
<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,12 +47,6 @@
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.
@ -88,35 +82,17 @@
<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="4"> <interface name="zwlr_layer_surface_v1" version="1">
<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 (layer, size, anchor, exclusive zone, Layer surface state (size, anchor, exclusive zone, margin, interactivity)
margin, interactivity) is double-buffered, and will be applied at the is double-buffered, and will be applied at the time wl_surface.commit of
time wl_surface.commit of the corresponding wl_surface is called. 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">
@ -151,19 +127,14 @@
<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 with other Requests that the compositor avoids occluding an area of the surface
surfaces. The compositor's use of this information is with other 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 one A positive value is only meaningful if the surface is anchored to an
edge or an edge and both perpendicular edges. If the surface is not edge, rather than a corner. The zone is the number of surface-local
anchored, anchored to only two perpendicular edges (a corner), anchored coordinates from the edge that is considered exclusive.
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
@ -203,85 +174,21 @@
<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 how keyboard events are delivered to this surface. By default, Set to 1 to request that the seat send keyboard events to this layer
layer shell surfaces do not receive keyboard events; this request can surface. For layers below the shell surface layer, the seat will use
be used to change this. normal focus semantics. For layers above the shell surface layers, the
seat will always give exclusive keyboard focus to the top-most layer
This setting is inherited by child surfaces set by the get_popup which has keyboard interactivity set to true.
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.
Keyboard interactivity is double-buffered, see wl_surface.commit. Events is double-buffered, see wl_surface.commit.
</description> </description>
<arg name="keyboard_interactivity" type="uint" enum="keyboard_interactivity"/> <arg name="keyboard_interactivity" type="uint"/>
</request> </request>
<request name="get_popup"> <request name="get_popup">
@ -366,7 +273,6 @@
<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">
@ -375,16 +281,5 @@
<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>

View File

@ -1,72 +0,0 @@
/*
* Copyright (C) 2022 Purism SPC
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
use crate::main;
use crate::state;
use std::thread;
use zbus::{Connection, ObjectServer, dbus_interface, fdo};
use super::Void;
use std::convert::TryInto;
/// Accepts commands controlling the debug mode
struct Manager {
sender: main::EventLoop,
enabled: bool,
}
#[dbus_interface(name = "sm.puri.SqueekDebug")]
impl Manager {
#[dbus_interface(property, name = "Enabled")]
fn get_enabled(&self) -> bool {
self.enabled
}
#[dbus_interface(property, name = "Enabled")]
fn set_enabled(&mut self, enabled: bool) {
self.enabled = enabled;
self.sender
.send(state::Event::Debug(
if enabled { Event::Enable }
else { Event::Disable }
))
.unwrap();
}
}
fn start(mgr: Manager) -> Result<Void, Box<dyn std::error::Error>> {
let connection = Connection::new_session()?;
fdo::DBusProxy::new(&connection)?.request_name(
"sm.puri.SqueekDebug",
fdo::RequestNameFlags::ReplaceExisting.into(),
)?;
let mut object_server = ObjectServer::new(&connection);
object_server.at(&"/sm/puri/SqueekDebug".try_into()?, mgr)?;
loop {
if let Err(err) = object_server.try_handle_next() {
eprintln!("{}", err);
}
}
}
pub fn init(sender: main::EventLoop) {
let mgr = Manager {
sender,
enabled: false,
};
thread::spawn(move || {
start(mgr).unwrap();
});
}
#[derive(Debug, Clone, Copy)]
pub enum Event {
Enable,
Disable,
}

View File

@ -1,14 +0,0 @@
/*
* 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 {}

View File

@ -1,57 +0,0 @@
/*
* 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,
),
}
}
}

View File

@ -1,33 +0,0 @@
/* Copyright (C) 2022 Purism SPC
* SPDX-License-Identifier: GPL-3.0+
*/
/*! Actors are parts of Squeekboard containing state independent from the main application state.
Because main application state is meant to be immutable,
it cannot be referenced directly by pieces of logic
interacting with the environment.
Such impure logic is split away (actor's logic)
and combined with relevant pieces of state (actor state),
thus preserving the purity (and sometimes simplicity) of the main state.
Actors can communicate with the main state by sending it messages,
and by receiving updates from it.
*/
// TODO: move crate::panel into crate::actors::panel.
// Panel contains state and logic to protect the main state from getting flooded
// with low-level wayland and gtk sizing events.
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);
}

View File

@ -1,76 +0,0 @@
/* Copyright (C) 2022 Purism SPC
* SPDX-License-Identifier: GPL-3.0+
*/
/*! The popover is opened directly by the GTK surface,
without bouncing click events off the main state.
Then it must accurately show which layout has been selected.
It can get the system layout directly from gsettings on open,
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,
and updated by main state every time it changes.
*/
use crate::logging;
use std::borrow::BorrowMut;
use std::sync::{Arc, Mutex};
pub mod c {
use super::*;
use crate::util::c::ArcWrapped;
/// The mutable instance of 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>;
}
pub type Destination = Arc<Mutex<State>>;
#[derive(Debug)]
pub enum Event {
Overlay(Option<String>),
ScreensaverActive(bool),
}
impl super::Destination for Destination {
type Event = Event;
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,
),
}
}
}
#[derive(Clone, Debug)]
pub struct State {
pub overlay: Option<String>,
/// Settings button active
pub settings_active: bool,
}
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
}
}

View File

@ -6,30 +6,18 @@
use std::time::Duration; use std::time::Duration;
use crate::imservice::ContentPurpose; use crate::main::PixelSize;
use crate::layout::ArrangementKind;
use crate::outputs::OutputId; use crate::outputs::OutputId;
use crate::panel::PixelSize;
/// The keyboard should hide after this has elapsed to prevent flickering. /// The keyboard should hide after this has elapsed to prevent flickering.
pub const HIDING_TIMEOUT: Duration = Duration::from_millis(200); pub const HIDING_TIMEOUT: Duration = Duration::from_millis(200);
/// Description of parameters which influence panel contents
#[derive(PartialEq, Clone, Debug)]
pub struct Contents {
pub name: String,
pub kind: ArrangementKind,
pub overlay_name: Option<String>,
pub purpose: ContentPurpose,
}
/// The outwardly visible state of visibility /// The outwardly visible state of visibility
#[derive(PartialEq, Debug, Clone)] #[derive(PartialEq, Debug, Clone)]
pub enum Outcome { pub enum Outcome {
Visible { Visible {
output: OutputId, output: OutputId,
height: PixelSize, height: PixelSize,
contents: Contents,
}, },
Hidden, Hidden,
} }

View File

@ -95,56 +95,56 @@ DEALINGS IN THE SOFTWARE.
/// ``` /// ```
#[macro_export] #[macro_export]
macro_rules! assert_matches { macro_rules! assert_matches {
( $e:expr , $($pat:pat_param)|+ ) => { ( $e:expr , $($pat:pat)|+ ) => {
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_param)|+ if $cond:expr ) => { ( $e:expr , $($pat:pat)|+ 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_param)|+ => $arm:expr ) => { ( $e:expr , $($pat:pat)|+ => $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_param)|+ if $cond:expr => $arm:expr ) => { ( $e:expr , $($pat:pat)|+ 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_param)|+ , $($arg:tt)* ) => { ( $e:expr , $($pat:pat)|+ , $($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_param)|+ if $cond:expr , $($arg:tt)* ) => { ( $e:expr , $($pat:pat)|+ 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_param)|+ => $arm:expr , $($arg:tt)* ) => { ( $e:expr , $($pat:pat)|+ => $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_param)|+ if $cond:expr => $arm:expr , $($arg:tt)* ) => { ( $e:expr , $($pat:pat)|+ 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 `{}`: {}",

View File

@ -5,28 +5,12 @@ 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();
#[cfg(not(feature = "clap_v4"))] if check_layout_file(matches.value_of("INPUT").unwrap()) == () {
let m = matches.value_of("INPUT");
if check_layout_file(m.unwrap()) == () {
println!("Test result: OK"); println!("Test result: OK");
} }
} }

View File

@ -7,16 +7,64 @@
use std::env; use std::env;
use std::fmt; use std::fmt;
use std::path::PathBuf; use std::path::PathBuf;
use std::convert::TryFrom;
use super::{ Error, LoadError }; use super::{ Error, LoadError };
use super::parsing; use super::parsing;
use crate::layout; use ::layout::ArrangementKind;
use crate::layout::ArrangementKind; use ::logging;
use crate::logging; use ::util::c::as_str;
use crate::xdg; use ::xdg;
use crate::imservice::ContentPurpose; use ::imservice::ContentPurpose;
// traits, derives
use ::logging::Warn;
/// Gathers stuff defined in C or called by C
pub mod c {
use super::*;
use std::os::raw::c_char;
#[no_mangle]
pub extern "C"
fn squeek_load_layout(
name: *const c_char, // name of the keyboard
type_: u32, // type like Wide
variant: u32, // purpose variant like numeric, terminal...
overlay: *const c_char, // the overlay (looking for "terminal")
) -> *mut ::layout::Layout {
let type_ = match type_ {
0 => ArrangementKind::Base,
1 => ArrangementKind::Wide,
_ => panic!("Bad enum value"),
};
let name = as_str(&name)
.expect("Bad layout name")
.expect("Empty layout name");
let variant = ContentPurpose::try_from(variant)
.or_print(
logging::Problem::Warning,
"Received invalid purpose value",
)
.unwrap_or(ContentPurpose::Normal);
let overlay_str = as_str(&overlay)
.expect("Bad overlay name")
.expect("Empty overlay name");
let overlay_str = match overlay_str {
"" => None,
other => Some(other),
};
let (kind, layout) = load_layout_data_with_fallback(&name, type_, variant, overlay_str);
let layout = ::layout::Layout::new(layout, kind, variant);
Box::into_raw(Box::new(layout))
}
}
const FALLBACK_LAYOUT_NAME: &str = "us"; const FALLBACK_LAYOUT_NAME: &str = "us";
@ -192,7 +240,7 @@ fn iter_layout_sources(
} }
fn load_layout_data(source: DataSource) fn load_layout_data(source: DataSource)
-> Result<crate::layout::LayoutParseData, LoadError> -> Result<::layout::LayoutData, LoadError>
{ {
let handler = logging::Print {}; let handler = logging::Print {};
match source { match source {
@ -217,7 +265,7 @@ fn load_layout_data_with_fallback(
kind: ArrangementKind, kind: ArrangementKind,
purpose: ContentPurpose, purpose: ContentPurpose,
overlay: Option<&str>, overlay: Option<&str>,
) -> (ArrangementKind, layout::LayoutParseData) { ) -> (ArrangementKind, ::layout::LayoutData) {
// 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")
@ -252,23 +300,12 @@ fn load_layout_data_with_fallback(
panic!("No useful layout found!"); panic!("No useful layout found!");
} }
pub fn load_layout(
name: &String,
kind: ArrangementKind,
variant: ContentPurpose,
overlay: &Option<String>,
) -> layout::Layout {
let overlay = overlay.as_ref().map(String::as_str);
let (found_kind, layout)
= load_layout_data_with_fallback(name, kind, variant, overlay);
layout::Layout::new(layout, found_kind, variant)
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::logging::ProblemPanic; use ::logging::ProblemPanic;
#[test] #[test]
fn parsing_fallback() { fn parsing_fallback() {

View File

@ -4,13 +4,13 @@
/*! Combined module for dealing with layout files */ /*! Combined module for dealing with layout files */
pub mod loading; mod loading;
pub mod parsing; pub mod parsing;
use std::io; use std::io;
use std::fmt; use std::fmt;
use crate::keyboard::FormattingError; use ::keyboard::FormattingError;
/// Errors encountered loading the layout into yaml /// Errors encountered loading the layout into yaml
#[derive(Debug)] #[derive(Debug)]

View File

@ -4,29 +4,33 @@
/*! 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 crate::action; use ::action;
use crate::keyboard::{ use ::keyboard::{
Key, generate_keymaps, generate_keycodes, KeyCode, FormattingError KeyState, PressType,
generate_keymaps, generate_keycodes, KeyCode, FormattingError
}; };
use crate::layout; use ::layout;
use crate::logging; use ::logging;
use crate::resources; use ::util::hash_map_map;
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 crate::logging::Warn; use ::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
@ -153,7 +157,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<crate::layout::LayoutParseData, FormattingError>, H) -> (Result<::layout::LayoutData, FormattingError>, H)
{ {
let button_names = self.views.values() let button_names = self.views.values()
.flat_map(|rows| { .flat_map(|rows| {
@ -164,7 +168,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, crate::action::Action)> let button_actions: Vec<(&str, ::action::Action)>
= button_names.iter().map(|name| {( = button_names.iter().map(|name| {(
*name, *name,
create_action( create_action(
@ -179,10 +183,10 @@ impl Layout {
extract_symbol_names(&button_actions) extract_symbol_names(&button_actions)
); );
let button_states = HashMap::<String, Key>::from_iter( let button_states = HashMap::<String, KeyState>::from_iter(
button_actions.into_iter().map(|(name, action)| { button_actions.into_iter().map(|(name, action)| {
let keycodes = match &action { let keycodes = match &action {
crate::action::Action::Submit { text: _, keys } => { ::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(
@ -204,7 +208,8 @@ impl Layout {
}; };
( (
name.into(), name.into(),
Key { KeyState {
pressed: PressType::Released,
keycodes, keycodes,
action, action,
} }
@ -217,14 +222,20 @@ impl Layout {
Ok(v) => v, Ok(v) => v,
}; };
let button_states_cache = button_states; let button_states_cache = hash_map_map(
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| {
create_button( Box::new(create_button(
&self.buttons, &self.buttons,
&self.outlines, &self.outlines,
name, name,
@ -232,7 +243,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(
@ -268,7 +279,7 @@ impl Layout {
}; };
( (
Ok(layout::LayoutParseData { Ok(::layout::LayoutData {
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)
@ -292,7 +303,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,
) -> crate::action::Action { ) -> ::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);
@ -356,7 +367,7 @@ fn create_action<H: logging::Handler>(
match submission { match submission {
SubmitData::Action( SubmitData::Action(
Action::SetView(view_name) Action::SetView(view_name)
) => crate::action::Action::SetView( ) => ::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,
@ -366,7 +377,7 @@ fn create_action<H: logging::Handler>(
lock_view, unlock_view, lock_view, unlock_view,
pops, pops,
looks_locked_from, looks_locked_from,
}) => crate::action::Action::LockView { }) => ::action::Action::LockView {
lock: filter_view_name( lock: filter_view_name(
name, name,
lock_view.clone(), lock_view.clone(),
@ -384,11 +395,11 @@ fn create_action<H: logging::Handler>(
}, },
SubmitData::Action( SubmitData::Action(
Action::ShowPrefs Action::ShowPrefs
) => crate::action::Action::ShowPreferences, ) => ::action::Action::ShowPreferences,
SubmitData::Action(Action::Erase) => action::Action::Erase, SubmitData::Action(Action::Erase) => action::Action::Erase,
SubmitData::Keysym(keysym) => crate::action::Action::Submit { SubmitData::Keysym(keysym) => ::action::Action::Submit {
text: None, text: None,
keys: vec!(crate::action::KeySym( keys: vec!(::action::KeySym(
match keysym_valid(keysym.as_str()) { match keysym_valid(keysym.as_str()) {
true => keysym.clone(), true => keysym.clone(),
false => { false => {
@ -404,7 +415,7 @@ fn create_action<H: logging::Handler>(
} }
)), )),
}, },
SubmitData::Text(text) => crate::action::Action::Submit { SubmitData::Text(text) => ::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,
@ -412,7 +423,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();
crate::action::KeySym(match keysym_valid(codepoint_string.as_str()) { ::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),
}) })
@ -450,9 +461,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,
data: Key, state: Rc<RefCell<KeyState>>,
warning_handler: &mut H, warning_handler: &mut H,
) -> crate::layout::Button { ) -> ::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
@ -462,13 +473,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 {
crate::layout::Label::Text(CString::new(label.as_str()) ::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 {
crate::layout::Label::IconName(CString::new(icon.as_str()) ::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 {
crate::layout::Label::Text( ::layout::Label::Text(
CString::new(text.as_str()) CString::new(text.as_str())
.or_warn( .or_warn(
warning_handler, warning_handler,
@ -477,7 +488,7 @@ fn create_button<H: logging::Handler>(
).unwrap_or_else(|| CString::new("").unwrap()) ).unwrap_or_else(|| CString::new("").unwrap())
) )
} else { } else {
crate::layout::Label::Text(cname.clone()) ::layout::Label::Text(cname.clone())
}; };
let outline_name = match &button_meta.outline { let outline_name = match &button_meta.outline {
@ -512,8 +523,7 @@ fn create_button<H: logging::Handler>(
height: outline.height, height: outline.height,
}, },
label: label, label: label,
action: data.action, state: state,
keycodes: data.keycodes,
} }
} }
@ -541,7 +551,7 @@ mod tests {
use std::env; use std::env;
use crate::logging::ProblemPanic; use ::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")
@ -637,7 +647,7 @@ mod tests {
.get_rows()[0].1 .get_rows()[0].1
.get_buttons()[0].1 .get_buttons()[0].1
.label, .label,
crate::layout::Label::Text(CString::new("test").unwrap()) ::layout::Label::Text(CString::new("test").unwrap())
); );
} }
@ -652,7 +662,7 @@ mod tests {
.get_rows()[0].1 .get_rows()[0].1
.get_buttons()[0].1 .get_buttons()[0].1
.label, .label,
crate::layout::Label::Text(CString::new("test").unwrap()) ::layout::Label::Text(CString::new("test").unwrap())
); );
} }
@ -667,6 +677,7 @@ 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
); );
@ -683,6 +694,7 @@ 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
); );
@ -717,9 +729,9 @@ mod tests {
Vec::new(), Vec::new(),
&mut ProblemPanic, &mut ProblemPanic,
), ),
crate::action::Action::Submit { ::action::Action::Submit {
text: Some(CString::new(".").unwrap()), text: Some(CString::new(".").unwrap()),
keys: vec!(crate::action::KeySym("U002E".into())), keys: vec!(::action::KeySym("U002E".into())),
}, },
); );
} }

View File

@ -1,12 +1,13 @@
/*! Drawing the UI */ /*! Drawing the UI */
use cairo; use cairo;
use std::cell::RefCell;
use crate::action::{ Action, Modifier }; use ::action::{ Action, Modifier };
use crate::keyboard; use ::keyboard;
use crate::layout::{ Button, ButtonPosition, Label, LatchedState, Layout }; use ::layout::{ Button, Label, LatchedState, Layout };
use crate::layout::c::{ Bounds, EekGtkKeyboard, Point }; use ::layout::c::{ Bounds, EekGtkKeyboard, Point };
use crate::submission::c::Submission as CSubmission; use ::submission::c::Submission as CSubmission;
use glib::translate::FromGlibPtrNone; use glib::translate::FromGlibPtrNone;
use gtk::prelude::WidgetExt; use gtk::prelude::WidgetExt;
@ -83,21 +84,14 @@ 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, (row, position_in_row)| { layout.foreach_visible_button(|offset, button| {
// TODO: this iterator copies string indices way too much. let state = RefCell::borrow(&button.state).clone();
// 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(
&button.action, &state.action,
&active_modifiers, &active_modifiers,
layout.get_view_latched(), layout.get_view_latched(),
&layout.state.current_view, &layout.current_view,
); );
if state.pressed == keyboard::PressType::Pressed if state.pressed == keyboard::PressType::Pressed
|| locked != LockedStyle::Free || locked != LockedStyle::Free
@ -105,7 +99,7 @@ mod c {
render_button_at_position( render_button_at_position(
renderer, &cr, renderer, &cr,
offset, offset,
button, button.as_ref(),
state.pressed, locked, state.pressed, locked,
); );
} }
@ -122,11 +116,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, _index| { layout.foreach_visible_button(|offset, button| {
render_button_at_position( render_button_at_position(
renderer, &cr, renderer, &cr,
offset, offset,
button, button.as_ref(),
keyboard::PressType::Released, keyboard::PressType::Released,
LockedStyle::Free, LockedStyle::Free,
); );

View File

@ -18,53 +18,35 @@
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 UISender<S> = glib::Sender< /// Type of the sender that waits for external events
< type Sender = mpsc::Sender<Event>;
<S as ActorState>::Outcome as Outcome /// Type of the sender that waits for internal state changes
>::Commands type UISender = glib::Sender<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.
/// It sends outcomes to the glib main loop using a channel. /// It sends outcomes to the glib main loop using a channel.
/// The outcomes are applied by the UI end of the channel in the `main` module. /// The outcomes are applied by the UI end of the channel in the `main` module.
// This could still be reasonably tested, // This could still be reasonably tested,
/// by creating a glib::Sender and checking what messages it receives. // by creating a glib::Sender and checking what messages it receives.
// 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.
#[derive(Clone)] #[derive(Clone)]
pub struct Threaded<S> pub struct Threaded {
where thread: Sender,
S: ActorState + Send,
S::Event: Send,
<S::Outcome as Outcome>::Commands: Send,
{
/// Waits for external events
thread: mpsc::Sender<S::Event>,
} }
impl<S> Threaded<S> impl Threaded {
where pub fn new(ui: UISender, initial_state: Application) -> Self {
// 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 || {
@ -87,16 +69,13 @@ where
} }
} }
pub fn send(&self, event: S::Event) -> Result<(), mpsc::SendError<S::Event>> { pub fn send(&self, event: Event) -> Result<(), mpsc::SendError<Event>> {
self.thread.send(event) self.thread.send(event)
} }
fn handle_loop_event( fn handle_loop_event(loop_sender: &Sender, state: event_loop::State, event: Event, ui: &UISender)
loop_sender: &mpsc::Sender<S::Event>, -> event_loop::State
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);
@ -113,16 +92,52 @@ where
new_state new_state
} }
fn schedule_timeout_wake( fn schedule_timeout_wake(loop_sender: &Sender, when: Instant) {
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(S::Event::new_timeout_reached(when)) sender.send(Event::TimeoutReached(when))
.or_warn(&mut logging::Print, logging::Problem::Warning, "Can't wake manager"); .or_warn(&mut logging::Print, logging::Problem::Warning, "Can't wake visibility manager");
}); });
} }
} }
/// For calling in only
mod c {
use super::*;
use crate::state::Presence;
use crate::state::visibility;
use crate::util::c::Wrapped;
#[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");
}
}

View File

@ -38,49 +38,27 @@
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<S> { struct State {
state: S, state: state::Application,
scheduled_wakeup: Option<Instant>, scheduled_wakeup: Option<Instant>,
last_update: Instant, last_update: Instant,
} }
impl<S> State<S> { impl State {
fn new(initial_state: S, now: Instant) -> Self { fn new(initial_state: state::Application, now: Instant) -> Self {
Self { Self {
state: initial_state, state: initial_state,
scheduled_wakeup: None, scheduled_wakeup: None,
@ -95,11 +73,11 @@ impl<S> State<S> {
/// - 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<S: ActorState>( fn handle_event(
mut loop_state: State<S>, mut loop_state: State,
event: S::Event, event: Event,
now: Instant, now: Instant,
) -> (State<S>, <S::Outcome as Outcome>::Commands) { ) -> (State, 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,
@ -115,8 +93,8 @@ fn handle_event<S: ActorState>(
.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.get_timeout_reached() { loop_state.scheduled_wakeup = match event {
Some(when) => { Event::TimeoutReached(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.
@ -134,7 +112,7 @@ fn handle_event<S: ActorState>(
None None
} }
}, },
None => loop_state.scheduled_wakeup.clone(), _ => loop_state.scheduled_wakeup.clone(),
}; };
// Reschedule timeout if the new state calls for it. // Reschedule timeout if the new state calls for it.
@ -173,8 +151,7 @@ mod test {
use super::*; use super::*;
use crate::animation; use crate::animation;
use crate::imservice::{ ContentHint, ContentPurpose }; use crate::imservice::{ ContentHint, ContentPurpose };
use crate::panel; use crate::main::PanelCommand;
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;
@ -185,9 +162,6 @@ 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
@ -202,13 +176,13 @@ mod test {
let l = State::new(state, now); let l = State::new(state, now);
let (l, commands) = handle_event(l, InputMethod::InactiveSince(now).into(), now); let (l, commands) = handle_event(l, InputMethod::InactiveSince(now).into(), now);
assert_matches!(commands.panel_visibility, Some(panel::Command::Show{..})); assert_matches!(commands.panel_visibility, Some(PanelCommand::Show{..}));
assert_eq!(l.scheduled_wakeup, Some(now + animation::HIDING_TIMEOUT)); assert_eq!(l.scheduled_wakeup, Some(now + animation::HIDING_TIMEOUT));
now += animation::HIDING_TIMEOUT; now += animation::HIDING_TIMEOUT;
let (l, commands) = handle_event(l, state::Event::TimeoutReached(now), now); let (l, commands) = handle_event(l, Event::TimeoutReached(now), now);
assert_eq!(commands.panel_visibility, Some(panel::Command::Hide)); assert_eq!(commands.panel_visibility, Some(PanelCommand::Hide));
assert_eq!(l.scheduled_wakeup, None); assert_eq!(l.scheduled_wakeup, None);
} }
} }

View File

@ -13,9 +13,9 @@
extern crate core; extern crate core;
use crate::float_ord::core::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd}; use ::float_ord::core::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
use crate::float_ord::core::hash::{Hash, Hasher}; use ::float_ord::core::hash::{Hash, Hasher};
use crate::float_ord::core::mem::transmute; use ::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(crate::float_ord::core::f64::NAN) == FloatOrd(crate::float_ord::core::f64::NAN)); assert!(FloatOrd(::float_ord::core::f64::NAN) == FloatOrd(::float_ord::core::f64::NAN));
assert!(FloatOrd(crate::float_ord::core::f32::NAN) == FloatOrd(crate::float_ord::core::f32::NAN)); assert!(FloatOrd(::float_ord::core::f32::NAN) == FloatOrd(::float_ord::core::f32::NAN));
assert!(FloatOrd(-crate::float_ord::core::f64::NAN) < FloatOrd(crate::float_ord::core::f64::NAN)); assert!(FloatOrd(-::float_ord::core::f64::NAN) < FloatOrd(::float_ord::core::f64::NAN));
assert!(FloatOrd(-crate::float_ord::core::f32::NAN) < FloatOrd(crate::float_ord::core::f32::NAN)); assert!(FloatOrd(-::float_ord::core::f32::NAN) < FloatOrd(::float_ord::core::f32::NAN));
assert!(FloatOrd(-crate::float_ord::core::f64::INFINITY) < FloatOrd(crate::float_ord::core::f64::INFINITY)); assert!(FloatOrd(-::float_ord::core::f64::INFINITY) < FloatOrd(::float_ord::core::f64::INFINITY));
assert!(FloatOrd(-crate::float_ord::core::f32::INFINITY) < FloatOrd(crate::float_ord::core::f32::INFINITY)); assert!(FloatOrd(-::float_ord::core::f32::INFINITY) < FloatOrd(::float_ord::core::f32::INFINITY));
assert!(FloatOrd(crate::float_ord::core::f64::INFINITY) < FloatOrd(crate::float_ord::core::f64::NAN)); assert!(FloatOrd(::float_ord::core::f64::INFINITY) < FloatOrd(::float_ord::core::f64::NAN));
assert!(FloatOrd(crate::float_ord::core::f32::INFINITY) < FloatOrd(crate::float_ord::core::f32::NAN)); assert!(FloatOrd(::float_ord::core::f32::INFINITY) < FloatOrd(::float_ord::core::f32::NAN));
assert!(FloatOrd(-crate::float_ord::core::f64::NAN) < FloatOrd(crate::float_ord::core::f64::INFINITY)); assert!(FloatOrd(-::float_ord::core::f64::NAN) < FloatOrd(::float_ord::core::f64::INFINITY));
assert!(FloatOrd(-crate::float_ord::core::f32::NAN) < FloatOrd(crate::float_ord::core::f32::INFINITY)); assert!(FloatOrd(-::float_ord::core::f32::NAN) < FloatOrd(::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(crate::float_ord::core::f64::NAN)), hash(FloatOrd(-crate::float_ord::core::f64::NAN))); assert_ne!(hash(FloatOrd(::float_ord::core::f64::NAN)), hash(FloatOrd(-::float_ord::core::f64::NAN)));
assert_ne!(hash(FloatOrd(crate::float_ord::core::f32::NAN)), hash(FloatOrd(-crate::float_ord::core::f32::NAN))); assert_ne!(hash(FloatOrd(::float_ord::core::f32::NAN)), hash(FloatOrd(-::float_ord::core::f32::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::f64::NAN)), hash(FloatOrd(::float_ord::core::f64::NAN)));
assert_eq!(hash(FloatOrd(-crate::float_ord::core::f32::NAN)), hash(FloatOrd(-crate::float_ord::core::f32::NAN))); assert_eq!(hash(FloatOrd(-::float_ord::core::f32::NAN)), hash(FloatOrd(-::float_ord::core::f32::NAN)));
} }
#[test] #[test]
fn test_sort_nan() { fn test_sort_nan() {
let nan = crate::float_ord::core::f64::NAN; let nan = ::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);

View File

@ -1,8 +1,7 @@
#include "input-method-unstable-v2-client-protocol.h"
#include "virtual-keyboard-unstable-v1-client-protocol.h"
#include "submission.h" #include "submission.h"
#include <glib.h>
struct imservice; struct imservice;
void imservice_handle_input_method_activate(void *data, struct zwp_input_method_v2 *input_method); void imservice_handle_input_method_activate(void *data, struct zwp_input_method_v2 *input_method);

View File

@ -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::main; use crate::event_loop::driver;
use crate::state; use crate::state;
use crate::state::Event; use crate::state::Event;
use crate::logging; use ::logging;
use crate::util::c::into_cstring; use ::util::c::into_cstring;
// Traits // Traits
use std::convert::TryFrom; use std::convert::TryFrom;
use crate::logging::Warn; use ::logging::Warn;
/// Gathers stuff defined in C or called by C /// Gathers stuff defined in C or called by C
@ -226,7 +226,7 @@ bitflags!{
/// use rs::imservice::ContentPurpose; /// use rs::imservice::ContentPurpose;
/// assert_eq!(ContentPurpose::Alpha as u32, 1); /// assert_eq!(ContentPurpose::Alpha as u32, 1);
/// ``` /// ```
#[derive(Debug, Copy, Clone, PartialEq)] #[derive(Debug, Copy, Clone)]
pub enum ContentPurpose { pub enum ContentPurpose {
Normal = 0, Normal = 0,
Alpha = 1, Alpha = 1,
@ -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: main::EventLoop, sender: driver::Threaded,
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: main::EventLoop, sender: driver::Threaded,
) -> 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

View File

@ -1,16 +1,18 @@
/*! 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 crate::action::Action; use std::cell::RefCell;
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 };
@ -22,7 +24,7 @@ pub enum PressType {
} }
/// The extended, unambiguous layout-keycode /// The extended, unambiguous layout-keycode
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone)]
pub struct KeyCode { pub struct KeyCode {
pub code: u32, pub code: u32,
pub keymap_idx: usize, pub keymap_idx: usize,
@ -47,28 +49,17 @@ 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(layout::ButtonPosition); pub struct KeyStateId(*const KeyState);
impl From<&layout::ButtonPosition> for KeyStateId {
fn from(v: &layout::ButtonPosition) -> Self {
Self(v.clone())
}
}
#[derive(Clone)]
pub struct Key {
/// A cache of raw keycodes derived from Action::Submit given a keymap
pub keycodes: Vec<KeyCode>,
/// Static description of what the key does when pressed or released
pub action: Action,
}
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct KeyState { pub struct KeyState {
pub pressed: PressType, pub pressed: PressType,
/// A cache of raw keycodes derived from Action::Submit given a keymap
pub keycodes: Vec<KeyCode>,
/// Static description of what the key does when pressed or released
pub action: Action,
} }
impl KeyState { impl KeyState {
@ -87,6 +78,12 @@ 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
@ -143,17 +140,18 @@ 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 -_- ?
// Inspired by
// 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();
unsafe { unsafe {
let arref = &mut *array.as_mut_ptr(); // Inspired by
for element in arref.iter_mut() { // https://www.reddit.com/r/rust/comments/5n7bh1/how_to_create_an_array_of_a_type_with_clone_but/
#[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() {
ptr::write(element, None); ptr::write(element, None);
} }
array
array.assume_init()
} }
} }

View File

@ -3,11 +3,10 @@
#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"
#include "src/main.h"
#include "src/popover.h"
#include "src/submission.h" #include "src/submission.h"
#include "virtual-keyboard-unstable-v1-client-protocol.h" #include "virtual-keyboard-unstable-v1-client-protocol.h"
#include "text-input-unstable-v3-client-protocol.h" #include "text-input-unstable-v3-client-protocol.h"
@ -41,8 +40,7 @@ void squeek_layout_release(struct squeek_layout *layout,
struct submission *submission, struct submission *submission,
struct transformation widget_to_layout, struct transformation widget_to_layout,
uint32_t timestamp, uint32_t timestamp,
struct squeek_popover *popover, EekboardContextService *manager,
struct squeek_state_manager *state,
EekGtkKeyboard *ui_keyboard); EekGtkKeyboard *ui_keyboard);
void squeek_layout_release_all_only(struct squeek_layout *layout, void squeek_layout_release_all_only(struct squeek_layout *layout,
struct submission *submission, struct submission *submission,
@ -56,8 +54,7 @@ void squeek_layout_drag(struct squeek_layout *layout,
struct submission *submission, struct submission *submission,
double x_widget, double y_widget, double x_widget, double y_widget,
struct transformation widget_to_layout, struct transformation widget_to_layout,
uint32_t timestamp, struct squeek_popover *popover, uint32_t timestamp, EekboardContextService *manager,
struct squeek_state_manager *state,
EekGtkKeyboard *ui_keyboard); EekGtkKeyboard *ui_keyboard);
void squeek_layout_draw_all_changed(struct squeek_layout *layout, EekRenderer* renderer, cairo_t *cr, struct submission *submission); void squeek_layout_draw_all_changed(struct squeek_layout *layout, EekRenderer* renderer, cairo_t *cr, struct submission *submission);
void squeek_draw_layout_base_view(struct squeek_layout *layout, EekRenderer* renderer, cairo_t *cr); void squeek_draw_layout_base_view(struct squeek_layout *layout, EekRenderer* renderer, cairo_t *cr);

File diff suppressed because it is too large Load Diff

View File

@ -13,8 +13,6 @@ extern crate gtk_sys;
extern crate maplit; extern crate maplit;
extern crate serde; extern crate serde;
extern crate xkbcommon; extern crate xkbcommon;
extern crate zbus;
extern crate zvariant;
#[cfg(test)] #[cfg(test)]
#[macro_use] #[macro_use]
@ -23,7 +21,6 @@ mod assert_matches;
mod logging; mod logging;
mod action; mod action;
pub mod actors;
mod animation; mod animation;
pub mod data; pub mod data;
mod drawing; mod drawing;
@ -34,11 +31,10 @@ mod keyboard;
mod layout; mod layout;
mod locale; mod locale;
mod main; mod main;
mod manager;
mod outputs; mod outputs;
mod panel;
mod popover; mod popover;
mod receiver; mod resources;
pub mod resources;
mod state; mod state;
mod style; mod style;
mod submission; mod submission;

View File

@ -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)*) => (crate::logging::print($level, &format!($($arg)*))) ($level:expr, $($arg:tt)*) => (::logging::print($level, &format!($($arg)*)))
} }
/// Approach 2 /// Approach 2

View File

@ -8,8 +8,6 @@
#include "eek/eek-types.h" #include "eek/eek-types.h"
#include "dbus.h" #include "dbus.h"
#include "panel.h"
#include "src/popover.h"
struct receiver; struct receiver;
@ -24,10 +22,9 @@ struct rsobjects {
struct squeek_state_manager *state_manager; struct squeek_state_manager *state_manager;
struct submission *submission; struct submission *submission;
struct squeek_wayland *wayland; struct squeek_wayland *wayland;
struct squeek_popover *popover;
}; };
void register_ui_loop_handler(struct receiver *receiver, struct panel_manager *panel, struct squeek_popover *popover, EekboardContextService *hint_manager, DBusHandler *dbus_handler); void register_ui_loop_handler(struct receiver *receiver, ServerContextService *ui, DBusHandler *dbus_handler);
struct rsobjects squeek_init(void); struct rsobjects squeek_init(void);
@ -35,4 +32,3 @@ void squeek_state_send_force_visible(struct squeek_state_manager *state);
void squeek_state_send_force_hidden(struct squeek_state_manager *state); void squeek_state_send_force_hidden(struct squeek_state_manager *state);
void squeek_state_send_keyboard_present(struct squeek_state_manager *state, uint32_t keyboard_present); void squeek_state_send_keyboard_present(struct squeek_state_manager *state, uint32_t keyboard_present);
void squeek_state_send_layout_set(struct squeek_state_manager *state, char *name, char *layout, uint32_t timestamp);

View File

@ -3,58 +3,46 @@
*/ */
/*! Glue for the main loop. */ /*! Glue for the main loop. */
use crate::actors; use crate::outputs::OutputId;
use crate::actors::external::debug;
use crate::animation;
use crate::data::loading;
use crate::event_loop;
use crate::panel;
use crate::state; 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::ffi::CString; use std::os::raw::c_void;
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;
use crate::layout;
use crate::outputs::Outputs; use crate::outputs::Outputs;
use crate::outputs::c::WlOutput;
use crate::state; use crate::state;
use crate::submission::Submission; use crate::submission::Submission;
use crate::util::c::{ArcWrapped, Wrapped}; use crate::util::c::Wrapped;
use crate::vkeyboard::c::ZwpVirtualKeyboardV1; use crate::vkeyboard::c::ZwpVirtualKeyboardV1;
/// ServerContextService*
#[repr(transparent)]
pub struct UIManager(*const c_void);
/// DbusHandler* /// DbusHandler*
#[repr(transparent)] #[repr(transparent)]
pub struct DBusHandler(*const c_void); pub struct DBusHandler(*const c_void);
/// EekboardContextService* in the role of a hint receiver
// The clone/copy is a concession to C style of programming.
// It would be hard to get rid of it.
#[repr(transparent)]
#[derive(Clone, Copy)]
pub struct HintManager(*const c_void);
/// Holds the Rust structures that are interesting from C. /// Holds the Rust structures that are interesting from C.
#[repr(C)] #[repr(C)]
pub struct RsObjects { pub struct RsObjects {
/// 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<EventLoop>, state_manager: Wrapped<driver::Threaded>,
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,
popover: actors::popover::c::Actor,
} }
/// Corresponds to wayland.h::squeek_wayland. /// Corresponds to wayland.h::squeek_wayland.
@ -87,15 +75,14 @@ mod c {
extern "C" { extern "C" {
#[allow(improper_ctypes)] #[allow(improper_ctypes)]
fn init_wayland(wayland: *mut Wayland); fn init_wayland(wayland: *mut Wayland);
#[allow(improper_ctypes)] fn server_context_service_update_keyboard(service: *const UIManager, output: WlOutput, scaled_height: u32);
fn eekboard_context_service_set_layout(service: HintManager, name: *const c_char, layout: *const layout::Layout, timestamp: u32); fn server_context_service_real_hide_keyboard(service: *const UIManager);
fn server_context_service_set_hint_purpose(service: *const UIManager, hint: u32, purpose: 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,
/// and that leads to suffering. /// and that leads to suffering.
@ -107,8 +94,6 @@ mod c {
let now = Instant::now(); let now = Instant::now();
let state_manager = driver::Threaded::new(sender, state::Application::new(now)); let state_manager = driver::Threaded::new(sender, state::Application::new(now));
debug::init(state_manager.clone());
let outputs = Outputs::new(state_manager.clone()); let outputs = Outputs::new(state_manager.clone());
let mut wayland = Box::new(Wayland::new(outputs)); let mut wayland = Box::new(Wayland::new(outputs));
let wayland_raw = &mut *wayland as *mut _; let wayland_raw = &mut *wayland as *mut _;
@ -123,17 +108,11 @@ 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,
} }
} }
@ -142,27 +121,18 @@ mod c {
pub extern "C" pub extern "C"
fn register_ui_loop_handler( fn register_ui_loop_handler(
receiver: Wrapped<Receiver<Commands>>, receiver: Wrapped<Receiver<Commands>>,
panel_manager: panel::c::PanelManager, ui_manager: *const UIManager,
popover: actors::popover::c::Actor,
hint_manager: HintManager,
dbus_handler: *const DBusHandler, dbus_handler: *const DBusHandler,
) { ) {
let receiver = unsafe { receiver.unwrap() }; let receiver = unsafe { receiver.unwrap() };
let receiver = Rc::try_unwrap(receiver).expect("References still present"); let receiver = Rc::try_unwrap(receiver).expect("References still present");
let receiver = receiver.into_inner(); let receiver = receiver.into_inner();
let panel_manager = Wrapped::new(panel::Manager::new(panel_manager));
let ctx = MainContext::default(); let ctx = MainContext::default();
let _acqu = ctx.acquire(); let _acqu = ctx.acquire();
receiver.attach( receiver.attach(
Some(&ctx), Some(&ctx),
move |msg| { move |msg| {
main_loop_handle_message( main_loop_handle_message(msg, ui_manager, dbus_handler);
msg,
panel_manager.clone(),
&popover.clone_ref(),
hint_manager,
dbus_handler,
);
Continue(true) Continue(true)
}, },
); );
@ -176,14 +146,18 @@ mod c {
/// and doesn't lend itself to testing other than integration. /// and doesn't lend itself to testing other than integration.
fn main_loop_handle_message( fn main_loop_handle_message(
msg: Commands, msg: Commands,
panel_manager: Wrapped<panel::Manager>, ui_manager: *const UIManager,
popover: &actors::popover::Destination,
hint_manager: HintManager,
dbus_handler: *const DBusHandler, dbus_handler: *const DBusHandler,
) { ) {
if let Some(visibility) = msg.panel_visibility { match msg.panel_visibility {
panel::Manager::update(panel_manager, visibility); Some(PanelCommand::Show { output, height }) => unsafe {
} server_context_service_update_keyboard(ui_manager, output.0, height.as_scaled_ceiling());
},
Some(PanelCommand::Hide) => unsafe {
server_context_service_real_hide_keyboard(ui_manager);
},
None => {},
};
if let Some(visible) = msg.dbus_visible_set { if let Some(visible) = msg.dbus_visible_set {
if dbus_handler != std::ptr::null() { if dbus_handler != std::ptr::null() {
@ -191,111 +165,54 @@ mod c {
} }
} }
if let Some(commands::SetLayout { description }) = msg.layout_selection { if let Some(hints) = msg.layout_hint_set {
let animation::Contents {
name,
kind,
overlay_name,
purpose,
} = description;
popover.send(popover::Event::Overlay(overlay_name.clone()));
let layout = loading::load_layout(&name, kind, purpose, &overlay_name);
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 {
// Take out the pointer to a temp variable so that it outlives the set_layout call. server_context_service_set_hint_purpose(
let name = name.as_ptr(); ui_manager,
eekboard_context_service_set_layout(hint_manager, name, layout, 0); hints.hint.bits(),
} hints.purpose.clone() as u32,
)
};
} }
} }
// 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");
}
} }
/// Size in pixels that is aware of scaling
#[derive(Clone, Copy, PartialEq, Debug)]
pub struct PixelSize {
pub pixels: u32,
pub scale_factor: u32,
}
pub type EventLoop = event_loop::driver::Threaded<state::Application>; fn div_ceil(a: u32, b: u32) -> u32 {
// Given that it's for pixels on a screen, an overflow is unlikely.
(a + b - 1) / b
}
impl PixelSize {
pub mod commands { pub fn as_scaled_floor(&self) -> u32 {
use crate::animation; self.pixels / self.scale_factor
#[derive(Clone, Debug)]
pub struct SetLayout {
pub description: animation::Contents,
} }
pub fn as_scaled_ceiling(&self) -> u32 {
div_ceil(self.pixels, self.scale_factor)
}
}
#[derive(Clone, PartialEq, Debug)]
pub enum PanelCommand {
Show {
output: OutputId,
height: PixelSize,
},
Hide,
} }
/// The commands consumed by the main loop, /// The commands consumed by the main loop,
/// to be sent out to external components. /// to be sent out to external components.
#[derive(Clone)] #[derive(Clone)]
pub struct Commands { pub struct Commands {
pub panel_visibility: Option<panel::Command>, pub panel_visibility: Option<PanelCommand>,
pub layout_hint_set: Option<state::InputMethodDetails>,
pub dbus_visible_set: Option<bool>, pub dbus_visible_set: Option<bool>,
pub layout_selection: Option<commands::SetLayout>,
} }

33
src/manager.rs Normal file
View File

@ -0,0 +1,33 @@
/*! Procedures relating to the management of the switching of layouts */
use ::util;
pub mod c {
use std::os::raw::{c_char, c_void};
/// EekboardContextService*
#[repr(transparent)]
#[derive(Clone, Copy)]
pub struct Manager(*const c_void);
extern "C" {
pub fn eekboard_context_service_set_overlay(
manager: Manager,
name: *const c_char,
);
pub fn eekboard_context_service_get_overlay(
manager: Manager,
) -> *const c_char;
}
}
/// Returns the overlay name.
/// The result lifetime is "as long as the C copy lives"
pub fn get_overlay(manager: c::Manager) -> Option<String> {
let raw_str = unsafe {
c::eekboard_context_service_get_overlay(manager)
};
// this string is generated from Rust, should never be invalid
util::c::as_str(&raw_str).unwrap()
.map(String::from)
}

View File

@ -14,37 +14,32 @@ sources = [
config_h, config_h,
'dbus.c', 'dbus.c',
'imservice.c', 'imservice.c',
'panel.c',
'popover.c', 'popover.c',
'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',
'../eek/eek-types.c', '../eek/eek-types.c',
'../eek/layersurface.c', '../eek/layersurface.c',
dbus_src,
'../eekboard/eekboard-context-service.c', '../eekboard/eekboard-context-service.c',
# '../eekboard/eekboard-xklutil.c',
squeekboard_resources,
wl_proto_sources,
] ]
generated_sources = declare_dependency(
sources: [
dbus_src,
squeekboard_resources,
wl_proto_sources,
],
)
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
deps = [ deps = [
generated_sources, # dependency('glib-2.0', version: '>=2.26.0'),
dependency('gio-2.0', version: '>=2.26.0'), dependency('gio-2.0', version: '>=2.26.0'),
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 +58,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_deps, depends: cargo_toml,
) )
build_rstests = custom_target( build_rstests = custom_target(
@ -78,7 +73,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_deps], # no point building tests if the code itself fails depends: [rslibs, cargo_toml], # no point building tests if the code itself fails
) )
test( test(
@ -88,7 +83,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_deps], depends: [build_rstests, cargo_toml],
) )
libsqueekboard = static_library('libsqueekboard', libsqueekboard = static_library('libsqueekboard',
@ -105,6 +100,8 @@ libsqueekboard = static_library('libsqueekboard',
squeekboard = executable('squeekboard', squeekboard = executable('squeekboard',
'server-main.c', 'server-main.c',
wl_proto_sources,
squeekboard_resources,
link_with: libsqueekboard, link_with: libsqueekboard,
include_directories: [include_directories('..'), include_directories('../eek')], include_directories: [include_directories('..'), include_directories('../eek')],
dependencies: deps, dependencies: deps,

View File

@ -4,14 +4,12 @@
/*! Managing Wayland outputs */ /*! Managing Wayland outputs */
use std::ops;
use std::vec::Vec; use std::vec::Vec;
use crate::logging; use crate::event_loop;
use crate::main; use ::logging;
use crate::util::DivCeil;
// traits // traits
use crate::logging::Warn; use ::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 +18,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 crate::util::c::{COpaquePtr, Wrapped}; use ::util::c::{COpaquePtr, Wrapped};
// Defined in C // Defined in C
@ -128,7 +126,7 @@ pub mod c {
outputs: COutputs, outputs: COutputs,
wl_output: WlOutput, wl_output: WlOutput,
_x: i32, _y: i32, _x: i32, _y: i32,
phys_width: i32, phys_height: i32, _phys_width: i32, _phys_height: i32,
_subpixel: i32, _subpixel: i32,
_make: *const c_char, _model: *const c_char, _make: *const c_char, _model: *const c_char,
transform: i32, transform: i32,
@ -146,19 +144,7 @@ pub mod c {
.find_output_mut(wl_output) .find_output_mut(wl_output)
.map(|o| &mut o.pending); .map(|o| &mut o.pending);
match output_state { match output_state {
Some(state) => { Some(state) => { state.transform = Some(transform) },
fn maybe_mm(value: i32) -> Option<Millimeter> {
if value == 0 { None }
else { Some(Millimeter(value)) }
}
state.geometry = Some(Geometry {
phys_size: Size {
width: maybe_mm(phys_width),
height: maybe_mm(phys_height),
},
transform,
});
},
None => log_print!( None => log_print!(
logging::Level::Warning, logging::Level::Warning,
"Got geometry on unknown output", "Got geometry on unknown output",
@ -300,51 +286,24 @@ pub mod c {
// TODO: handle unregistration // TODO: handle unregistration
} }
/// Generic size /// Generic size
#[derive(Clone, Copy, Debug)] #[derive(Clone)]
pub struct Size<Unit> { pub struct Size {
pub width: Unit, pub width: u32,
pub height: Unit, pub height: u32,
} }
pub type PixelSize = Size<u32>;
/// wl_output mode /// wl_output mode
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub struct Mode { pub struct Mode {
pub width: i32, width: i32,
pub height: i32, height: i32,
}
#[derive(Clone, Copy, Debug)]
pub struct Millimeter(pub i32);
impl DivCeil<i32> for Millimeter {
type Output = Millimeter;
fn div_ceil(self, other: i32) -> Self {
Self(self.0.div_ceil(other))
}
}
impl ops::Mul<i32> for Millimeter {
type Output = Self;
fn mul(self, m: i32) -> Self {
Self(self.0 * m as i32)
}
}
/// All geometry parameters
#[derive(Clone, Copy, Debug)]
pub struct Geometry {
pub transform: c::Transform,
pub phys_size: Size<Option<Millimeter>>,
} }
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub struct OutputState { pub struct OutputState {
pub current_mode: Option<Mode>, pub current_mode: Option<Mode>,
pub geometry: Option<Geometry>, pub transform: Option<c::Transform>,
pub scale: i32, pub scale: i32,
} }
@ -358,56 +317,33 @@ impl OutputState {
fn uninitialized() -> OutputState { fn uninitialized() -> OutputState {
OutputState { OutputState {
current_mode: None, current_mode: None,
geometry: None, transform: None,
scale: 1, scale: 1,
} }
} }
fn transform_size<T>( pub fn get_pixel_size(&self) -> Option<Size> {
width: T,
height: T,
transform: self::c::Transform,
) -> Size<T> {
use self::c::Transform; use self::c::Transform;
match transform {
Transform::Normal
| Transform::Rotated180
| Transform::Flipped
| Transform::FlippedRotated180 => Size {
width,
height,
},
_ => Size {
width: height,
height: width,
},
}
}
/// Return resolution adjusted for current transform
pub fn get_pixel_size(&self) -> Option<PixelSize> {
match self { match self {
OutputState { OutputState {
current_mode: Some(Mode { width, height } ), current_mode: Some(Mode { width, height } ),
geometry: Some(Geometry { transform, .. } ), transform: Some(transform),
scale: _, scale: _,
} => Some(Self::transform_size(*width as u32, *height as u32, *transform)), } => Some(
OutputState { match transform {
current_mode: Some(Mode { width, height } ), Transform::Normal
.. | Transform::Rotated180
} => Some(PixelSize { width: *width as u32, height: *height as u32 } ), | Transform::Flipped
_ => None, | Transform::FlippedRotated180 => Size {
} width: *width as u32,
} height: *height as u32,
},
/// Return physical dimensions adjusted for current transform _ => Size {
pub fn get_physical_size(&self) -> Option<Size<Option<Millimeter>>> { width: *height as u32,
match self { height: *width as u32,
OutputState { },
geometry: Some(Geometry { transform, phys_size } ), }
.. ),
} => Some(Self::transform_size(phys_size.width, phys_size.height, *transform)),
_ => None, _ => None,
} }
} }
@ -438,11 +374,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: main::EventLoop, sender: event_loop::driver::Threaded,
} }
impl Outputs { impl Outputs {
pub fn new(sender: main::EventLoop) -> Outputs { pub fn new(sender: event_loop::driver::Threaded) -> Outputs {
Outputs { Outputs {
outputs: Vec::new(), outputs: Vec::new(),
sender, sender,

View File

@ -1,125 +0,0 @@
#include "eekboard/eekboard-context-service.h"
#include "wayland.h"
#include "panel.h"
// Called from rust
/// Destroys the widget
void
panel_manager_hide(struct panel_manager *self)
{
if (self->window) {
gtk_widget_hide (GTK_WIDGET (self->window));
}
}
static void
on_destroy (struct panel_manager *self, GtkWidget *widget)
{
g_assert (widget == GTK_WIDGET(self->window));
panel_manager_hide(self);
}
/// panel::Manager. Only needed for this callback
struct squeek_panel_manager;
/// Calls back into Rust
void squeek_panel_manager_configured(struct squeek_panel_manager *mgr, uint32_t width, uint32_t height);
static void
on_surface_configure(struct squeek_panel_manager *self, PhoshLayerSurface *surface)
{
gint width;
gint height;
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (surface));
g_object_get(G_OBJECT(surface),
"configured-width", &width,
"configured-height", &height,
NULL);
squeek_panel_manager_configured(self, width, height);
}
static void
make_widget (struct panel_manager *self)
{
if (self->widget) {
g_error("Widget already present");
}
self->widget = eek_gtk_keyboard_new (self->state, self->submission, self->state_manager, self->popover);
gtk_widget_set_has_tooltip (self->widget, TRUE);
gtk_container_add (GTK_CONTAINER(self->window), self->widget);
gtk_widget_show_all(self->widget);
}
// 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
/// Creates a new panel widget
void
panel_manager_request_widget (struct panel_manager *self, struct wl_output *output, uint32_t height, struct squeek_panel_manager *mgr)
{
if (!self->window) {
self->window = g_object_new (
PHOSH_TYPE_LAYER_SURFACE,
"layer-shell", squeek_wayland->layer_shell,
"wl-output", output,
"height", height,
"anchor", ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM
| ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT
| ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT,
"layer", ZWLR_LAYER_SHELL_V1_LAYER_TOP,
"kbd-interactivity", FALSE,
"exclusive-zone", height,
"namespace", "osk",
NULL
);
g_object_connect (self->window,
"swapped-signal::destroy", G_CALLBACK(on_destroy), self,
"swapped-signal::configured", G_CALLBACK(on_surface_configure), mgr,
NULL);
// The properties below are just to make hacking easier.
// The way we use layer-shell overrides some,
// and there's no space in the protocol for others.
// Those may still be useful in the future,
// or for hacks with regular windows.
gtk_widget_set_can_focus (GTK_WIDGET(self->window), FALSE);
g_object_set (G_OBJECT(self->window), "accept_focus", FALSE, NULL);
gtk_window_set_title (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);
} else {
panel_manager_resize(self, height);
}
if (!self->widget) {
make_widget(self);
}
gtk_widget_show (GTK_WIDGET(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 mgr = {
.state = state,
.submission = submission,
.window = NULL,
.widget = NULL,
.current_output = NULL,
.state_manager = state_manager,
.popover = popover,
};
return mgr;
}

View File

@ -1,25 +0,0 @@
#pragma once
#include "eek/layersurface.h"
#include "src/layout.h"
#include "src/main.h"
#include "src/submission.h"
// Stores the objects that the panel and its widget will refer to
struct panel_manager {
EekboardContextService *state; // unowned
/// Needed for instantiating the widget
struct squeek_state_manager *state_manager; // shared reference
struct squeek_popover *popover; // shared reference
struct submission *submission; // unowned
// both memoized - doesn't have to be, but bugs happen:
// https://gitlab.gnome.org/World/Phosh/squeekboard/-/issues/343
PhoshLayerSurface *window;
GtkWidget *widget;
// Those should be held in Rust
struct wl_output *current_output;
};
struct panel_manager panel_manager_new(EekboardContextService *state, struct submission *submission, struct squeek_state_manager *state_manager, struct squeek_popover *popover);

View File

@ -1,274 +0,0 @@
/* Copyright (C) 2022 Purism SPC
* SPDX-License-Identifier: GPL-3.0+
*/
/*! Panel state management.
*
* This is effectively a mirror of the previous C code,
* with an explicit state machine managing the panel size.
*
* It still relies on a callback from Wayland to accept the panel size,
* which makes this code somewhat prone to mistakes.
*
* An alternative to the callback would be
* to send a message all the way to `state::State`
* every time the allocated size changes.
* That would allow for a more holistic view
* of interactions of different pieces of state.
*
* However, `state::State` already has the potential to become a ball of mud,
* tightly coupling different functionality and making it difficult to see independent units.
*
* For this reason, I'm taking a light touch approach with the panel manager,
* and moving it just a bit closer to `state::State`.
* Hopefully ths still allows us to expose assumptions that were not stated yet
* (e.g. can the output disappear between size request andallocation?).
*
* Tight coupling, e.g. a future one between presented hints and layout size,
* will have to be taken into account later.
*/
use crate::logging;
use crate::outputs::OutputId;
use crate::util::c::Wrapped;
pub mod c {
use super::*;
use glib;
use std::os::raw::c_void;
use crate::outputs::c::WlOutput;
/// struct panel_manager*
#[repr(transparent)]
#[derive(Clone, Copy)]
pub struct PanelManager(*const c_void);
extern "C" {
#[allow(improper_ctypes)]
pub fn panel_manager_request_widget(
service: PanelManager,
output: WlOutput,
height: u32,
// for callbacks
panel: Wrapped<Manager>,
);
pub fn panel_manager_resize(service: PanelManager, height: u32);
pub fn panel_manager_hide(service: PanelManager);
}
#[no_mangle]
pub extern "C"
fn squeek_panel_manager_configured(panel: Wrapped<Manager>, width: u32, height: u32) {
// This is why this needs to be moved into state::State:
// it's getting too coupled to glib.
glib::idle_add_local(move || {
let panel = panel.clone_ref();
panel.borrow_mut().set_configured(Size{width, height});
glib::Continue(false)
});
}
}
/// Size in pixels that is aware of scaling
#[derive(Clone, Copy, PartialEq, Debug)]
pub struct PixelSize {
pub pixels: u32,
pub scale_factor: u32,
}
fn div_ceil(a: u32, b: u32) -> u32 {
// Given that it's for pixels on a screen, an overflow is unlikely.
(a + b - 1) / b
}
impl PixelSize {
pub fn as_scaled_floor(&self) -> u32 {
self.pixels / self.scale_factor
}
pub fn as_scaled_ceiling(&self) -> u32 {
div_ceil(self.pixels, self.scale_factor)
}
}
#[derive(Clone, Debug)]
struct Size {
width: u32,
height: u32,
}
/// This state requests the Wayland layer shell protocol synchronization:
/// the application asks for some size,
/// and then receives a size that the compositor thought appropriate.
/// Stores raw values passed to Wayland, i.e. scaled dimensions.
#[derive(Clone, Debug)]
enum State {
Hidden,
SizeRequested {
output: OutputId,
height: u32,
//width: u32,
},
SizeAllocated {
output: OutputId,
wanted_height: u32,
allocated: Size,
},
}
#[derive(Clone, PartialEq, Debug)]
pub enum Command {
Show {
output: OutputId,
height: PixelSize,
},
Hide,
}
/// Tries to contain all the panel sizing duties.
pub struct Manager {
panel: c::PanelManager,
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 {
pub fn new(panel: c::PanelManager) -> Self {
Self {
panel,
state: State::Hidden,
debug: false,
}
}
// TODO: mabe send the allocated size back to state::State,
// to perform layout adjustments
fn set_configured(&mut self, size: Size) {
if self.debug {
eprintln!("Panel received configure {:?}", &size);
}
self.state = match self.state.clone() {
State::Hidden => {
// This may happen if a hide is scheduled immediately after a show.
log_print!(
logging::Level::Surprise,
"Panel has been configured, but no request is pending. Ignoring",
);
State::Hidden
},
State::SizeAllocated{output, wanted_height, ..} => {
log_print!(
logging::Level::Surprise,
"Panel received new configuration without asking",
);
State::SizeAllocated{output, wanted_height, allocated: size}
},
State::SizeRequested{output, height} => State::SizeAllocated {
output,
wanted_height: height,
allocated: 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);
}
(*mgr).state = match (cmd, mgr.state.clone()) {
(Command::Hide, State::Hidden) => State::Hidden,
(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) => {
let height = height.as_scaled_ceiling();
if mgr.debug {
eprintln!("Panel requests widget {:?}", (&output.0, &height));
}
unsafe { c::panel_manager_request_widget(mgr.panel, output.0, height, copied); }
State::SizeRequested{output, height}
},
(
Command::Show{output, height},
State::SizeRequested{output: req_output, height: req_height},
) => {
let height = height.as_scaled_ceiling();
if output == req_output && height == req_height {
State::SizeRequested{output: req_output, height: req_height}
} else if output == req_output {
// I'm not sure about that.
// This could cause a busy loop,
// when two requests are being processed at the same time:
// one message in the compositor to allocate size A,
// causing the state to update to height A'
// the other from the state wanting height B',
// causing the compositor to change size to B.
// 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
// for the purpose of handling it better somehow.
State::SizeRequested{output: req_output, height: req_height}
} else {
if mgr.debug {
eprintln!("Panel requests widget {:?}", (&output.0, &height));
}
// This looks weird, but should be safe.
// The stack seems to handle
// configure events on a dead surface.
unsafe {
c::panel_manager_hide(mgr.panel);
c::panel_manager_request_widget(mgr.panel, output.0, height, copied);
}
State::SizeRequested{output, height}
}
},
(
Command::Show{output, height},
State::SizeAllocated{output: alloc_output, allocated, wanted_height},
) => {
let height = height.as_scaled_ceiling();
if output == alloc_output && height == wanted_height {
State::SizeAllocated{output: alloc_output, wanted_height, allocated}
} else if output == alloc_output && height == allocated.height {
State::SizeAllocated{output: alloc_output, wanted_height: height, allocated}
} else if output == alloc_output {
// Should *all* other heights cause a resize?
// What about those between wanted and allocated?
unsafe { c::panel_manager_resize(mgr.panel, height); }
State::SizeRequested{output, height}
} else {
unsafe {
c::panel_manager_hide(mgr.panel);
c::panel_manager_request_widget(mgr.panel, output.0, height, copied);
}
State::SizeRequested{output, height}
}
},
};
if mgr.debug {
eprintln!("Panel is now {:?}", &(*mgr).state);
}
}
}

View File

@ -1,5 +0,0 @@
#pragma once
/// Popover state.
/// Wrapped<actors::popover::State>
struct squeek_popover;

View File

@ -4,13 +4,11 @@ use gio;
use gtk; use gtk;
use std::ffi::CString; use std::ffi::CString;
use std::cmp::Ordering; use std::cmp::Ordering;
use crate::actors; use ::layout::c::{ Bounds, EekGtkKeyboard };
use crate::layout::c::{ Bounds, EekGtkKeyboard }; use ::locale::{ OwnedTranslation, compare_current_locale };
use crate::locale::{ OwnedTranslation, compare_current_locale }; use ::logging;
use crate::logging; use ::manager;
use crate::receiver; use ::resources;
use crate::resources;
use crate::state;
// Traits // Traits
use gio::prelude::ActionMapExt; use gio::prelude::ActionMapExt;
@ -18,7 +16,7 @@ use gio::prelude::SettingsExt;
use glib::translate::FromGlibPtrNone; use glib::translate::FromGlibPtrNone;
use glib::variant::ToVariant; use glib::variant::ToVariant;
use gtk::prelude::*; use gtk::prelude::*;
use crate::logging::Warn; use ::logging::Warn;
mod c { mod c {
use std::os::raw::c_char; use std::os::raw::c_char;
@ -129,11 +127,9 @@ fn get_settings(schema_name: &str) -> Option<gio::Settings> {
.map(|_sschema| gio::Settings::new(schema_name)) .map(|_sschema| gio::Settings::new(schema_name))
} }
fn set_layout(kind: &str, name: &str) { fn set_layout(kind: String, name: String) {
let settings = get_settings("org.gnome.desktop.input-sources"); let settings = get_settings("org.gnome.desktop.input-sources");
if let Some(settings) = settings { if let Some(settings) = settings {
let kind = String::from(kind);
let name = String::from(name);
#[cfg(feature = "glib_v0_14")] #[cfg(feature = "glib_v0_14")]
let inputs = settings.value("sources"); let inputs = settings.value("sources");
#[cfg(not(feature = "glib_v0_14"))] #[cfg(not(feature = "glib_v0_14"))]
@ -154,7 +150,7 @@ fn set_layout(kind: &str, name: &str) {
/// A reference to what the user wants to see /// A reference to what the user wants to see
#[derive(PartialEq, Clone, Debug)] #[derive(PartialEq, Clone, Debug)]
pub enum LayoutId { enum LayoutId {
/// Affects the layout in system settings /// Affects the layout in system settings
System { System {
kind: String, kind: String,
@ -174,23 +170,40 @@ impl LayoutId {
} }
fn set_visible_layout( fn set_visible_layout(
layout_id: &LayoutId, manager: manager::c::Manager,
layout_id: LayoutId,
) { ) {
match layout_id { match layout_id {
LayoutId::System { kind, name } => { LayoutId::System { kind, name } => {
unsafe {
use std::ptr;
manager::c::eekboard_context_service_set_overlay(
manager,
ptr::null(),
);
}
set_layout(kind, name); set_layout(kind, name);
}
LayoutId::Local(name) => {
let name = CString::new(name.as_str()).unwrap();
let name_ptr = name.as_ptr();
unsafe {
manager::c::eekboard_context_service_set_overlay(
manager,
name_ptr,
)
}
}, },
_ => {},
} }
} }
/// Takes into account first any overlays, then system layouts from the list /// Takes into account first any overlays, then system layouts from the list
fn get_current_layout( fn get_current_layout(
popover: &actors::popover::State, manager: manager::c::Manager,
system_layouts: &Vec<LayoutId>, system_layouts: &Vec<LayoutId>,
) -> Option<LayoutId> { ) -> Option<LayoutId> {
match &popover.overlay { match manager::get_overlay(manager) {
Some(name) => Some(LayoutId::Local(name.into())), Some(name) => Some(LayoutId::Local(name)),
None => system_layouts.get(0).map(LayoutId::clone), None => system_layouts.get(0).map(LayoutId::clone),
} }
} }
@ -208,7 +221,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 = crate::locale::XkbInfo::new(); let xkb_translator = ::locale::XkbInfo::new();
let translated_names = layouts.iter() let translated_names = layouts.iter()
.map(|id| match id { .map(|id| match id {
@ -234,8 +247,7 @@ fn translate_layout_names(layouts: &Vec<LayoutId>) -> Vec<OwnedTranslation> {
pub fn show( pub fn show(
window: EekGtkKeyboard, window: EekGtkKeyboard,
position: Bounds, position: Bounds,
popover: &actors::popover::State, manager: manager::c::Manager,
app_state: receiver::State,
) { ) {
unsafe { gtk::set_initialized() }; unsafe { gtk::set_initialized() };
let window = unsafe { gtk::Widget::from_glib_none(window.0) }; let window = unsafe { gtk::Widget::from_glib_none(window.0) };
@ -315,7 +327,7 @@ pub fn show(
let action_group = gio::SimpleActionGroup::new(); let action_group = gio::SimpleActionGroup::new();
if let Some(current_layout) = get_current_layout(popover, &system_layouts) { if let Some(current_layout) = get_current_layout(manager, &system_layouts) {
let current_layout_name = all_layouts.iter() let current_layout_name = all_layouts.iter()
.find( .find(
|l| l.get_name() == current_layout.get_name() |l| l.get_name() == current_layout.get_name()
@ -344,13 +356,10 @@ pub fn show(
.find( .find(
|choices| state == choices.get_name() |choices| state == choices.get_name()
).unwrap(); ).unwrap();
app_state set_visible_layout(
.send(state::Event::OverlayChanged(layout.clone())) manager,
.or_print( layout.clone(),
logging::Problem::Bug, )
&format!("Can't send to state"),
);
set_visible_layout(layout)
}); });
}, },
None => log_print!( None => log_print!(
@ -364,7 +373,6 @@ 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()) };

Some files were not shown because too many files have changed in this diff Show More