cursor and verbosity

This commit is contained in:
Michael Zhang 2020-12-23 22:55:06 -06:00
parent 2372cbb963
commit eca99edb41
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
2 changed files with 8 additions and 2 deletions

View file

@ -114,6 +114,7 @@ impl Gui {
println!("result: {:?}", result.status()); println!("result: {:?}", result.status());
info!("Grabbing pointer..."); info!("Grabbing pointer...");
let cursor = xcb_util::cursor::create_font_cursor(&self.conn, xcb_util::cursor::CROSSHAIR);
let result = xproto::grab_pointer( let result = xproto::grab_pointer(
&self.conn, &self.conn,
false, false,
@ -124,7 +125,7 @@ impl Gui {
xcb::GRAB_MODE_ASYNC as u8, xcb::GRAB_MODE_ASYNC as u8,
xcb::GRAB_MODE_ASYNC as u8, xcb::GRAB_MODE_ASYNC as u8,
xcb::NONE, xcb::NONE,
xcb::NONE, cursor,
xcb::CURRENT_TIME, xcb::CURRENT_TIME,
) )
.get_reply()?; .get_reply()?;
@ -226,6 +227,7 @@ impl Gui {
info!("Loop exited, cleaning up..."); info!("Loop exited, cleaning up...");
xproto::ungrab_keyboard(&self.conn, xcb::CURRENT_TIME).request_check()?; xproto::ungrab_keyboard(&self.conn, xcb::CURRENT_TIME).request_check()?;
xproto::ungrab_pointer(&self.conn, xcb::CURRENT_TIME).request_check()?;
Ok(state.rect()) Ok(state.rect())
} }

View file

@ -17,7 +17,7 @@ fn main() -> Result<()> {
stderrlog::new() stderrlog::new()
.module(module_path!()) .module(module_path!())
.verbosity(5) .verbosity(opt.verbose)
.init() .init()
.unwrap(); .unwrap();
@ -48,6 +48,10 @@ pub struct Options {
/// The file to save the screenshot to /// The file to save the screenshot to
#[structopt(short = "o", long = "out", parse(from_os_str))] #[structopt(short = "o", long = "out", parse(from_os_str))]
pub outfile: PathBuf, pub outfile: PathBuf,
/// Verbose mode (-v, -vv, -vvv, etc)
#[structopt(short = "v", long = "verbose", parse(from_occurrences))]
verbose: usize,
} }
/// A region option /// A region option