From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: "Gao,Shiyuan" <gaoshiyuan@baidu.com>,
"kraxel@redhat.com" <kraxel@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"mark.cave-ayland@ilande.co.uk" <mark.cave-ayland@ilande.co.uk>,
"peter.maydell@linaro.org" <peter.maydell@linaro.org>
Subject: Re: [PATCH] vnc,ps2: fix the PS/2 mouse work badly when connect VNC
Date: Mon, 17 Jul 2023 11:05:11 +0100 [thread overview]
Message-ID: <ZLUSV0B1GqLl9Sr5@redhat.com> (raw)
In-Reply-To: <CAMxuvaxssGvBLb-gFFEibDcQ+MJyorDJi-xSMTBVRCNyVyFVqA@mail.gmail.com>
On Mon, Jul 17, 2023 at 01:16:41PM +0400, Marc-André Lureau wrote:
> Hi
>
> On Mon, Jul 17, 2023 at 12:54 PM Gao,Shiyuan <gaoshiyuan@baidu.com> wrote:
>
> > Hi,
> > > Hi Shiyuan
> > >
> > > On Mon, Jul 17, 2023 at 7:16 AM Shiyuan Gao <gaoshiyuan@baidu.com>
> > wrote:
> > >
> > > > When only use PS/2 mouse without usb-tablet, the mouse pointer of the
> > > > guest on the VNC will work badly that the cursor of VNC is inconsistent
> > > > with the mouse pointer of guest.
> > > >
> > > >
> > > Afaik, VNC doesn't support client-side drawing of guest mouse (there are
> > no
> > > message to set guest mouse position). So the guest mouse should be drawn
> > by
> > > the server, and currently QEMU doesn't do it.
> > >
> > >
> > > > The reason is the PS/2 mouse use relative coordinates and we can't know
> > > > the initial position of the guest mouse pointer.
> > > >
> > >
> > > It's not just about the initial position.
> >
> > Now pointer_event use the cursor of VNC init the vs->last_x, vs->last_y
> > when
> > connect the VNC and the relative coordinates is based on VNC cursor. If the
> > initial position of VNC cursor is inconsistent with guest mouse, the
> > inconsistency will keep. I think the root cause is we cann't know the
> > postion
> > of the guest mouse pointer.
> >
>
> last_x/last_y is only used when the client doesn't support relative motion
> (pointer-motion change pseudo encoding): it doesn't have a direct relation
> with the guest pointer position, it's only use to compute the relative
> motion of the client pointer as a fallback.
>
>
> > >
> > > >
> > > >
> > > 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)
>
>
> > >
> > >
> > > > 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 ??? */)
>
>
>
> > >
> > > 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?
For modern Linux there is virtio-input too IIUC
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2023-07-17 10:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 2:59 [PATCH] vnc,ps2: fix the PS/2 mouse work badly when connect VNC Shiyuan Gao
2023-07-17 7:40 ` Marc-André Lureau
2023-07-17 8:53 ` Gao,Shiyuan
2023-07-17 9:16 ` Marc-André Lureau
2023-07-17 10:05 ` Daniel P. Berrangé [this message]
2023-07-17 12:52 ` Gao,Shiyuan
2023-07-17 13:12 ` Marc-André Lureau
2023-07-17 13:41 ` Gao,Shiyuan
2023-07-17 14:05 ` Marc-André Lureau
2023-07-18 2:07 ` Gao,Shiyuan
2023-07-17 10:04 ` Daniel P. Berrangé
2023-07-17 12:49 ` Gao,Shiyuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZLUSV0B1GqLl9Sr5@redhat.com \
--to=berrange@redhat.com \
--cc=gaoshiyuan@baidu.com \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).