summaryrefslogtreecommitdiff
path: root/src/safe_x11/mod.rs
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2015-11-30 22:50:01 -0300
committerMatias Linares <matiaslina@openmailbox.org>2015-11-30 22:50:01 -0300
commit12faa87415d91820503b6b1c98ebabbddc50d665 (patch)
tree1f44c59543467629b0e6560dae05594d82142070 /src/safe_x11/mod.rs
parent17e7402348195d24b7745d4dbea9f922b71f675c (diff)
downloaddotwm-12faa87415d91820503b6b1c98ebabbddc50d665.tar.gz
Add resize-win-sticky.
The move window sticky is working weirdly. The movement should be using the attrs.x and attrs.y instead the attrs.x/y + attrs.width/height. But it's working :).
Diffstat (limited to 'src/safe_x11/mod.rs')
-rw-r--r--src/safe_x11/mod.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/safe_x11/mod.rs b/src/safe_x11/mod.rs
index 9cd14fd..2e368aa 100644
--- a/src/safe_x11/mod.rs
+++ b/src/safe_x11/mod.rs
@@ -149,7 +149,7 @@ pub fn grab_button(display: *mut Display, button: u32, modifiers: u32,
cursor: Cursor) {
unsafe {
let default_win = xlib::XDefaultRootWindow(display);
- xlib::XGrabButton(display, button, modifiers , default_win,
+ xlib::XGrabButton(display, button, modifiers, default_win,
owner_events as i32, event_mask as u32, pointer_mode,
keyboard_mode, confine_to, cursor);
}
@@ -159,6 +159,7 @@ pub fn grab_button(display: *mut Display, button: u32, modifiers: u32,
///
pub fn grab_key(display: *mut Display, key: u32, modifiers: u32, owner_events: bool,
pointer_mode: i32, keyboard_mode: i32) {
+ println!("Modifiers {:x}", modifiers);
unsafe {
let default_win = xlib::XDefaultRootWindow(display);
let keycode: i32 = xlib::XKeysymToKeycode(display, key as u64) as i32;
@@ -166,6 +167,14 @@ pub fn grab_key(display: *mut Display, key: u32, modifiers: u32, owner_events: b
owner_events as i32, pointer_mode, keyboard_mode);
}
}
+/// Unregister a combination of keys that will send a `XEvent`
+pub fn ungrab_key(display: *mut Display, key: u32, modifiers: u32) {
+ unsafe {
+ let default_win = xlib::XDefaultRootWindow(display);
+ let keycode: i32 = xlib::XKeysymToKeycode(display, key as u64) as i32;
+ xlib::XUngrabKey(display, keycode, modifiers, default_win);
+ }
+}
// Window code.