I fixed the following bugs:
* enable-event & disable-event do not check if the event
is already enabled/disabled. This can lead to enabling
the idle callback more than once for a given window
which can break the event loop in various ways.
For instance, in current cl-opengl, rb-double enables
idle once per mouseclick and this leads to multiple
entires in *windows-with-idle-event* which in turn
means that the idle method will get called multiple times
breaking the logic.
* Currently the idle callback is disabled only in close,
and only when *windows-with-idle-event* is nil. We need to
do the same check in disable-event too. Currently this
manifests in gears.lisp. If you minimize the window,
(disable-event :idle) will get called but the callback
will continue to run -> 100% cpu usage.
Now for darwin, i fixed all the issues i could find.
It now works on sbcl/ccl/ccl64 with no issues. Instead of
forcing the glut event loop on the initial thread, i used
the trick from ccl opengl-ffi on sbcl too.
This means that, on sbcl and ccl/ccl64, a new thread is created
(GLUT-thread) which will run the glut event loop. This also
has the bonus of making cl-glut work without any changes under
slime. The only issue when developing interactively is that one
can not call glut functions from a thread other than GLUT-thread
_while_ the glut event loop is running. I added warnings to indicate
when the event loop runs/stops. If the glut event loop is not running
(example: leave-main-loop is called), you can call glut functions
from any thread and they will take effect when the glut event loop
starts
running again. This shouldn't affect normal development, i had to
mention
it because osx has the tendency to kill the process when one ignores
this :-)
(All the changes apart from the bug fixes are only for darwin.)