Hello,
I have only recently begun programming Lisp, so please excuse my
newbish questions.
I'm using SBCL with GNU/Linux and want to use cl-cairo with an Xlib
surface; however, CLX
and cl-cairo seem to have differing ideas about the nature of foreign
data structures.
The following minimal snippet exhibits the problem:
(asdf:operate 'asdf:load-op 'clx)
(asdf:operate 'asdf:load-op 'cl-cairo)
(let* ((display (xlib:open-display ""))
(window (xlib:create-window :parent (xlib:screen-root (first
(xlib:display-roots display)))
:x 0 :y 0 :width 250 :height 250
:class :input-output :background :parent-
relative)))
(cairo:xlib-surface-create display window :direct-color 250
250))
It gives me:
debugger invoked on a TYPE-ERROR in thread #<THREAD "initial
thread" {A6E85B1}>:
The value #<XLIB:DISPLAY :0 (The X.Org Foundation R70200000)>
is not of type
SYSTEM-AREA-POINTER.
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
(CAIRO:XLIB-SURFACE-CREATE
#<XLIB:DISPLAY :0 (The X.Org Foundation R70200000)>
#<XLIB:WINDOW :0 5400001>
:DIRECT-COLOR
250
250)
If I interpret correctly from cl-cairo's source, it wants a type
named :pointer, which CLX doesn't return from open-display. But since
there are effectively the same data structures involved behind the
scenes, it should be possible to use them with some casting magic,
shouldn't it?
I guess the sb-alien: functions may be of help, but I'm not yet savvy
enough to handle this stuff.
Any ideas?
Leslie
"Leslie P. Polzer" <·············@gmx.net> writes:
> If I interpret correctly from cl-cairo's source, it wants a type
> named :pointer, which CLX doesn't return from open-display. But since
> there are effectively the same data structures involved behind the
> scenes, it should be possible to use them with some casting magic,
> shouldn't it?
This question was asked and answered last week. See
http://groups.google.com/group/comp.lang.lisp/msg/b46b134529765f33
They aren't using the same data structures at all; CLX uses Lisp
data structures, and cairo uses C data structures.
Zach
On 10 Jun, 19:58, Zach Beane <····@xach.com> wrote:
> This question was asked and answered last week. See
Sorry, must have overlooked that one. Thanks for pointing me at it.
> They aren't using the same data structures at all; CLX uses Lisp
> data structures, and cairo uses C data structures.
Yeah, as said in the CLX description, they are independent
implementations
of the X protocol. I suppose I wasn't able to apply my knowledge of
this
fact to the problem at hand.
Leslie
On 2007-06-11, Leslie P. Polzer <·············@gmx.net> wrote:
> Yeah, as said in the CLX description, they are independent
> implementations of the X protocol. I suppose I wasn't able to apply
> my knowledge of this fact to the problem at hand.
The client-side data structures are different, but you can use the C
library (through cairo) and CLX (to set up the windows) simultaneously
to access the same drawable in the server.
Grep for cairo-set-target-drawable and xlib:window-id in
http://bauhh.dyndns.org:8000/mcclim/cairo/cairo-medium.lisp
d.
On 11 Jun, 12:39, David Lichteblau <···········@lichteblau.com> wrote:
> The client-side data structures are different, but you can use the C
> library (through cairo) and CLX (to set up the windows) simultaneously
> to access the same drawable in the server.
If I interpret this correctly, this will, through the use of the
unique window-id
field, enable me to use CLX for event processing, right?
> Grep for cairo-set-target-drawable and xlib:window-id inhttp://bauhh.dyndns.org:8000/mcclim/cairo/cairo-medium.lisp
Seems to be down right now...
Leslie
Zach Beane <····@xach.com> writes:
> "Leslie P. Polzer" <·············@gmx.net> writes:
>
>> If I interpret correctly from cl-cairo's source, it wants a type
>> named :pointer, which CLX doesn't return from open-display. But since
>> there are effectively the same data structures involved behind the
>> scenes, it should be possible to use them with some casting magic,
>> shouldn't it?
>
> This question was asked and answered last week. See
>
> http://groups.google.com/group/comp.lang.lisp/msg/b46b134529765f33
>
> They aren't using the same data structures at all; CLX uses Lisp
> data structures, and cairo uses C data structures.
>
> Zach
Moreover, cl-cairo appears to be dormant (see
http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/db27f81ad08da1d1).
Try my cl-cairo2 (http://common-lisp.net/project/cl-cairo2/, X11
support coming in a few days) or Christian Haselbach's cffi-cairo (see
the thread), which uses sdl.
Best,
Tamas
> Try my cl-cairo2 (http://common-lisp.net/project/cl-cairo2/, X11
> support coming in a few days)
Great! That means I won't have to fiddle around with cffi to get my
Display and Drawable.
> or Christian Haselbach's cffi-cairo (see the thread), which uses sdl.
This one's not an option for me; I want slim dependencies.
Leslie
Tamas Papp <······@gmail.com> writes:
> Moreover, cl-cairo appears to be dormant (see
> http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/db27f81ad08da1d1).
> Try my cl-cairo2 (http://common-lisp.net/project/cl-cairo2/, X11
> support coming in a few days) or Christian Haselbach's cffi-cairo (see
> the thread), which uses sdl.
It took more than a few days, but now cl-cairo2 has X11 (and SVG
support). You can get the latest version from
http://common-lisp.net/project/cl-cairo2/ -- make sure that you read
the README.xlib-context before trying to use X11 contexts.
Bug reports and comments are welcome, I tried to make the threads part
portable, but only tested on sbcl.
Best,
Tamas