chiark / gitweb /
64-bit fix
[clg] / gdk / gdk.lisp
CommitLineData
112ac1d3 1;; Common Lisp bindings for GTK+ v2.x
2;; Copyright 2000-2005 Espen S. Johnsen <espen@users.sf.net>
560af5c5 3;;
112ac1d3 4;; Permission is hereby granted, free of charge, to any person obtaining
5;; a copy of this software and associated documentation files (the
6;; "Software"), to deal in the Software without restriction, including
7;; without limitation the rights to use, copy, modify, merge, publish,
8;; distribute, sublicense, and/or sell copies of the Software, and to
9;; permit persons to whom the Software is furnished to do so, subject to
10;; the following conditions:
560af5c5 11;;
112ac1d3 12;; The above copyright notice and this permission notice shall be
13;; included in all copies or substantial portions of the Software.
560af5c5 14;;
112ac1d3 15;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18;; IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19;; CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
e4251a29 23;; $Id: gdk.lisp,v 1.22 2006-02-26 15:09:44 espen Exp $
560af5c5 24
25
26(in-package "GDK")
27
13b24566 28;;; Initialization
29
30(defbinding (gdk-init "gdk_parse_args") () nil
31 "Initializes the library without opening the display."
32 (nil null)
33 (nil null))
560af5c5 34
560af5c5 35
13b24566 36
a02fc41f 37;;; Display
13b24566 38
39(defbinding %display-open () display
40 (display-name (or null string)))
41
42(defun display-open (&optional display-name)
43 (let ((display (%display-open display-name)))
44 (unless (display-get-default)
45 (display-set-default display))
46 display))
47
a02fc41f 48(defbinding %display-get-n-screens () int
49 (display display))
50
51(defbinding %display-get-screen () screen
52 (display display)
53 (screen-num int))
54
55(defun display-screens (&optional (display (display-get-default)))
56 (loop
57 for i from 0 below (%display-get-n-screens display)
58 collect (%display-get-screen display i)))
59
60(defbinding display-get-default-screen
61 (&optional (display (display-get-default))) screen
62 (display display))
63
64(defbinding display-beep (&optional (display (display-get-default))) nil
65 (display display))
66
67(defbinding display-sync (&optional (display (display-get-default))) nil
68 (display display))
69
70(defbinding display-flush (&optional (display (display-get-default))) nil
71 (display display))
72
73(defbinding display-close (&optional (display (display-get-default))) nil
74 (display display))
75
76(defbinding display-get-event
77 (&optional (display (display-get-default))) event
78 (display display))
79
80(defbinding display-peek-event
81 (&optional (display (display-get-default))) event
82 (display display))
83
84(defbinding display-put-event
85 (event &optional (display (display-get-default))) event
86 (display display)
87 (event event))
88
13b24566 89(defbinding (display-connection-number "clg_gdk_connection_number")
90 (&optional (display (display-get-default))) int
91 (display display))
92
93
a02fc41f 94
95;;; Display manager
96
97(defbinding display-get-default () display)
98
99(defbinding (display-manager "gdk_display_manager_get") () display-manager)
100
101(defbinding (display-set-default "gdk_display_manager_set_default_display")
102 (display) nil
103 ((display-manager) display-manager)
104 (display display))
105
106
107
13b24566 108;;; Events
560af5c5 109
8bb8ead0 110(defbinding (events-pending-p "gdk_events_pending") () boolean)
560af5c5 111
8bb8ead0 112(defbinding event-get () event)
560af5c5 113
8bb8ead0 114(defbinding event-peek () event)
560af5c5 115
8bb8ead0 116(defbinding event-get-graphics-expose () event
560af5c5 117 (window window))
118
8bb8ead0 119(defbinding event-put () event
560af5c5 120 (event event))
121
8bb8ead0 122;(defbinding event-handler-set () ...)
560af5c5 123
8bb8ead0 124(defbinding set-show-events () nil
560af5c5 125 (show-events boolean))
126
8bb8ead0 127(defbinding get-show-events () boolean)
560af5c5 128
560af5c5 129
a02fc41f 130;;; Miscellaneous functions
560af5c5 131
a02fc41f 132(defbinding screen-width () int)
133(defbinding screen-height () int)
560af5c5 134
a02fc41f 135(defbinding screen-width-mm () int)
136(defbinding screen-height-mm () int)
560af5c5 137
a02fc41f 138(defbinding pointer-grab
139 (window &key owner-events events confine-to cursor time) grab-status
560af5c5 140 (window window)
141 (owner-events boolean)
a02fc41f 142 (events event-mask)
560af5c5 143 (confine-to (or null window))
144 (cursor (or null cursor))
580820d8 145 ((or time 0) (unsigned 32)))
560af5c5 146
a02fc41f 147(defbinding (pointer-ungrab "gdk_display_pointer_ungrab")
580820d8 148 (&optional time (display (display-get-default))) nil
a02fc41f 149 (display display)
580820d8 150 ((or time 0) (unsigned 32)))
560af5c5 151
a02fc41f 152(defbinding (pointer-is-grabbed-p "gdk_display_pointer_is_grabbed")
153 (&optional (display (display-get-default))) boolean)
154
155(defbinding keyboard-grab (window &key owner-events time) grab-status
560af5c5 156 (window window)
157 (owner-events boolean)
580820d8 158 ((or time 0) (unsigned 32)))
560af5c5 159
a02fc41f 160(defbinding (keyboard-ungrab "gdk_display_keyboard_ungrab")
580820d8 161 (&optional time (display (display-get-default))) nil
a02fc41f 162 (display display)
580820d8 163 ((or time 0) (unsigned 32)))
560af5c5 164
560af5c5 165
560af5c5 166
628fd576 167(defbinding atom-intern (atom-name &optional only-if-exists) atom
168 ((string atom-name) string)
169 (only-if-exists boolean))
170
171(defbinding atom-name () string
172 (atom atom))
173
560af5c5 174
175
176;;; Visuals
177
8bb8ead0 178(defbinding visual-get-best-depth () int)
560af5c5 179
8bb8ead0 180(defbinding visual-get-best-type () visual-type)
560af5c5 181
8bb8ead0 182(defbinding visual-get-system () visual)
560af5c5 183
184
8bb8ead0 185(defbinding (%visual-get-best-with-nothing "gdk_visual_get_best") () visual)
560af5c5 186
8bb8ead0 187(defbinding %visual-get-best-with-depth () visual
560af5c5 188 (depth int))
189
8bb8ead0 190(defbinding %visual-get-best-with-type () visual
560af5c5 191 (type visual-type))
192
8bb8ead0 193(defbinding %visual-get-best-with-both () visual
560af5c5 194 (depth int)
195 (type visual-type))
196
197(defun visual-get-best (&key depth type)
198 (cond
199 ((and depth type) (%visual-get-best-with-both depth type))
200 (depth (%visual-get-best-with-depth depth))
201 (type (%visual-get-best-with-type type))
202 (t (%visual-get-best-with-nothing))))
203
8bb8ead0 204;(defbinding query-depths ..)
560af5c5 205
8bb8ead0 206;(defbinding query-visual-types ..)
560af5c5 207
8bb8ead0 208(defbinding list-visuals () (glist visual))
560af5c5 209
210
211;;; Windows
212
8bb8ead0 213(defbinding window-destroy () nil
560af5c5 214 (window window))
215
216
8f30d7da 217(defbinding window-at-pointer () window
218 (x int :out)
219 (y int :out))
560af5c5 220
8bb8ead0 221(defbinding window-show () nil
560af5c5 222 (window window))
223
8f30d7da 224(defbinding window-show-unraised () nil
225 (window window))
226
8bb8ead0 227(defbinding window-hide () nil
560af5c5 228 (window window))
229
8f30d7da 230(defbinding window-is-visible-p () boolean
231 (window window))
232
233(defbinding window-is-viewable-p () boolean
234 (window window))
235
8bb8ead0 236(defbinding window-withdraw () nil
560af5c5 237 (window window))
238
8f30d7da 239(defbinding window-iconify () nil
240 (window window))
241
242(defbinding window-deiconify () nil
243 (window window))
244
245(defbinding window-stick () nil
246 (window window))
247
248(defbinding window-unstick () nil
249 (window window))
250
251(defbinding window-maximize () nil
252 (window window))
253
254(defbinding window-unmaximize () nil
255 (window window))
256
257(defbinding window-fullscreen () nil
258 (window window))
259
260(defbinding window-unfullscreen () nil
261 (window window))
262
263(defbinding window-set-keep-above () nil
264 (window window)
265 (setting boolean))
266
267(defbinding window-set-keep-below () nil
268 (window window)
269 (setting boolean))
270
8bb8ead0 271(defbinding window-move () nil
560af5c5 272 (window window)
273 (x int)
274 (y int))
275
8bb8ead0 276(defbinding window-resize () nil
560af5c5 277 (window window)
278 (width int)
279 (height int))
280
8bb8ead0 281(defbinding window-move-resize () nil
560af5c5 282 (window window)
283 (x int)
284 (y int)
285 (width int)
286 (height int))
287
8f30d7da 288(defbinding window-scroll () nil
289 (window window)
290 (dx int)
291 (dy int))
292
8bb8ead0 293(defbinding window-reparent () nil
560af5c5 294 (window window)
295 (new-parent window)
296 (x int)
297 (y int))
298
8bb8ead0 299(defbinding window-clear () nil
560af5c5 300 (window window))
301
8f30d7da 302(defbinding %window-clear-area () nil
560af5c5 303 (window window)
304 (x int) (y int) (width int) (height int))
305
8f30d7da 306(defbinding %window-clear-area-e () nil
560af5c5 307 (window window)
308 (x int) (y int) (width int) (height int))
309
310(defun window-clear-area (window x y width height &optional expose)
311 (if expose
8f30d7da 312 (%window-clear-area-e window x y width height)
313 (%window-clear-area window x y width height)))
560af5c5 314
8bb8ead0 315(defbinding window-raise () nil
560af5c5 316 (window window))
317
8bb8ead0 318(defbinding window-lower () nil
560af5c5 319 (window window))
320
8f30d7da 321(defbinding window-focus () nil
322 (window window)
323 (timestamp unsigned-int))
324
325(defbinding window-register-dnd () nil
326 (window window))
327
328(defbinding window-begin-resize-drag () nil
329 (window window)
330 (edge window-edge)
331 (button int)
332 (root-x int)
333 (root-y int)
334 (timestamp unsigned-int))
335
336(defbinding window-begin-move-drag () nil
337 (window window)
338 (button int)
339 (root-x int)
340 (root-y int)
341 (timestamp unsigned-int))
342
343