Hi, I installed WinXP in QEMU (with KVM enabled), now I used a VNC client (AndroidVNC, which is modified from TightVNC client) to connect QEMU via VNC mode. All works fine except for the mouse position is un-matched.
When I move the mouse slowly, the mouse cursor in QEMU moves slower than it moves in client. When I move the mouse quickly, the mouse cursor in QEMU moves quicker than it moves in client. I tried to debug it. The client (androidVNC) generates correct screen coordinates of mouse cursor. The server (QEMU) also receives correct screen coordinates, then calculate the difference between current position and last position, then put events into ps2_queue. Then ps2_read_data reads these data. the call stack is: ps2_mouse_event kbd_mouse_event pointer_event In the following code of function pointer_event, it runs into the last "else" branch: if (vs->absolute) { kbd_mouse_event(ds_get_width(vs->ds) > 1 ? x * 0x7FFF / (ds_get_width(vs->ds) - 1) : 0x4000, ds_get_height(vs->ds) > 1 ? y * 0x7FFF / (ds_get_height(vs->ds) - 1) : 0x4000, dz, buttons); } else if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE)) { x -= 0x7FFF; y -= 0x7FFF; kbd_mouse_event(x, y, dz, buttons); } else { if (vs->last_x != -1) kbd_mouse_event(x - vs->last_x, y - vs->last_y, dz, buttons); vs->last_x = x; vs->last_y = y; } vs->absolute seems initiated by a mouse_handler. Can I change it in somewhere? The consumer of mouse data seems in ps2_read_data, then I tracked the call hierarchy of it is: #0 ps2_read_data (opaque=0x8aafa48) #1 0x08197686 in kbd_read_data (opaque=0x8aaf7a0, addr=96) #2 0x080bb19e in ioport_read (index=0, address=96) at ioport.c:68 #3 0x080bb9de in cpu_inb (addr=96) at ioport.c:284 #4 0x0806ebd3 in kvm_handle_io (port=96, data=0xb7438000, direction=0, #5 0x0806f090 in kvm_cpu_exec (env=0x8991708) I stopped at here and cannot continue debugging to see where the cursor position becomes incorrect since this data structure (kvm_run) is in linux/kvm.h: switch (run->exit_reason) { case KVM_EXIT_IO: DPRINTF("handle_io\n"); ret = kvm_handle_io(run->io.port, (uint8_t *)run + run->io.data_offset, run->io.direction, run->io.size, run->io.count); break; I also did some experiments: I tried androidVNC client to connect WinXP (with TightVNC server) installed in VirtualBox. It works fine (at least better). I also tried use Ubuntu's VNC client (vinagre) to connect QEMU-winxp, it also works fine. I tried to debug it and found it runs into the second branch (with this feature: VNC_FEATURE_POINTER_TYPE_CHANGE). But this feature seems not supported in androidVNC client. So anyone can give me some clues to solve this issue? Thanks a lot! -- Best Regards Dan Zhang