fix lints and update deps
This commit is contained in:
parent
36d6192d4f
commit
2372cbb963
4 changed files with 18 additions and 45 deletions
40
Cargo.lock
generated
40
Cargo.lock
generated
|
@ -153,7 +153,7 @@ dependencies = [
|
|||
"cfg-if 1.0.0",
|
||||
"const_fn",
|
||||
"crossbeam-utils",
|
||||
"lazy_static 1.4.0",
|
||||
"lazy_static",
|
||||
"memoffset",
|
||||
"scopeguard",
|
||||
]
|
||||
|
@ -166,7 +166,7 @@ checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
|
|||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if 1.0.0",
|
||||
"lazy_static 1.4.0",
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -242,12 +242,6 @@ dependencies = [
|
|||
"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"
|
||||
|
@ -442,7 +436,7 @@ dependencies = [
|
|||
"crossbeam-channel",
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
"lazy_static 1.4.0",
|
||||
"lazy_static",
|
||||
"num_cpus",
|
||||
]
|
||||
|
||||
|
@ -475,9 +469,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
|||
|
||||
[[package]]
|
||||
name = "stderrlog"
|
||||
version = "0.4.3"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32e5ee9b90a5452c570a0b0ac1c99ae9498db7e56e33d74366de7f2a7add7f25"
|
||||
checksum = "b02f316286ae558d83acc93dd81eaba096e746987a7961d4a9ae026842bae67f"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"chrono",
|
||||
|
@ -499,7 +493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"lazy_static 1.4.0",
|
||||
"lazy_static",
|
||||
"structopt-derive",
|
||||
]
|
||||
|
||||
|
@ -559,12 +553,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "0.3.4"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14"
|
||||
checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
|
||||
dependencies = [
|
||||
"lazy_static 0.2.11",
|
||||
"unreachable",
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -607,15 +600,6 @@ version = "0.2.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "unreachable"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
|
||||
dependencies = [
|
||||
"void",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.2"
|
||||
|
@ -628,12 +612,6 @@ version = "0.9.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
|
||||
|
||||
[[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"
|
||||
|
|
|
@ -10,8 +10,8 @@ authors = ["Michael Zhang <mail@mzhang.io>"]
|
|||
[dependencies]
|
||||
anyhow = "1.0.36"
|
||||
image = "0.23.12"
|
||||
log = "0.4.8"
|
||||
stderrlog = "0.4.3"
|
||||
log = "0.4.11"
|
||||
stderrlog = "0.5.0"
|
||||
xcb-util = { version = "0.3.0", features = ["image", "cursor"] }
|
||||
xcb = { version = "0.9" }
|
||||
xcb = "0.9.0"
|
||||
structopt = "0.3.21"
|
||||
|
|
15
src/gui.rs
15
src/gui.rs
|
@ -1,27 +1,22 @@
|
|||
use std::path::Path;
|
||||
use std::ptr;
|
||||
|
||||
use anyhow::Result;
|
||||
use image::{Bgra, ColorType, DynamicImage, ImageBuffer};
|
||||
use image::{Bgra, DynamicImage, ImageBuffer};
|
||||
use xcb::{
|
||||
base::Connection,
|
||||
xproto::{self, Rectangle},
|
||||
Screen,
|
||||
};
|
||||
use xcb_util::{ffi::image::*, image as xcb_image};
|
||||
use xcb_util::image as xcb_image;
|
||||
|
||||
pub struct Gui {
|
||||
conn: Connection,
|
||||
default_screen: i32,
|
||||
}
|
||||
|
||||
impl Gui {
|
||||
pub fn new() -> Result<Self> {
|
||||
let (conn, default_screen) = Connection::connect(None)?;
|
||||
Ok(Gui {
|
||||
conn,
|
||||
default_screen,
|
||||
})
|
||||
let (conn, _) = Connection::connect(None)?;
|
||||
Ok(Gui { conn })
|
||||
}
|
||||
|
||||
fn get_default_screen(&self) -> Screen {
|
||||
|
@ -58,7 +53,7 @@ impl Gui {
|
|||
let root_window = screen.root();
|
||||
let (width, height) = (screen.width_in_pixels(), screen.height_in_pixels());
|
||||
|
||||
let window = xproto::create_window(
|
||||
xproto::create_window(
|
||||
&self.conn,
|
||||
xcb::COPY_FROM_PARENT as u8,
|
||||
id,
|
||||
|
|
|
@ -30,7 +30,7 @@ fn main() -> Result<()> {
|
|||
}
|
||||
Region::Selection => {
|
||||
let rectangle = gui.interactive_select(&capture)?;
|
||||
capture.save_cropped_to(&opt.outfile, rectangle);
|
||||
capture.save_cropped_to(&opt.outfile, rectangle)?;
|
||||
}
|
||||
_ => todo!("TODO"),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue