This obviously wanted a helper function beforehand, but even more so now that we have XCB. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Julien Cristau <jcristau@debian.org>