Implemented display sleep during redraw.
Fixed a bug with ui_enter() being called twice.