From b84c402c4a6a2a93b1ec41a2365caea10d2af570 Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Sun, 1 Sep 2019 11:38:05 +0000 Subject: [PATCH] WIP WIP WIP: keymap generation test passes meta: Update features and version WiP: cargo.lock WIP: don't crash WIP: no outlines parsing: New tests WIP: base level works WIP: remove old keyboard symbols correctly input WIP: lodaing files WIP: fallback works Valid fallback --- Cargo.lock | 106 ++++ Cargo.toml | 5 + README.md | 10 +- data/keyboards/geometry/compact.xml | 64 --- data/keyboards/symbols/us.xml | 118 ---- data/keyboards/us.yaml | 165 ++++++ data/squeekboard.gresources.xml | 2 - debian/changelog | 7 + eek/eek-gtk-keyboard.c | 3 +- eek/eek-keyboard.c | 145 +---- eek/eek-keyboard.h | 18 +- eek/eek-layout.c | 6 - eek/eek-layout.h | 9 - eek/eek-renderer.c | 45 +- eek/eek-section.c | 56 -- eek/eek-section.h | 34 -- eek/eek-xml-layout.c | 859 +--------------------------- eek/eek-xml-layout.h | 2 +- eek/keymap.h | 31 - eekboard/eekboard-context-service.c | 52 +- eekboard/key-emitter.c | 2 +- meson.build | 2 +- src/data.rs | 483 ++++++++++++++++ src/imservice.rs | 14 +- src/keyboard.rs | 292 +++++----- src/layout.h | 40 +- src/layout.rs | 441 +++++++------- src/lib.rs | 7 + src/meson.build | 2 +- src/resources.rs | 22 + src/symbol.h | 24 - src/symbol.rs | 89 +-- src/util.rs | 3 +- src/xdg.rs | 63 ++ tests/eek-simple-test.c | 45 -- tests/eek-xml-test.c | 55 -- tests/layout.yaml | 17 + tests/layout2.yaml | 12 + tests/layout3.yaml | 16 + tests/meson.build | 2 - tests/test-keymap-generation.c | 19 +- 41 files changed, 1319 insertions(+), 2068 deletions(-) create mode 100644 Cargo.lock delete mode 100644 data/keyboards/geometry/compact.xml delete mode 100644 data/keyboards/symbols/us.xml create mode 100644 data/keyboards/us.yaml delete mode 100644 eek/eek-section.c delete mode 100644 eek/eek-section.h create mode 100644 src/data.rs create mode 100644 src/resources.rs delete mode 100644 src/symbol.h create mode 100644 src/xdg.rs delete mode 100644 tests/eek-simple-test.c delete mode 100644 tests/eek-xml-test.c create mode 100644 tests/layout.yaml create mode 100644 tests/layout2.yaml create mode 100644 tests/layout3.yaml diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000..11011fd6 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,106 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "dtoa" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "linked-hash-map" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proc-macro2" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rs" +version = "0.1.0" +dependencies = [ + "maplit 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_derive" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_yaml" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syn" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "yaml-rust" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" +"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" +"checksum maplit 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" +"checksum proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "175a40b9cf564ce9bf050654633dbf339978706b8ead1a907bb970b63185dd95" +"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" +"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f" +"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425" +"checksum serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "38b08a9a90e5260fe01c6480ec7c811606df6d3a660415808c3c3fa8ed95b582" +"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +"checksum yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d" diff --git a/Cargo.toml b/Cargo.toml index e6e1015c..f86af5c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,11 @@ name = "rs" version = "0.1.0" +[dependencies] +maplit = "1.0" +serde = { version = "1.0", features = ["derive"] } +serde_yaml = "0.8" + [lib] name = "rs" path = "src/lib.rs" diff --git a/README.md b/README.md index aa91d705..9f9ca22e 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,18 @@ *Squeekboard* is a virtual keyboard supporting Wayland, built primarily for the *Librem 5* phone. +It squeaks because some Rust got inside. + Features -------- ### Present - GTK3 -- Custom xml-defined keyboards +- Custom yaml-defined keyboards - DBus interface to show and hide +- Use Wayland input method protocol to show and hide +- Use Wayland virtual keyboard protocol ### Temporarily dropped @@ -18,8 +22,7 @@ Features ### TODO -- Use Wayland virtual keyboard protocol -- Use Wayland text input protocol +- Pick up user-defined layouts - Use Wayland input method protocol - Pick up DBus interface files from /usr/share @@ -38,6 +41,7 @@ $ cd squeekboard $ mkdir ../build $ meson ../build/ $ cd ../build +$ ninja test $ ninja install ``` diff --git a/data/keyboards/geometry/compact.xml b/data/keyboards/geometry/compact.xml deleted file mode 100644 index 43e8ffc2..00000000 --- a/data/keyboards/geometry/compact.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -