diff --git a/Cargo.lock b/Cargo.lock index 1994bfd32..a037b4e33 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "ab_glyph_rasterizer" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13739d7177fbd22bb0ed28badfff9f372f8bef46c863db4e1c6248f6b223b6e" - [[package]] name = "addr2line" version = "0.17.0" @@ -69,19 +63,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "andrew" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c4afb09dd642feec8408e33f92f3ffc4052946f6b20f32fb99c1f58cd4fa7cf" -dependencies = [ - "bitflags", - "rusttype", - "walkdir", - "xdg", - "xml-rs", -] - [[package]] name = "android_log-sys" version = "0.2.0" @@ -325,6 +306,18 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block" version = "0.1.6" @@ -374,9 +367,12 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +dependencies = [ + "serde 1.0.137", +] [[package]] name = "cache-padded" @@ -410,12 +406,12 @@ dependencies = [ [[package]] name = "calloop" -version = "0.6.5" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b036167e76041694579972c28cf4877b4f92da222560ddb49008937b6a6727c" +checksum = "bf2eec61efe56aa1e813f5126959296933cf0700030e4314786c48779a66ab82" dependencies = [ "log", - "nix 0.18.0", + "nix 0.22.3", ] [[package]] @@ -533,7 +529,7 @@ checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b" dependencies = [ "glob", "libc", - "libloading 0.7.3", + "libloading", ] [[package]] @@ -559,13 +555,28 @@ checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b" dependencies = [ "atty", "bitflags", + "clap_derive", "clap_lex", "indexmap", + "lazy_static", "strsim 0.10.0", "termcolor", "textwrap 0.15.0", ] +[[package]] +name = "clap_derive" +version = "3.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c" +dependencies = [ + "heck 0.4.0", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "clap_lex" version = "0.2.0" @@ -965,38 +976,14 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" -[[package]] -name = "darling" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" -dependencies = [ - "darling_core 0.10.2", - "darling_macro 0.10.2", -] - [[package]] name = "darling" version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", -] - -[[package]] -name = "darling_core" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.9.3", - "syn", + "darling_core", + "darling_macro", ] [[package]] @@ -1013,24 +1000,13 @@ dependencies = [ "syn", ] -[[package]] -name = "darling_macro" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" -dependencies = [ - "darling_core 0.10.2", - "quote", - "syn", -] - [[package]] name = "darling_macro" version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", "syn", ] @@ -1165,6 +1141,18 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "default-net" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05e70d471b0ba4e722c85651b3bb04b6880dfdb1224a43ade80c1295314db646" +dependencies = [ + "libc", + "memalloc", + "system-configuration", + "windows", +] + [[package]] name = "deflate" version = "0.8.6" @@ -1195,15 +1183,6 @@ dependencies = [ "dirs-sys-next", ] -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - [[package]] name = "dirs-next" version = "2.0.0" @@ -1214,17 +1193,6 @@ dependencies = [ "dirs-sys-next", ] -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi 0.3.9", -] - [[package]] name = "dirs-sys-next" version = "0.1.2" @@ -1242,22 +1210,13 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" -[[package]] -name = "dlib" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76" -dependencies = [ - "libloading 0.6.7", -] - [[package]] name = "dlib" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" dependencies = [ - "libloading 0.7.3", + "libloading", ] [[package]] @@ -1313,6 +1272,7 @@ name = "enigo" version = "0.0.14" dependencies = [ "core-graphics 0.22.3", + "hbb_common", "libc", "log", "objc", @@ -1382,6 +1342,16 @@ dependencies = [ "str-buf", ] +[[package]] +name = "evdev" +version = "0.11.5" +source = "git+https://github.com/fufesou/evdev#cec616e37790293d2cd2aa54a96601ed6b1b35a9" +dependencies = [ + "bitvec", + "libc", + "nix 0.23.1", +] + [[package]] name = "event-listener" version = "2.5.2" @@ -1553,6 +1523,12 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futures" version = "0.3.21" @@ -2139,19 +2115,21 @@ dependencies = [ "lazy_static", "log", "mac_address", + "machine-uid", "protobuf", - "protobuf-codegen-pure", + "protobuf-codegen", "quinn", "rand 0.8.5", "regex", "serde 1.0.137", "serde_derive", "serde_json 1.0.81", + "serde_with", "socket2 0.3.19", "sodiumoxide", "tokio", "tokio-socks", - "tokio-util 0.6.10", + "tokio-util 0.7.2", "toml", "winapi 0.3.9", "zstd", @@ -2227,6 +2205,19 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "hwcodec" +version = "0.1.0" +source = "git+https://github.com/21pages/hwcodec#890204e0703a3d361fc7a45f035fe75c0575bb1d" +dependencies = [ + "bindgen", + "cc", + "log", + "serde 1.0.137", + "serde_derive", + "serde_json 1.0.81", +] + [[package]] name = "hyper" version = "0.14.19" @@ -2333,6 +2324,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", ] [[package]] @@ -2457,7 +2451,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d83c2227727d7950ada2ae554613d35fd4e55b87f0a29b86d2368267d19b1d99" dependencies = [ "gtk-sys", - "libloading 0.7.3", + "libloading", "once_cell", ] @@ -2476,16 +2470,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "libloading" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" -dependencies = [ - "cfg-if 1.0.0", - "winapi 0.3.9", -] - [[package]] name = "libloading" version = "0.7.3" @@ -2642,6 +2626,12 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "memalloc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df39d232f5c40b0891c10216992c2f250c054105cb1e56f0fc9032db6203ecc1" + [[package]] name = "memchr" version = "2.5.0" @@ -2650,9 +2640,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b70ca2a6103ac8b665dc150b142ef0e4e89df640c9e6cf295d189c3caebe5a" +checksum = "00b6c2ebff6180198788f5db08d7ce3bc1d0b617176678831a7510825973e357" dependencies = [ "libc", ] @@ -2725,19 +2715,6 @@ dependencies = [ "winapi 0.2.8", ] -[[package]] -name = "mio" -version = "0.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" -dependencies = [ - "libc", - "log", - "miow 0.3.7", - "ntapi", - "winapi 0.3.9", -] - [[package]] name = "mio" version = "0.8.3" @@ -2750,18 +2727,6 @@ dependencies = [ "windows-sys 0.36.1", ] -[[package]] -name = "mio-misc" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b47412f3a52115b936ff2a229b803498c7b4d332adeb87c2f1498c9da54c398c" -dependencies = [ - "crossbeam", - "crossbeam-queue", - "log", - "mio 0.7.14", -] - [[package]] name = "mio-named-pipes" version = "0.1.7" @@ -2804,6 +2769,15 @@ dependencies = [ "windows-sys 0.28.0", ] +[[package]] +name = "mouce" +version = "0.2.1" +source = "git+https://github.com/fufesou/mouce.git#26da8d4b0009b7f96996799c2a5c0990a8dbf08b" +dependencies = [ + "glob", + "libc", +] + [[package]] name = "muldiv" version = "0.2.1" @@ -2812,10 +2786,11 @@ checksum = "0419348c027fa7be448d2ae7ea0e4e04c2334c31dc4e74ab29f00a2a7ca69204" [[package]] name = "ndk" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8794322172319b972f528bf90c6b467be0079f1fa82780ffb431088e741a73ab" +checksum = "96d868f654c72e75f8687572699cdabe755f03effbb62542768e995d5b8d699d" dependencies = [ + "bitflags", "jni-sys", "ndk-sys 0.2.2", "num_enum", @@ -2843,15 +2818,16 @@ checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] name = "ndk-glue" -version = "0.3.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5caf0c24d51ac1c905c27d4eda4fa0635bbe0de596b8f79235e0b17a4d29385" +checksum = "c71bee8ea72d685477e28bd004cfe1bf99c754d688cd78cad139eae4089484d4" dependencies = [ "lazy_static", "libc", "log", - "ndk 0.3.0", - "ndk-macro 0.2.0", + "ndk 0.5.0", + "ndk-context", + "ndk-macro", "ndk-sys 0.2.2", ] @@ -2866,30 +2842,17 @@ dependencies = [ "log", "ndk 0.6.0", "ndk-context", - "ndk-macro 0.3.0", + "ndk-macro", "ndk-sys 0.3.0", ] -[[package]] -name = "ndk-macro" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" -dependencies = [ - "darling 0.10.2", - "proc-macro-crate 0.1.5", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "ndk-macro" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" dependencies = [ - "darling 0.13.4", + "darling", "proc-macro-crate 1.1.3", "proc-macro2", "quote", @@ -2922,30 +2885,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "nix" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83450fe6a6142ddd95fb064b746083fc4ef1705fe81f64a64e1d4b39f54a1055" -dependencies = [ - "bitflags", - "cc", - "cfg-if 0.1.10", - "libc", -] - -[[package]] -name = "nix" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" -dependencies = [ - "bitflags", - "cc", - "cfg-if 1.0.0", - "libc", -] - [[package]] name = "nix" version = "0.22.3" @@ -3191,15 +3130,6 @@ version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" -[[package]] -name = "owned_ttf_parser" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f923fb806c46266c02ab4a5b239735c144bdeda724a50ed058e5226f594cde3" -dependencies = [ - "ttf-parser", -] - [[package]] name = "padlock" version = "0.2.0" @@ -3509,60 +3439,56 @@ dependencies = [ [[package]] name = "protobuf" -version = "3.0.0-alpha.2" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5ef59c35c7472ce5e1b6c5924b87585143d1fc2cf39eae0009bba6c4df62f1" +checksum = "4ee4a7d8b91800c8f167a6268d1a1026607368e1adc84e98fe044aeb905302f7" +dependencies = [ + "bytes", + "once_cell", + "protobuf-support", + "thiserror", +] [[package]] name = "protobuf-codegen" -version = "3.0.0-alpha.2" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89100ee819f69b77a4cab389fec9dd155a305af4c615e6413ec1ef9341f333ef" +checksum = "07b893e5e7d3395545d5244f8c0d33674025bd566b26c03bfda49b82c6dec45e" dependencies = [ "anyhow", + "once_cell", "protobuf", "protobuf-parse", - "thiserror", -] - -[[package]] -name = "protobuf-codegen-pure" -version = "3.0.0-alpha.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79453e74d08190551e821533ee42c447f9e21ca26f83520e120e6e8af27f6879" -dependencies = [ - "anyhow", - "protobuf", - "protobuf-codegen", - "protobuf-parse", - "thiserror", -] - -[[package]] -name = "protobuf-parse" -version = "3.0.0-alpha.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c265ffc69976efc3056955b881641add3186ad0be893ef10622482d80d1d2b68" -dependencies = [ - "anyhow", - "protobuf", - "protoc", + "regex", "tempfile", "thiserror", ] [[package]] -name = "protoc" -version = "3.0.0-alpha.2" +name = "protobuf-parse" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f1f8b318a54d18fbe542513331e058f4f8ce6502e542e057c50c7e5e803fdab" +checksum = "9b1447dd751c434cc1b415579837ebd0411ed7d67d465f38010da5d7cd33af4d" dependencies = [ "anyhow", + "indexmap", "log", + "protobuf", + "protobuf-support", + "tempfile", "thiserror", "which 4.2.5", ] +[[package]] +name = "protobuf-support" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca157fe12fc7ee2e315f2f735e27df41b3d97cdd70ea112824dac1ffb08ee1c" +dependencies = [ + "thiserror", +] + [[package]] name = "quest" version = "0.3.0" @@ -3638,6 +3564,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.6.5" @@ -3774,16 +3706,6 @@ dependencies = [ "rand_core 0.3.1", ] -[[package]] -name = "raw-window-handle" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28f55143d0548dad60bb4fbdc835a3d7ac6acc3324506450c5fdd6e42903a76" -dependencies = [ - "libc", - "raw-window-handle 0.4.3", -] - [[package]] name = "raw-window-handle" version = "0.4.3" @@ -3972,13 +3894,11 @@ dependencies = [ [[package]] name = "rpassword" -version = "6.0.1" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf099a1888612545b683d2661a1940089f6c2e5a8e38979b2159da876bfd956" +checksum = "26b763cb66df1c928432cc35053f8bd4cec3335d8559fc16010017d16b3c1680" dependencies = [ "libc", - "serde 1.0.137", - "serde_json 1.0.81", "winapi 0.3.9", ] @@ -4042,6 +3962,7 @@ dependencies = [ "async-process", "async-trait", "base64", + "bytes", "cc", "cfg-if 1.0.0", "clap 3.1.18", @@ -4052,8 +3973,10 @@ dependencies = [ "cpal", "ctrlc", "dasp", + "default-net", "dispatch", "enigo", + "evdev", "flexi_logger", "flutter_rust_bridge", "flutter_rust_bridge_codegen", @@ -4068,13 +3991,14 @@ dependencies = [ "mac_address", "machine-uid", "magnum-opus", + "mouce", "num_cpus", "objc", "parity-tokio-ipc", "rdev", "repng", "reqwest", - "rpassword 6.0.1", + "rpassword 7.0.0", "rubato", "runas", "rust-pulsectl", @@ -4088,6 +4012,7 @@ dependencies = [ "simple_rc", "sys-locale", "sysinfo", + "system_shutdown", "tray-item", "trayicon", "uuid", @@ -4098,6 +4023,7 @@ dependencies = [ "winit", "winreg 0.10.1", "winres", + "wol-rs", ] [[package]] @@ -4165,16 +4091,6 @@ dependencies = [ "base64", ] -[[package]] -name = "rusttype" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc7c727aded0be18c5b80c1640eae0ac8e396abf6fa8477d96cb37d18ee5ec59" -dependencies = [ - "ab_glyph_rasterizer", - "owned_ttf_parser", -] - [[package]] name = "rustversion" version = "1.0.6" @@ -4251,6 +4167,8 @@ dependencies = [ "gstreamer", "gstreamer-app", "gstreamer-video", + "hbb_common", + "hwcodec", "jni", "lazy_static", "libc", @@ -4387,6 +4305,28 @@ dependencies = [ "serde 1.0.137", ] +[[package]] +name = "serde_with" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" +dependencies = [ + "serde 1.0.137", + "serde_with_macros", +] + +[[package]] +name = "serde_with_macros" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "serde_yaml" version = "0.8.24" @@ -4472,18 +4412,18 @@ checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] name = "smithay-client-toolkit" -version = "0.12.3" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4750c76fd5d3ac95fa3ed80fe667d6a3d8590a960e5b575b98eea93339a80b80" +checksum = "8a28f16a97fa0e8ce563b2774d1e732dd5d4025d2772c5dba0a41a0f90a29da3" dependencies = [ - "andrew", "bitflags", "calloop", - "dlib 0.4.2", + "dlib", "lazy_static", "log", "memmap2", - "nix 0.18.0", + "nix 0.22.3", + "pkg-config", "wayland-client", "wayland-cursor", "wayland-protocols", @@ -4552,12 +4492,6 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -[[package]] -name = "strsim" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" - [[package]] name = "strsim" version = "0.10.0" @@ -4644,9 +4578,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.23.13" +version = "0.24.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3977ec2e0520829be45c8a2df70db2bf364714d8a748316a10c3c35d4d2b01c9" +checksum = "54cb4ebf3d49308b99e6e9dc95e989e2fdbdc210e4f67c39db0bb89ba927001c" dependencies = [ "cfg-if 1.0.0", "core-foundation-sys 0.8.3", @@ -4657,6 +4591,27 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "system-configuration" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75182f12f490e953596550b65ee31bda7c8e043d9386174b353bda50838c3fd" +dependencies = [ + "bitflags", + "core-foundation 0.9.3", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys 0.8.3", + "libc", +] + [[package]] name = "system-deps" version = "1.3.2" @@ -4685,6 +4640,21 @@ dependencies = [ "version-compare 0.1.0", ] +[[package]] +name = "system_shutdown" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "035e081d603551d8d78db27d2232913269c749ea67648c369100049820406a14" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "target_build_utils" version = "0.3.1" @@ -4818,10 +4788,11 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.18.2" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4903bf0427cf68dddd5aa6a93220756f8be0c34fcfa9f5e6191e103e15a31395" +checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581" dependencies = [ + "autocfg 1.1.0", "bytes", "libc", "memchr", @@ -4882,11 +4853,9 @@ checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" dependencies = [ "bytes", "futures-core", - "futures-io", "futures-sink", "log", "pin-project-lite", - "slab", "tokio", ] @@ -4898,8 +4867,11 @@ checksum = "f988a1a1adc2fb21f9c12aa96441da33a1728193ae0b95d2be22dbd17fcb4e5c" dependencies = [ "bytes", "futures-core", + "futures-io", "futures-sink", + "futures-util", "pin-project-lite", + "slab", "tokio", "tracing", ] @@ -4981,9 +4953,8 @@ dependencies = [ [[package]] name = "trayicon" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c367fd7cdcdf19234aa104f7e03abe1be526018e4282af9f275bf436b9c9ad23" +version = "0.1.3-1" +source = "git+https://github.com/open-trade/trayicon-rs#8d9c4489287752cc5be4a35c103198f7111112f9" dependencies = [ "winapi 0.3.9", "winit", @@ -4995,12 +4966,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" -[[package]] -name = "ttf-parser" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e5d7cd7ab3e47dda6e56542f4bbf3824c15234958c6e1bd6aaa347e93499fdc" - [[package]] name = "typenum" version = "1.15.0" @@ -5222,14 +5187,14 @@ checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" [[package]] name = "wayland-client" -version = "0.28.6" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ab332350e502f159382201394a78e3cc12d0f04db863429260164ea40e0355" +checksum = "91223460e73257f697d9e23d401279123d36039a3f7a449e983f123292d4458f" dependencies = [ "bitflags", "downcast-rs", "libc", - "nix 0.20.0", + "nix 0.22.3", "scoped-tls", "wayland-commons", "wayland-scanner", @@ -5238,11 +5203,11 @@ dependencies = [ [[package]] name = "wayland-commons" -version = "0.28.6" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21817947c7011bbd0a27e11b17b337bfd022e8544b071a2641232047966fbda" +checksum = "94f6e5e340d7c13490eca867898c4cec5af56c27a5ffe5c80c6fc4708e22d33e" dependencies = [ - "nix 0.20.0", + "nix 0.22.3", "once_cell", "smallvec", "wayland-sys", @@ -5250,20 +5215,20 @@ dependencies = [ [[package]] name = "wayland-cursor" -version = "0.28.6" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be610084edd1586d45e7bdd275fe345c7c1873598caa464c4fb835dee70fa65a" +checksum = "c52758f13d5e7861fc83d942d3d99bf270c83269575e52ac29e5b73cb956a6bd" dependencies = [ - "nix 0.20.0", + "nix 0.22.3", "wayland-client", "xcursor", ] [[package]] name = "wayland-protocols" -version = "0.28.6" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "286620ea4d803bacf61fa087a4242ee316693099ee5a140796aaba02b29f861f" +checksum = "60147ae23303402e41fe034f74fb2c35ad0780ee88a1c40ac09a3be1e7465741" dependencies = [ "bitflags", "wayland-client", @@ -5273,9 +5238,9 @@ dependencies = [ [[package]] name = "wayland-scanner" -version = "0.28.6" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce923eb2deb61de332d1f356ec7b6bf37094dc5573952e1c8936db03b54c03f1" +checksum = "39a1ed3143f7a143187156a2ab52742e89dac33245ba505c17224df48939f9e0" dependencies = [ "proc-macro2", "quote", @@ -5284,11 +5249,11 @@ dependencies = [ [[package]] name = "wayland-sys" -version = "0.28.6" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d841fca9aed7febf9bed2e9796c49bf58d4152ceda8ac949ebe00868d8f0feb8" +checksum = "d9341df79a8975679188e37dab3889bfa57c44ac2cb6da166f519a81cbe452d4" dependencies = [ - "dlib 0.5.0", + "dlib", "lazy_static", "pkg-config", ] @@ -5444,6 +5409,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b749ebd2304aa012c5992d11a25d07b406bdbe5f79d371cb7a918ce501a19eb0" +dependencies = [ + "windows_aarch64_msvc 0.30.0", + "windows_i686_gnu 0.30.0", + "windows_i686_msvc 0.30.0", + "windows_x86_64_gnu 0.30.0", + "windows_x86_64_msvc 0.30.0", +] + [[package]] name = "windows-service" version = "0.4.0" @@ -5488,6 +5466,12 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52695a41e536859d5308cc613b4a022261a274390b25bd29dfff4bf08505f3c2" +[[package]] +name = "windows_aarch64_msvc" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29277a4435d642f775f63c7d1faeb927adba532886ce0287bd985bffb16b6bca" + [[package]] name = "windows_aarch64_msvc" version = "0.36.1" @@ -5500,6 +5484,12 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f54725ac23affef038fecb177de6c9bf065787c2f432f79e3c373da92f3e1d8a" +[[package]] +name = "windows_i686_gnu" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1145e1989da93956c68d1864f32fb97c8f561a8f89a5125f6a2b7ea75524e4b8" + [[package]] name = "windows_i686_gnu" version = "0.36.1" @@ -5512,6 +5502,12 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d5158a43cc43623c0729d1ad6647e62fa384a3d135fd15108d37c683461f64" +[[package]] +name = "windows_i686_msvc" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a09e3a0d4753b73019db171c1339cd4362c8c44baf1bcea336235e955954a6" + [[package]] name = "windows_i686_msvc" version = "0.36.1" @@ -5524,6 +5520,12 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc31f409f565611535130cfe7ee8e6655d3fa99c1c61013981e491921b5ce954" +[[package]] +name = "windows_x86_64_gnu" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca64fcb0220d58db4c119e050e7af03c69e6f4f415ef69ec1773d9aab422d5a" + [[package]] name = "windows_x86_64_gnu" version = "0.36.1" @@ -5536,6 +5538,12 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f2b8c7cbd3bfdddd9ab98769f9746a7fad1bca236554cd032b78d768bc0e89f" +[[package]] +name = "windows_x86_64_msvc" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08cabc9f0066848fef4bc6a1c1668e6efce38b661d2aeec75d18d8617eebb5f1" + [[package]] name = "windows_x86_64_msvc" version = "0.36.1" @@ -5544,9 +5552,9 @@ checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] name = "winit" -version = "0.25.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79610794594d5e86be473ef7763f604f2159cbac8c94debd00df8fb41e86c2f8" +checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a" dependencies = [ "bitflags", "cocoa 0.24.0", @@ -5558,18 +5566,19 @@ dependencies = [ "lazy_static", "libc", "log", - "mio 0.7.14", - "mio-misc", - "ndk 0.3.0", - "ndk-glue 0.3.0", + "mio 0.8.3", + "ndk 0.5.0", + "ndk-glue 0.5.2", "ndk-sys 0.2.2", "objc", "parking_lot 0.11.2", "percent-encoding", - "raw-window-handle 0.3.4", - "scopeguard", + "raw-window-handle", "smithay-client-toolkit", + "wasm-bindgen", "wayland-client", + "wayland-protocols", + "web-sys", "winapi 0.3.9", "x11-dl", ] @@ -5601,6 +5610,15 @@ dependencies = [ "toml", ] +[[package]] +name = "wol-rs" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7f97e69b28b256ccfb02472c25057132e234aa8368fea3bb0268def564ce1f2" +dependencies = [ + "clap 3.1.18", +] + [[package]] name = "ws2_32-sys" version = "0.2.1" @@ -5611,6 +5629,15 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "wyz" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +dependencies = [ + "tap", +] + [[package]] name = "x11" version = "2.19.1" @@ -5653,15 +5680,6 @@ dependencies = [ "nom", ] -[[package]] -name = "xdg" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6" -dependencies = [ - "dirs", -] - [[package]] name = "xml-rs" version = "0.8.4" diff --git a/flutter/lib/desktop/pages/connection_page.dart b/flutter/lib/desktop/pages/connection_page.dart index fe11857f3..628f962a2 100644 --- a/flutter/lib/desktop/pages/connection_page.dart +++ b/flutter/lib/desktop/pages/connection_page.dart @@ -17,7 +17,7 @@ import '../../mobile/pages/scan_page.dart'; import '../../mobile/pages/settings_page.dart'; import '../../models/model.dart'; -enum RemoteType { recently, favorite, discovered, addressBook } +// enum RemoteType { recently, favorite, discovered, addressBook } /// Connection page for connecting to a remote peer. class ConnectionPage extends StatefulWidget implements PageShape { @@ -76,74 +76,57 @@ class _ConnectionPageState extends State { thickness: 1, ), Expanded( - child: DefaultTabController( - length: 4, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - TabBar( - isScrollable: true, - indicatorSize: TabBarIndicatorSize.label, - tabs: [ - Tab( - child: Text(translate("Recent Sessions")), - ), - Tab( - child: Text(translate("Favorites")), - ), - Tab( - child: Text(translate("Discovered")), - ), - Tab( - child: Text(translate("Address Book")), - ), - ]), - Expanded( - child: TabBarView(children: [ - RecentPeerWidget(), - FavoritePeerWidget(), - DiscoveredPeerWidget(), - // AddressBookPeerWidget(), - // FutureBuilder( - // future: getPeers(rType: RemoteType.recently), - // builder: (context, snapshot) { - // if (snapshot.hasData) { - // return snapshot.data!; - // } else { - // return Offstage(); - // } - // }), - // FutureBuilder( - // future: getPeers(rType: RemoteType.favorite), - // builder: (context, snapshot) { - // if (snapshot.hasData) { - // return snapshot.data!; - // } else { - // return Offstage(); - // } - // }), - // FutureBuilder( - // future: getPeers(rType: RemoteType.discovered), - // builder: (context, snapshot) { - // if (snapshot.hasData) { - // return snapshot.data!; - // } else { - // return Offstage(); - // } - // }), - FutureBuilder( - future: buildAddressBook(context), - builder: (context, snapshot) { - if (snapshot.hasData) { - return snapshot.data!; - } else { - return Offstage(); - } - }), - ]).paddingSymmetric(horizontal: 12.0, vertical: 4.0)) - ], - )), - ), + // TODO: move all tab info into _PeerTabbedPage + child: _PeerTabbedPage( + tabs: [ + translate('Recent Sessions'), + translate('Favorites'), + translate('Discovered'), + translate('Address Book') + ], + children: [ + RecentPeerWidget(), + FavoritePeerWidget(), + DiscoveredPeerWidget(), + // AddressBookPeerWidget(), + // FutureBuilder( + // future: getPeers(rType: RemoteType.recently), + // builder: (context, snapshot) { + // if (snapshot.hasData) { + // return snapshot.data!; + // } else { + // return Offstage(); + // } + // }), + // FutureBuilder( + // future: getPeers(rType: RemoteType.favorite), + // builder: (context, snapshot) { + // if (snapshot.hasData) { + // return snapshot.data!; + // } else { + // return Offstage(); + // } + // }), + // FutureBuilder( + // future: getPeers(rType: RemoteType.discovered), + // builder: (context, snapshot) { + // if (snapshot.hasData) { + // return snapshot.data!; + // } else { + // return Offstage(); + // } + // }), + FutureBuilder( + future: buildAddressBook(context), + builder: (context, snapshot) { + if (snapshot.hasData) { + return snapshot.data!; + } else { + return Offstage(); + } + }), + ], + )), Divider(), SizedBox(height: 50, child: Obx(() => buildStatus())) .paddingSymmetric(horizontal: 12.0) @@ -329,61 +312,61 @@ class _ConnectionPageState extends State { return true; } - /// Show the peer menu and handle user's choice. - /// User might remove the peer or send a file to the peer. - void showPeerMenu(BuildContext context, String id, RemoteType rType) async { - var items = [ - PopupMenuItem( - child: Text(translate('Connect')), value: 'connect'), - PopupMenuItem( - child: Text(translate('Transfer File')), value: 'file'), - PopupMenuItem( - child: Text(translate('TCP Tunneling')), value: 'tcp-tunnel'), - PopupMenuItem(child: Text(translate('Rename')), value: 'rename'), - rType == RemoteType.addressBook - ? PopupMenuItem( - child: Text(translate('Remove')), value: 'ab-delete') - : PopupMenuItem( - child: Text(translate('Remove')), value: 'remove'), - PopupMenuItem( - child: Text(translate('Unremember Password')), - value: 'unremember-password'), - ]; - if (rType == RemoteType.favorite) { - items.add(PopupMenuItem( - child: Text(translate('Remove from Favorites')), - value: 'remove-fav')); - } else if (rType != RemoteType.addressBook) { - items.add(PopupMenuItem( - child: Text(translate('Add to Favorites')), value: 'add-fav')); - } else { - items.add(PopupMenuItem( - child: Text(translate('Edit Tag')), value: 'ab-edit-tag')); - } - var value = await showMenu( - context: context, - position: this._menuPos, - items: items, - elevation: 8, - ); - if (value == 'remove') { - setState(() => gFFI.setByName('remove', '$id')); - () async { - removePreference(id); - }(); - } else if (value == 'file') { - connect(id, isFileTransfer: true); - } else if (value == 'add-fav') { - } else if (value == 'connect') { - connect(id, isFileTransfer: false); - } else if (value == 'ab-delete') { - gFFI.abModel.deletePeer(id); - await gFFI.abModel.updateAb(); - setState(() {}); - } else if (value == 'ab-edit-tag') { - abEditTag(id); - } - } + // /// Show the peer menu and handle user's choice. + // /// User might remove the peer or send a file to the peer. + // void showPeerMenu(BuildContext context, String id, RemoteType rType) async { + // var items = [ + // PopupMenuItem( + // child: Text(translate('Connect')), value: 'connect'), + // PopupMenuItem( + // child: Text(translate('Transfer File')), value: 'file'), + // PopupMenuItem( + // child: Text(translate('TCP Tunneling')), value: 'tcp-tunnel'), + // PopupMenuItem(child: Text(translate('Rename')), value: 'rename'), + // rType == RemoteType.addressBook + // ? PopupMenuItem( + // child: Text(translate('Remove')), value: 'ab-delete') + // : PopupMenuItem( + // child: Text(translate('Remove')), value: 'remove'), + // PopupMenuItem( + // child: Text(translate('Unremember Password')), + // value: 'unremember-password'), + // ]; + // if (rType == RemoteType.favorite) { + // items.add(PopupMenuItem( + // child: Text(translate('Remove from Favorites')), + // value: 'remove-fav')); + // } else if (rType != RemoteType.addressBook) { + // items.add(PopupMenuItem( + // child: Text(translate('Add to Favorites')), value: 'add-fav')); + // } else { + // items.add(PopupMenuItem( + // child: Text(translate('Edit Tag')), value: 'ab-edit-tag')); + // } + // var value = await showMenu( + // context: context, + // position: this._menuPos, + // items: items, + // elevation: 8, + // ); + // if (value == 'remove') { + // setState(() => gFFI.setByName('remove', '$id')); + // () async { + // removePreference(id); + // }(); + // } else if (value == 'file') { + // connect(id, isFileTransfer: true); + // } else if (value == 'add-fav') { + // } else if (value == 'connect') { + // connect(id, isFileTransfer: false); + // } else if (value == 'ab-delete') { + // gFFI.abModel.deletePeer(id); + // await gFFI.abModel.updateAb(); + // setState(() {}); + // } else if (value == 'ab-edit-tag') { + // abEditTag(id); + // } + // } var svcStopped = false.obs; var svcStatusCode = 0.obs; @@ -896,3 +879,86 @@ class _WebMenuState extends State { }); } } + +class _PeerTabbedPage extends StatefulWidget { + final List tabs; + final List children; + const _PeerTabbedPage({required this.tabs, required this.children, Key? key}) + : super(key: key); + @override + _PeerTabbedPageState createState() => _PeerTabbedPageState(); +} + +class _PeerTabbedPageState extends State<_PeerTabbedPage> + with SingleTickerProviderStateMixin { + late TabController _tabController; + + @override + void initState() { + super.initState(); + _tabController = + TabController(vsync: this, length: super.widget.tabs.length); + _tabController.addListener(_handleTabSelection); + } + + // hard code for now + void _handleTabSelection() { + if (_tabController.indexIsChanging) { + switch (_tabController.index) { + case 0: + break; + case 1: + break; + case 2: + gFFI.bind.mainDiscover(); + break; + case 3: + break; + } + } + } + + @override + void dispose() { + _tabController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + // return DefaultTabController( + // length: 4, + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // _createTabBar(), + // _createTabBarView(), + // ], + // )); + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _createTabBar(), + _createTabBarView(), + ], + ); + } + + Widget _createTabBar() { + return TabBar( + isScrollable: true, + indicatorSize: TabBarIndicatorSize.label, + controller: _tabController, + tabs: super.widget.tabs.map((t) { + return Tab(child: Text(t)); + }).toList()); + } + + Widget _createTabBarView() { + return Expanded( + child: TabBarView( + controller: _tabController, children: super.widget.children) + .paddingSymmetric(horizontal: 12.0, vertical: 4.0)); + } +} diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index e0a4fa563..3e4810c0e 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -296,6 +296,7 @@ class _RemotePageState extends State Widget getRawPointerAndKeyBody(bool keyboard, Widget child) { return Listener( onPointerHover: (e) { + debugPrint("onPointerHover ${e}"); if (e.kind != ui.PointerDeviceKind.mouse) return; if (!_isPhysicalMouse) { setState(() { @@ -307,6 +308,7 @@ class _RemotePageState extends State } }, onPointerDown: (e) { + debugPrint("onPointerDown ${e}"); if (e.kind != ui.PointerDeviceKind.mouse) { if (_isPhysicalMouse) { setState(() { @@ -319,18 +321,21 @@ class _RemotePageState extends State } }, onPointerUp: (e) { + debugPrint("onPointerUp ${e}"); if (e.kind != ui.PointerDeviceKind.mouse) return; if (_isPhysicalMouse) { _ffi.handleMouse(getEvent(e, 'mouseup')); } }, onPointerMove: (e) { + debugPrint("onPointerMove ${e}"); if (e.kind != ui.PointerDeviceKind.mouse) return; if (_isPhysicalMouse) { _ffi.handleMouse(getEvent(e, 'mousemove')); } }, onPointerSignal: (e) { + debugPrint("onPointerSignal ${e}"); if (e is PointerScrollEvent) { var dx = e.scrollDelta.dx; var dy = e.scrollDelta.dy; diff --git a/flutter/lib/desktop/widgets/peer_widget.dart b/flutter/lib/desktop/widgets/peer_widget.dart index 42cb8eb1d..45e2953eb 100644 --- a/flutter/lib/desktop/widgets/peer_widget.dart +++ b/flutter/lib/desktop/widgets/peer_widget.dart @@ -15,15 +15,13 @@ typedef OffstageFunc = bool Function(Peer peer); typedef PeerCardWidgetFunc = Widget Function(Peer peer); class _PeerWidget extends StatefulWidget { - late final _name; late final _peers; late final OffstageFunc _offstageFunc; late final PeerCardWidgetFunc _peerCardWidgetFunc; - _PeerWidget(String name, List peers, OffstageFunc offstageFunc, + _PeerWidget(Peers peers, OffstageFunc offstageFunc, PeerCardWidgetFunc peerCardWidgetFunc, {Key? key}) : super(key: key) { - _name = name; _peers = peers; _offstageFunc = offstageFunc; _peerCardWidgetFunc = peerCardWidgetFunc; @@ -70,7 +68,7 @@ class _PeerWidgetState extends State<_PeerWidget> with WindowListener { Widget build(BuildContext context) { final space = 8.0; return ChangeNotifierProvider( - create: (context) => Peers(super.widget._name, super.widget._peers), + create: (context) => super.widget._peers, child: SingleChildScrollView( child: Consumer( builder: (context, peers, child) => Wrap( @@ -136,83 +134,69 @@ class _PeerWidgetState extends State<_PeerWidget> with WindowListener { abstract class BasePeerWidget extends StatelessWidget { late final _name; + late final _loadEvent; late final OffstageFunc _offstageFunc; late final PeerCardWidgetFunc _peerCardWidgetFunc; + late final List _initPeers; BasePeerWidget({Key? key}) : super(key: key) {} @override Widget build(BuildContext context) { - return FutureBuilder(future: () async { - return _PeerWidget( - _name, await _loadPeers(), _offstageFunc, _peerCardWidgetFunc); - }(), builder: (context, snapshot) { - if (snapshot.hasData) { - return snapshot.data!; - } else { - return Offstage(); - } - }); + return _PeerWidget(Peers(_name, _loadEvent, _initPeers), _offstageFunc, + _peerCardWidgetFunc); } - - @protected - Future> _loadPeers(); } class RecentPeerWidget extends BasePeerWidget { RecentPeerWidget({Key? key}) : super(key: key) { super._name = "recent peer"; + super._loadEvent = "load_recent_peers"; super._offstageFunc = (Peer _peer) => false; super._peerCardWidgetFunc = (Peer peer) => RecentPeerCard(peer: peer); + super._initPeers = []; } - Future> _loadPeers() async { - debugPrint("call RecentPeerWidget _loadPeers"); - return gFFI.peers(); + @override + Widget build(BuildContext context) { + final widget = super.build(context); + gFFI.bind.mainLoadRecentPeers(); + return widget; } } class FavoritePeerWidget extends BasePeerWidget { FavoritePeerWidget({Key? key}) : super(key: key) { super._name = "favorite peer"; + super._loadEvent = "load_fav_peers"; super._offstageFunc = (Peer _peer) => false; super._peerCardWidgetFunc = (Peer peer) => FavoritePeerCard(peer: peer); + super._initPeers = []; } @override - Future> _loadPeers() async { - debugPrint("call FavoritePeerWidget _loadPeers"); - return await gFFI.bind.mainGetFav().then((peers) async { - final peersEntities = await Future.wait(peers - .map((id) => gFFI.bind.mainGetPeers(id: id)) - .toList(growable: false)) - .then((peers_str) { - final len = peers_str.length; - final ps = List.empty(growable: true); - for (var i = 0; i < len; i++) { - print("${peers[i]}: ${peers_str[i]}"); - ps.add(Peer.fromJson(peers[i], jsonDecode(peers_str[i])['info'])); - } - return ps; - }); - return peersEntities; - }); + Widget build(BuildContext context) { + final widget = super.build(context); + gFFI.bind.mainLoadFavPeers(); + return widget; } } class DiscoveredPeerWidget extends BasePeerWidget { DiscoveredPeerWidget({Key? key}) : super(key: key) { super._name = "discovered peer"; + super._loadEvent = "load_lan_peers"; super._offstageFunc = (Peer _peer) => false; super._peerCardWidgetFunc = (Peer peer) => DiscoveredPeerCard(peer: peer); + super._initPeers = []; } - Future> _loadPeers() async { - debugPrint("call DiscoveredPeerWidget _loadPeers"); - return await gFFI.bind.mainGetLanPeers().then((peers_string) { - debugPrint(peers_string); - return []; - }); + @override + Widget build(BuildContext context) { + debugPrint("DiscoveredPeerWidget build"); + final widget = super.build(context); + gFFI.bind.mainLoadLanPeers(); + return widget; } } @@ -222,10 +206,10 @@ class AddressBookPeerWidget extends BasePeerWidget { super._offstageFunc = (Peer peer) => !_hitTag(gFFI.abModel.selectedTags, peer.tags); super._peerCardWidgetFunc = (Peer peer) => AddressBookPeerCard(peer: peer); + super._initPeers = _loadPeers(); } - Future> _loadPeers() async { - debugPrint("call AddressBookPeerWidget _loadPeers"); + List _loadPeers() { return gFFI.abModel.peers.map((e) { return Peer.fromJson(e['id'], e); }).toList(); diff --git a/flutter/lib/mobile/pages/remote_page.dart b/flutter/lib/mobile/pages/remote_page.dart index 23900ef07..df1a91a79 100644 --- a/flutter/lib/mobile/pages/remote_page.dart +++ b/flutter/lib/mobile/pages/remote_page.dart @@ -125,10 +125,10 @@ class _RemotePageState extends State { oldValue = oldValue.substring(j + 1); var common = 0; for (; - common < oldValue.length && - common < newValue.length && - newValue[common] == oldValue[common]; - ++common) {} + common < oldValue.length && + common < newValue.length && + newValue[common] == oldValue[common]; + ++common) {} for (i = 0; i < oldValue.length - common; ++i) { gFFI.inputKey('VK_BACK'); } @@ -235,13 +235,13 @@ class _RemotePageState extends State { floatingActionButton: !showActionButton ? null : FloatingActionButton( - mini: !hideKeyboard, - child: Icon( - hideKeyboard ? Icons.expand_more : Icons.expand_less), - backgroundColor: MyTheme.accent, - onPressed: () { - setState(() { - if (hideKeyboard) { + mini: !hideKeyboard, + child: Icon( + hideKeyboard ? Icons.expand_more : Icons.expand_less), + backgroundColor: MyTheme.accent, + onPressed: () { + setState(() { + if (hideKeyboard) { _showEdit = false; gFFI.invokeMethod("enable_soft_keyboard", false); _mobileFocusNode.unfocus(); @@ -250,7 +250,7 @@ class _RemotePageState extends State { _showBar = !_showBar; } }); - }), + }), bottomNavigationBar: _showBar && pi.displays.length > 0 ? getBottomAppBar(keyboard) : null, @@ -262,7 +262,7 @@ class _RemotePageState extends State { child: isWebDesktop ? getBodyForDesktopWithListener(keyboard) : SafeArea(child: - OrientationBuilder(builder: (ctx, orientation) { + OrientationBuilder(builder: (ctx, orientation) { if (_currentOrientation != orientation) { Timer(Duration(milliseconds: 200), () { resetMobileActionsOverlay(); @@ -271,10 +271,10 @@ class _RemotePageState extends State { }); } return Container( - color: MyTheme.canvasColor, - child: _isPhysicalMouse - ? getBodyForMobile() - : getBodyForMobileWithGesture()); + color: MyTheme.canvasColor, + child: _isPhysicalMouse + ? getBodyForMobile() + : getBodyForMobileWithGesture()); }))); }) ], @@ -395,14 +395,14 @@ class _RemotePageState extends State { children: [ Row( children: [ - IconButton( - color: Colors.white, - icon: Icon(Icons.clear), - onPressed: () { - clientClose(); - }, - ) - ] + + IconButton( + color: Colors.white, + icon: Icon(Icons.clear), + onPressed: () { + clientClose(); + }, + ) + ] + [ IconButton( color: Colors.white, @@ -441,20 +441,20 @@ class _RemotePageState extends State { : Icons.mouse), onPressed: changeTouchMode, ), - ]) + + ]) + (isWeb ? [] : [ - IconButton( - color: Colors.white, - icon: Icon(Icons.message), - onPressed: () { + IconButton( + color: Colors.white, + icon: Icon(Icons.message), + onPressed: () { gFFI.chatModel .changeCurrentID(ChatModel.clientModeID); toggleChatOverlay(); }, - ) - ]) + + ) + ]) + [ IconButton( color: Colors.white, @@ -602,17 +602,17 @@ class _RemotePageState extends State { child: !_showEdit ? Container() : TextFormField( - textInputAction: TextInputAction.newline, - autocorrect: false, - enableSuggestions: false, - autofocus: true, - focusNode: _mobileFocusNode, - maxLines: null, - initialValue: _value, - // trick way to make backspace work always - keyboardType: TextInputType.multiline, - onChanged: handleInput, - ), + textInputAction: TextInputAction.newline, + autocorrect: false, + enableSuggestions: false, + autofocus: true, + focusNode: _mobileFocusNode, + maxLines: null, + initialValue: _value, + // trick way to make backspace work always + keyboardType: TextInputType.multiline, + onChanged: handleInput, + ), ), ])); } @@ -697,7 +697,7 @@ class _RemotePageState extends State { value: 'block-input')); } } - () async { + () async { var value = await showMenu( context: context, position: RelativeRect.fromLTRB(x, y, x, y), @@ -715,7 +715,7 @@ class _RemotePageState extends State { } else if (value == 'refresh') { gFFI.setByName('refresh'); } else if (value == 'paste') { - () async { + () async { ClipboardData? data = await Clipboard.getData(Clipboard.kTextPlain); if (data != null && data.text != null) { gFFI.setByName('input_string', '${data.text}'); @@ -803,25 +803,25 @@ class _RemotePageState extends State { final keys = [ wrap( ' Fn ', - () => setState( + () => setState( () { - _fn = !_fn; - if (_fn) { - _more = false; - } - }, - ), + _fn = !_fn; + if (_fn) { + _more = false; + } + }, + ), _fn), wrap( ' ... ', - () => setState( + () => setState( () { - _more = !_more; - if (_more) { - _fn = false; - } - }, - ), + _more = !_more; + if (_more) { + _fn = false; + } + }, + ), _more), ]; final fn = [ @@ -952,7 +952,8 @@ class ImagePainter extends CustomPainter { } } -CheckboxListTile getToggle(void Function(void Function()) setState, option, name) { +CheckboxListTile getToggle( + void Function(void Function()) setState, option, name) { return CheckboxListTile( value: gFFI.getByName('toggle_option', option) == 'true', onChanged: (v) { diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 743712324..e9367bd4c 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -1028,6 +1028,7 @@ class FFI { RustdeskImpl get bind => ffiModel.platformFFI.ffiBind; handleMouse(Map evt) { + debugPrint("mouse ${evt.toString()}"); var type = ''; var isMove = false; switch (evt['type']) { @@ -1045,7 +1046,7 @@ class FFI { } evt['type'] = type; var x = evt['x']; - var y = evt['y']; + var y = max(0.0, (evt['y'] as double) - 50.0); if (isMove) { canvasModel.moveDesktopMouse(x, y); } diff --git a/flutter/lib/models/peer_model.dart b/flutter/lib/models/peer_model.dart index 939d16ede..eb520f015 100644 --- a/flutter/lib/models/peer_model.dart +++ b/flutter/lib/models/peer_model.dart @@ -1,3 +1,4 @@ +import 'dart:convert'; import 'package:flutter/foundation.dart'; import '../../common.dart'; @@ -35,23 +36,29 @@ class Peer { class Peers extends ChangeNotifier { late String _name; - late var _peers; - static const cbQueryOnlines = 'callback_query_onlines'; + late List _peers; + late final _loadEvent; + static const _cbQueryOnlines = 'callback_query_onlines'; - Peers(String name, List peers) { + Peers(String name, String loadEvent, List _initPeers) { _name = name; - _peers = peers; - gFFI.ffiModel.platformFFI.registerEventHandler(cbQueryOnlines, _name, + _loadEvent = loadEvent; + _peers = _initPeers; + gFFI.ffiModel.platformFFI.registerEventHandler(_cbQueryOnlines, _name, (evt) { _updateOnlineState(evt); }); + gFFI.ffiModel.platformFFI.registerEventHandler(_loadEvent, _name, (evt) { + _updatePeers(evt); + }); } List get peers => _peers; @override void dispose() { - gFFI.ffiModel.platformFFI.unregisterEventHandler(cbQueryOnlines, _name); + gFFI.ffiModel.platformFFI.unregisterEventHandler(_cbQueryOnlines, _name); + gFFI.ffiModel.platformFFI.unregisterEventHandler(_loadEvent, _name); super.dispose(); } @@ -86,4 +93,37 @@ class Peers extends ChangeNotifier { notifyListeners(); } + + void _updatePeers(Map evt) { + final onlineStates = _getOnlineStates(); + _peers = _decodePeers(evt['peers']); + _peers.forEach((peer) { + final state = onlineStates[peer.id]; + peer.online = state != null && state != false; + }); + notifyListeners(); + } + + Map _getOnlineStates() { + var onlineStates = new Map(); + _peers.forEach((peer) { + onlineStates[peer.id] = peer.online; + }); + return onlineStates; + } + + List _decodePeers(String peersStr) { + try { + if (peersStr == "") return []; + List peers = json.decode(peersStr); + return peers + .map((s) => s as List) + .map((s) => + Peer.fromJson(s[0] as String, s[1] as Map)) + .toList(); + } catch (e) { + print('peers(): $e'); + } + return []; + } } diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index f1aeabfcc..9f40b69d5 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -7,11 +7,11 @@ use std::{ use flutter_rust_bridge::{StreamSink, SyncReturn, ZeroCopyBuffer}; use serde_json::{json, Number, Value}; -use hbb_common::{ResultType, password_security}; use hbb_common::{ config::{self, Config, LocalConfig, PeerConfig, ONLINE}, fs, log, }; +use hbb_common::{password_security, ResultType}; use crate::client::file_trait::FileManager; use crate::common::make_fd_to_json; @@ -20,7 +20,7 @@ use crate::flutter::{self, Session, SESSIONS}; use crate::start_server; use crate::ui_interface; use crate::ui_interface::{ - change_id, check_connect_status, forget_password, get_api_server, get_app_name, + change_id, check_connect_status, discover, forget_password, get_api_server, get_app_name, get_async_job_status, get_connect_status, get_fav, get_id, get_lan_peers, get_license, get_local_option, get_options, get_peer, get_peer_option, get_socks, get_sound_inputs, get_uuid, get_version, has_rendezvous_service, is_ok_change_id, post_request, set_local_option, @@ -469,6 +469,10 @@ pub fn main_is_using_public_server() -> bool { using_public_server() } +pub fn main_discover() { + discover(); +} + pub fn main_has_rendezvous_service() -> bool { has_rendezvous_service() } @@ -509,6 +513,61 @@ pub fn main_forget_password(id: String) { forget_password(id) } +pub fn main_load_recent_peers() { + if !config::APP_DIR.read().unwrap().is_empty() { + let peers: Vec<(String, config::PeerInfoSerde)> = PeerConfig::peers() + .drain(..) + .map(|(id, _, p)| (id, p.info)) + .collect(); + if let Some(s) = flutter::GLOBAL_EVENT_STREAM.read().unwrap().as_ref() { + let data = HashMap::from([ + ("name", "load_recent_peers".to_owned()), + ( + "peers", + serde_json::ser::to_string(&peers).unwrap_or("".to_owned()), + ), + ]); + s.add(serde_json::ser::to_string(&data).unwrap_or("".to_owned())); + }; + } +} + +pub fn main_load_fav_peers() { + if !config::APP_DIR.read().unwrap().is_empty() { + let favs = get_fav(); + let peers: Vec<(String, config::PeerInfoSerde)> = PeerConfig::peers() + .into_iter() + .filter_map(|(id, _, peer)| { + if favs.contains(&id) { + Some((id, peer.info)) + } else { + None + } + }) + .collect(); + if let Some(s) = flutter::GLOBAL_EVENT_STREAM.read().unwrap().as_ref() { + let data = HashMap::from([ + ("name", "load_fav_peers".to_owned()), + ( + "peers", + serde_json::ser::to_string(&peers).unwrap_or("".to_owned()), + ), + ]); + s.add(serde_json::ser::to_string(&data).unwrap_or("".to_owned())); + }; + } +} + +pub fn main_load_lan_peers() { + if let Some(s) = flutter::GLOBAL_EVENT_STREAM.read().unwrap().as_ref() { + let data = HashMap::from([ + ("name", "load_lan_peers".to_owned()), + ("peers", get_lan_peers()), + ]); + s.add(serde_json::ser::to_string(&data).unwrap_or("".to_owned())); + }; +} + /// FFI for **get** commands which are idempotent. /// Return result in c string. /// diff --git a/src/lan.rs b/src/lan.rs index 733e271a9..f74492b8e 100644 --- a/src/lan.rs +++ b/src/lan.rs @@ -277,6 +277,9 @@ async fn handle_received_peers(mut rx: UnboundedReceiver) if last_write_time.elapsed().as_millis() > 300 { config::LanPeers::store(&peers); last_write_time = Instant::now(); + + #[cfg(feature = "flutter")] + crate::flutter_ffi::main_load_lan_peers(); } } None => { diff --git a/src/rendezvous_mediator.rs b/src/rendezvous_mediator.rs index 6e38bff21..08a1316f0 100644 --- a/src/rendezvous_mediator.rs +++ b/src/rendezvous_mediator.rs @@ -604,68 +604,6 @@ fn lan_discovery() -> ResultType<()> { } } -pub fn discover() -> ResultType<()> { - let addr = SocketAddr::from(([0, 0, 0, 0], 0)); - let socket = std::net::UdpSocket::bind(addr)?; - socket.set_broadcast(true)?; - let mut msg_out = Message::new(); - let peer = PeerDiscovery { - cmd: "ping".to_owned(), - ..Default::default() - }; - msg_out.set_peer_discovery(peer); - let maddr = SocketAddr::from(([255, 255, 255, 255], get_broadcast_port())); - socket.send_to(&msg_out.write_to_bytes()?, maddr)?; - log::info!("discover ping sent"); - let mut last_recv_time = Instant::now(); - let mut last_write_time = Instant::now(); - let mut last_write_n = 0; - // to-do: load saved peers, and update incrementally (then we can see offline) - let mut peers = Vec::new(); - let mac = get_mac(); - socket.set_read_timeout(Some(std::time::Duration::from_millis(10)))?; - loop { - let mut buf = [0; 2048]; - if let Ok((len, _)) = socket.recv_from(&mut buf) { - if let Ok(msg_in) = Message::parse_from_bytes(&buf[0..len]) { - match msg_in.union { - Some(rendezvous_message::Union::PeerDiscovery(p)) => { - last_recv_time = Instant::now(); - if p.cmd == "pong" { - if p.mac != mac { - let dp = DiscoveryPeer { - id: "".to_string(), - ip_mac: HashMap::from([ - // TODO: addr ip - (addr.ip().to_string(), p.mac.clone()), - ]), - username: p.username, - hostname: p.hostname, - platform: p.platform, - online: true, - }; - peers.push(dp); - } - } - } - _ => {} - } - } - } - if last_write_time.elapsed().as_millis() > 300 && last_write_n != peers.len() { - config::LanPeers::store(&peers); - last_write_time = Instant::now(); - last_write_n = peers.len(); - } - if last_recv_time.elapsed().as_millis() > 3_000 { - break; - } - } - log::info!("discover ping done"); - config::LanPeers::store(&peers); - Ok(()) -} - #[tokio::main(flavor = "current_thread")] pub async fn query_online_states, Vec)>(ids: Vec, f: F) { let test = false; diff --git a/src/ui.rs b/src/ui.rs index c2bc8cbc3..f51b3e7c9 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -20,6 +20,7 @@ use hbb_common::{ }; use crate::common::{get_app_name, SOFTWARE_UPDATE_URL}; +use crate::ipc; use crate::ui_interface::{ check_mouse_time, closing, create_shortcut, current_is_wayland, fix_login_wayland, forget_password, get_api_server, get_async_job_status, get_connect_status, get_error, get_fav, @@ -35,7 +36,6 @@ use crate::ui_interface::{ show_run_without_install, store_fav, t, temporary_password, test_if_valid_server, update_me, update_temporary_password, using_public_server, }; -use crate::{discover, ipc}; mod cm; #[cfg(feature = "inline")] @@ -493,7 +493,9 @@ impl UI { } fn discover(&self) { - discover(); + std::thread::spawn(move || { + allow_err!(crate::lan::discover()); + }); } fn get_lan_peers(&self) -> String { diff --git a/src/ui_interface.rs b/src/ui_interface.rs index a3643d5c9..5b4850271 100644 --- a/src/ui_interface.rs +++ b/src/ui_interface.rs @@ -9,12 +9,12 @@ use hbb_common::{ allow_err, config::{self, Config, LocalConfig, PeerConfig, RENDEZVOUS_PORT, RENDEZVOUS_TIMEOUT}, futures::future::join_all, - log, + log, password_security, protobuf::Message as _, rendezvous_proto::*, sleep, tcp::FramedStream, - tokio::{self, sync::mpsc, time}, password_security, + tokio::{self, sync::mpsc, time}, }; use crate::common::SOFTWARE_UPDATE_URL; @@ -538,12 +538,26 @@ pub fn create_shortcut(_id: String) { pub fn discover() { std::thread::spawn(move || { - allow_err!(crate::rendezvous_mediator::discover()); + allow_err!(crate::lan::discover()); }); } pub fn get_lan_peers() -> String { - serde_json::to_string(&config::LanPeers::load().peers).unwrap_or_default() + let peers: Vec<(String, config::PeerInfoSerde)> = config::LanPeers::load() + .peers + .iter() + .map(|peer| { + ( + peer.id.clone(), + config::PeerInfoSerde { + username: peer.username.clone(), + hostname: peer.hostname.clone(), + platform: peer.platform.clone(), + }, + ) + }) + .collect(); + serde_json::to_string(&peers).unwrap_or_default() } pub fn get_uuid() -> String {