why is this so painful: note, broken

lines
expectocode 2018-11-25 23:08:41 +00:00
parent 614b9881d2
commit 24e977748e
2 changed files with 43 additions and 1 deletions

View File

@ -4,4 +4,4 @@ version = "0.1.0"
authors = ["expectocode <expectocode@gmail.com>"]
[dependencies]
xcb = {version = "0.8.2", features = ["xkb"]}
xcb = {version = "0.8.2", features = ["xkb", "shape"]}

View File

@ -1,4 +1,5 @@
extern crate xcb;
use xcb::shape;
fn main() {
let (conn, screen_num) = xcb::Connection::connect(None).unwrap();
@ -72,6 +73,47 @@ fn main() {
conn.flush();
let temp_win = conn.generate_id();
xcb::create_window(
&conn,
xcb::COPY_FROM_PARENT as u8,
temp_win,
screen.root(),
0, // x
0, // y
200, // width
499, // height
0,
xcb::WINDOW_CLASS_INPUT_OUTPUT as u16,
screen.root_visual(),
&[(xcb::CW_BACK_PIXEL, screen.black_pixel())],
);
let rects = [xcb::Rectangle::new(300, 300, 400, 300)];
shape::rectangles(
&conn,
shape::SO_SET as u8,
shape::SK_BOUNDING as u8,
0,
temp_win,
0,
0,
&rects,
);
shape::combine(
&conn,
shape::SO_SET as u8,
shape::SK_BOUNDING as u8,
shape::SK_BOUNDING as u8,
window,
0,
0,
temp_win,
);
xcb::map_window(&conn, window);
conn.flush();
// TODO formalise the fact that motion comes after press?
let mut start_x = 0;
let mut start_y = 0;