> Hi
>
> On Mon, Jul 17, 2023 at 5:43 PM Gao,Shiyuan <gaoshiy...@baidu.com> wrote:
>
> > > 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.
> >
> > yes, set last_x = 0 / last_y = 0 and only the first time enter
> > pointer_event.
> >
> >          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;
> >
> > >
> > > But even then, there is no guarantee the guest position will be a x/y...
> > >
> >
> > Emmm, compared to the current implementation, it is at least getting
> > closer.
> > The current state is simply unbearable.
> >
> > > 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.
> >
> > Thanks, I tried install vmmouse driver in windows success and reboot.
> > However 'info mice' as
> > follows and don't have vmmouse (absolute).
> >
> > * Mouse #2: QEMU PS/2 Mouse
> >
> > The guest mouse isn't sync with client cursor...
> >
>
> Look if you have "dev: vmmouse, id " in "info qtree" or set -machine
> vmport=on.

"info qtree" as follows, the client cursor and guest mouse cann't align...

          dev: vmmouse, id ""
          dev: vmport, id ""
            x-read-set-eax = true
            x-signal-unsupported-cmd = true
            x-report-vmx-type = true
            x-cmds-v2 = true
            vmware-vmx-version = 6 (0x6)
            vmware-vmx-type = 2 (0x2)
          dev: i8042, id ""
            gpio-out "a20" 1
            extended-state = true
            kbd-throttle = false
            isa irqs 1,12

I have decided to still use the method in this patch. 

Thanks Marc-André.

Reply via email to