Import fixes from X.org tree (Søren Sandmann <sandmann@redhat.com>).