stumpwm-devel
[Top][All Lists]
Advanced

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

[STUMP] [PATCH] Redisplay functionality like in ratpoison


From: 38a938c2 38a938c2
Subject: [STUMP] [PATCH] Redisplay functionality like in ratpoison
Date: Tue, 19 Aug 2008 10:29:54 +0400

Two commits: code itself and comments; works in the cases I thought of (like small configuration windows); resizes window down to 1x1, then fills the entire frame, calling maximize-window on both resizes. Bound to "redisplay" command and "l" key.

---
bindings.lisp |    1 +
window.lisp   |   23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/bindings.lisp b/bindings.lisp
index 0991011..4a4e840 100644
--- a/bindings.lisp
+++ b/bindings.lisp
@@ -146,6 +146,7 @@
          (define-key m (kbd "A") "title")
          (define-key m (kbd "h") '*help-map*)
          (define-key m (kbd "i") "info")
+          (define-key m (kbd "l") "redisplay")
          m)))

(when (null *groups-map*)
diff --git a/window.lisp b/window.lisp
index fb9e6f1..a7a13e4 100644
--- a/window.lisp
+++ b/window.lisp
@@ -639,6 +639,29 @@ than the root window's width and height."
(xlib:drawable-height (window-parent win)) (- (frame-display-height (window-group win) frame) (* 2 (xlib:drawable-border-width (window-parent win))))))))))

+(defun to-top-left-corner (window)
+  (let ((frame (window-frame window)))
+    (set-window-geometry window
+      :x (frame-x frame)
+      :y (frame-y frame))))
+
+(defun fill-frame (window)
+  (to-top-left-corner window)
+  (let ((frame (window-frame window)))
+    (set-window-geometry window
+      :width (frame-width frame)
+      :height (frame-height frame))))
+
+(defcommand redisplay () ()
+  (let ((window (current-window)))
+    (to-top-left-corner window)
+    (set-window-geometry window
+      :width 1
+      :height 1)
+    (maximize-window window)
+    (fill-frame window)
+    (maximize-window window)))
+
(defun find-free-window-number (group)
  "Return a free window number for GROUP."
  (find-free-number (mapcar 'window-number (group-windows group))))
--
1.5.6.2

---
window.lisp |    3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/window.lisp b/window.lisp
index a7a13e4..05dfc3d 100644
--- a/window.lisp
+++ b/window.lisp
@@ -640,12 +640,14 @@ than the root window's width and height."
(* 2 (xlib:drawable-border-width (window-parent win))))))))))

(defun to-top-left-corner (window)
+  "Move the window to the top left corner of corresponding frame."
  (let ((frame (window-frame window)))
    (set-window-geometry window
      :x (frame-x frame)
      :y (frame-y frame))))

(defun fill-frame (window)
+  "Resize the window to occupy entire frame."
  (to-top-left-corner window)
  (let ((frame (window-frame window)))
    (set-window-geometry window
@@ -653,6 +655,7 @@ than the root window's width and height."
      :height (frame-height frame))))

(defcommand redisplay () ()
+ "Refresh current window by a pair of resizes, also make it occupy entire frame."
  (let ((window (current-window)))
    (to-top-left-corner window)
    (set-window-geometry window
--
1.5.6.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]