diff options
author | Matias Linares <matiaslina@openmailbox.org> | 2016-09-04 14:01:37 -0300 |
---|---|---|
committer | Matias Linares <matiaslina@openmailbox.org> | 2016-09-04 14:01:37 -0300 |
commit | 5bcdb566c69523edb1ceb857cbf6d0a676cc318d (patch) | |
tree | d3506fee02510999128fdfb5ec6a84ca99c9962b /src/main.rs | |
parent | 67306a1f063f15bc8127cdc2f72f971f2d06dd69 (diff) | |
download | dotwm-5bcdb566c69523edb1ceb857cbf6d0a676cc318d.tar.gz |
Add Mouse drag support.
This concludes the first 'release' :p.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 11 |
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(); |