aboutsummaryrefslogtreecommitdiff
path: root/ui/sdl2.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2022-05-19 17:56:24 +0200
committerThomas Huth <thuth@redhat.com>2022-06-03 08:03:28 +0200
commit9eafdeeac3513eb515c0e602fc56aa73353cf20d (patch)
tree674b90cf190aef4111d90f8bb3f57e7db5366533 /ui/sdl2.c
parenta743d60bcaa6a3a33f4376f87c1fc7cc977bc811 (diff)
downloadqemu-9eafdeeac3513eb515c0e602fc56aa73353cf20d.zip
qemu-9eafdeeac3513eb515c0e602fc56aa73353cf20d.tar.gz
qemu-9eafdeeac3513eb515c0e602fc56aa73353cf20d.tar.bz2
ui: Switch "-display sdl" to use the QAPI parser
The "-display sdl" option still uses a hand-crafted parser for its parameters since we didn't want to drag an interface we considered somewhat flawed into the QAPI schema. Since the flaws are gone now, it's time to QAPIfy. This introduces the new "DisplaySDL" QAPI struct that is used to hold the parameters that are unique to the SDL display. The only specific parameter is currently "grab-mod" that is used to specify the required modifier keys to escape from the mouse grabbing mode. Message-Id: <20220519155625.1414365-3-thuth@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'ui/sdl2.c')
-rw-r--r--ui/sdl2.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ui/sdl2.c b/ui/sdl2.c
index d3741f9..8cb7741 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,14 @@ 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 (o->u.sdl.grab_mod == HOT_KEY_MOD_LSHIFT_LCTRL_LALT) {
+ alt_grab = true;
+ } else if (o->u.sdl.grab_mod == HOT_KEY_MOD_RCTRL) {
+ ctrl_grab = true;
+ }
+ }
+
for (i = 0;; i++) {
QemuConsole *con = qemu_console_lookup_by_index(i);
if (!con) {