summaryrefslogtreecommitdiff
path: root/src/safe_x11/mod.rs
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2015-12-07 16:19:36 -0300
committerMatias Linares <matiaslina@openmailbox.org>2015-12-07 16:19:36 -0300
commit69f8194da778a692b6b0c14f43d9611c2072e8ba (patch)
tree8d9f252bf7a6db515a05800a73b35b21d1692cfb /src/safe_x11/mod.rs
parent12faa87415d91820503b6b1c98ebabbddc50d665 (diff)
downloaddotwm-69f8194da778a692b6b0c14f43d9611c2072e8ba.tar.gz
Implement desktops.
It's somewhat buggy. But works :). There're 2 desktops only for now, maybe later I will implement something more dynamic
Diffstat (limited to 'src/safe_x11/mod.rs')
-rw-r--r--src/safe_x11/mod.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/safe_x11/mod.rs b/src/safe_x11/mod.rs
index 2e368aa..9e5859a 100644
--- a/src/safe_x11/mod.rs
+++ b/src/safe_x11/mod.rs
@@ -78,10 +78,8 @@ impl<'a> fmt::Display for XSafeError<'a> {
///
pub fn open_display(display: &str) -> Result<*mut Display, XSafeError> {
let d = if display == "" {
- println!("Opening default display");
unsafe { xlib::XOpenDisplay(0x0 as *const i8) }
} else {
- println!("Opening {}", display);
let cstr = try!(CString::new(display));
unsafe { xlib::XOpenDisplay(cstr.as_ptr()) }
};
@@ -121,6 +119,10 @@ pub fn screen_size(display: *mut Display) -> (u32, u32) {
(dw, dh)
}
+pub fn root_window(display: *mut Display) -> Window {
+ unsafe { xlib::XDefaultRootWindow(display) }
+}
+
/// Grab pointer buttons.
///
/// # Example
@@ -159,7 +161,6 @@ 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;