All of lore.kernel.org
 help / color / mirror / Atom feed
From: Howard Spoelstra <hsp.cat7@gmail.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: "Cédric Le Goater" <clg@kaod.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>, QEMU <qemu-devel@nongnu.org>
Subject: Re: Mouse pointer warping with gtk display
Date: Thu, 27 Jan 2022 21:28:33 +0100	[thread overview]
Message-ID: <CABLmASH5K=mO0=k4oR76JS70a9L87rNzJu9OhtNR9dohzg5-jA@mail.gmail.com> (raw)
In-Reply-To: <CAJ+F1C+hwUJ5Zt9-bANNw8tpeeX4KyoRYk4g=qJNv3J-ji-LnA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4885 bytes --]

On Thu, Jan 27, 2022 at 8:48 PM Marc-André Lureau <
marcandre.lureau@gmail.com> wrote:

> Hi
>
> On Thu, Jan 27, 2022 at 10:29 PM BALATON Zoltan <balaton@eik.bme.hu>
> wrote:
>
>> Hello,
>>
>> We've found a problem with mouse pointer jumping around then constantly
>> warping making it unusable which only seems to happen with the gtk
>> display. Similar problem was reported with MacOS guests but now we could
>> also reproduce with MorphOS on pegasos2 and thus confirm it's not a guest
>> issue or hardware emulation problem but seems to be related to QEMU's gtk
>> display. This can be reproduced as following (boot.img is the file from
>> the root dir of the iso which is available from
>> https://www.morphos-team.net/morphos-3.15.iso ):
>>
>> qemu-system-ppc -M pegasos2 -cdrom morphos-3.15.iso -display sdl \
>> -L ../pc-bios -kernel boot.img -device ati-vga,romfile=""
>>
>> This does not have this problem and mouse works but running with -display
>> gtk has the mouse pointer issue making it unusable. It can be seemingly
>> avoided with using -device ati-vga,romfile="",guest_hwcursor=true so I
>> think problem is somewhere in mouse handling in ui/gtk.c with host side
>> mouse pointer. The gd_motion_event() in that file has a big comment about
>> warping mouse back to the middle near the end of the function which seems
>> to ne what's happening and causing this as this does not appear in sdl.c
>> that does not show the same issue but I don't understand what that code
>> is
>> trying to do.
>>
>
> In general, a guest handles mouse input with relative motion events
> (standard ps2).
>
> A more VM-friendly guest can additionally handle mouse input with absolute
> coordinates (vmmouse, usb tablet etc)
>
> While giving absolute coordinates to a guest is quite a simple task from a
> client (and offers some advantages) it is more tricky to deal with relative
> mouse events...
>
> At the toolkit level, iirc, you generally don't have low-level events &
> relative motion (gtk doesn't let you grab the mouse exclusively to receive
> all events). You can workaround this with some window managers (ex wayland
> relative-pointer unstable extension).
>
> The "old" strategy with gtk2/3 is to grab the mouse, which is then
> constrained within the display widget iirc, and convert absolute events to
> relative events by doing simple current_position - last_position. Since
> your client mouse may reach the widget borders (and/or the client monitor
> limits, can't remember which applies, I think it varies), you also need to
> recenter the client mouse somewhere, and that's usually in the middle of
> the display widget.
>
> This is clunky at best, and gtk devs decided to no longer support that
> kind of API with gtk4. The recommended approach is to use lower-level
> events, like the one you get from the wayland extensions. This is a pain
> for portability, but that's all we have for now.
>
> spice-gtk implements the wayland stuff. Have you tried running -display
> spice-app? It may have a more polished behavior than the one in qemu.
>
>
>
>
>
>
>>
>> It's a known problem that host mouse pointer can get out of sync with the
>> guest which I think is because mouse acceleration on the host is not
>> correctly taken into account when reporting mouse moves to the guest and
>> this may try to correct that issue but it seems to cause more harm than
>> good in some cases. Any idea what might be the problem and how to solve
>> this? I wonder why nobody else is seeing this with other guests. (I'm not
>> direcly interested in fixing it as I'm using sdl display but this makes
>> it
>> hard to use some guests for users whose distros make gtk backend the
>> default which may actually be most people so it might be a good idea to
>> improve this for them so I thought at least reporting the problem is
>> useful.)
>>
>
> I suspect SDL offers an API for relative mouse events, which works better
> than what we do in the gtk backend.
>
> I hope in the future we can drop the gtk code from qemu, in favor of
> dbus-display and rdw. Maintaining that kind of code is hard, and having the
> same gtk widget base code for various remote desktop apps & protocols
> should help maintenance and offer a consistent behavior, whether you use
> QEMU/DBus, VNC, Spice, or RDP and whatever the future brings.
>
> (I wrote the above mostly from memory, I agree it's convoluted and a bit
> buggy, I doubt anyone likes it ;)
>
> --
> Marc-André Lureau
>

Hi Zoltan,

While I can reproduce the issue you report when running morphos with gtk, I
cannot currently reproduce with the Mac OS/OSX guests I tested on Linux
host. Both mac99 (adb mouse and kbd) and mac99,via=pmu (usb mouse and kbd)
keep the mouse inside the guest window with both sdl and gtk.

Best,
Howard

[-- Attachment #2: Type: text/html, Size: 6339 bytes --]

  reply	other threads:[~2022-01-27 20:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 18:16 Mouse pointer warping with gtk display BALATON Zoltan
2022-01-27 19:48 ` Marc-André Lureau
2022-01-27 20:28   ` Howard Spoelstra [this message]
2022-01-27 20:37     ` Mark Cave-Ayland
2022-01-27 23:07       ` BALATON Zoltan
2022-01-27 21:55     ` BALATON Zoltan

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='CABLmASH5K=mO0=k4oR76JS70a9L87rNzJu9OhtNR9dohzg5-jA@mail.gmail.com' \
    --to=hsp.cat7@gmail.com \
    --cc=clg@kaod.org \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.