I apologize for the lateness of my review. ~rongyichang <[email protected]> writes:
> From: rongyichang <[email protected]> > > When using absolute coordinate input devices (e.g. virtio-tablet-device), > the SDL display backend implements a "soft grab" where the mouse is > automatically grabbed when it enters the window interior and ungrabbed > when it hits the window edge. This edge-ungrab behavior causes problems > in embedded emulation scenarios: > > 1. Mouse escapes the SDL window at edges > 2. SDL does not deliver BUTTONUP events for the escaped mouse > 3. The guest gets stuck in a pressed/touch-down state > 4. First click back into the window is silently dropped > > This issue is confirmed as a known SDL limitation (SDL issue #5301). > > Add a new -display sdl,grab-on-tablet=on option that makes absolute > coordinate devices use the same grab behavior as relative (mouse) > devices: user must click to grab, Ctrl+Alt+G to release, and no > automatic grab on window enter or edge-based ungrab/regrab. > > Signed-off-by: Yichang Rong <[email protected]> > --- > qapi/ui.json | 8 +++++++- > qemu-options.hx | 9 +++++++-- > ui/sdl2.c | 16 +++++++++++++--- > 3 files changed, 27 insertions(+), 6 deletions(-) > > diff --git a/qapi/ui.json b/qapi/ui.json > index b2c42a7f57..454d9041bf 100644 > --- a/qapi/ui.json > +++ b/qapi/ui.json > @@ -1477,10 +1477,16 @@ > # @grab-mod: Modifier keys that should be pressed together with the > # "G" key to release the mouse grab. > # > +# @grab-on-tablet: When enabled, the mouse grab is required even for > +# tablet (absolute) input devices. This is useful when the guest > +# OS uses a tablet device but you still want click-to-grab > +# semantics (e.g. NuttX touchscreen emulation). Missing: (since 11.1) When would you still want click-to-grab semantics? The commit message gives a fairly specific use case. The doc comment gives only an example. Is this good enough for users? > +# > # Since: 7.1 > ## > { 'struct' : 'DisplaySDL', > - 'data' : { '*grab-mod' : 'HotKeyMod' } } > + 'data' : { '*grab-mod' : 'HotKeyMod', > + '*grab-on-tablet' : 'bool' } } > > ## > # @DisplayType:
