From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: Shiyuan Gao <gaoshiyuan@baidu.com>
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
Peter Maydell <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:40:31 +0400 [thread overview]
Message-ID: <CAMxuvaz4NwRfCoWGVBofihBsZnBya7cv3Cq7w-Y6Wzd0mPoDQQ@mail.gmail.com> (raw)
In-Reply-To: <20230717025936.71456-1-gaoshiyuan@baidu.com>
[-- Attachment #1: Type: text/plain, Size: 2845 bytes --]
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.
>
>
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.
> 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?
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.
> Signed-off-by: Shiyuan Gao <gaoshiyuan@baidu.com>
> ---
> hw/input/ps2.c | 2 +-
> ui/vnc.c | 5 +++++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/hw/input/ps2.c b/hw/input/ps2.c
> index 45af76a837..e1f44bd298 100644
> --- a/hw/input/ps2.c
> +++ b/hw/input/ps2.c
> @@ -77,7 +77,7 @@
> #define MOUSE_STATUS_ENABLED 0x20
> #define MOUSE_STATUS_SCALE21 0x10
>
> -#define PS2_QUEUE_SIZE 16 /* Queue size required by PS/2 protocol */
> +#define PS2_QUEUE_SIZE 32 /* Queue size required by PS/2 protocol */
> #define PS2_QUEUE_HEADROOM 8 /* Queue size for keyboard command
> replies */
>
> /* Bits for 'modifiers' field in PS2KbdState */
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 92964dcc0c..a1a6048ee4 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -1816,6 +1816,11 @@ static void pointer_event(VncState *vs, int
> button_mask, int x, int y)
> if (vs->last_x != -1) {
> qemu_input_queue_rel(con, INPUT_AXIS_X, x - vs->last_x);
> qemu_input_queue_rel(con, INPUT_AXIS_Y, y - vs->last_y);
> + } else {
> + 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;
> --
> 2.27.0
>
>
[-- Attachment #2: Type: text/html, Size: 4314 bytes --]
next prev parent reply other threads:[~2023-07-17 7:41 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 [this message]
2023-07-17 8:53 ` Gao,Shiyuan
2023-07-17 9:16 ` Marc-André Lureau
2023-07-17 10:05 ` Daniel P. Berrangé
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=CAMxuvaz4NwRfCoWGVBofihBsZnBya7cv3Cq7w-Y6Wzd0mPoDQQ@mail.gmail.com \
--to=marcandre.lureau@redhat.com \
--cc=gaoshiyuan@baidu.com \
--cc=kraxel@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).