|
@@ -2,6 +2,7 @@ use chan;
|
|
use xcb;
|
|
use xcb;
|
|
|
|
|
|
pub enum Event {
|
|
pub enum Event {
|
|
|
|
+ Ready(xcb::Timestamp),
|
|
ChildRequest(xcb::Window),
|
|
ChildRequest(xcb::Window),
|
|
ChildDestroyed(xcb::Window),
|
|
ChildDestroyed(xcb::Window),
|
|
ChildConfigured(xcb::Window)
|
|
ChildConfigured(xcb::Window)
|
|
@@ -10,10 +11,15 @@ pub enum Event {
|
|
const CLIENT_MESSAGE: u8 = xcb::CLIENT_MESSAGE | 0x80;
|
|
const CLIENT_MESSAGE: u8 = xcb::CLIENT_MESSAGE | 0x80;
|
|
|
|
|
|
pub fn event_loop(conn: &xcb::Connection, tx: chan::Sender<Event>) {
|
|
pub fn event_loop(conn: &xcb::Connection, tx: chan::Sender<Event>) {
|
|
|
|
+ let mut ready = false;
|
|
loop {
|
|
loop {
|
|
match conn.wait_for_event() {
|
|
match conn.wait_for_event() {
|
|
Some(event) => match event.response_type() {
|
|
Some(event) => match event.response_type() {
|
|
- xcb::EXPOSE => { println!("expose") },
|
|
|
|
|
|
+ xcb::PROPERTY_NOTIFY if !ready => {
|
|
|
|
+ ready = true;
|
|
|
|
+ let event: &xcb::PropertyNotifyEvent = xcb::cast_event(&event);
|
|
|
|
+ tx.send(Event::Ready(event.time()));
|
|
|
|
+ },
|
|
CLIENT_MESSAGE => {
|
|
CLIENT_MESSAGE => {
|
|
let event: &xcb::ClientMessageEvent = xcb::cast_event(&event);
|
|
let event: &xcb::ClientMessageEvent = xcb::cast_event(&event);
|
|
let data = event.data().data32();
|
|
let data = event.data().data32();
|