I've noticed that when quitting, if you clicked cancel, it would just keep asking you if you wanted to save. So I added a simple check to continue with the quitting process if the CloseIcon function returned true, otherwise we go back into the EventLoop function.
Then I worked on improving the overlay. The overlay is used for the rectangle, line and lasso tools. Basically it provides another (temporary layer) for displaying stuff (ie for the rectangle it is used to show the size of the rectangle being drawn, and only when the user lets go is it actually drawn on the icon's pixmap). Until now, when I created the overlay I used the current depth and color table. However, I realized that this was unecessary. All it needed was to have a 2 color color table, with the foreground color, and the transparent one (actually until now I was using white for the transparent color, which caused problems when drawing white lines). The transparent color is the same one that's used for determining the shape of irregular selections pasted in from other programs, 0xFFFFFE.