From 12faa87415d91820503b6b1c98ebabbddc50d665 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Mon, 30 Nov 2015 22:50:01 -0300 Subject: 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 :). --- src/safe_x11/mod.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/safe_x11/mod.rs') 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. -- cgit v1.2.3-54-g00ecf