src/clfswm-internal.lisp (show-all-children): Remove flickering on select-next/previo...
[clfswm.git] / src / package.lisp
blobf14945a035fd2f042acb9f907b7f0c3dd687b58b
1 ;;; --------------------------------------------------------------------------
2 ;;; CLFSWM - FullScreen Window Manager
3 ;;;
4 ;;; --------------------------------------------------------------------------
5 ;;; Documentation: Package definition
6 ;;; --------------------------------------------------------------------------
7 ;;;
8 ;;; (C) 2011 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.")
111 (defstruct child-rect child parent selected-p x y w h)
114 (defclass frame ()
115 ((name :initarg :name :accessor frame-name :initform nil)
116 (number :initarg :number :accessor frame-number :initform 0)
117 ;;; Float size between 0 and 1 - Manipulate only this variable and not real size
118 (x :initarg :x :accessor frame-x :initform 0.1)
119 (y :initarg :y :accessor frame-y :initform 0.1)
120 (w :initarg :w :accessor frame-w :initform 0.8)
121 (h :initarg :h :accessor frame-h :initform 0.8)
122 ;;; Real size (integer) in screen size - Don't set directly this variables
123 ;;; they may be recalculated by the layout manager.
124 (rx :initarg :rx :accessor frame-rx :initform 0)
125 (ry :initarg :ry :accessor frame-ry :initform 0)
126 (rw :initarg :rw :accessor frame-rw :initform 800)
127 (rh :initarg :rh :accessor frame-rh :initform 600)
128 (layout :initarg :layout :accessor frame-layout :initform nil
129 :documentation "Layout to display windows on a frame")
130 (nw-hook :initarg :nw-hook :accessor frame-nw-hook :initform nil
131 :documentation "Hook done by the frame when a new window is mapped")
132 (managed-type :initarg :managed-type :accessor frame-managed-type
133 :initform *default-managed-type*
134 :documentation "Managed window type")
135 (forced-managed-window :initarg :forced-managed-window
136 :accessor frame-forced-managed-window
137 :initform nil
138 :documentation "A list of forced managed windows (wm-name or window)")
139 (forced-unmanaged-window :initarg :forced-unmanaged-window
140 :accessor frame-forced-unmanaged-window
141 :initform nil
142 :documentation "A list of forced unmanaged windows (wm-name or window)")
143 (show-window-p :initarg :show-window-p :accessor frame-show-window-p :initform t)
144 (hidden-children :initarg :hidden-children :accessor frame-hidden-children :initform nil
145 :documentation "A list of hidden children")
146 (selected-pos :initarg :selected-pos :accessor frame-selected-pos :initform 0
147 :documentation "The position in the child list of the selected child")
148 (focus-policy :initarg :focus-ploicy :accessor frame-focus-policy
149 :initform *default-focus-policy*)
150 (window :initarg :window :accessor frame-window :initform nil)
151 (gc :initarg :gc :accessor frame-gc :initform nil)
152 (child :initarg :child :accessor frame-child :initform nil)
153 (data :initarg :data :accessor frame-data
154 :initform *default-frame-data*
155 :documentation "An assoc list to store additional data")))
159 (defparameter *root-frame* nil
160 "Root of the root - ie the root frame")
161 (defparameter *current-root* nil
162 "The current fullscreen maximized child")
163 (defparameter *current-child* nil
164 "The current child with the focus")
167 (defparameter *main-keys* nil)
168 (defparameter *main-mouse* nil)
169 (defparameter *second-keys* nil)
170 (defparameter *second-mouse* nil)
171 (defparameter *info-keys* nil)
172 (defparameter *info-mouse* nil)
173 (defparameter *query-keys* nil)
174 (defparameter *circulate-keys* nil)
175 (defparameter *circulate-keys-release* nil)
176 (defparameter *expose-keys* nil)
177 (defparameter *expose-mouse* nil)
180 (defparameter *other-window-manager* nil)
183 (defstruct menu name item doc)
184 (defstruct menu-item key value)
187 (defparameter *menu* (make-menu :name 'main :doc "Main menu"))
192 (defconfig *binding-hook* nil 'Hook
193 "Hook executed when keys/buttons are bounds")
195 (defconfig *loop-hook* nil 'Hook
196 "Hook executed on each event loop")
198 (defconfig *main-entrance-hook* nil 'Hook
199 "Hook executed on the main function entrance after
200 loading configuration file and before opening the display.")
203 (defparameter *in-second-mode* nil)
206 ;;; Placement variables. A list of two absolute coordinates
207 ;;; or a function: 'Y-X-placement' for absolute placement or
208 ;;; 'Y-X-child-placement' for child relative placement.
209 ;;; Where Y-X are one of:
211 ;;; top-left top-middle top-right
212 ;;; middle-left middle-middle middle-right
213 ;;; bottom-left bottom-middle bottom-right
215 (defconfig *banish-pointer-placement* 'bottom-right-placement
216 'Placement "Pointer banishment placement")
217 (defconfig *second-mode-placement* 'top-middle-placement
218 'Placement "Second mode window placement")
219 (defconfig *info-mode-placement* 'top-left-placement
220 'Placement "Info mode window placement")
221 (defconfig *query-mode-placement* 'top-left-placement
222 'Placement "Query mode window placement")
223 (defconfig *circulate-mode-placement* 'bottom-middle-placement
224 'Placement "Circulate mode window placement")
225 (defconfig *expose-mode-placement* 'top-left-child-placement
226 'Placement "Expose mode window placement (Selection keys position)")
227 (defconfig *notify-window-placement* 'bottom-right-placement
228 'Placement "Notify window placement")
229 (defconfig *ask-close/kill-placement* 'top-right-placement
230 'Placement "Ask close/kill window placement")
234 (defparameter *in-process-existing-windows* nil)
236 ;; For debug - redefine defun
237 ;;(shadow :defun)
239 ;;(defmacro defun (name args &body body)
240 ;; `(progn
241 ;; (format t "defun: ~A ~A~%" ',name ',args)
242 ;; (force-output)
243 ;; (cl:defun ,name ,args
244 ;; (handler-case
245 ;; (progn
246 ;; ,@body)
247 ;; (error (c)
248 ;; (format t "New defun: Error in ~A : ~A~%" ',name c)
249 ;; (format t "Root tree=~A~%All windows=~A~%"
250 ;; (xlib:query-tree *root*) (get-all-windows))
251 ;; (force-output))))))