From 12faa87415d91820503b6b1c98ebabbddc50d665 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Mon, 30 Nov 2015 22:50:01 -0300 Subject: 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 :). --- src/safe_x11/window.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/safe_x11/window.rs') 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(); -- cgit v1.2.3-54-g00ecf