[cells-gtk-devel] pulse

Kenny Tilton ktilton at nyc.rr.com
Mon Feb 7 21:40:56 UTC 2005



Andras Simon wrote:

> The Pulse button in the Display demo sends cmucl immediately to the
> debugger. The following patch corrects this, but cmucl ffi experts
> should refrain from looking at it.
>
> --- cells-gtk/widgets.lisp      3 Jan 2005 22:33:16 -0000       1.7
> +++ cells-gtk/widgets.lisp      7 Feb 2005 14:45:36 -0000
> @@ -247,6 +247,12 @@
>      (trc nil "timeout func really returning" r2)
>      r2))
>
> +#+cmu
> +(alien:def-callback timeout-handler-callback
> +    ((boolean 1) (data (* integer)))
> +  (let* ((id (elti data 0))
> +        (r2 (gtk-global-callback-funcall id)))
> +    (if r2 1 0)))
>
>  (defun timeout-add (milliseconds function)
>    (let ((id (gtk-global-callback-register
>
Thanks for the patches.

>
>
> Allegro (6.2/Linux) on the other hand will happily start to pulse, but
> will not stop, no matter what. I wonder if it's like this on Windows,
> too. 

Yes, it is the same on Windows. This is the relevant code:

(defmodel test-display (vbox)
  ()
  (:default-initargs
      :md-value (c? (when (md-value (fm-other :pulse))
                      (timeout-add (md-value (fm-other :timeout))
                        (lambda ()
                          (pulse (fm-other :pbar2))
                          (md-value (fm-other :pulse))))))

Apparently with Gtk, if the callback returns true the timeout gets 
reposted, if it returns false it does not. Just guessing. If so, does 
this mean we have to translate the return value to 0/1 instead of nil/t?

Maybe I broke this porting to UFFI, which does not have the same trick 
as CLisp's FFI of translating automaticall between Lisp and C truth 
values. I hacked that up (IIRC) for explicit API wrappers, but not 
lambdas. Sorry, I am guilty of a lot of guesswork, but I am caught up 
now in a commercial project and do not have time to look into this.

kt




More information about the cells-gtk-devel mailing list