Comment 2 for bug 218105

Revision history for this message
Bryce Harrington (bryce) wrote :

Sounds like KVM needs to learn libXrandr. Similar problems exist for games, movie players, screensavers, and other such things that like to take over the full screen.

It's not an X issue per se, but that client apps often were developed either with the old Xinerama-style of multi-screen layout, or without taking multi-head configurations into account.

There are actually several different problems here...

1. Resolution of both screens changing. libXrandr provides for per-output resolution changing; if you don't specify which output, it sets all by default. So kvm probably needs more logic to keep track of outputs and which ones "belong" to kvm.

2. When kvm exits, it doesn't restore the screens to their original state. You'll need to have kvm snapshot the Xrandr layout before going full screen, and then just re-applying it when it's done. Probably will need to also hook this in for error conditions as well (or doing it all in a wrapper script).

3. Always using the first desktop. Sounds like it's using the "primary output". It's possible to redefine which is the primary output, but in this case it's almost certainly better if kvm just were smarter about which output it picks to fullscreen on. This is a common issue for most games and movie players. If nothing else, it would be nice to give the user a command line option for specifying which output to use.

4. ctrl-alt problem. No idea on this one. Maybe not an xrandr issue.

Most of the above could probably be done with the xrandr command line tool, however I suspect it will be cleaner to hook into libXrandr directly. The xrandr tool provides an example of using libXrandr, but you might find the Screen Resolution applet to be clearer - see in particular randrwrap.c in libgnome-desktop.

Also note that the latest GTK in Intrepid has some API for xrandr. If KVM needs to remain desktop-agnostic, those won't be of use of course, but could provide some interesting reference info.

You might also take a look at screensavers or movie players. Offhand, I don't know which if any have xrandr support, but they have similar needs so if there is one with xrandr support you might be able to adapt their solution for kvm.