protected void exec () {
    if (help_option) return;

    window.map ();
    if ((event_mask & RESIZE_BIT) != 0)
      handle_resize (window.width, window.height);

    while (!exit_now) {
      if (window_dirty) {
        window_dirty = false;
        handle_expose ();
      }
     
      // `exit_now' may have become true during `handle_expose'
      if (!exit_now) dispatch_event ();
    }

    if (!leave_display_open) display.close ();
  }