summaryrefslogtreecommitdiff
path: root/src/safe_x11/mod.rs
diff options
context:
space:
mode:
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.