1 ;;; --------------------------------------------------------------------------
2 ;;; CLFSWM - FullScreen Window Manager
4 ;;; --------------------------------------------------------------------------
5 ;;; Documentation: Package definition
6 ;;; --------------------------------------------------------------------------
8 ;;; (C) 2011 Philippe Brochard <hocwp@free.fr>
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.
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.
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.
24 ;;; --------------------------------------------------------------------------
29 (:use
:common-lisp
:my-html
:tools
:version
)
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.")
48 (defconfig *transparent-background
* t nil
49 "Enable transparent background")
51 (defconfig *show-root-frame-p
* nil nil
52 "Show the root frame information or not")
55 (defconfig *border-size
* 1 nil
56 "Windows and frames border size")
60 (defparameter *modifier-alias
* '((:alt
:mod-1
) (:alt-l
:mod-1
)
63 (:alt-r
:mod-5
) (:alt-gr
:mod-5
)
65 "Syntax: (modifier-alias effective-modifier)")
68 (defparameter *display
* nil
)
69 (defparameter *screen
* nil
)
70 (defparameter *root
* nil
)
71 (defparameter *no-focus-window
* nil
)
73 (defparameter *background-image
* nil
)
74 (defparameter *background-gc
* nil
)
76 (defconfig *loop-timeout
* 0.1 nil
77 "Maximum time (in seconds) to wait before calling *loop-hook*")
79 (defparameter *pixmap-buffer
* nil
)
81 (defparameter *contrib-dir
* "")
83 (defparameter *default-font
* nil
)
84 ;;(defparameter *default-font-string* "9x15")
85 (defconfig *default-font-string
* "fixed" nil
86 "The default font used in clfswm")
88 (defconfig *color-move-window
* "DeepPink" 'Main-mode
89 "Color when moving or resizing a windows")
91 (defparameter *child-selection
* nil
)
93 ;;; CONFIG - Default frame datas
94 (defconfig *default-frame-data
*
95 (list '(:tile-size
0.8) '(:tile-space-size
0.1)
96 '(:fast-layout
(tile-left-layout tile-layout
))
97 '(:main-layout-windows nil
))
99 "Default slots set in frame date")
102 ;;; CONFIG - Default managed window type for a frame
103 ;;; type can be :all, :normal, :transient, :maxsize, :desktop, :dock, :toolbar, :menu, :utility, :splash, :dialog
104 (defconfig *default-managed-type
* '(:normal
) nil
105 "Default managed window types")
106 ;;(defparameter *default-managed-type* '(:normal :maxsize :transient))
107 ;;(defparameter *default-managed-type* '(:normal :transient :maxsize :desktop :dock :toolbar :menu :utility :splash :dialog))
108 ;;(defparameter *default-managed-type* '())
109 ;;(defparameter *default-managed-type* '(:all))
112 ;;; CONFIG - Default focus policy
113 (defconfig *default-focus-policy
* :click nil
114 "Default mouse focus policy. One of :click, :sloppy, :sloppy-strict or :sloppy-select.")
116 (defstruct child-rect child parent selected-p x y w h
)
120 ((name :initarg
:name
:accessor frame-name
:initform nil
)
121 (number :initarg
:number
:accessor frame-number
:initform
0)
122 ;;; Float size between 0 and 1 - Manipulate only this variable and not real size
123 (x :initarg
:x
:accessor frame-x
:initform
0.1)
124 (y :initarg
:y
:accessor frame-y
:initform
0.1)
125 (w :initarg
:w
:accessor frame-w
:initform
0.8)
126 (h :initarg
:h
:accessor frame-h
:initform
0.8)
127 ;;; Real size (integer) in screen size - Don't set directly this variables
128 ;;; they may be recalculated by the layout manager.
129 (rx :initarg
:rx
:accessor frame-rx
:initform
0)
130 (ry :initarg
:ry
:accessor frame-ry
:initform
0)
131 (rw :initarg
:rw
:accessor frame-rw
:initform
800)
132 (rh :initarg
:rh
:accessor frame-rh
:initform
600)
133 (layout :initarg
:layout
:accessor frame-layout
:initform nil
134 :documentation
"Layout to display windows on a frame")
135 (nw-hook :initarg
:nw-hook
:accessor frame-nw-hook
:initform nil
136 :documentation
"Hook done by the frame when a new window is mapped")
137 (managed-type :initarg
:managed-type
:accessor frame-managed-type
138 :initform
*default-managed-type
*
139 :documentation
"Managed window type")
140 (forced-managed-window :initarg
:forced-managed-window
141 :accessor frame-forced-managed-window
143 :documentation
"A list of forced managed windows (wm-name or window)")
144 (forced-unmanaged-window :initarg
:forced-unmanaged-window
145 :accessor frame-forced-unmanaged-window
147 :documentation
"A list of forced unmanaged windows (wm-name or window)")
148 (show-window-p :initarg
:show-window-p
:accessor frame-show-window-p
:initform t
)
149 (hidden-children :initarg
:hidden-children
:accessor frame-hidden-children
:initform nil
150 :documentation
"A list of hidden children")
151 (selected-pos :initarg
:selected-pos
:accessor frame-selected-pos
:initform
0
152 :documentation
"The position in the child list of the selected child")
153 (focus-policy :initarg
:focus-ploicy
:accessor frame-focus-policy
154 :initform
*default-focus-policy
*)
155 (window :initarg
:window
:accessor frame-window
:initform nil
)
156 (gc :initarg
:gc
:accessor frame-gc
:initform nil
)
157 (child :initarg
:child
:accessor frame-child
:initform nil
)
158 (data :initarg
:data
:accessor frame-data
159 :initform
*default-frame-data
*
160 :documentation
"An assoc list to store additional data")))
164 (defparameter *root-frame
* nil
165 "Root of the root - ie the root frame")
166 (defparameter *current-root
* nil
167 "The current fullscreen maximized child")
168 (defparameter *current-child
* nil
169 "The current child with the focus")
172 (defparameter *main-keys
* nil
)
173 (defparameter *main-mouse
* nil
)
174 (defparameter *second-keys
* nil
)
175 (defparameter *second-mouse
* nil
)
176 (defparameter *info-keys
* nil
)
177 (defparameter *info-mouse
* nil
)
178 (defparameter *query-keys
* nil
)
179 (defparameter *circulate-keys
* nil
)
180 (defparameter *circulate-keys-release
* nil
)
181 (defparameter *expose-keys
* nil
)
182 (defparameter *expose-mouse
* nil
)
185 (defparameter *other-window-manager
* nil
)
188 (defstruct menu name item doc
)
189 (defstruct menu-item key value
)
192 (defparameter *menu
* (make-menu :name
'main
:doc
"Main menu"))
197 (defconfig *binding-hook
* nil
'Hook
198 "Hook executed when keys/buttons are bounds")
200 (defconfig *loop-hook
* nil
'Hook
201 "Hook executed on each event loop")
203 (defconfig *main-entrance-hook
* nil
'Hook
204 "Hook executed on the main function entrance after
205 loading configuration file and before opening the display.")
208 (defparameter *in-second-mode
* nil
)
211 ;;; Placement variables. A list of two absolute coordinates
212 ;;; or a function: 'Y-X-placement' for absolute placement or
213 ;;; 'Y-X-child-placement' for child relative placement.
214 ;;; Where Y-X are one of:
216 ;;; top-left top-middle top-right
217 ;;; middle-left middle-middle middle-right
218 ;;; bottom-left bottom-middle bottom-right
220 (defconfig *banish-pointer-placement
* 'bottom-right-placement
221 'Placement
"Pointer banishment placement")
222 (defconfig *second-mode-placement
* 'top-middle-placement
223 'Placement
"Second mode window placement")
224 (defconfig *info-mode-placement
* 'top-left-placement
225 'Placement
"Info mode window placement")
226 (defconfig *query-mode-placement
* 'top-left-placement
227 'Placement
"Query mode window placement")
228 (defconfig *circulate-mode-placement
* 'bottom-middle-placement
229 'Placement
"Circulate mode window placement")
230 (defconfig *expose-mode-placement
* 'top-left-child-placement
231 'Placement
"Expose mode window placement (Selection keys position)")
232 (defconfig *notify-window-placement
* 'bottom-right-placement
233 'Placement
"Notify window placement")
234 (defconfig *ask-close
/kill-placement
* 'top-right-placement
235 'Placement
"Ask close/kill window placement")
236 (defconfig *unmanaged-window-placement
* 'middle-middle-child-placement
237 'PLACEMENT
"Unmanager window placement")
240 (defparameter *in-process-existing-windows
* nil
)
242 ;; For debug - redefine defun
245 ;;(defmacro defun (name args &body body)
247 ;; (format t "defun: ~A ~A~%" ',name ',args)
249 ;; (cl:defun ,name ,args
254 ;; (format t "New defun: Error in ~A : ~A~%" ',name c)
255 ;; (format t "Root tree=~A~%All windows=~A~%"
256 ;; (xlib:query-tree *root*) (get-all-windows))
257 ;; (force-output))))))
262 (defmacro make-x-drawable
(argname type
)
263 "Drawable wrapper to prevent type error in some CLX versions.
264 Replace xlib:drawable-* functions with x-drawable-* equivalents"
265 (let ((fun-symbol (symb 'x-drawable- argname
))
266 (set-symbol (symb 'set-x-drawable- argname
))
267 (xlib-equiv-symbol (symb-intern :xlib
'drawable- argname
)))
269 (declaim (inline ,fun-symbol
))
270 (defun ,fun-symbol
(window)
271 (,xlib-equiv-symbol window
))
272 (defun ,set-symbol
(window ,argname
)
273 (if (typep ,argname
',type
)
274 (setf (,xlib-equiv-symbol window
) ,argname
)
275 (dbg ',(symb 'drawable-type-error- argname
) window
,argname
(xlib:wm-name window
))))
276 (defsetf ,fun-symbol
,set-symbol
))))
280 (make-x-drawable x
(signed-byte 16))
281 (make-x-drawable y
(signed-byte 16))
282 (make-x-drawable width
(unsigned-byte 16))
283 (make-x-drawable height
(unsigned-byte 16))
284 (make-x-drawable border-width
(unsigned-byte 16))