[sawfish] added resize-window-to-dimensions



commit aa563e20b0b1e19ac68b3496867a9dc584e53604
Author: Christopher Roy Bratusek <zanghar freenet de>
Date:   Thu Jan 6 18:54:58 2011 +0100

    added resize-window-to-dimensions

 ChangeLog                               |    7 +++++++
 lisp/sawfish/wm/commands/move-resize.jl |   12 ++++++++++++
 lisp/sawfish/wm/menus.jl                |    3 +++
 3 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 66bb0f1..fc075fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-01-06  Christopher Bratusek <zanghar freenet de>
+	* lisp/sawfish/wm/commands/move-resize.jl
+	* lisp/sawfish/wm/menus.jl: added a function to resize either the
+	current-event-window or a given one, to a specific size. Also added
+	corresponding window-operations-menu entry. (resize-window-to-dimensions)
+	Improved version of a code snippet from GSR
+
 2010-12-29  Christopher Bratusek <zanghar freenet de>
 	* src/events.c: rep_INTERNâ??while-grabbed [Teika Kazura]
 
diff --git a/lisp/sawfish/wm/commands/move-resize.jl b/lisp/sawfish/wm/commands/move-resize.jl
index 912dba6..27f745f 100644
--- a/lisp/sawfish/wm/commands/move-resize.jl
+++ b/lisp/sawfish/wm/commands/move-resize.jl
@@ -22,6 +22,7 @@
 
     (export move-window-interactively
 	    resize-window-interactively
+	    resize-window-to-dimensions
 	    move-selected-window
 	    resize-selected-window
 	    double-window-size
@@ -554,6 +555,12 @@ its edges with an edge of another window.")
     (if (not (window-get w 'fixed-size))
       (do-move-resize w 'resize)))
 
+  (define (resize-window-to-dimensions x y #!key window)
+    "Resize the current window to the specified dimensions"
+    (if window
+        (resize-window-with-hints* window x y)
+      (resize-window-with-hints* (current-event-window) x y)))
+
   (define (move-selected-window)
     "Wait for the user to select a window, then interactively move
 that window."
@@ -584,6 +591,11 @@ that window."
     move-window-interactively #:spec "%W")
   (define-command 'resize-window-interactively
     resize-window-interactively #:spec "%W")
+  (define-command 'resize-window-to-dimensions
+     resize-window-to-dimensions
+     #:spec "NNew width:\nNNew height:"
+     #:type '(and (labelled "New width:" (number 100))
+                  (labelled "New height:" (number 100))))
   (define-command 'move-selected-window
     move-selected-window)
   (define-command 'resize-selected-window
diff --git a/lisp/sawfish/wm/menus.jl b/lisp/sawfish/wm/menus.jl
index efa4165..9adc59b 100644
--- a/lisp/sawfish/wm/menus.jl
+++ b/lisp/sawfish/wm/menus.jl
@@ -107,6 +107,9 @@ before killing it.")
       (,(_ "_Resize") resize-window-interactively
        (insensitive . ,(lambda (w)
 			 (window-get w 'fixed-size))))
+      (,(_ "_Resize to") resize-window-to-dimensions
+       (insensitive . ,(lambda (w)
+			 (window-get w 'fixed-size))))
       (,(_ "_Close") delete-window
        (insensitive . ,(lambda (w)
 			 (window-get w 'never-delete))))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]