Hi

On Mon, Jul 17, 2023 at 4:53 PM Gao,Shiyuan <gaoshiy...@baidu.com> wrote:

> > > > >
> > > > So move the guest mouse pointer to (0, 0) of the screen when connect
> the
> > > > > VNC, and then move the mouse pointer to the cursor of VNC(absolute
> > > > > coordinates are also relative coordinates).
> > > > >
> > > > >
> > > > It's hardly a solution, you still have no clue what will be the guest
> > > mouse
> > > > position.
> > >
> > > We have no clue what will be the guest mouse position, we can move the
> > > guest
> > > mouse to (0,0) each connect the VNC. Now, the cursor of VNC will be the
> > > relative coordinates. In a way, this is a quirk to know the guest mouse
> > > position.
> > >
> >
> > There is no guarantee the guest pointer will be at (0,0) though, and that
> > doesn't explain how that would help. Which client are you using? Are you
> > drawing the guest cursor? This can't be done currently with the lack of a
> > message to tell the guest mouse position. (moving / sync-ing the client
> > cursor position would be even worse in many ways)
>
> Sorry, my description isn't accurate.
>
> When connect the vnc server,
>     vnc_connect
>       -> vs->last_x = -1;
>       -> vs->last_y = -1;
>
> move client cursor to vnc screen,
>     vnc_client_io
>       ->vnc_client_read
>         ->protocol_client_msg
>           ->pointer_event(x,y)
>             -> qemu_input_queue_rel(con, INPUT_AXIS_X, 0 - width);
>             -> qemu_input_queue_rel(con, INPUT_AXIS_Y, 0 - height);
>             -> x=0,y=0
>             -> vs->last_x = x;vs->last_y = y;
>             -> qemu_input_event_sync   // this will inform the guest move
> to (0, 0)
>
> the next event,
>           ->pointer_event(x,y)
>             -> qemu_input_queue_rel(con, INPUT_AXIS_X, x - vs->last_x);
>             -> qemu_input_queue_rel(con, INPUT_AXIS_X, x - vs->last_x);
>             -> qemu_input_event_sync    // this will inform the guest from
> (0,0) move to (x,y),
>                                                                  // the
> client cursor and guest mouse will sync.
>

Actually, it will be ( x - vs->last_x, y - vs->last_y), not necessarily (x,
y), unless you also set last_x = 0 / last_y = 0.

But even then, there is no guarantee the guest position will be a x/y...


> and if the resolution is high, alse need increace the queue size of ps2
> PS2_QUEUE_SIZE.
> Otherwise, if the guest mouse far from the (0,0) before vnc connect, it
> can't move to (0,0).
>
>
Oh indeed, ps2 will queue multiple messages.. another reason you can't do
such big relative moves reliably.


> >
> > > >
> > > >
> > > > > On windows VM, also need disable "Enhance Pointer Precision"
> Option in
> > > > > "Pointer Options" (Control Panel -> Mouse).
> > > > >
> > > > >
> > > > Apparently, this option doesn't have much to do with relative mouse
> > > motion.
> > > > Can you explain what it does with this change?
> > >
> > > Emmm, I don't know why this can solve the problem. It's quite
> effective and
> > > get this way from
> > >
> > >
> https://forum.proxmox.com/threads/is-it-possible-not-to-use-usbdevice-tablet.1498/
> > > .
> > >
> > > Only use this way, we need to manually align the VNC cursor with the
> guest
> > > mouse.
> > >
> >
> > It's a bit vague what the "VNC cursor" mean. If you mean the client
> cursor
> > position, there is no way to align / sync with the guest without an extra
> > message to inform the client of its position. There is even a comment
> about
> > that in vnc.c  /* can we ask the client(s) to move the pointer ??? */)
>
> Sorry, I mean the client cursor position. I found disable "Enhance Pointer
> Precision"
> Option, move cursor to the bound of the VNC screen, they maybe align.
>
> >
> >
> > > >
> > > > Which guest OS are you using? Hopefully they all support either
> > > usb-tablet
> > > > or vmmouse extension for absolute positioning. Otherwise, I'd suggest
> > > using
> > > > Spice, which has those messages for client side guest-mouse drawing.
> > > >
> > >
> > > Yeah, I know the best way is use a absolute positioning. We need remove
> > > all usb devices,
> > > I can only use the PS/2 mouse.
> > >
> >
> > Can't you use vmmouse extension?
>
> Thanks, I will try it. I cann't found the official driver of vmmouse, can I
> install it for free?
>
>
It's been implemented on Linux VM for a long while (first in userspace,
then in kernel since ~2015). But I don't know about the Windows support, it
looks like you need a driver such as provided by VMWave, but it seems
closed-source...  At this point it's probably better to use virtio-input,
which has open-source/free windows drivers.

Reply via email to