From d5e55aab6499a89e9dfaf5b976938bfe3e2f6aee Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Sun, 29 Nov 2015 11:57:19 -0300 Subject: 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. --- src/safe_x11/mod.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/safe_x11/mod.rs') 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>>(display: *mut Display, color: T) -> u64{ pub fn lookup_keysym(ev: &mut XKeyEvent) -> xlib::KeySym { unsafe { xlib::XLookupKeysym(ev, 0) } } + +pub fn atom>>(display: *mut Display, name: T) -> Atom { + unsafe { + let cstr = CString::new(name).unwrap(); + XInternAtom(display, cstr.as_ptr(), 0) + } +} -- cgit v1.2.3-70-g09d2