aboutsummaryrefslogtreecommitdiffstats
path: root/src/x11
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2014-11-18 05:22:01 +0100
committertomaka <pierre.krieger1708@gmail.com>2014-11-18 05:22:01 +0100
commit4edb3df155c2bb1b58b2a93d87fae0860a09d1fe (patch)
treedecec08122b0dc34345ccc5d560735f7d66888e5 /src/x11
parent0dc5086efb29e84c48cd4dcc1da48ee9755842e3 (diff)
parentc9e1912eb741daee231034c140b8f5b0b11d0871 (diff)
downloadglutin-4edb3df155c2bb1b58b2a93d87fae0860a09d1fe.tar.gz
glutin-4edb3df155c2bb1b58b2a93d87fae0860a09d1fe.zip
Merge pull request #120 from glennw/x11-visibility
Add support for with_visibility(), show(), hide() on X11.
Diffstat (limited to 'src/x11')
-rw-r--r--src/x11/ffi.rs2
-rw-r--r--src/x11/window/mod.rs17
2 files changed, 18 insertions, 1 deletions
diff --git a/src/x11/ffi.rs b/src/x11/ffi.rs
index 6fbfd81..b7e7379 100644
--- a/src/x11/ffi.rs
+++ b/src/x11/ffi.rs
@@ -1426,6 +1426,8 @@ extern "C" {
index: libc::c_int) -> KeySym;
pub fn XMoveWindow(display: *mut Display, w: Window, x: libc::c_int, y: libc::c_int);
pub fn XMapWindow(display: *mut Display, w: Window);
+ pub fn XMapRaised(display: *mut Display, w: Window);
+ pub fn XUnmapWindow(display: *mut Display, w: Window);
pub fn XNextEvent(display: *mut Display, event_return: *mut XEvent);
pub fn XInitThreads() -> Status;
pub fn XOpenDisplay(display_name: *const libc::c_char) -> *mut Display;
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs
index 64461a8..fd63d60 100644
--- a/src/x11/window/mod.rs
+++ b/src/x11/window/mod.rs
@@ -163,12 +163,19 @@ impl Window {
win
};
+ // set visibility
+ if builder.visible {
+ unsafe {
+ ffi::XMapRaised(display, window);
+ ffi::XFlush(display);
+ }
+ }
+
// creating window, step 2
let wm_delete_window = unsafe {
use std::c_str::ToCStr;
let delete_window = "WM_DELETE_WINDOW".to_c_str();
- ffi::XMapWindow(display, window);
let mut wm_delete_window = ffi::XInternAtom(display, delete_window.as_ptr(), 0);
ffi::XSetWMProtocols(display, window, &mut wm_delete_window, 1);
let c_title = builder.title.to_c_str();
@@ -287,9 +294,17 @@ impl Window {
}
pub fn show(&self) {
+ unsafe {
+ ffi::XMapRaised(self.display, self.window);
+ ffi::XFlush(self.display);
+ }
}
pub fn hide(&self) {
+ unsafe {
+ ffi::XUnmapWindow(self.display, self.window);
+ ffi::XFlush(self.display);
+ }
}
fn get_geometry(&self) -> Option<(int, int, uint, uint)> {