A new geometrical look at gravity coupled with Yang-Mills fields