Copied change from x-display-order