x11: Create/destroy window code.