Unable to release mouse in SDL2 mode

Bug #1703795 reported by Ruslan
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
QEMU
Fix Released
Undecided
Unassigned

Bug Description

Starting with commit 8f4ea9cd0b770dbe496d9d24f0ef8813fdbfe0d0 "sdl: prefer sdl2 over sdl1", I can no longer release mouse pointer grab unless I use --with-sdlabi=1.2 configure option.

This easily reproduces in e.g. guest Kubuntu, when I let it start Xorg and then click into the QEMU window. After this the mouse is trapped and no matter how I combine Ctrl+Alt and motion of the cursor, the pointer never goes out from the window. When at the border, QEMU window switches from "Press Ctrl+Alt to exit grab" to "QEMU", i.e. it thinks that it has released the grab. But it hasn't really, so I have to go to VT1 and do "pkill qemu" from there to get my pointer back.

Revision history for this message
Thomas Huth (th-huth) wrote :

Which version of SDL2 are you using? Could you please try to reproduce it with the latest version to see whether the problem has been fixed there?

Revision history for this message
Ruslan (b7-10110111) wrote :

I'm using SDL2-2.0.5, which I believe is the latest already.

Revision history for this message
jmicco (john-micco) wrote :

I am seeing this on my system as well - the exact same symptoms. Has anyone investigated this problem?

Revision history for this message
BALATON Zoltan (balaton-4) wrote :

I'm also seeing this problem with -vga vmware in case that matters.

Revision history for this message
BALATON Zoltan (balaton-4) wrote :

Additionally 2ec78706d188df7d3dab43d07b19b05ef7800a44 also broke keyboard with SDL1 so that e.g. in a Windows password prompt backspace and enter just inserts chars instead of doing actions so now the workaround to avoid this bug (--with-sdlabi=1.2) is also unusable.

Revision history for this message
Daniel Berrange (berrange) wrote :

Can you file a separate bug for the SDL1 backspace problem - it was not intended to cause problems like that.

Revision history for this message
BALATON Zoltan (balaton-4) wrote : Re: [Qemu-devel] [Bug 1703795] Re: Unable to release mouse in SDL2 mode

On Thu, 1 Feb 2018, Daniel Berrange wrote:
> Can you file a separate bug for the SDL1 backspace problem - it was not
> intended to cause problems like that.

Unless you want it tracked in a bug I'm happy with a fix submitted to the
list eventually without being separately tracked on launchpad. I would've
reported this on the mailing list normally but since this is also relevant
here due to SDL2 also not uasable beacause of this bug I've commented
here so people affected by this know about both problems.

Revision history for this message
Gerd Hoffmann (kraxel-redhat) wrote :

workaround: don't click into the guest window before the tablet driver loads.

Revision history for this message
Gerd Hoffmann (kraxel-redhat) wrote : [PATCH] sdl2: fix mouse grab

When qemu mouse mode changes from relative to absolute
we must turn off sdl relative mouse mode too.

Fixes: https://bugs.launchpad.net/qemu/+bug/1703795
Signed-off-by: Gerd Hoffmann <email address hidden>
---
 ui/sdl2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index 812c315891..858e04d7c0 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -249,6 +249,7 @@ static void sdl_mouse_mode_change(Notifier *notify, void *data)
     if (qemu_input_is_absolute()) {
         if (!absolute_enabled) {
             absolute_enabled = 1;
+ SDL_SetRelativeMouseMode(SDL_FALSE);
             absolute_mouse_grab(&sdl2_console[0]);
         }
     } else if (absolute_enabled) {
--
2.9.3

Revision history for this message
Ruslan (b7-10110111) wrote :

I can confirm that the patch from comment #9 appears to fix the original problem.

Revision history for this message
BALATON Zoltan (balaton-4) wrote : Re: [Qemu-devel] [Bug 1703795] Re: Unable to release mouse in SDL2 mode

The patch works for me too. Thanks.

Revision history for this message
Thomas Huth (th-huth) wrote :
Changed in qemu:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.