Wednesday, February 28, 2007

Coherence for QEMU

As I have previously discussed, I have been fascinated by the idea of Coherence that Parallels has now officially supporting. After some digging, I think I have a pretty good idea of how it works.

Very similar technologies exist. SeamlessRDP is a special program you can run in a Terminal Services session to expose only a single application over RDP. It works by replacing the normal Shell program (explorer.exe) with a process that uses SetWindowsHookEx to keep track of window creation, destruction, resizing, and movement events. For SeamlessRDP, this information is sent over a special RDP channel.

The RDP session is always full screen and this window position information is used to only show the portion of the RDP session that the window occupies. Since the RDP session is full screen, and the window positions are mapped at the same location in the host as in the RDP session, things like z-order and window dragging Just Work.

To just get the taskbar, you just have to launch explorer and track it's children being careful to not display the desktop window. Here is a screenshot demonstrating this with QEMU, KQEMU, SeamlessRDP, and a slightly modified rdesktop.

I'd like to integrate this all a little more into QEMU. The first thing I'd like to do is eliminate the need for RDP. We can use a paravirtual channel to communicate the windowing information and then just use VNC extensions to communicate that data to the client. A tricky problem is that the session has to be full screen for this to work and QEMU does not provide VGA emulation that supports some weird resolutions (1400x1050--which my laptop uses!). I think this can be solved with software scaling though.