I'm making an application using Gtk2hs, and there are actually two separate problems I'd like to ask about. The first concerns HOpenGL: I have a polyhedron displayed in a glDrawingArea which users can manually rotate around. The rotation is pretty smooth and satisfactory when I run the application from ghci, but if I compile it into an executable and run it, the rotation becomes jerky and sometimes unresponsive. Shouldn't compiling make it faster? I compiled using "ghc --make Main.hs" and just double-clicked the produced executable to run it.

The other problem concerns progress bars. I have to do a certain computation (in a new thread) that produces a 2D geometrical figure that I display in a drawingArea using Cairo. At each stage in the computation, I record the current progress in an IORef. Through a timeoutAdd I also regularly check the IORef (in the main thread) and update the progress bar accordingly using progressBarSetFraction. However, when I run the computation, the entire GUI becomes unresponsive and static, including the progress bar; after the computation is done, the progress bar simply jumps from 0% to 100%. To debug, I called "print fraction" below every call to progressBarSetFraction to check if my updates were spread evenly throughout the computation, and indeed they were. It seems that the computation tried to update the progress bar at the right times, but the GUI lagged because of the computation; at the end of the computation, all the updates were then made in a flurry, so the progress bar jumped to 100%. It doesn't even work when I compile into an executable. It works, though, if I compile using the -threaded flag.

I don't think I've been doing it correctly because there should be some way to do it without compiling specially (or so I think). I can't find sample code for progress bar usage too...

Thanks for the help!

Herng Yi