Drawing the updated contents of a custom widget

customkeyfocus.C's custom widget's appearance changes when it gains or loses keyboard input focus, and in response to r, g, and b keys. This means that it's necessary to redraw the widget when any of these events occur.

It's possible to perform the necessary work and immediately call do_draw(), directly. customkeyfocus.C gives an example of a better way to do this, by calling schedule_redraw().

schedule_redraw() arranges for a subsequent call to do_draw() to take place; but also does a few things that produce a better result: