handle.c
// unmapping could indicate the focus window has closed
// find a new one to focus if needed
unmapping could indicate the focus window has closed
find a new one to focus if needed
unmapping could indicate the focus window has closed find a new one to focus if needed
void handle_unmapnotify(XEvent *ev)
{
	reset_cache_inplay();
	int was_active = window_is_active(ev->xunmap.window);
	client *c = client_create(ev->xunmap.window);
	if (c && c->manage)
	{
		event_log("UnmapNotify", c->window);
		event_client_dump(c);
		if (c->minimized || c->shaded)
		{
			client_set_wm_state(c, IconicState);
			winlist_forget(windows_activated, c->window);
		} else
		{
			client_set_wm_state(c, WithdrawnState);
			window_unset_prop(c->window, netatoms[_NET_WM_STATE]);
			window_unset_prop(c->window, netatoms[_NET_WM_DESKTOP]);
			winlist_forget(windows_activated, c->window);
			winlist_forget(windows_minimized, c->window);
			winlist_forget(windows_shaded,    c->window);
		}
		if (c->decorate)
			box_hide(c->cache->frame);
	}
	if (was_active)
	{
		if (ev->xunmap.event == root)
		{
			if (!client_active(current_tag))
				XSetInputFocus(display, PointerRoot, RevertToPointerRoot, CurrentTime);
			ewmh_client_list();
		}
		else
		if ((c = client_create(ev->xunmap.event)) && c && c->manage)
		{
			client_activate(c, RAISEDEF, WARPDEF);
			ewmh_client_list();
		}
	}
}
void handle_unmapnotify ( XEvent * ev ) { reset_cache_inplay ( ) ; int was_active = window_is_active ( ev -> xunmap . window ) ; client * c = client_create ( ev -> xunmap . window ) ; if ( c && c -> manage ) { event_log ( " " , c -> window ) ; event_client_dump ( c ) ; if ( c -> minimized || c -> shaded ) { client_set_wm_state ( c , IconicState ) ; winlist_forget ( windows_activated , c -> window ) ; } else { client_set_wm_state ( c , WithdrawnState ) ; window_unset_prop ( c -> window , netatoms [ _NET_WM_STATE ] ) ; window_unset_prop ( c -> window , netatoms [ _NET_WM_DESKTOP ] ) ; winlist_forget ( windows_activated , c -> window ) ; winlist_forget ( windows_minimized , c -> window ) ; winlist_forget ( windows_shaded , c -> window ) ; } if ( c -> decorate ) box_hide ( c -> cache -> frame ) ; } if ( was_active ) { if ( ev -> xunmap . event == root ) { if ( ! client_active ( current_tag ) ) XSetInputFocus ( display , PointerRoot , RevertToPointerRoot , CurrentTime ) ; ewmh_client_list ( ) ; } else if ( ( c = client_create ( ev -> xunmap . event ) ) && c && c -> manage ) { client_activate ( c , RAISEDEF , WARPDEF ) ; ewmh_client_list ( ) ; } } }
unmapping could indicate the focus window has closed
find a new one to focus if needed
unmapping could indicate the focus window has closed find a new one to focus if needed
// was it a top-level app window that closed? // hide border // if window has already been destroyed, above client_create() may have failed // see if this was the active window, and if so, find someone else to take the job