xcb: Major changes and fixes.

Fixes bug 720225.