aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2016-09-04 14:01:37 -0300
committerMatias Linares <matiaslina@openmailbox.org>2016-09-04 14:01:37 -0300
commit5bcdb566c69523edb1ceb857cbf6d0a676cc318d (patch)
treed3506fee02510999128fdfb5ec6a84ca99c9962b /src/main.rs
parent67306a1f063f15bc8127cdc2f72f971f2d06dd69 (diff)
downloaddotwm-5bcdb566c69523edb1ceb857cbf6d0a676cc318d.tar.gz
Add Mouse drag support.
This concludes the first 'release' :p.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index dcef752..f745e92 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -23,6 +23,7 @@ use event::{Event,select_event};
use socket::parser;
use std::collections::HashMap;
+use std::mem::uninitialized;
use x11::xlib;
use x11::keysym;
@@ -77,12 +78,20 @@ fn main() {
dotwm.remove_window(e.window);
},
Event::Enter(e) => {
- if let Some(idx) = dotwm.find_window(e.window) {
+ if let Some(idx) = dotwm.window_idx(e.window) {
dotwm.change_focus_of(idx);
}
},
Event::Expose(_) => {
},
+ Event::Drag(e) => {
+ // We can "compress" the drag notify here.
+ unsafe{
+ let mut new_ev = uninitialized();
+ while xlib::XCheckTypedEvent(dotwm.display, xlib::MotionNotify, &mut new_ev) != 0 {};
+ };
+ exec_func(&mut dotwm, &mut bindings, 1, e.state, xlib::XEvent::from(e));
+ },
Event::Socket(stream) => {
let mut s = stream.try_clone().unwrap();
let mut buf = String::new();