handle.c
// map requests are when we get nasty about co-ords and size
map requests are when we get nasty about co-ords and size
map requests are when we get nasty about co - ords and size
void handle_maprequest(XEvent *ev)
{
	client *c = client_recreate(ev->xmaprequest.window);
#ifdef DEBUG
	if (c)
	{
		event_log("MapRequest", c->window);
		event_client_dump(c);
	}
#endif
	if (c && c->manage)
	{
		reset_lazy_caches();
		window_select(c->window);
		client_extended_data(c);
		monitor_active(&c->monitor);
		client_review_border(c);
		client_deactivate(c, client_active(0));
		client_rules_ewmh(c);
		if (config_window_placement == PLACEPOINTER && !(c->xsize.flags & (PPosition|USPosition)))
		{
			int x, y; pointer_get(&x, &y);
			workarea a; monitor_dimensions_struts(x, y, &a);
			client_moveresize(c, 0, MAX(a.x, x-(c->w/2)), MAX(a.y, y-(c->h/2)), c->w, c->h);
		}
		else
		if ((config_window_placement == PLACEANY && !(c->xsize.flags & (PPosition|USPosition))) || (config_window_placement == PLACECENTER))
		{
			client *p = NULL;
			if (c->trans != None && (p = client_create(c->trans)) && p)
			{
				client_extended_data(p);
				client_moveresize(c, 0, p->x + (p->w/2) - (c->w/2),
					p->y + (p->h/2) - (c->h/2), c->w, c->h);
			}
			else
			{
				workarea *m = &c->monitor;
				client_moveresize(c, 0, MAX(m->x, m->x + ((m->w - c->w) / 2)),
					MAX(m->y, m->y + ((m->h - c->h) / 2)), c->w, c->h);
			}
		} else
		if (c->xsize.flags & (PPosition|USPosition))
			client_moveresize(c, 0, c->x, c->y, c->w, c->h);
		client_rules_tags(c);
		if (!c->cache->tags) client_toggle_tag(c, current_tag, NOFLASH);
		client_rules_monitor(c);
		client_rules_moveresize(c);
		client_rules_locks(c);
		client_rules_moveresize_post(c);
		if (client_rule(c, RULE_MINIMIZE))
		{
			client_minimize(c);
			return;
		}
		if (c->trans == None) client_lower(c, 0);
		XSync(display, False);
	}
	XMapWindow(display, ev->xmaprequest.window);
}
void handle_maprequest ( XEvent * ev ) { client * c = client_recreate ( ev -> xmaprequest . window ) ; #ifdef DEBUG if ( c ) { event_log ( " " , c -> window ) ; event_client_dump ( c ) ; } #endif if ( c && c -> manage ) { reset_lazy_caches ( ) ; window_select ( c -> window ) ; client_extended_data ( c ) ; monitor_active ( & c -> monitor ) ; client_review_border ( c ) ; client_deactivate ( c , client_active ( 0 ) ) ; client_rules_ewmh ( c ) ; if ( config_window_placement == PLACEPOINTER && ! ( c -> xsize . flags & ( PPosition | USPosition ) ) ) { int x , y ; pointer_get ( & x , & y ) ; workarea a ; monitor_dimensions_struts ( x , y , & a ) ; client_moveresize ( c , 0 , MAX ( a . x , x - ( c -> w / 2 ) ) , MAX ( a . y , y - ( c -> h / 2 ) ) , c -> w , c -> h ) ; } else if ( ( config_window_placement == PLACEANY && ! ( c -> xsize . flags & ( PPosition | USPosition ) ) ) || ( config_window_placement == PLACECENTER ) ) { client * p = NULL ; if ( c -> trans != None && ( p = client_create ( c -> trans ) ) && p ) { client_extended_data ( p ) ; client_moveresize ( c , 0 , p -> x + ( p -> w / 2 ) - ( c -> w / 2 ) , p -> y + ( p -> h / 2 ) - ( c -> h / 2 ) , c -> w , c -> h ) ; } else { workarea * m = & c -> monitor ; client_moveresize ( c , 0 , MAX ( m -> x , m -> x + ( ( m -> w - c -> w ) / 2 ) ) , MAX ( m -> y , m -> y + ( ( m -> h - c -> h ) / 2 ) ) , c -> w , c -> h ) ; } } else if ( c -> xsize . flags & ( PPosition | USPosition ) ) client_moveresize ( c , 0 , c -> x , c -> y , c -> w , c -> h ) ; client_rules_tags ( c ) ; if ( ! c -> cache -> tags ) client_toggle_tag ( c , current_tag , NOFLASH ) ; client_rules_monitor ( c ) ; client_rules_moveresize ( c ) ; client_rules_locks ( c ) ; client_rules_moveresize_post ( c ) ; if ( client_rule ( c , RULE_MINIMIZE ) ) { client_minimize ( c ) ; return ; } if ( c -> trans == None ) client_lower ( c , 0 ) ; XSync ( display , False ) ; } XMapWindow ( display , ev -> xmaprequest . window ) ; }
map requests are when we get nasty about co-ords and size
map requests are when we get nasty about co - ords and size
// this reset mainly for -auto apps, which may fire before docks/panels have set // their struts, or (apparently?) before nvidia's xinerama stuff reports all monitors // if this MapRequest was already dispatched before a previous ConfigureRequest was // received, some clients seem to be able to map before applying the border change, // resulting in a little jump on screen. ensure border is done first // PLACEPOINTER: center window on pointer // figure out which monitor holds the pointer, so we can nicely keep the window on-screen // PLACEANY: windows which specify position hints are honored, all else gets centered on screen or their parent // PLACECENTER: centering is enforced // try to center transients on their main window // center everything else on current monitor // let program or user specified positions go through, but require it to be neatly on-screen. // client_moveresize() does the necessary nudging // default to current tag // specifying a non-active monitor will center the window there // this overrides PLACEPOINTER! // rules may move window again // must occur after move/resize! // following designed to work after h/v locks // auto minimizing