From eca99edb41b9a336bc715c13ee68af345166bf9e Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Wed, 23 Dec 2020 22:55:06 -0600 Subject: [PATCH] cursor and verbosity --- src/gui.rs | 4 +++- src/main.rs | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui.rs b/src/gui.rs index d76a589..989a5cb 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -114,6 +114,7 @@ impl Gui { println!("result: {:?}", result.status()); info!("Grabbing pointer..."); + let cursor = xcb_util::cursor::create_font_cursor(&self.conn, xcb_util::cursor::CROSSHAIR); let result = xproto::grab_pointer( &self.conn, false, @@ -124,7 +125,7 @@ impl Gui { xcb::GRAB_MODE_ASYNC as u8, xcb::GRAB_MODE_ASYNC as u8, xcb::NONE, - xcb::NONE, + cursor, xcb::CURRENT_TIME, ) .get_reply()?; @@ -226,6 +227,7 @@ impl Gui { info!("Loop exited, cleaning up..."); xproto::ungrab_keyboard(&self.conn, xcb::CURRENT_TIME).request_check()?; + xproto::ungrab_pointer(&self.conn, xcb::CURRENT_TIME).request_check()?; Ok(state.rect()) } diff --git a/src/main.rs b/src/main.rs index 18ae147..70962ff 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,7 @@ fn main() -> Result<()> { stderrlog::new() .module(module_path!()) - .verbosity(5) + .verbosity(opt.verbose) .init() .unwrap(); @@ -48,6 +48,10 @@ pub struct Options { /// The file to save the screenshot to #[structopt(short = "o", long = "out", parse(from_os_str))] pub outfile: PathBuf, + + /// Verbose mode (-v, -vv, -vvv, etc) + #[structopt(short = "v", long = "verbose", parse(from_occurrences))] + verbose: usize, } /// A region option