[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[STUMP] Frames
From: |
Manuel Giraud |
Subject: |
[STUMP] Frames |
Date: |
Fri, 21 Apr 2006 18:21:23 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (berkeley-unix) |
The following patch is not a great thing. I've just changed the frame
struct to be class. Updated the code where it needed to (not much, with a
good naming convention :-). And add few after method though when the frame
geometry is programmatically modified windows are update correctly.
So now, you're in a SLIME repl connected to your stumpwm lisp process
and you can go like this:
(in-package :stumpwm)
(with-accessors ((x frame-x) (y frame-y) (w frame-width) (h frame-height))
(screen-current-frame (current-screen))
(setf x 200
y 200
w 800
h 600))
Fun, isn't it :-)
(Note: a function like resize-frame have to be rewritten not to call
sync-frame-windows at all)
---8<------------------
cvs diff: Diffing .
Index: core.lisp
===================================================================
RCS file: /cvsroot/stumpwm/stumpwm/core.lisp,v
retrieving revision 1.46
diff -u -r1.46 core.lisp
--- core.lisp 16 Apr 2006 22:12:10 -0000 1.46
+++ core.lisp 21 Apr 2006 16:06:21 -0000
@@ -537,6 +537,18 @@
;;; Frame functions
+(defmethod (setf frame-x) :after (x (f frame))
+ (sync-frame-windows (current-screen) f))
+
+(defmethod (setf frame-y) :after (y (f frame))
+ (sync-frame-windows (current-screen) f))
+
+(defmethod (setf frame-width) :after (width (f frame))
+ (sync-frame-windows (current-screen) f))
+
+(defmethod (setf frame-height) :after (height (f frame))
+ (sync-frame-windows (current-screen) f))
+
(defun frame-raise-window (s f w &optional (focus t))
"Raise the window w in frame f in screen s. if FOCUS is
T (default) then also focus the frame."
@@ -573,12 +585,13 @@
(defun make-initial-frame (w h)
"Used to create an initial frame hash for a screen."
- (make-frame :number 0
- :x 0
- :y 0
- :width w
- :height h
- :window nil))
+ (make-instance 'frame
+ :number 0
+ :x 0
+ :y 0
+ :width w
+ :height h
+ :window nil))
(defun screen-frames (screen)
(tree-accum-fn (screen-frame-tree screen) 'nconc 'list))
@@ -591,36 +604,40 @@
"Return 2 new frames. The first one stealing P's number and window"
(let* ((w (truncate (/ (frame-width p) 2)))
(h (frame-height p))
- (f1 (make-frame :number (frame-number p)
- :x (frame-x p)
- :y (frame-y p)
- :width w
- :height h
- :window (frame-window p)))
- (f2 (make-frame :number (find-free-frame-number screen)
- :x (+ (frame-x p) w)
- :y (frame-y p)
- :width w
- :height h
- :window nil)))
+ (f1 (make-instance 'frame
+ :number (frame-number p)
+ :x (frame-x p)
+ :y (frame-y p)
+ :width w
+ :height h
+ :window (frame-window p)))
+ (f2 (make-instance 'frame
+ :number (find-free-frame-number screen)
+ :x (+ (frame-x p) w)
+ :y (frame-y p)
+ :width w
+ :height h
+ :window nil)))
(values f1 f2)))
(defun split-frame-v (screen p)
"Return 2 new frames. The first one stealing P's number and window"
(let* ((w (frame-width p))
(h (truncate (/ (frame-height p) 2)))
- (f1 (make-frame :number (frame-number p)
- :x (frame-x p)
- :y (frame-y p)
- :width w
- :height h
- :window (frame-window p)))
- (f2 (make-frame :number (find-free-frame-number screen)
- :x (frame-x p)
- :y (+ (frame-y p) h)
- :width w
- :height h
- :window nil)))
+ (f1 (make-instance 'frame
+ :number (frame-number p)
+ :x (frame-x p)
+ :y (frame-y p)
+ :width w
+ :height h
+ :window (frame-window p)))
+ (f2 (make-instance 'frame
+ :number (find-free-frame-number screen)
+ :x (frame-x p)
+ :y (+ (frame-y p) h)
+ :width w
+ :height h
+ :window nil)))
(values f1 f2)))
(defun funcall-on-leaf (tree leaf fn)
Index: primitives.lisp
===================================================================
RCS file: /cvsroot/stumpwm/stumpwm/primitives.lisp,v
retrieving revision 1.28
diff -u -r1.28 primitives.lisp
--- primitives.lisp 16 Apr 2006 22:04:44 -0000 1.28
+++ primitives.lisp 21 Apr 2006 16:06:21 -0000
@@ -151,13 +151,13 @@
mapped key the ENTIRE keyboard will be frozen and you will have
to login remotely to regain control.")
-(defstruct frame
- (number nil :type integer)
- x
- y
- width
- height
- window)
+(defclass frame ()
+ ((number :initform nil :initarg :number :type number :accessor frame-number)
+ (x :initform 0 :initarg :x :accessor frame-x)
+ (y :initform 0 :initarg :y :accessor frame-y)
+ (width :initform 0 :initarg :width :accessor frame-width)
+ (height :initform 0 :initarg :height :accessor frame-height)
+ (window :initform nil :initarg :window :accessor frame-window)))
(defstruct modifiers
(meta nil)
---8<------------------
--
Manuel Giraud _ 10-12 avenue de l'Europe
tel: +33 1 39253902 { \," 78140 Vélizy
fax: +33 1 39254778 {_`/ France
address@hidden ` http://www.cetp.ipsl.fr
- [STUMP] Frames,
Manuel Giraud <=