summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2015-11-22 02:58:41 -0300
committerMatias Linares <matiaslina@openmailbox.org>2015-11-22 02:58:41 -0300
commit5da38341bc54f24c8cad41f1b63405d8cc955fe7 (patch)
treedebe4dda2dd02cc23ed64b54df768a0f584938d2 /src/main.rs
parenta21473f60c6cfad6335db3b0b45cdff23f8b3a89 (diff)
downloaddotwm-5da38341bc54f24c8cad41f1b63405d8cc955fe7.tar.gz
next_xevent don't block anymore!
Now the next_xevent (from the safex11) will not block forever. So we can listen the socket without doing some thread stuff.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index e652dca..8bf3caa 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,6 +14,7 @@ use dotwm::DotWM;
use command::*;
use event::{Event,next_event};
use socket::{configure_wm, listen_socket};
+use safe_x11::event as x11_event;
use std::collections::HashMap;
@@ -29,6 +30,7 @@ fn main() {
println!("Creating dotwm");
let mut dotwm = DotWM::new();
let mut bindings: BindingHash = HashMap::new();
+ let x11_fd = x11_event::x11_fd(dotwm.display);
add_binding(&mut dotwm,&mut bindings, keysym::XK_Return, xlib::Mod4Mask, exec,
&["xterm"]);
@@ -65,14 +67,15 @@ fn main() {
}
}
});
-
configure_wm(&mut dotwm, &receiver);
// Main loop
loop {
+ println!("Listening socket");
listen_socket(&mut dotwm, &receiver);
// Event handling.
- let event = next_event(dotwm.display);
+ println!("Waiting event");
+ let event = next_event(dotwm.display, x11_fd);
println!("Event {:?}", event);
match event {
Event::Key(mut e, true) => {
@@ -100,7 +103,7 @@ fn main() {
dotwm.change_focus_of(idx);
}
},
- _ => (),
+ _ => println!("Unknown event"),
}
collect_zombies();
}