From: Thomas Huth <thuth@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Eric Blake <eblake@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
libvir-list@redhat.com
Subject: Re: [PATCH] ui: Remove deprecated parameters of -display sdl and switch to QAPI parser
Date: Wed, 11 May 2022 14:57:48 +0200 [thread overview]
Message-ID: <0087bd6b-e3c9-1b51-92e0-7cacfa45826c@redhat.com> (raw)
In-Reply-To: <Ynuuo02cDee1nsZL@redhat.com>
On 11/05/2022 14.40, Daniel P. Berrangé wrote:
> On Wed, May 11, 2022 at 02:17:25PM +0200, Thomas Huth wrote:
>> The "-display sdl" option still used a hand-crafted parser for its
>> parameters since some of them used underscores which is forbidden
>> in QAPI. Now that they've been deprecated and the deprecation period
>> is over, we can remove the problematic parameters and switch to use
>> the QAPI parser instead.
>
> I'd say the removal of deprecated bits ought to be separate
> from the addition of new QAPI bits.
Ok, agreed, that likely makes sense.
>
>> diff --git a/qapi/ui.json b/qapi/ui.json
>> index 059302a5ef..7d5097808a 100644
>> --- a/qapi/ui.json
>> +++ b/qapi/ui.json
>> @@ -1309,6 +1309,19 @@
>> '*swap-opt-cmd': 'bool'
>> } }
>>
>> +##
>> +# @DisplaySDL:
>> +#
>> +# SDL2 display options.
>> +#
>> +# @grab-mod: Modifier keys that should be pressed together
>> +# with "G" to release the mouse grab.
>> +#
>> +# Since: 7.1
>> +##
>> +{ 'struct' : 'DisplaySDL',
>> + 'data' : { '*grab-mod' : 'str' } }
>
> So any arbitrary string here, but...
>
>> diff --git a/ui/sdl2.c b/ui/sdl2.c
>> index d3741f9b75..18c63e1fc9 100644
>> --- a/ui/sdl2.c
>> +++ b/ui/sdl2.c
>> @@ -40,6 +40,8 @@ static struct sdl2_console *sdl2_console;
>>
>> static SDL_Surface *guest_sprite_surface;
>> static int gui_grab; /* if true, all keyboard/mouse events are grabbed */
>> +static bool alt_grab;
>> +static bool ctrl_grab;
>>
>> static int gui_saved_grab;
>> static int gui_fullscreen;
>> @@ -853,6 +855,17 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
>>
>> gui_fullscreen = o->has_full_screen && o->full_screen;
>>
>> + if (o->u.sdl.has_grab_mod) {
>> + if (g_str_equal(o->u.sdl.grab_mod, "lshift-lctrl-lalt")) {
>> + alt_grab = true;
>> + } else if (g_str_equal(o->u.sdl.grab_mod, "rctrl")) {
>> + ctrl_grab = true;
>> + } else {
>> + error_report("Unsupported grab-mod: %s", o->u.sdl.grab_mod);
>> + exit(1);
>> + }
>> + }
>
> We're treating this more like an enum here. It does leave the door
> open for adding a generic parsing of arbitrary grab mods later
> I guess
Yes, that's the basic idea - so one day, the user might specify an arbitrary
string here consisting of their favorite modifiers.
Thomas
prev parent reply other threads:[~2022-05-11 12:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 12:17 [PATCH] ui: Remove deprecated parameters of -display sdl and switch to QAPI parser Thomas Huth
2022-05-11 12:40 ` Daniel P. Berrangé
2022-05-11 12:57 ` Thomas Huth [this message]
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=0087bd6b-e3c9-1b51-92e0-7cacfa45826c@redhat.com \
--to=thuth@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=kraxel@redhat.com \
--cc=libvir-list@redhat.com \
--cc=pbonzini@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).