diff --git a/src/gui.rs b/src/gui.rs index cb48c6a..a793e07 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -52,6 +52,11 @@ impl Gui { let root_window = screen.root(); let (width, height) = (screen.width_in_pixels(), screen.height_in_pixels()); + let evt_mask = xcb::EVENT_MASK_BUTTON_PRESS + | xcb::EVENT_MASK_BUTTON_RELEASE + | xcb::EVENT_MASK_POINTER_MOTION; + let cursor = xcb_util::cursor::create_font_cursor(&self.conn, xcb_util::cursor::CROSSHAIR); + xproto::create_window( &self.conn, xcb::COPY_FROM_PARENT as u8, @@ -67,7 +72,8 @@ impl Gui { &[ (xcb::CW_OVERRIDE_REDIRECT, 1), // (xcb::CW_BACK_PIXEL, screen.white_pixel()), - // (xcb::CW_EVENT_MASK, u32::MAX), + (xcb::CW_EVENT_MASK, evt_mask), + (xcb::CW_CURSOR, cursor), ], ) .request_check()?; @@ -112,14 +118,11 @@ impl Gui { .get_reply()?; info!("Grabbing pointer..."); - let cursor = xcb_util::cursor::create_font_cursor(&self.conn, xcb_util::cursor::CROSSHAIR); xproto::grab_pointer( &self.conn, false, id, - (xcb::EVENT_MASK_BUTTON_PRESS - | xcb::EVENT_MASK_BUTTON_RELEASE - | xcb::EVENT_MASK_POINTER_MOTION) as u16, + evt_mask as u16, xcb::GRAB_MODE_ASYNC as u8, xcb::GRAB_MODE_ASYNC as u8, xcb::NONE, diff --git a/src/main.rs b/src/main.rs index b6e7aa8..594f92c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,8 +5,8 @@ extern crate anyhow; mod gui; -use std::process; use std::path::PathBuf; +use std::process; use anyhow::Result; use structopt::StructOpt;