;;;; Run the GLXGears demo.
-(load "make")
-(with-system-library-directories
- '("./")
- (lambda ()
- (load-package-set "glxgears")
- ((access main (->environment '(gl glxgears))))))
\ No newline at end of file
+(load-option 'GTK)
+
+(if (gtk-thread-running?)
+ (begin
+ (let ((env (->environment '(runtime pathname))))
+ (set! (access library-directory-path env)
+ (cons (merge-pathnames "./")
+ (access library-directory-path env))))
+ (load "make")
+ (let* ((widget (make-glxgears-demo))
+ (thread ((access glxgears-demo-animation-thread
+ (->environment '(gl glxgears)))
+ widget)))
+ (let ((gtk (->environment '(gtk gtk-widget))))
+ (let wait ()
+ (if (not (null? (access toplevel-windows gtk)))
+ (begin
+ (sleep-current-thread 1000)
+ (wait)))))
+ (join-thread thread (lambda (thread* value)
+ (lambda ()
+ (display "; glxgears: joined\n")
+ (if (not (eq? thread* thread))
+ (error "What?!"))
+ value))))
+ (gc-flip)
+ (let ((ffi (->environment '(runtime ffi))))
+ (if (not (= 0 (length (access malloced-aliens ffi))))
+ (warn "Test gl-demo.mallocs failed.\n"))
+ (if (not (= 0 (car ((access registered-callback-count ffi)))))
+ (warn "; Test gl-demo.callbacks failed.\n"))))
+ (warn "Could not test the GL subsystem without a DISPLAY."))
\ No newline at end of file