modify from spice-gtk and virt-viewer.