clfswm.asd: Change compilation order to prevent undefined variables. src/clfswm-inter...
[clfswm.git] / src / package.lisp
blob787eea89dce81f483303376e3484a3f94caddcc1
1 ;;; --------------------------------------------------------------------------
2 ;;; CLFSWM - FullScreen Window Manager
3 ;;;
4 ;;; --------------------------------------------------------------------------
5 ;;; Documentation: Package definition
6 ;;; --------------------------------------------------------------------------
7 ;;;
8 ;;; (C) 2010 Philippe Brochard <hocwp@free.fr>
9 ;;;
10 ;;; This program is free software; you can redistribute it and/or modify
11 ;;; it under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or
13 ;;; (at your option) any later version.
14 ;;;
15 ;;; This program is distributed in the hope that it will be useful,
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with this program; if not, write to the Free Software
22 ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 ;;;
24 ;;; --------------------------------------------------------------------------
26 (in-package :cl-user)
28 (defpackage clfswm
29 (:use :common-lisp :my-html :tools :version)
30 ;; (:shadow :defun)
31 (:export :main
32 :reload-clfswm
33 :reset-clfswm
34 :exit-clfswm))
38 (in-package :clfswm)
40 ;;; CONFIG - Compress motion notify ?
41 ;; This variable may be useful to speed up some slow version of CLX.
42 ;; It is particulary useful with CLISP/MIT-CLX (and others).
43 (defconfig *have-to-compress-notify* t nil
44 "Compress event notify?
45 This variable may be useful to speed up some slow version of CLX.
46 It is particulary useful with CLISP/MIT-CLX.")
49 (defconfig *show-root-frame-p* nil nil
50 "Show the root frame information or not")
53 (defconfig *border-size* 1 nil
54 "Windows and frames border size")
58 (defparameter *modifier-alias* '((:alt :mod-1) (:alt-l :mod-1)
59 (:numlock :mod-2)
60 (:super_l :mod-4)
61 (:alt-r :mod-5) (:alt-gr :mod-5)
62 (:capslock :lock))
63 "Syntax: (modifier-alias effective-modifier)")
66 (defparameter *display* nil)
67 (defparameter *screen* nil)
68 (defparameter *root* nil)
69 (defparameter *no-focus-window* nil)
71 (defconfig *loop-timeout* 0.1 nil
72 "Maximum time (in seconds) to wait before calling *loop-hook*")
74 (defparameter *pixmap-buffer* nil)
76 (defparameter *contrib-dir* "")
78 (defparameter *default-font* nil)
79 ;;(defparameter *default-font-string* "9x15")
80 (defconfig *default-font-string* "fixed" nil
81 "The default font used in clfswm")
83 (defconfig *color-move-window* "DeepPink" 'Main-mode
84 "Color when moving or resizing a windows")
86 (defparameter *child-selection* nil)
88 ;;; CONFIG - Default frame datas
89 (defconfig *default-frame-data*
90 (list '(:tile-size 0.8) '(:tile-space-size 0.1)
91 '(:fast-layout (tile-left-layout tile-layout))
92 '(:main-layout-windows nil))
93 nil
94 "Default slots set in frame date")
97 ;;; CONFIG - Default managed window type for a frame
98 ;;; type can be :all, :normal, :transient, :maxsize, :desktop, :dock, :toolbar, :menu, :utility, :splash, :dialog
99 (defconfig *default-managed-type* '(:normal) nil
100 "Default managed window types")
101 ;;(defparameter *default-managed-type* '(:normal :maxsize :transient))
102 ;;(defparameter *default-managed-type* '(:normal :transient :maxsize :desktop :dock :toolbar :menu :utility :splash :dialog))
103 ;;(defparameter *default-managed-type* '())
104 ;;(defparameter *default-managed-type* '(:all))
107 ;;; CONFIG - Default focus policy
108 (defconfig *default-focus-policy* :click nil
109 "Default mouse focus policy. One of :click, :sloppy, :sloppy-strict or :sloppy-select.")
112 (defclass frame ()
113 ((name :initarg :name :accessor frame-name :initform nil)
114 (number :initarg :number :accessor frame-number :initform 0)
115 ;;; Float size between 0 and 1 - Manipulate only this variable and not real size
116 (x :initarg :x :accessor frame-x :initform 0.1)
117 (y :initarg :y :accessor frame-y :initform 0.1)
118 (w :initarg :w :accessor frame-w :initform 0.8)
119 (h :initarg :h :accessor frame-h :initform 0.8)
120 ;;; Real size (integer) in screen size - Don't set directly this variables
121 ;;; they may be recalculated by the layout manager.
122 (rx :initarg :rx :accessor frame-rx :initform 0)
123 (ry :initarg :ry :accessor frame-ry :initform 0)
124 (rw :initarg :rw :accessor frame-rw :initform 800)
125 (rh :initarg :rh :accessor frame-rh :initform 600)
126 (layout :initarg :layout :accessor frame-layout :initform nil
127 :documentation "Layout to display windows on a frame")
128 (nw-hook :initarg :nw-hook :accessor frame-nw-hook :initform nil
129 :documentation "Hook done by the frame when a new window is mapped")
130 (managed-type :initarg :managed-type :accessor frame-managed-type
131 :initform *default-managed-type*
132 :documentation "Managed window type")
133 (forced-managed-window :initarg :forced-managed-window
134 :accessor frame-forced-managed-window
135 :initform nil
136 :documentation "A list of forced managed windows (wm-name or window)")
137 (forced-unmanaged-window :initarg :forced-unmanaged-window
138 :accessor frame-forced-unmanaged-window
139 :initform nil
140 :documentation "A list of forced unmanaged windows (wm-name or window)")
141 (show-window-p :initarg :show-window-p :accessor frame-show-window-p :initform t)
142 (hidden-children :initarg :hidden-children :accessor frame-hidden-children :initform nil
143 :documentation "A list of hidden children")
144 (selected-pos :initarg :selected-pos :accessor frame-selected-pos :initform 0
145 :documentation "The position in the child list of the selected child")
146 (focus-policy :initarg :focus-ploicy :accessor frame-focus-policy
147 :initform *default-focus-policy*)
148 (window :initarg :window :accessor frame-window :initform nil)
149 (gc :initarg :gc :accessor frame-gc :initform nil)
150 (child :initarg :child :accessor frame-child :initform nil)
151 (data :initarg :data :accessor frame-data
152 :initform *default-frame-data*
153 :documentation "An assoc list to store additional data")))
157 (defparameter *root-frame* nil
158 "Root of the root - ie the root frame")
159 (defparameter *current-root* nil
160 "The current fullscreen maximized child")
161 (defparameter *current-child* nil
162 "The current child with the focus")
165 (defparameter *main-keys* nil)
166 (defparameter *main-mouse* nil)
167 (defparameter *second-keys* nil)
168 (defparameter *second-mouse* nil)
169 (defparameter *info-keys* nil)
170 (defparameter *info-mouse* nil)
171 (defparameter *query-keys* nil)
172 (defparameter *circulate-keys* nil)
173 (defparameter *circulate-keys-release* nil)
174 (defparameter *expose-keys* nil)
175 (defparameter *expose-mouse* nil)
178 (defparameter *other-window-manager* nil)
181 (defstruct menu name item doc)
182 (defstruct menu-item key value)
185 (defparameter *menu* (make-menu :name 'main :doc "Main menu"))
190 (defconfig *binding-hook* nil 'Hook
191 "Hook executed when keys/buttons are bounds")
193 (defconfig *loop-hook* nil 'Hook
194 "Hook executed on each event loop")
196 (defconfig *main-entrance-hook* nil 'Hook
197 "Hook executed on the main function entrance after
198 loading configuration file and before opening the display.")
201 (defparameter *in-second-mode* nil)
204 ;;; Placement variables. A list of two absolute coordinates
205 ;;; or a function: 'Y-X-placement' for absolute placement or
206 ;;; 'Y-X-child-placement' for child relative placement.
207 ;;; Where Y-X are one of:
209 ;;; top-left top-middle top-right
210 ;;; middle-left middle-middle middle-right
211 ;;; bottom-left bottom-middle bottom-right
213 (defconfig *banish-pointer-placement* 'bottom-right-placement
214 'Placement "Pointer banishment placement")
215 (defconfig *second-mode-placement* 'top-middle-placement
216 'Placement "Second mode window placement")
217 (defconfig *info-mode-placement* 'top-left-placement
218 'Placement "Info mode window placement")
219 (defconfig *query-mode-placement* 'top-left-placement
220 'Placement "Query mode window placement")
221 (defconfig *circulate-mode-placement* 'bottom-middle-placement
222 'Placement "Circulate mode window placement")
223 (defconfig *expose-mode-placement* 'top-left-child-placement
224 'Placement "Expose mode window placement (Selection keys position)")
225 (defconfig *notify-window-placement* 'bottom-right-placement
226 'Placement "Notify window placement")
230 (defparameter *in-process-existing-windows* nil)
232 ;; For debug - redefine defun
233 ;;(shadow :defun)
235 ;;(defmacro defun (name args &body body)
236 ;; `(progn
237 ;; (format t "defun: ~A ~A~%" ',name ',args)
238 ;; (force-output)
239 ;; (cl:defun ,name ,args
240 ;; (handler-case
241 ;; (progn
242 ;; ,@body)
243 ;; (error (c)
244 ;; (format t "New defun: Error in ~A : ~A~%" ',name c)
245 ;; (format t "Root tree=~A~%All windows=~A~%"
246 ;; (xlib:query-tree *root*) (get-all-windows))
247 ;; (force-output))))))