run-other-window-manager: Add the ability to launch an other window manager and to...
[clfswm.git] / src / package.lisp
blob776d8e65caa5d4d266f18f73ac90ec7aa45ec154
1 ;;; --------------------------------------------------------------------------
2 ;;; CLFSWM - FullScreen Window Manager
3 ;;;
4 ;;; --------------------------------------------------------------------------
5 ;;; Documentation: Package definition
6 ;;; --------------------------------------------------------------------------
7 ;;;
8 ;;; (C) 2005 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)
42 ;;; Compress motion notify ?
43 ;;; Note: this variable is overwriten in config.lisp
44 (defparameter *have-to-compress-notify* t
45 "Config(): Compress event notify?
46 This variable may be useful to speed up some slow version of CLX.
47 It is particulary useful with CLISP/MIT-CLX.")
49 (defparameter *modifier-alias* '((:alt :mod-1) (:alt-l :mod-1)
50 (:numlock :mod-2)
51 (:super_l :mod-4)
52 (:alt-r :mod-5) (:alt-gr :mod-5)
53 (:capslock :lock))
54 "Syntax: (modifier-alias effective-modifier)")
57 (defparameter *display* nil)
58 (defparameter *screen* nil)
59 (defparameter *root* nil)
60 (defparameter *no-focus-window* nil)
62 (defparameter *loop-timeout* 0.1
63 "Config(): Maximum time (in seconds) to wait before calling *loop-hook*")
65 (defparameter *pixmap-buffer* nil)
67 (defparameter *contrib-dir* "")
69 (defparameter *default-font* nil)
70 ;;(defparameter *default-font-string* "9x15")
71 (defparameter *default-font-string* "fixed"
72 "Config(): The default font used in clfswm")
75 (defparameter *child-selection* nil)
77 ;;; CONFIG - Default frame datas
78 (defparameter *default-frame-data*
79 (list '(:tile-size 0.8) '(:tile-space-size 0.1)
80 '(:fast-layout (tile-left-layout tile-layout))
81 '(:main-layout-windows nil))
82 "Config(): Default slots set in frame date")
85 ;;; CONFIG - Default managed window type for a frame
86 ;;; type can be :all, :normal, :transient, :maxsize, :desktop, :dock, :toolbar, :menu, :utility, :splash, :dialog
87 (defparameter *default-managed-type* '(:normal)
88 "Config(): Default managed window types")
89 ;;(defparameter *default-managed-type* '(:normal :maxsize :transient))
90 ;;(defparameter *default-managed-type* '(:normal :transient :maxsize :desktop :dock :toolbar :menu :utility :splash :dialog))
91 ;;(defparameter *default-managed-type* '())
92 ;;(defparameter *default-managed-type* '(:all))
95 ;;; CONFIG - Default focus policy
96 (defparameter *default-focus-policy* :click
97 "Config(): Default mouse focus policy. One of :click, :sloppy, :sloppy-strict or :sloppy-select.")
100 (defclass frame ()
101 ((name :initarg :name :accessor frame-name :initform nil)
102 (number :initarg :number :accessor frame-number :initform 0)
103 ;;; Float size between 0 and 1 - Manipulate only this variable and not real size
104 (x :initarg :x :accessor frame-x :initform 0.1)
105 (y :initarg :y :accessor frame-y :initform 0.1)
106 (w :initarg :w :accessor frame-w :initform 0.8)
107 (h :initarg :h :accessor frame-h :initform 0.8)
108 ;;; Real size (integer) in screen size - Don't set directly this variables
109 ;;; they may be recalculated by the layout manager.
110 (rx :initarg :rx :accessor frame-rx :initform 0)
111 (ry :initarg :ry :accessor frame-ry :initform 0)
112 (rw :initarg :rw :accessor frame-rw :initform 800)
113 (rh :initarg :rh :accessor frame-rh :initform 600)
114 (layout :initarg :layout :accessor frame-layout :initform nil
115 :documentation "Layout to display windows on a frame")
116 (nw-hook :initarg :nw-hook :accessor frame-nw-hook :initform nil
117 :documentation "Hook done by the frame when a new window is mapped")
118 (managed-type :initarg :managed-type :accessor frame-managed-type
119 :initform *default-managed-type*
120 :documentation "Managed window type")
121 (forced-managed-window :initarg :forced-managed-window
122 :accessor frame-forced-managed-window
123 :initform nil
124 :documentation "A list of forced managed windows (wm-name or window)")
125 (forced-unmanaged-window :initarg :forced-unmanaged-window
126 :accessor frame-forced-unmanaged-window
127 :initform nil
128 :documentation "A list of forced unmanaged windows (wm-name or window)")
129 (show-window-p :initarg :show-window-p :accessor frame-show-window-p :initform t)
130 (hidden-children :initarg :hidden-children :accessor frame-hidden-children :initform nil
131 :documentation "A list of hidden children")
132 (selected-pos :initarg :selected-pos :accessor frame-selected-pos :initform 0
133 :documentation "The position in the child list of the selected child")
134 (focus-policy :initarg :focus-ploicy :accessor frame-focus-policy
135 :initform *default-focus-policy*)
136 (window :initarg :window :accessor frame-window :initform nil)
137 (gc :initarg :gc :accessor frame-gc :initform nil)
138 (child :initarg :child :accessor frame-child :initform nil)
139 (data :initarg :data :accessor frame-data
140 :initform *default-frame-data*
141 :documentation "An assoc list to store additional data")))
145 (defparameter *root-frame* nil
146 "Root of the root - ie the root frame")
147 (defparameter *current-root* nil
148 "The current fullscreen maximized child")
149 (defparameter *current-child* nil
150 "The current child with the focus")
152 (defparameter *show-root-frame-p* nil)
155 (defparameter *main-keys* nil)
156 (defparameter *main-mouse* nil)
157 (defparameter *second-keys* nil)
158 (defparameter *second-mouse* nil)
159 (defparameter *info-keys* nil)
160 (defparameter *info-mouse* nil)
161 (defparameter *query-keys* nil)
162 (defparameter *circulate-keys* nil)
163 (defparameter *circulate-keys-release* nil)
166 (defparameter *other-window-manager* nil)
169 (defstruct menu name item doc)
170 (defstruct menu-item key value)
173 (defparameter *menu* (make-menu :name 'main :doc "Main menu"))
176 ;;; Main mode hooks (set in clfswm.lisp)
177 (defparameter *button-press-hook* nil
178 "Config(Hook group):")
179 (defparameter *button-release-hook* nil
180 "Config(Hook group):")
181 (defparameter *motion-notify-hook* nil
182 "Config(Hook group):")
183 (defparameter *key-press-hook* nil
184 "Config(Hook group):")
185 (defparameter *key-release-hook* nil
186 "Config(Hook group):")
187 (defparameter *configure-request-hook* nil
188 "Config(Hook group):")
189 (defparameter *configure-notify-hook* nil
190 "Config(Hook group):")
191 (defparameter *create-notify-hook* nil
192 "Config(Hook group):")
193 (defparameter *destroy-notify-hook* nil
194 "Config(Hook group):")
195 (defparameter *enter-notify-hook* nil
196 "Config(Hook group):")
197 (defparameter *exposure-hook* nil
198 "Config(Hook group):")
199 (defparameter *map-request-hook* nil
200 "Config(Hook group):")
201 (defparameter *mapping-notify-hook* nil
202 "Config(Hook group):")
203 (defparameter *property-notify-hook* nil
204 "Config(Hook group):")
205 (defparameter *unmap-notify-hook* nil
206 "Config(Hook group):")
209 ;;; Second mode hooks (set in clfswm-second-mode.lisp)
210 (defparameter *sm-button-press-hook* nil
211 "Config(Hook group):")
212 (defparameter *sm-button-release-hook* nil
213 "Config(Hook group):")
214 (defparameter *sm-motion-notify-hook* nil
215 "Config(Hook group):")
216 (defparameter *sm-key-press-hook* nil
217 "Config(Hook group):")
218 (defparameter *sm-key-release-hook* nil
219 "Config(Hook group):")
220 (defparameter *sm-configure-request-hook* nil
221 "Config(Hook group):")
222 (defparameter *sm-configure-notify-hook* nil
223 "Config(Hook group):")
224 (defparameter *sm-map-request-hook* nil
225 "Config(Hook group):")
226 (defparameter *sm-unmap-notify-hook* nil
227 "Config(Hook group):")
228 (defparameter *sm-destroy-notify-hook* nil
229 "Config(Hook group):")
230 (defparameter *sm-mapping-notify-hook* nil
231 "Config(Hook group):")
232 (defparameter *sm-property-notify-hook* nil
233 "Config(Hook group):")
234 (defparameter *sm-create-notify-hook* nil
235 "Config(Hook group):")
236 (defparameter *sm-enter-notify-hook* nil
237 "Config(Hook group):")
238 (defparameter *sm-exposure-hook* nil
239 "Config(Hook group):")
242 (defparameter *binding-hook* nil
243 "Config(Hook group): Hook executed when keys/buttons are bounds")
245 (defparameter *loop-hook* nil
246 "Config(Hook group): Kook executed on each event loop")
249 (defparameter *in-second-mode* nil)
252 (defparameter *vt-keyboard-on* nil)
253 (defparameter *clfswm-terminal* nil)
256 ;;; Placement variables. A list of two absolute coordinates
257 ;;; or a function: 'Y-X-placement' for absolute placement or
258 ;;; 'Y-X-child-placement' for child relative placement.
259 ;;; Where Y-X are one of:
261 ;;; top-left top-middle top-right
262 ;;; middle-left middle-middle middle-right
263 ;;; bottom-left bottom-middle bottom-right
265 (defparameter *banish-pointer-placement* 'bottom-right-child-placement)
266 (defparameter *second-mode-placement* 'top-middle-child-placement)
267 (defparameter *info-mode-placement* 'top-left-child-placement)
268 (defparameter *query-mode-placement* 'top-left-child-placement)
269 (defparameter *circulate-mode-placement* 'bottom-middle-child-placement)
274 ;; For debug - redefine defun
275 ;;(shadow :defun)
277 ;;(defmacro defun (name args &body body)
278 ;; `(progn
279 ;; (format t "defun: ~A ~A~%" ',name ',args)
280 ;; (force-output)
281 ;; (cl:defun ,name ,args
282 ;; (handler-case
283 ;; (progn
284 ;; ,@body)
285 ;; (error (c)
286 ;; (format t "New defun: Error in ~A : ~A~%" ',name c)
287 ;; (format t "Root tree=~A~%All windows=~A~%"
288 ;; (xlib:query-tree *root*) (get-all-windows))
289 ;; (force-output))))))