public void when_map_notify (MapNotify event) {
    Client client = (Client) Client.intern (display, event.window_id);
    if (client.early_unmapped || client.early_destroyed) return;


    /* Get override_redirect and map_state.
     *
     * Case 1. !override_redirect (). MapRequest is generated and
     * client.attributes is already initialized in when (MapRequest)
     *
     * Case 2. override_redirect (). NO MapRequest is generated and
     * client.attributes == null - it must be initialized here.
     *
     * @see <a href="XMapWindow.html">XMapWindow</a>
     */
    if (client.attributes == null)
      client.attributes = client.attributes ();

    if (client.attributes.override_redirect ()) return;

    /* Now and only now sets the window state to NORMAL (except during
     * initialization). Setting this earlier gives false impression that
     * the window is mapped, but it does not happen until MapNotify.
     * Note window.raise () and window.map () do not guarantee the
     * visibility of a window (due to map request and configure request
     * redirection of wm). Hence, any operations that depends on visibility
     * (warp pointer and set input focus) should check window.state.
     *
     * state == NO_FOCUS from grant_preference ().
     */
    if (client.state != NO_FOCUS) client.state = NORMAL;
    client.set_wm_state (Window.WMState.NORMAL);

    /* We can set focus to a window only when it is ready, ie.
     * MapNotify, not MapRequest.
     */
    if (client.state != NO_FOCUS) set_focus (client, false);
  }