Compare commits
No commits in common. "e690aa07f145fcfb4191260f8023ec0e1125975f" and "caa4102856610e4be83e666229cfa85a1a79ac84" have entirely different histories.
e690aa07f1
...
caa4102856
50
src/main.rs
50
src/main.rs
|
@ -7,22 +7,15 @@ fn main() {
|
||||||
|
|
||||||
let window = conn.generate_id();
|
let window = conn.generate_id();
|
||||||
|
|
||||||
let width = screen.width_in_pixels();
|
|
||||||
let height = screen.height_in_pixels();
|
|
||||||
|
|
||||||
println!("width {} height {}", width, height);
|
|
||||||
|
|
||||||
let values = [
|
let values = [
|
||||||
// ?RGB. First 4 bytes appear to do nothing
|
(xcb::CW_BACK_PIXEL, screen.white_pixel()),
|
||||||
(xcb::CW_BACK_PIXEL, 0x00_00_00_00),
|
|
||||||
(
|
(
|
||||||
xcb::CW_EVENT_MASK,
|
xcb::CW_EVENT_MASK,
|
||||||
xcb::EVENT_MASK_EXPOSURE
|
xcb::EVENT_MASK_EXPOSURE
|
||||||
| xcb::EVENT_MASK_KEY_PRESS // we'll need this later
|
| xcb::EVENT_MASK_KEY_PRESS // we'll need this later
|
||||||
// | xcb::EVENT_MASK_BUTTON_PRESS
|
| xcb::EVENT_MASK_BUTTON_PRESS
|
||||||
// | xcb::EVENT_MASK_BUTTON_RELEASE,
|
| xcb::EVENT_MASK_BUTTON_RELEASE,
|
||||||
),
|
),
|
||||||
(xcb::CW_OVERRIDE_REDIRECT, 1 as u32), // Don't be window managed
|
|
||||||
];
|
];
|
||||||
|
|
||||||
xcb::create_window(
|
xcb::create_window(
|
||||||
|
@ -30,11 +23,11 @@ fn main() {
|
||||||
xcb::COPY_FROM_PARENT as u8,
|
xcb::COPY_FROM_PARENT as u8,
|
||||||
window,
|
window,
|
||||||
screen.root(),
|
screen.root(),
|
||||||
0, // x
|
|
||||||
0, // y
|
|
||||||
0, // width
|
|
||||||
0, // height
|
|
||||||
0,
|
0,
|
||||||
|
0,
|
||||||
|
150,
|
||||||
|
150,
|
||||||
|
10,
|
||||||
xcb::WINDOW_CLASS_INPUT_OUTPUT as u16,
|
xcb::WINDOW_CLASS_INPUT_OUTPUT as u16,
|
||||||
screen.root_visual(),
|
screen.root_visual(),
|
||||||
&values,
|
&values,
|
||||||
|
@ -42,38 +35,11 @@ fn main() {
|
||||||
|
|
||||||
xcb::map_window(&conn, window);
|
xcb::map_window(&conn, window);
|
||||||
|
|
||||||
let title = "hacksaw";
|
|
||||||
// setting title
|
|
||||||
xcb::change_property(
|
|
||||||
&conn,
|
|
||||||
xcb::PROP_MODE_REPLACE as u8,
|
|
||||||
window,
|
|
||||||
xcb::ATOM_WM_NAME,
|
|
||||||
xcb::ATOM_STRING,
|
|
||||||
8,
|
|
||||||
title.as_bytes(),
|
|
||||||
);
|
|
||||||
|
|
||||||
xcb::grab_pointer(
|
|
||||||
&conn,
|
|
||||||
true,
|
|
||||||
screen.root(),
|
|
||||||
(xcb::EVENT_MASK_BUTTON_RELEASE | xcb::EVENT_MASK_BUTTON_PRESS) as u16,
|
|
||||||
xcb::GRAB_MODE_ASYNC as u8,
|
|
||||||
xcb::GRAB_MODE_ASYNC as u8,
|
|
||||||
xcb::NONE,
|
|
||||||
xcb::NONE,
|
|
||||||
xcb::CURRENT_TIME,
|
|
||||||
).get_reply()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
conn.flush();
|
conn.flush();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let ev = conn.wait_for_event();
|
let ev = conn.wait_for_event();
|
||||||
match ev {
|
match ev {
|
||||||
None => {
|
None => {
|
||||||
println!("Error reading events");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Some(ev) => {
|
Some(ev) => {
|
||||||
|
@ -97,6 +63,4 @@ fn main() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// Now we have taken coordinates, we use them
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue