aboutsummaryrefslogtreecommitdiff
path: root/src/safe_x11/window.rs
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2015-11-09 05:53:12 -0300
committerMatias Linares <matiaslina@openmailbox.org>2015-11-09 05:53:12 -0300
commit975aabe3362baf56e47d0ba022f7ea35f7bc5c7f (patch)
tree9fc8c5b3a28be7b0ab3825f8f8836031222c5a2b /src/safe_x11/window.rs
parent05bfd598a060beafe1a20ff759e499987f1ce87b (diff)
downloaddotwm-975aabe3362baf56e47d0ba022f7ea35f7bc5c7f.tar.gz
ExecFn Rewrite.
This now allows to call a ExecFn with a &mut DotWM by parameter. This help to do some things like do the window swapping. through mod4 + tab. Also the bindings are not longer on the wm, because this generates some problems with the ExecFn. Also, now it's posible to resize the windows :)
Diffstat (limited to 'src/safe_x11/window.rs')
-rw-r--r--src/safe_x11/window.rs21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/safe_x11/window.rs b/src/safe_x11/window.rs
index d2fc9ea..24b5b62 100644
--- a/src/safe_x11/window.rs
+++ b/src/safe_x11/window.rs
@@ -83,9 +83,9 @@ impl XWindow {
/// Returns the window attributes from certain window.
pub fn attributes(&self) -> XWindowAttributes {
unsafe {
- let attrptr: *mut XWindowAttributes = uninitialized();
- XGetWindowAttributes(self.display, self.inner, attrptr);
- ptr::read(attrptr)
+ let mut attrptr: XWindowAttributes = uninitialized();
+ XGetWindowAttributes(self.display, self.inner, &mut attrptr);
+ attrptr
}
}
@@ -94,10 +94,6 @@ impl XWindow {
unsafe {
let mut attributes: XWindowAttributes = uninitialized();
XGetWindowAttributes(self.display, self.inner, &mut attributes);
- println!("Moving window({:x}), {} + {} = {}, {} + {} = {}",
- self.inner as u64,
- attributes.x, xoffset, attributes.x + xoffset,
- attributes.y, yoffset, attributes.y + yoffset);
XMoveWindow(self.display, self.inner,
attributes.x + xoffset,
attributes.y + yoffset);
@@ -131,7 +127,7 @@ impl XWindow {
}
}
- /// Raise the focus of the window.
+ /// Raise the focus of the window and set a border.
pub fn focus(&self) {
let attrs = self.attributes();
if attrs.map_state == IsViewable {
@@ -140,5 +136,14 @@ impl XWindow {
RevertToParent, CurrentTime)
};
}
+ self.raise();
+ self.set_border_width(1);
+ self.set_border_color("red");
+ }
+
+ /// Give a black border.
+ pub fn unfocus(&self) {
+ self.set_border_width(1);
+ self.set_border_color("black");
}
}