summaryrefslogtreecommitdiff
path: root/src/safe_x11/window.rs
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2015-11-30 22:50:01 -0300
committerMatias Linares <matiaslina@openmailbox.org>2015-11-30 22:50:01 -0300
commit12faa87415d91820503b6b1c98ebabbddc50d665 (patch)
tree1f44c59543467629b0e6560dae05594d82142070 /src/safe_x11/window.rs
parent17e7402348195d24b7745d4dbea9f922b71f675c (diff)
downloaddotwm-12faa87415d91820503b6b1c98ebabbddc50d665.tar.gz
Add resize-win-sticky.
The move window sticky is working weirdly. The movement should be using the attrs.x and attrs.y instead the attrs.x/y + attrs.width/height. But it's working :).
Diffstat (limited to 'src/safe_x11/window.rs')
-rw-r--r--src/safe_x11/window.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/safe_x11/window.rs b/src/safe_x11/window.rs
index 6c8e48b..34cce64 100644
--- a/src/safe_x11/window.rs
+++ b/src/safe_x11/window.rs
@@ -166,6 +166,26 @@ impl XWindow {
}
}
+ /// Resizes the window an absolute amount within the height and width.
+ pub fn resize_abs(&self, w: i32, h: i32) {
+ let attrs = self.attributes();
+ unsafe {
+ let ww: u32 = max(1, (attrs.width + w) as u32);
+ let wh: u32 = max(1, (attrs.height + h) as u32);
+ xlib::XResizeWindow(self.display, self.inner,
+ ww, wh);
+ }
+ }
+
+ pub fn resize_to(&self, w: i32, h: i32) {
+ unsafe {
+ let ww: u32 = max(1, w as u32);
+ let wh: u32 = max(1, h as u32);
+ xlib::XResizeWindow(self.display, self.inner,
+ ww, wh);
+ }
+ }
+
/// Raise the focus of the window and set a border.
pub fn focus(&self) {
let attrs = self.attributes();