fix event mask and cursor
This commit is contained in:
parent
c681ad2648
commit
8bcd9d6385
2 changed files with 9 additions and 6 deletions
13
src/gui.rs
13
src/gui.rs
|
@ -52,6 +52,11 @@ impl Gui {
|
||||||
let root_window = screen.root();
|
let root_window = screen.root();
|
||||||
let (width, height) = (screen.width_in_pixels(), screen.height_in_pixels());
|
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(
|
xproto::create_window(
|
||||||
&self.conn,
|
&self.conn,
|
||||||
xcb::COPY_FROM_PARENT as u8,
|
xcb::COPY_FROM_PARENT as u8,
|
||||||
|
@ -67,7 +72,8 @@ impl Gui {
|
||||||
&[
|
&[
|
||||||
(xcb::CW_OVERRIDE_REDIRECT, 1),
|
(xcb::CW_OVERRIDE_REDIRECT, 1),
|
||||||
// (xcb::CW_BACK_PIXEL, screen.white_pixel()),
|
// (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()?;
|
.request_check()?;
|
||||||
|
@ -112,14 +118,11 @@ impl Gui {
|
||||||
.get_reply()?;
|
.get_reply()?;
|
||||||
|
|
||||||
info!("Grabbing pointer...");
|
info!("Grabbing pointer...");
|
||||||
let cursor = xcb_util::cursor::create_font_cursor(&self.conn, xcb_util::cursor::CROSSHAIR);
|
|
||||||
xproto::grab_pointer(
|
xproto::grab_pointer(
|
||||||
&self.conn,
|
&self.conn,
|
||||||
false,
|
false,
|
||||||
id,
|
id,
|
||||||
(xcb::EVENT_MASK_BUTTON_PRESS
|
evt_mask as u16,
|
||||||
| xcb::EVENT_MASK_BUTTON_RELEASE
|
|
||||||
| xcb::EVENT_MASK_POINTER_MOTION) as u16,
|
|
||||||
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,
|
||||||
|
|
|
@ -5,8 +5,8 @@ extern crate anyhow;
|
||||||
|
|
||||||
mod gui;
|
mod gui;
|
||||||
|
|
||||||
use std::process;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
use std::process;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
Loading…
Reference in a new issue