On 19.07.21 13:31, Marc-André Lureau wrote:
Hi Dennis
On Tue, Jun 29, 2021 at 5:26 PM Dennis Wölfing <denniswoelf...@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 <denniswoelf...@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.