summaryrefslogtreecommitdiff
path: root/src/safe_x11/mod.rs
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2015-11-29 11:57:19 -0300
committerMatias Linares <matiaslina@openmailbox.org>2015-11-29 11:57:48 -0300
commitd5e55aab6499a89e9dfaf5b976938bfe3e2f6aee (patch)
tree52efc28076c31fdd2522ed8b7871a7dd99ad0c87 /src/safe_x11/mod.rs
parente1ec354306742a5804a20e2651cf49945cd17287 (diff)
downloaddotwm-d5e55aab6499a89e9dfaf5b976938bfe3e2f6aee.tar.gz
Begin ef EWMH support and sticky movement
The implementationn of the EWMH and ICCCM support is incomplete. I need to check how to implement on the right way.
Diffstat (limited to 'src/safe_x11/mod.rs')
-rw-r--r--src/safe_x11/mod.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/safe_x11/mod.rs b/src/safe_x11/mod.rs
index 0283966..9cd14fd 100644
--- a/src/safe_x11/mod.rs
+++ b/src/safe_x11/mod.rs
@@ -6,6 +6,8 @@
use x11::xlib;
use x11::xlib::{
Display,
+ XDisplayWidth, XDisplayHeight,
+ XDefaultScreen,
XConnectionNumber,
Screen,
Cursor,
@@ -17,6 +19,8 @@ use x11::xlib::{
// Windows
Window,
+
+ Atom, XInternAtom,
};
use x11::xlib::XKeyEvent;
@@ -110,6 +114,12 @@ pub fn next_xevent(display: *mut Display) -> XEvent {
}
}
+pub fn screen_size(display: *mut Display) -> (u32, u32) {
+ let screen = unsafe { XDefaultScreen(display) };
+ let dw: u32 = unsafe { XDisplayWidth(display, screen) as u32 };
+ let dh: u32 = unsafe { XDisplayHeight(display, screen) as u32 };
+ (dw, dh)
+}
/// Grab pointer buttons.
///
@@ -210,3 +220,10 @@ fn get_color<T: Into<Vec<u8>>>(display: *mut Display, color: T) -> u64{
pub fn lookup_keysym(ev: &mut XKeyEvent) -> xlib::KeySym {
unsafe { xlib::XLookupKeysym(ev, 0) }
}
+
+pub fn atom<T: Into<Vec<u8>>>(display: *mut Display, name: T) -> Atom {
+ unsafe {
+ let cstr = CString::new(name).unwrap();
+ XInternAtom(display, cstr.as_ptr(), 0)
+ }
+}