def draw_if_needed(canvas):
    """
    Force canvas to be drawn if there are drawing commands outstanding.

    This is needed if the application has emitted a draw_idle() that hasn't
    had time to process prior to the mouse event detection running.
    """
    if not canvas._isDrawn:
        canvas.draw()
