void dump_event(int wn,ui_event_p ev)
{
	printf("WND %i =============================\nType: ", wn);
	switch(ev->type)
	{
		case ui_key_event: puts("ui_key_event"); break;
		case ui_pointer_motion_event: puts("ui_pointer_motion_event"); break;
		case ui_window_focus_in_event: puts("ui_window_focus_in_event"); break;
		case ui_window_focus_out_event: puts("ui_window_focus_out_event"); break;
		case ui_window_expose_event: puts("ui_window_expose_event"); break;
		case ui_window_map_event: puts("ui_window_map_event"); break;
		case ui_window_unmap_event: puts("ui_window_unmap_event"); break;
		case ui_window_move_event: puts("ui_window_move_event"); break;
		case ui_window_size_event: puts("ui_window_size_event"); break;
		case ui_wm_event: printf("ui_wm_event (%d)\n",ev->configure.wm_event); break;
		default:
			printf("unknown %d\n",ev->type);
			return;
	}
	printf("time %g, x %d, y %d, rx %d, ry %d\n",
		ev->time, ev->client_x, ev->client_y, ev->screen_x, ev->screen_y);
	printf("buton %x, state %x, ",ev->button,ev->state);
	printf("press %u, char '%c' (%X), uni %X, scan %s\n",
		ev->key.press, (ev->key.acode >= 32) ? ev->key.acode : '?',
		ev->key.acode, ev->key.ucode,
		uiKeyscan2Name(ev->key.scan));
	if(ev->type == ui_key_event && ev->key.ucode)
		printf("keyname: \"%s\"\n",ucCharName(ev->key.ucode));
	printf("focused %u, visible %u, ",
		ev->configure.focused, ev->configure.visible);
	printf("exposed: [%u,%u]-[%u,%u]\n",
		ev->configure.exposed_left,
		ev->configure.exposed_top,
		ev->configure.exposed_right,
		ev->configure.exposed_bottom);
	printf("position [%d,%d], ",
		ev->configure.x, ev->configure.y);
	printf("size %u X %u\n",
		ev->configure.width, ev->configure.height);
}

