diff --git a/.gitignore b/.gitignore index c1864d4..75de0b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /target **/*.rs.bk -shiet.png +shiet.* diff --git a/Cargo.lock b/Cargo.lock index ba54d8e..f7844fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,743 +1,666 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. [[package]] -name = "adler32" -version = "1.1.0" +name = "adler" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" + +[[package]] +name = "adler32" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi", ] [[package]] name = "anyhow" -version = "1.0.31" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68803225a7b13e47191bab76f2687382b60d259e8cf37f6e1893658b84bb9479" [[package]] name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" dependencies = [ - "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "termion", + "winapi", ] [[package]] name = "autocfg" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "bytemuck" -version = "1.2.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac" [[package]] name = "byteorder" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[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]] name = "chrono" -version = "0.4.11" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ - "num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "num-integer", + "num-traits", + "time", + "winapi", ] [[package]] name = "clap" -version = "2.33.1" +version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] name = "color_quant" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "const_fn" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826" [[package]] name = "crc32fast" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.7.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-queue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "const_fn", + "crossbeam-utils", + "lazy_static 1.4.0", + "memoffset", + "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.7.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "cfg-if 1.0.0", + "lazy_static 1.4.0", ] [[package]] name = "deflate" -version = "0.7.20" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" dependencies = [ - "adler32 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "deflate" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "adler32 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "derivative" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", + "adler32", + "byteorder", ] [[package]] name = "either" -version = "1.5.3" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "gif" -version = "0.10.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02efba560f227847cb41463a7395c514d127d4f74fff12ef0137fff1b84b96c4" dependencies = [ - "color_quant 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "color_quant", + "weezl", ] [[package]] name = "heck" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" dependencies = [ - "unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-segmentation", ] [[package]] name = "hermit-abi" -version = "0.1.14" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" dependencies = [ - "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "image" -version = "0.23.5" +version = "0.23.12" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce04077ead78e39ae8610ad26216aed811996b043d47beed5090db674f9e9b5" dependencies = [ - "bytemuck 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gif 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jpeg-decoder 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", - "png 0.16.5 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tiff 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "inflate" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "adler32 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bytemuck", + "byteorder", + "color_quant", + "gif", + "jpeg-decoder", + "num-iter", + "num-rational", + "num-traits", + "png", + "scoped_threadpool", + "tiff", ] [[package]] name = "jpeg-decoder" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc797adac5f083b8ff0ca6f6294a999393d76e197c36488e2ef732c4715f6fa3" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder", + "rayon", ] [[package]] name = "lazy_static" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leanshot" version = "0.4.0" dependencies = [ - "anyhow 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "image 0.23.5 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "png 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", - "safex11 0.0.4", - "stderrlog 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "anyhow", + "image", + "log", + "stderrlog", + "structopt", + "xcb", + "xcb-util", ] [[package]] name = "libc" -version = "0.2.71" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" [[package]] name = "log" -version = "0.4.8" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", ] -[[package]] -name = "lzw" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "memoffset" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "miniz_oxide" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" dependencies = [ - "adler32 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d" +dependencies = [ + "adler", + "autocfg", ] [[package]] name = "num-integer" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "num-traits", ] [[package]] name = "num-iter" -version = "0.1.41" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "num-integer", + "num-traits", ] [[package]] name = "num-rational" -version = "0.2.4" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "num-integer", + "num-traits", ] [[package]] name = "num-traits" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", ] [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "pkg-config" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "png" -version = "0.14.1" +version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)", - "inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "png" -version = "0.16.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "deflate 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "crc32fast", + "deflate", + "miniz_oxide 0.3.7", ] [[package]] name = "proc-macro2" version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "1.0.18" -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)", + "unicode-xid", ] [[package]] name = "quote" version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "rayon" -version = "1.3.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", ] [[package]] name = "rayon-core" -version = "1.7.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-queue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static 1.4.0", + "num_cpus", ] [[package]] name = "redox_syscall" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" dependencies = [ - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "safex11" -version = "0.0.4" -dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "derivative 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "x11 2.18.2 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall", ] [[package]] name = "scoped_threadpool" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "stderrlog" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e5ee9b90a5452c570a0b0ac1c99ae9498db7e56e33d74366de7f2a7add7f25" dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "chrono", + "log", + "termcolor", + "thread_local", ] [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16c2cdbf9cc375f15d1b4141bc48aeef444806655cd0e904207edc8d68d86ed7" dependencies = [ - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt-derive 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "structopt-derive", ] [[package]] name = "structopt-derive" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53010261a84b37689f9ed7d395165029f9cc7abb9f56bbfe86bee2597ed25107" dependencies = [ - "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "heck", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "syn" version = "0.15.44" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-xid", ] [[package]] name = "termcolor" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" dependencies = [ - "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] [[package]] name = "termion" version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22cec9d8978d906be5ac94bceb5a010d885c626c4c8855721a4dbd20e3ac905" dependencies = [ - "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", - "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "numtoa", + "redox_syscall", + "redox_termios", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thiserror" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "thiserror-impl 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "thread_local" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" dependencies = [ - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.11", + "unreachable", ] [[package]] name = "tiff" -version = "0.5.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a53f4706d65497df0c4349241deddf35f84cee19c87ed86ea8ca590f4464437" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "jpeg-decoder", + "miniz_oxide 0.4.3", + "weezl", ] [[package]] name = "time" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ - "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "wasi", + "winapi", ] [[package]] name = "unicode-segmentation" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" [[package]] name = "unicode-width" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" version = "0.1.0" source = "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" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" [[package]] name = "unreachable" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" dependencies = [ - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "void", ] [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "weezl" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2bb9fc8309084dd7cd651336673844c1d47f8ef6d2091ec160b27f5c4aa277" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "x11" -version = "2.18.2" +name = "xcb" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62056f63138b39116f82a540c983cc11f1c90cd70b3d492a70c25eaa50bd22a6" dependencies = [ - "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "log", ] -[metadata] -"checksum adler32 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum anyhow 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f" -"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum bytemuck 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37fa13df2292ecb479ec23aa06f4507928bef07839be9ef15281411076629431" -"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" -"checksum clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129" -"checksum color_quant 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd" -"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -"checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" -"checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -"checksum crossbeam-queue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" -"checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -"checksum deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4" -"checksum deflate 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e5d2a2273fed52a7f947ee55b092c4057025d7a3e04e5ecdbd25d6c3fb1bd7" -"checksum derivative 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f" -"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" -"checksum gif 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)" = "471d90201b3b223f3451cd4ad53e34295f16a1df17b1edf3736d47761c3981af" -"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -"checksum hermit-abi 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" -"checksum image 0.23.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d534e95ad8b9d5aa614322d02352b4f1bf962254adcf02ac6f2def8be18498e8" -"checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff" -"checksum jpeg-decoder 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "5b47b4c4e017b01abdc5bcc126d2d1002e5a75bbe3ce73f9f4f311a916363704" -"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" -"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" -"checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" -"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -"checksum memoffset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" -"checksum miniz_oxide 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" -"checksum num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" -"checksum num-iter 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f" -"checksum num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -"checksum num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" -"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" -"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" -"checksum png 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63daf481fdd0defa2d1d2be15c674fbfa1b0fd71882c303a91f9a79b3252c359" -"checksum png 0.16.5 (registry+https://github.com/rust-lang/crates.io-index)" = "34ccdd66f6fe4b2433b07e4728e9a013e43233120427046e93ceb709c3a439bf" -"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" -"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -"checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -"checksum rayon 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080" -"checksum rayon-core 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280" -"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" -"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -"checksum stderrlog 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "32e5ee9b90a5452c570a0b0ac1c99ae9498db7e56e33d74366de7f2a7add7f25" -"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum structopt 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "16c2cdbf9cc375f15d1b4141bc48aeef444806655cd0e904207edc8d68d86ed7" -"checksum structopt-derive 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "53010261a84b37689f9ed7d395165029f9cc7abb9f56bbfe86bee2597ed25107" -"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -"checksum syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6" -"checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" -"checksum termion 1.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c22cec9d8978d906be5ac94bceb5a010d885c626c4c8855721a4dbd20e3ac905" -"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thiserror 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" -"checksum thiserror-impl 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" -"checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" -"checksum tiff 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f3b8a87c4da944c3f27e5943289171ac71a6150a79ff6bacfff06d159dfff2f" -"checksum time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" -"checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" -"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum x11 2.18.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77ecd092546cb16f25783a5451538e73afc8d32e242648d54f4ae5459ba1e773" +[[package]] +name = "xcb-util" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43893e47f27bf7d81d489feef3a0e34a457e90bc314b7e74ad9bb3980e4c1c48" +dependencies = [ + "libc", + "xcb", +] diff --git a/Cargo.toml b/Cargo.toml index 4a27664..96e935d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,21 +2,16 @@ name = "leanshot" description = "Screenshot capture for Linux." version = "0.4.0" -repository = "https://git.sr.ht/~iptq/leanshot" +repository = "https://git.mzhang.io/michael/leanshot" license-file = "LICENSE" edition = "2018" -authors = ["Michael Zhang "] - -[features] -default = ["x11"] -x11 = ["safex11"] +authors = ["Michael Zhang "] [dependencies] -png = "0.14" -structopt = "0.2" -anyhow = "1.0.31" -image = "0.23.5" +anyhow = "1.0.36" +image = "0.23.12" log = "0.4.8" stderrlog = "0.4.3" - -safex11 = { version = "0.0", path = "../safex11", optional = true, features = ["xlib", "xinerama"] } +structopt = "0.2" +xcb-util = { version = "0.3.0", features = ["image", "cursor"] } +xcb = { version = "0.9" } diff --git a/LICENSE b/LICENSE index 0cab0b2..822f894 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,19 @@ Copyright 2018-2020 Michael Zhang -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index d65e203..3380f81 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,13 @@ leanshot ======== -[![](https://api.travis-ci.org/iptq/leanshot.svg?branch=develop)](https://travis-ci.org/iptq/leanshot) -[![dependency status](https://deps.rs/repo/github/iptq/leanshot/status.svg)](https://deps.rs/repo/github/iptq/leanshot) - Screenshot-capturing utility. Requirements ------------ -You must have imlib2 and OpenGL installed. Fortunately, these are relatively common libraries. +You must have imlib2 and OpenGL installed. Fortunately, these are relatively +common libraries. Installation ------------ diff --git a/src/gui.rs b/src/gui.rs index c3dcabb..04e885a 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -1,67 +1,141 @@ +use std::path::Path; +use std::ptr; + use anyhow::Result; -use image::RgbaImage; -use x11::{ - xlib::{Display, Window}, - Rectangle, -}; +use image::ColorType; +use xcb::{base::Connection, xproto, Screen}; +use xcb_util::{ffi::image::*, image as xcb_image}; -use crate::platform::{x11::X11, Platform}; -use crate::{Options, Region}; - -pub struct GUI { - inner: P, +pub struct Gui { + conn: Connection, + default_screen: i32, } -impl GUI { +impl Gui { pub fn new() -> Result { - let x11 = X11::new()?; - Ok(GUI { inner: x11 }) + let (conn, default_screen) = Connection::connect(None)?; + Ok(Gui { + conn, + default_screen, + }) } -} -impl GUI

{ - /// Captures the window and produces an Image. - pub fn capture_window(&self, opt: &Options, window: Window) -> Result { - let attr = window.get_attributes()?; - let width = attr.get_width(); - let height = attr.get_height(); - let root = attr.get_root(); + fn get_default_screen(&self) -> Screen { + // TODO: multiple screens + let setup = self.conn.get_setup(); + let mut iter = setup.roots(); + iter.next().unwrap() + } - // let (x, y, _) = self.display.translate_coordinates(window, 0, 0, root)?; + pub fn capture_entire_screen(&self) -> Result { + // get the dimensions of the screen + let screen = self.get_default_screen(); + let (width, height) = (screen.width_in_pixels(), screen.height_in_pixels()); + println!("width, height = {:?}", (width, height)); - // imlib2::context_set_display(&self.display); - // let visual = Visual::default(&self.display, 0); - // imlib2::context_set_visual(&visual); + let image = xcb_image::get( + &self.conn, + screen.root(), + 0, + 0, + width, + height, + u32::MAX, + xcb::IMAGE_FORMAT_Z_PIXMAP, + ) + .unwrap(); - if let Region::Selection = opt.region { - let image = self.inner.capture_full_screen()?; - let rect = self.inner.show_interactive_selection(image)?; - unimplemented!("rect: {:?}", rect); - // let capture = - // Image2::create_from_drawable(window, 0, x, y, width as i32, height as i32, true)?; - // let region = self.interactive_select(&capture)?; - // imlib2::context_set_image(&capture); - // return imlib2::create_scaled_cropped_image( - // region.x, - // region.y, - // region.width, - // region.height, - // ) - // .map_err(|err| err.into()); + Ok(ScreenCapture { image }) + } + + pub fn interactive_select(&self, image: &ScreenCapture) -> Result<()> { + let id = self.conn.generate_id(); + let screen = self.get_default_screen(); + let root_window = screen.root(); + let (width, height) = (screen.width_in_pixels(), screen.height_in_pixels()); + + let window = xproto::create_window( + &self.conn, + xcb::COPY_FROM_PARENT as u8, + id, + root_window, + 0, + 0, + width, + height, + 0, + xcb::WINDOW_CLASS_INPUT_OUTPUT as u16, + screen.root_visual(), + &[ + // (xcb::CW_OVERRIDE_REDIRECT, 1), + (xcb::CW_BACK_PIXEL, screen.white_pixel()), + (xcb::CW_EVENT_MASK, u32::MAX), + ], + ).request_check()?; + + xproto::map_window(&self.conn, id).request_check()?; + self.conn.flush(); + + xproto::set_input_focus( + &self.conn, + xcb::INPUT_FOCUS_POINTER_ROOT as u8, + id, + xcb::CURRENT_TIME, + ); + xproto::grab_pointer( + &self.conn, + true, + id, + u16::MAX, + xcb::GRAB_MODE_ASYNC as u8, + xcb::GRAB_MODE_ASYNC as u8, + xcb::NONE, + xcb::NONE, + xcb::CURRENT_TIME, + ); + + let gc = self.conn.generate_id(); + xproto::create_gc(&self.conn, gc, id, &[]); + + // drag start + let mut dragging = false; + let mut dx = -1.0f64; + let mut dy = -1.0f64; + + while let Some(evt) = self.conn.wait_for_event() { + xcb_image::put(&self.conn, id, gc, &image.image, 0, 0); + + match evt.response_type() { + xcb::EXPOSE => { + println!("EXPOSE"); + } + xcb::BUTTON_PRESS => { + println!("PRESSED BUTTON"); + } + v => { + println!("value: {:?}", v); + } + } } - unimplemented!() - // Image2::create_from_drawable(window, 0, x, y, width as i32, height as i32, true) - // .map_err(|err| err.into()) - } - - /// Get the active window. - pub fn get_active_window(&self) -> Result { - self.inner.get_active_window() - } - - /// Get the active window. - pub fn capture_full_screen(&self) -> Result { - self.inner.capture_full_screen() + todo!(); + } +} + +pub struct ScreenCapture { + image: xcb_image::Image, +} + +impl ScreenCapture { + pub fn save_to(&self, to: impl AsRef) -> Result<()> { + let to = to.as_ref(); + image::save_buffer( + to, + self.image.data(), + self.image.width() as u32, + self.image.height() as u32, + ColorType::Bgra8, + )?; + Ok(()) } } diff --git a/src/lib.rs b/src/lib.rs deleted file mode 100644 index 3d9637b..0000000 --- a/src/lib.rs +++ /dev/null @@ -1,38 +0,0 @@ -//! Screenshot capturing utility. - -#![deny(missing_docs)] - -#[macro_use] -extern crate anyhow; -#[macro_use] -extern crate log; -extern crate safex11 as x11; - -mod platform; - -use anyhow::Result; - -pub use crate::platform::{x11::X11, Image, Platform}; - -type Rectangle = x11::Rectangle; - -/// A region option -#[allow(missing_docs)] -pub enum Region { - Fullscreen, - ActiveWindow, - Selection, -} - -impl Region { - /// Convert string to Region enum - // TODO: use FromStr trait - pub fn from_str(x: &str) -> Result { - match x { - "fullscreen" => Ok(Region::Fullscreen), - "window" => Ok(Region::ActiveWindow), - "select" | "selection" => Ok(Region::Selection), - _ => bail!("please choose a region from 'fullscreen', 'window', or 'select'"), - } - } -} diff --git a/src/main.rs b/src/main.rs index b7a1558..8a95ef1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,107 +1,20 @@ #[macro_use] extern crate log; -use std::path::PathBuf; +mod gui; use anyhow::Result; -use image::{imageops, RgbImage}; -use leanshot::{Image, Platform, Region, X11}; -use structopt::StructOpt; -#[allow(missing_docs)] -pub fn main() -> Result<()> { - let opt = Options::from_args(); - stderrlog::new() - .module(module_path!()) - .module("safex11") - .verbosity(opt.verbose) - .init() - .unwrap(); +use crate::gui::Gui; - let gui = X11::new()?; +fn main() -> Result<()> { + stderrlog::new().module(module_path!()).init().unwrap(); - let screen_layout = gui.get_screen_layout()?; - debug!("screen layout: {:?}", screen_layout); + let gui = Gui::new()?; + let capture = gui.capture_entire_screen()?; + capture.save_to("shiet.jpg")?; - let _image = match opt.region { - Region::ActiveWindow => { - let window = gui.get_active_window()?; - let _image = gui.capture_window(window); - } - Region::Fullscreen | Region::Selection => { - let _image = gui.capture_full_screen()?; - - // calculate the full size of the image - let mut min_x = 0; - let mut min_y = 0; - let mut max_x = 0; - let mut max_y = 0; - for (i, (_, screen)) in screen_layout.iter().enumerate() { - let left = screen.x; - let right = screen.x + screen.width as i16; - let top = screen.y; - let bottom = screen.y + screen.height as i16; - if i == 0 { - min_x = left; - min_y = top; - max_x = right; - max_y = bottom; - } else { - min_x = min_x.min(left); - min_y = min_y.min(top); - max_x = max_x.max(right); - max_y = max_y.max(bottom); - } - } - - // make a new image - let width = (max_x - min_x) as u32; - let height = (max_y - min_y) as u32; - let mut base_image = RgbImage::new(width, height); - - // copy all of the images into it - let images = gui.capture_full_screen()?; - for (id, image) in images.iter() { - let screen = screen_layout.get(&id).expect("shouldn't fail"); - let x = (screen.x + min_x) as u32; - let y = (screen.y + min_y) as u32; - let image = image.to_rgb_image(); - imageops::overlay(&mut base_image, &image, x, y); - } - - if let Region::Selection = opt.region { - // bring up the interactive selection - let _rect = gui.show_interactive_selection(&images)?; - } - - // save the image - base_image.save(&opt.outfile)?; - } - }; + gui.interactive_select(&capture)?; Ok(()) } - -/// Options for screenshot -#[derive(StructOpt)] -pub struct Options { - /// The region to select (fullscreen | window | select) - #[structopt(parse(try_from_str = "Region::from_str"))] - pub region: Region, - - /// The file to save the screenshot to - #[structopt(short = "o", long = "out", parse(from_os_str))] - pub outfile: PathBuf, - - /// Whether or not to also copy it to the clipboard - #[structopt(short = "c")] - pub clipboard: bool, - - /// Verbosity of output - #[structopt(short = "v", long = "verbose", parse(from_occurrences))] - pub verbose: usize, - - /// X display connection string to use - #[structopt(long = "x-display", default_value = ":0")] - pub x_display: String, -} diff --git a/src/old.rs b/src/old.rs deleted file mode 100644 index 9e47b14..0000000 --- a/src/old.rs +++ /dev/null @@ -1,279 +0,0 @@ - - - /// Brings up an interactive selection GUI. - pub fn interactive_select(&self, capture: &Image2) -> Result { - // let window = SelectWindow::new(&self.display); - // let root = self.display.get_default_root_window()?; - - // let root_im = root.get_image(); - - // let mut done = 0; - // let mut button_press = false; - // while done == 0 && self.display.pending()? > 0 { - // let ev = self.display.next_event()?; - // match ev.kind() { - // EventKind::ButtonPress => { - // button_press = true; - // } - // EventKind::ButtonRelease => { - // if button_press { - // done = 1; - // } - // button_press = false; - // } - // _ => (), - // } - // } - - use glutin::{ - dpi::{PhysicalPosition, PhysicalSize}, - os::unix::{WindowBuilderExt, WindowExt, XWindowType}, - ElementState, Event, EventsLoop, GlContext, GlWindow, KeyboardInput, MouseButton, - MouseCursor, VirtualKeyCode, WindowBuilder, WindowEvent, - }; - use nanovg::{Image, ImagePattern, PathOptions, StrokeOptions}; - use std::{f32::consts, mem, slice}; - - // let attr = window.get_attributes()?; - // let width = attr.get_width(); - // let height = attr.get_height(); - // let root = attr.get_root(); - // let (x, y, _) = self.display.translate_coordinates(window, 0, 0, root)?; - let width = capture.get_width(); - let height = capture.get_height(); - - let mut evl = EventsLoop::new(); - let mon = evl.get_primary_monitor(); - - // TODO: handle error - let wb = WindowBuilder::new() - .with_x11_window_type(XWindowType::Splash) - .with_decorations(false) - .with_visibility(false) - .with_always_on_top(true) - .with_dimensions( - PhysicalSize::new(width.into(), height.into()).to_logical(mon.get_hidpi_factor()), - ) - .with_fullscreen(Some(mon)); - let ctx = glutin::ContextBuilder::new() - .with_vsync(false) - .with_multisampling(4) - .with_double_buffer(Some(true)) - .with_srgb(true); - let win = GlWindow::new(wb, ctx, &evl).expect("couldn't make window"); - win.set_position((0.0, 0.0).into()); - let f = win.get_hidpi_factor() as f64; - - // crosshair - win.set_cursor(MouseCursor::Crosshair); - // win.set_inner_size((width, height).into()); - // println!("size={:?} pos={:?} outer={:?}", win.get_inner_size(), win.get_inner_position(), win.get_outer_size()); - // println!("{:?}", win.get_hidpi_factor()); - - let x = Display::from_handle(win.get_xlib_display().unwrap() as u64); - let len; - let raw_data; - { - let _g = x.grab(); - // let img = Image2::create_from_drawable(window, 0, 0, 0, width as i32, height as i32, true)?; - imlib2::context_set_image(&capture); - len = (width * height) as usize; - // println!("{}", window.as_raw()); - raw_data = unsafe { slice::from_raw_parts(imlib2::image_get_data(), len) }; - - unsafe { - win.make_current().expect("couldn't make window"); - gl::load_with(|sym| win.get_proc_address(sym) as *const _); - } - } - mem::forget(x); - - // convert ARGB to RGBA - let mut data = vec![0u32; raw_data.len()]; - data.copy_from_slice(raw_data); - for i in &mut data { - // fix the colors - *i = (*i & 0xff00ff00) | ((*i & 0xff) << 16) | ((*i >> 16) & 0xff); - } - - // invert image - let mut inverted = vec![0u32; raw_data.len()]; - inverted.copy_from_slice(raw_data); - for i in &mut inverted { - // fix the colors - *i = (*i & 0xff000000) | !(*i & 0xffffff); - } - - let ctx = nanovg::ContextBuilder::new() - .build() - .expect("couldn't init nanovg"); - - let image = Image::new(&ctx) - .build_from_rgba(width as usize, height as usize, data.as_slice()) - .expect("couldn't create image"); - - let inverted_image = Image::new(&ctx) - .build_from_rgba(width as usize, height as usize, inverted.as_slice()) - .expect("couldn't create image"); - - let mut running = true; - let mut down = false; - // drag start - let mut dx = -1.0f64; - let mut dy = -1.0f64; - // curr mouse - let mut mx = -1.0f64; - let mut my = -1.0f64; - // rect - let mut rectw = 0.0f64; - let mut recth = 0.0f64; - let mut delayed_down = false; - let mut redraw = true; - - win.show(); - win.set_position(PhysicalPosition::new(0.0, 0.0).to_logical(f)); - while running { - if redraw { - // let size = win.get_inner_size().unwrap(); - // let (width, height) = (size.width as i32, size.height as i32); - - unsafe { - gl::Viewport(0, 0, width as i32, height as i32); - gl::ClearColor(0.3, 0.3, 0.32, 1.0); - gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT | gl::STENCIL_BUFFER_BIT); - } - - let (width, height) = (width as f64, height as f64); - ctx.frame((width as f32, height as f32), f as f32, |frame| { - let path_opts = PathOptions::default(); - frame.path( - |path| { - path.rect((0.0, 0.0), ((width * f) as f32, (height * f) as f32)); - // path.fill(Color::from_rgba(200, 200, 200, 255), Default::default()); - path.fill( - ImagePattern { - image: &image, - origin: (0.0, 0.0), - size: (width as f32, height as f32), - angle: 0.0 / 180.0 * consts::PI, - alpha: 1.0, - }, - Default::default(), - ) - }, - path_opts, - ); - if down && rectw.abs() > 0.0 && recth.abs() > 0.0 { - frame.path( - |path| { - path.rect( - ((dx * f) as f32, (dy * f) as f32), - ((rectw * f) as f32, (recth * f) as f32), - ); - path.stroke( - // Color::from_rgba(0, 0, 0, 255), - ImagePattern { - image: &inverted_image, - origin: (0.0, 0.0), - size: (width as f32, height as f32), - angle: 0.0 / 180.0 * consts::PI, - alpha: 1.0, - }, - StrokeOptions { - width: 1.0, - ..Default::default() - }, - ); - }, - path_opts, - ); - } - }); - } - - evl.poll_events(|event| { - if let Event::WindowEvent { event, .. } = event { - match event { - WindowEvent::Destroyed => running = false, - WindowEvent::KeyboardInput { - input: - KeyboardInput { - virtual_keycode, - state, - .. - }, - .. - } => { - if let (Some(VirtualKeyCode::Escape), ElementState::Released) = - (virtual_keycode, state) - { - if down { - down = false; - rectw = 0.0; - recth = 0.0; - } else { - running = false; - } - } - } - WindowEvent::CursorMoved { position, .. } => { - mx = position.x; - my = position.y; - if down { - if delayed_down { - dx = mx; - dy = my; - delayed_down = false; - } else { - redraw = true; - } - rectw = mx - dx; - recth = my - dy; - } - } - WindowEvent::MouseInput { button, state, .. } => { - if let MouseButton::Left = button { - down = match state { - ElementState::Pressed => { - delayed_down = true; - if mx < 0.0 || my < 0.0 { - } else { - dx = mx; - dy = my; - } - true - } - ElementState::Released => { - if down && rectw.abs() > 0.0 && recth.abs() > 0.0 { - running = false; - } - false - } - } - } - } - _ => (), - } - } - }); - win.swap_buffers().expect("couldn't swap buffers"); - } - if rectw.abs() > 0.0 && recth.abs() > 0.0 { - let mut x = dx; - let mut y = dy; - if rectw < 0.0 { - x += rectw; - } - if recth < 0.0 { - y += recth; - } - Ok(Rectangle::new( - (x * f) as i32, - (y * f) as i32, - (rectw.abs() * f) as u32, - (recth.abs() * f) as u32, - )) - } else { - Err(ScreenshotError::Error) - } - } diff --git a/src/platform/mod.rs b/src/platform/mod.rs deleted file mode 100644 index 4efae84..0000000 --- a/src/platform/mod.rs +++ /dev/null @@ -1,54 +0,0 @@ -#[cfg(feature = "x11")] -pub mod x11; - -use std::collections::HashMap; -use std::hash::Hash; - -use anyhow::Result; -use image::RgbImage; - -use crate::Rectangle; - -#[derive(Debug)] -pub struct ScreenInfo { - pub width: u16, - pub height: u16, - pub x: i16, - pub y: i16, -} - -/// Set of functions that all platforms must implement -pub trait Platform { - /// Type of window handles - type Window; - - /// Type of images - type Image: Image; - - /// Type of screen handles (must be hashable and uniquely identifying) - type ScreenId: Hash; - - /// Get a handle to the currently active window - fn get_active_window(&self) -> Result; - - /// Capture a specific window by handle - fn capture_window(&self, window: Self::Window) -> Result; - - /// Get the screen layout (list of screens, where they are) - fn get_screen_layout(&self) -> Result>; - - /// Capture full screen - fn capture_full_screen(&self) -> Result>; - - /// Open the interactive selection interface - fn show_interactive_selection( - &self, - image: &HashMap, - ) -> Result; -} - -/// Set of functions platform-specific images must implement -pub trait Image { - /// Convert the image into an image::RgbImage - fn to_rgb_image(&self) -> RgbImage; -} diff --git a/src/platform/x11.rs b/src/platform/x11.rs deleted file mode 100644 index d2e2c76..0000000 --- a/src/platform/x11.rs +++ /dev/null @@ -1,113 +0,0 @@ -use std::collections::HashMap; - -use anyhow::Result; -use image::{Rgb, RgbImage}; -use x11::{ - xinerama::ScreensInfo, - xlib::{Display, ImageByteOrder, Window}, -}; - -use crate::platform::{Image as ImageT, Platform, ScreenInfo}; -use crate::Rectangle; - -/// Interface to x11 -pub struct X11 { - inner: Display, -} - -impl X11 { - /// Create a new x11 instace - pub fn new() -> Result { - // TODO: configure connection string - let display = Display::connect(":0")?; - - Ok(X11 { inner: display }) - } -} - -impl Platform for X11 { - type Window = x11::x11::xlib::Window; - type Image = Image; - type ScreenId = i32; - - fn get_active_window(&self) -> Result { - let (window, _) = self.inner.get_input_focus()?; - Ok(window.inner) - } - - fn capture_window(&self, window: Self::Window) -> Result { - let window = Window { - display: &self.inner, - inner: window, - }; - let image = window.get_image()?; - Ok(Image(image)) - } - - fn capture_full_screen(&self) -> Result> { - let mut result = HashMap::new(); - - // wait what? - // x11 doesn't have a root window for each screen apparently - let window = self.inner.get_default_root_window()?; - result.insert(0, Image(window.get_image()?)); - - Ok(result) - } - - fn get_screen_layout(&self) -> Result> { - let screens_info = ScreensInfo::query(&self.inner)?; - Ok(screens_info - .iter() - .map(|(num, screen)| { - ( - num, - ScreenInfo { - x: screen.x, - y: screen.y, - width: screen.width as u16, - height: screen.height as u16, - }, - ) - }) - .collect()) - } - - fn show_interactive_selection( - &self, - image: &HashMap, - ) -> Result { - let root_window = self.inner.get_default_root_window()?; - let window = Window::create( - &self.inner, - Some(root_window), - Rectangle::new(0, 0, 500, 500), - Default::default(), - )?; - window.map(); - - loop { - let event = self.inner.next_event()?; - debug!("event: {:?}", event); - - // quit - } - - unimplemented!() - } -} - -pub struct Image(x11::xlib::Image); - -impl ImageT for Image { - fn to_rgb_image(&self) -> RgbImage { - let width = self.0.get_width(); - let height = self.0.get_height(); - let pixbuf = self.0.buffer(); - let byte_order = self.0.get_byte_order().unwrap(); - RgbImage::from_fn(width, height, |x, y| { - let (r, g, b) = pixbuf.get_pixel(x, y).unwrap(); - [r, g, b].into() - }) - } -}