aboutsummaryrefslogtreecommitdiff
path: root/src/safe_x11/window.rs
diff options
context:
space:
mode:
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();