Gents,
I would like to get Mr. Denno set up as a fellow project admin on the Cells-gtk project, including giving him cvs write access. What do we need to do?
By the way, it seems I have done it again and can find no trace of the emails you sent informing me of various project passwords for cells-gtk. I would be amenable to you all working directly with Mr. Denno to get those reset. I will catch up later if necessary.
cheers, kenny
Peter Denno wrote:
Hi,
I have a solution to the problem, but I am puzzled that a simpler solution does not work. What I'd like to do:
(loop (loop while (gtk-events-pending) do (gtk-main-iteration-do)) (mp:process-wait "Waiting for GTK window event" #'gtk-events-pending)))
Simple enough, right?
Well, it's a mystery to me, but about two seconds elapse after a click on the window and a diagnostic print after the wait. Event handling is really that slow. I've used process-wait on LW recently to handle character input in some low level stuff and it was very responsive. But not here.
Also, I found that if I run that loop as it appears at the listener prompt, without even having a gtk application running, X events on LW windows (mouse clicks and expose events, anyway) will trigger the wait too. I thought that was odd... and maybe somehow related.
Anyway, a solution:
(with-periodic-invocation (:interval 100) (loop while (gtk-events-pending) do (gtk-main-iteration-do)))
This invokes the loop every 100 milliseconds.
With-periodic-invocation is some stuff I borrowed from a LW CAPI demo:
(defmacro with-periodic-invocation ((&key (interval 500)) &body body) `(invoke-with-periodic-invocation ,interval #'(lambda () ,@body)))
(defun invoke-with-periodic-invocation (millisecond-interval closure) (flet ((timer-callback () (funcall closure))) (let ((timer (mp:make-timer #'timer-callback))) (unwind-protect (progn ;; Schedule the repetitive timer. (mp:schedule-timer-relative-milliseconds timer millisecond-interval millisecond-interval) ;; Wait forever... (mp:process-wait "Periodic wait" #'(lambda () nil))) (when timer (mp:unschedule-timer timer))))))
I don't know how this might port to sbcl etc. I don't recall seeing timers, but then I really shouldn't need them. I think LW is getting confused about X11 events.