qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ui/gtk: Fix relative mouse with multiple monitors


From: Dennis Wölfing
Subject: Re: [PATCH] ui/gtk: Fix relative mouse with multiple monitors
Date: Tue, 20 Jul 2021 16:37:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0

On 19.07.21 13:31, Marc-André Lureau wrote:
Hi Dennis

On Tue, Jun 29, 2021 at 5:26 PM Dennis Wölfing <denniswoelfing@gmx.de> wrote:

> To handle relative mouse input the event handler needs to move the mouse
> away from the screen edges. Failing to do so results in the mouse
> getting stuck at invisible walls. However the current implementation for
> this is broken on hosts with multiple monitors.
>
> With multiple monitors the mouse can be located outside of the current
> monitor which is not handled by the current code. Also the monitor
> itself might be located at coordinates different from (0, 0).
>
> Signed-off-by: Dennis Wölfing <denniswoelfing@gmx.de>


Looks reasonable to me. In spice-gtk we have slightly different code, we
wrap at the middle of the monitor instead
(https://gitlab.freedesktop.org/spice/spice-gtk/-/blob/master/src/spice-widget.c#L1214),
what do you think?

Indeed, warping to the center of the monitor allows for simpler code and
means that it will take longer until the cursors hits a border again.
I'll send a v2 that warps to the middle of the monitor.

And also, spice-gtk has special cases for w32 and wayland, which behave
differently.

I just tested QEMU on a Windows host and relative mouse input is quite
broken both before and after this patch: As soon as the cursor leaves
the window QEMU no longer receives mouse events until the cursor is
moved back into the window. I haven't tested it with Wayland.
So we should perhaps have similar special cases as in spice-gtk. However
I'm not comfortable with writing a patch to fix this as I am not
familiar with the Windows and Wayland APIs.

Gtk4 is also different, as device_warp() is gone (it will have to handle
it specifically again for the different platforms:
https://gitlab.gnome.org/malureau/rdw/-/blob/master/rdw/src/display.rs#L812)

That is unfortunate. The code will need to be rewritten then when it
updated for Gtk4.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]