Hi,
When I try to run the X11 example in the Aug 22 version, the following happens:
--------------------------------------------------------------
CL-USER> (load "/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp") ; in: LAMBDA NIL ; CAIRO-XLIB-EXAMPLE::OPEN-X11-DISPLAY ; ; caught STYLE-WARNING: ; undefined function: OPEN-X11-DISPLAY
; ; caught STYLE-WARNING: ; This function is undefined: ; OPEN-X11-DISPLAY ; ; compilation unit finished ; caught 2 STYLE-WARNING conditions ; Evaluation aborted. CL-USER>
--------------------------------------------------------------
Does it work for anybody else?
Joubert
PS: here is a full stack trace:
function CAIRO-XLIB-EXAMPLE::OPEN-X11-DISPLAY is undefined. [Condition of type UNDEFINED-FUNCTION]
Restarts: 0: [ABORT] Return to SLIME's top level. 1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" {AF89931}>)
Backtrace: 0: ("bogus stack frame") 1: (SB-INT:SIMPLE-EVAL-IN-LEXENV (CAIRO-XLIB-EXAMPLE::OPEN-X11-DISPLAY ":0") #<NULL-LEXENV>) 2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SB-IMPL::%DEFPARAMETER 'CAIRO-XLIB-EXAMPLE::*DISPLAY* (CAIRO-XLIB-EXAMPLE::OPEN-X11-DISPLAY ":0") NIL 'NIL (SB-C:SOURCE-LOCATION)) #<NULL-LEXENV>) 3: (SB-INT:SIMPLE-EVAL-IN-LEXENV (EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) (SB-IMPL::%DEFPARAMETER 'CAIRO-XLIB-EXAMPLE::*DISPLAY* (CAIRO-XLIB-EXAMPLE::OPEN-X11-DISPLAY ":0") NIL 'NIL (SB-C:SOURCE-LOCATION))) #<NULL-LEXENV>) 4: (SB-INT:SIMPLE-EVAL-IN-LEXENV (DEFPARAMETER CAIRO-XLIB-EXAMPLE::*DISPLAY* (CAIRO-XLIB-EXAMPLE::OPEN-X11-DISPLAY ":0")) #<NULL-LEXENV>) 5: (SB-FASL::LOAD-AS-SOURCE #<SB-SYS:FD-STREAM for "file /tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp" {B82F001}> NIL NIL) 6: (SB-FASL::INTERNAL-LOAD
#P"/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp"
#P"/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp" :ERROR NIL NIL :SOURCE :DEFAULT) 7: (SB-FASL::INTERNAL-LOAD
#P"/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp"
#P"/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp" :ERROR NIL NIL NIL :DEFAULT) 8: (LOAD
"/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp") 9: (SB-INT:SIMPLE-EVAL-IN-LEXENV (LOAD
"/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp") #<NULL-LEXENV>) 10: (SWANK::EVAL-REGION "(load "/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp") " T) 11: ((LAMBDA ())) 12: ((LAMBDA (SWANK-BACKEND::FN)) #<CLOSURE (LAMBDA #) {B816D45}>) 13: (SWANK::CALL-WITH-BUFFER-SYNTAX #<CLOSURE (LAMBDA #) {B816D45}>) 14: (SWANK:LISTENER-EVAL "(load "/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp") ") 15: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:LISTENER-EVAL "(load "/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp") ") #<NULL-LEXENV>) 16: ((LAMBDA ())) 17: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA #) {B816BCD}>) 18: ((LAMBDA ())) 19: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA #) {AA86005}>) 20: (SWANK::CALL-WITH-REDIRECTED-IO #<SWANK::CONNECTION {AE97F89}> #<CLOSURE (LAMBDA #) {B816B15}>) 21: (SWANK::CALL-WITH-CONNECTION #<SWANK::CONNECTION {AE97F89}> #<FUNCTION (LAMBDA #) {AA86005}>) 22: (SWANK::HANDLE-REQUEST #<SWANK::CONNECTION {AE97F89}>) 23: (SWANK::REPL-LOOP #<SWANK::CONNECTION {AE97F89}>) 24: (SWANK::REPL-LOOP #<SWANK::CONNECTION {AE97F89}>) 25: (SWANK::CALL-WITH-BINDINGS NIL #<CLOSURE (LAMBDA #) {AF990C5}>) 26: ((FLET SB-THREAD::WITH-MUTEX-THUNK)) 27: (SB-UNIX::CALL-WITH-LOCAL-INTERRUPTS #<CLOSURE (FLET SB-UNIX::WITH-LOCAL-INTERRUPTS-THUNK) {B647A095}> T) 28: ((FLET SB-UNIX::WITHOUT-INTERRUPTS-THUNK) T) 29: ((FLET SB-UNIX::RUN-WITHOUT-INTERRUPTS)) 30: (SB-UNIX::CALL-WITHOUT-INTERRUPTS #<CLOSURE (FLET SB-UNIX::WITHOUT-INTERRUPTS-THUNK) {B647A185}>) 31: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK) {B647A205}> #S(SB-THREAD:MUTEX :NAME "thread result lock" :VALUE #<SB-THREAD:THREAD "repl-thread" {AF89931}>) #<SB-THREAD:THREAD "repl-thread" {AF89931}> T) 32: ((LAMBDA ())) 33: ("foreign function: call_into_lisp") 34: ("foreign function: funcall0") 35: ("foreign function: new_thread_trampoline") 36: ("foreign function: #xB7FBE31B") function CAIRO-XLIB-EXAMPLE::OPEN-X11-DISPLAY is undefined. [Condition of type UNDEFINED-FUNCTION]
Restarts: 0: [ABORT] Return to SLIME's top level. 1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" {AF89931}>)
Backtrace: 0: ("bogus stack frame") 1: (SB-INT:SIMPLE-EVAL-IN-LEXENV (CAIRO-XLIB-EXAMPLE::OPEN-X11-DISPLAY ":0") #<NULL-LEXENV>) 2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SB-IMPL::%DEFPARAMETER 'CAIRO-XLIB-EXAMPLE::*DISPLAY* (CAIRO-XLIB-EXAMPLE::OPEN-X11-DISPLAY ":0") NIL 'NIL (SB-C:SOURCE-LOCATION)) #<NULL-LEXENV>) 3: (SB-INT:SIMPLE-EVAL-IN-LEXENV (EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) (SB-IMPL::%DEFPARAMETER 'CAIRO-XLIB-EXAMPLE::*DISPLAY* (CAIRO-XLIB-EXAMPLE::OPEN-X11-DISPLAY ":0") NIL 'NIL (SB-C:SOURCE-LOCATION))) #<NULL-LEXENV>) 4: (SB-INT:SIMPLE-EVAL-IN-LEXENV (DEFPARAMETER CAIRO-XLIB-EXAMPLE::*DISPLAY* (CAIRO-XLIB-EXAMPLE::OPEN-X11-DISPLAY ":0")) #<NULL-LEXENV>) 5: (SB-FASL::LOAD-AS-SOURCE #<SB-SYS:FD-STREAM for "file /tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp" {B82F001}> NIL NIL) 6: (SB-FASL::INTERNAL-LOAD
#P"/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp"
#P"/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp" :ERROR NIL NIL :SOURCE :DEFAULT) 7: (SB-FASL::INTERNAL-LOAD
#P"/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp"
#P"/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp" :ERROR NIL NIL NIL :DEFAULT) 8: (LOAD
"/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp") 9: (SB-INT:SIMPLE-EVAL-IN-LEXENV (LOAD
"/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp") #<NULL-LEXENV>) 10: (SWANK::EVAL-REGION "(load "/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp") " T) 11: ((LAMBDA ())) 12: ((LAMBDA (SWANK-BACKEND::FN)) #<CLOSURE (LAMBDA #) {B816D45}>) 13: (SWANK::CALL-WITH-BUFFER-SYNTAX #<CLOSURE (LAMBDA #) {B816D45}>) 14: (SWANK:LISTENER-EVAL "(load "/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp") ") 15: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:LISTENER-EVAL "(load "/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp") ") #<NULL-LEXENV>) 16: ((LAMBDA ())) 17: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA #) {B816BCD}>) 18: ((LAMBDA ())) 19: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA #) {AA86005}>) 20: (SWANK::CALL-WITH-REDIRECTED-IO #<SWANK::CONNECTION {AE97F89}> #<CLOSURE (LAMBDA #) {B816B15}>) 21: (SWANK::CALL-WITH-CONNECTION #<SWANK::CONNECTION {AE97F89}> #<FUNCTION (LAMBDA #) {AA86005}>) 22: (SWANK::HANDLE-REQUEST #<SWANK::CONNECTION {AE97F89}>) 23: (SWANK::REPL-LOOP #<SWANK::CONNECTION {AE97F89}>) 24: (SWANK::REPL-LOOP #<SWANK::CONNECTION {AE97F89}>) 25: (SWANK::CALL-WITH-BINDINGS NIL #<CLOSURE (LAMBDA #) {AF990C5}>) 26: ((FLET SB-THREAD::WITH-MUTEX-THUNK)) 27: (SB-UNIX::CALL-WITH-LOCAL-INTERRUPTS #<CLOSURE (FLET SB-UNIX::WITH-LOCAL-INTERRUPTS-THUNK) {B647A095}> T) 28: ((FLET SB-UNIX::WITHOUT-INTERRUPTS-THUNK) T) 29: ((FLET SB-UNIX::RUN-WITHOUT-INTERRUPTS)) 30: (SB-UNIX::CALL-WITHOUT-INTERRUPTS #<CLOSURE (FLET SB-UNIX::WITHOUT-INTERRUPTS-THUNK) {B647A185}>) 31: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK) {B647A205}> #S(SB-THREAD:MUTEX :NAME "thread result lock" :VALUE #<SB-THREAD:THREAD "repl-thread" {AF89931}>) #<SB-THREAD:THREAD "repl-thread" {AF89931}> T) 32: ((LAMBDA ())) 33: ("foreign function: call_into_lisp") 34: ("foreign function: funcall0") 35: ("foreign function: new_thread_trampoline") 36: ("foreign function: #xB7FBE31B")
On Fri, Aug 24, 2007 at 10:44:40PM -0400, Joubert Nel wrote:
Hi,
When I try to run the X11 example in the Aug 22 version, the following happens:
CL-USER> (load "/tank/lisp/sbcl/lib/sbcl/site/cl-cairo2-latest/tutorial/x11-example.lisp") ; in: LAMBDA NIL ; CAIRO-XLIB-EXAMPLE::OPEN-X11-DISPLAY ; ; caught STYLE-WARNING: ; undefined function: OPEN-X11-DISPLAY
; ; caught STYLE-WARNING: ; This function is undefined: ; OPEN-X11-DISPLAY ; ; compilation unit finished ; caught 2 STYLE-WARNING conditions ; Evaluation aborted. CL-USER>
Does it work for anybody else?
Hi Joubert,
My mistake, the X11 code has been rewritten again. Sorry for the frequent changes, the only justification is that I hope it is getting better and cleaner each time.
You will find the corrected version of x11-example.lisp on the site now. In the current version, each window has its own event loop and thread (in the previous code, it used to be one loop/thread per display). I find this approach eliminates some rare but nasty redrawing bugs.
Currently, you can create xlib contexts with
(create-xlib-context width height)
and you can supply optional arguments display-name (if nil as by default, Xlib will use your $DISPLAY settings) and window-name (the title of the window).
Also, in the current version you will find sync-lock, sync-unlock and the macro
(with-sync-lock (context) ...)
which suspends redrawing the window for operations in its body. Use it for drawings with lots of elements, they will appear on the screen at the same time, and drawing will be much faster.
I hope that there will be no more major reorganizations in the X11 code, at least the API.
HTH,
Tamas
On Sat, 2007-08-25 at 14:42 +0200, Tamas K Papp wrote:
Does it work for anybody else?
Hi Joubert,
My mistake, the X11 code has been rewritten again. Sorry for the frequent changes, the only justification is that I hope it is getting better and cleaner each time.
No problem; I'm still in the early growing pains of my GUI framework (busy switching from cl-cairo) so this comes with the territory.
You will find the corrected version of x11-example.lisp on the site now. In the current version, each window has its own event loop and
Got it from svn - works fine.
thread (in the previous code, it used to be one loop/thread per display). I find this approach eliminates some rare but nasty redrawing bugs.
Currently, you can create xlib contexts with
(create-xlib-context width height)
and you can supply optional arguments display-name (if nil as by default, Xlib will use your $DISPLAY settings) and window-name (the title of the window).
That's good, I know previously you had to call it with ":0".
Also, in the current version you will find sync-lock, sync-unlock and the macro
(with-sync-lock (context) ...)
which suspends redrawing the window for operations in its body. Use it for drawings with lots of elements, they will appear on the screen at the same time, and drawing will be much faster.
I did notice the speed increase in the X11 sample.
Joubert
cl-cairo2-devel@common-lisp.net