'*swap-opt-cmd': 'bool'
} }
+##
+# @HotKeyMod:
+#
+# Set of modifier keys that need to be held for shortcut key actions.
+#
+# Since: 7.1
+##
+{ 'enum' : 'HotKeyMod',
+ 'data' : [ 'lctrl-lalt', 'lshift-lctrl-lalt', 'rctrl' ] }
+
+##
+# @DisplaySDL:
+#
+# SDL2 display options.
+#
+# @grab-mod: Modifier keys that should be pressed together with the
+# "G" key to release the mouse grab.
+#
+# Since: 7.1
+##
+{ 'struct' : 'DisplaySDL',
+ 'data' : { '*grab-mod' : 'HotKeyMod' } }
+
##
# @DisplayType:
#
'curses': { 'type': 'DisplayCurses', 'if': 'CONFIG_CURSES' },
'egl-headless': { 'type': 'DisplayEGLHeadless',
'if': { 'all': ['CONFIG_OPENGL', 'CONFIG_GBM'] } },
- 'dbus': { 'type': 'DisplayDBus', 'if': 'CONFIG_DBUS_DISPLAY' }
+ 'dbus': { 'type': 'DisplayDBus', 'if': 'CONFIG_DBUS_DISPLAY' },
+ 'sdl': { 'type': 'DisplaySDL', 'if': 'CONFIG_SDL' }
}
}
exit(0);
}
- if (strstart(p, "sdl", &opts)) {
- /*
- * sdl DisplayType needs hand-crafted parser instead of
- * parse_display_qapi() due to some options not in
- * DisplayOptions, specifically:
- * - ctrl_grab + alt_grab
- * They can't be moved into the QAPI since they use underscores,
- * thus they will get replaced by "grab-mod" in the long term
- */
-#if defined(CONFIG_SDL)
- dpy.type = DISPLAY_TYPE_SDL;
- while (*opts) {
- const char *nextopt;
-
- if (strstart(opts, ",grab-mod=", &nextopt)) {
- opts = nextopt;
- if (strstart(opts, "lshift-lctrl-lalt", &nextopt)) {
- alt_grab = 1;
- } else if (strstart(opts, "rctrl", &nextopt)) {
- ctrl_grab = 1;
- } else {
- goto invalid_sdl_args;
- }
- } else if (strstart(opts, ",window-close=", &nextopt)) {
- opts = nextopt;
- dpy.has_window_close = true;
- if (strstart(opts, "on", &nextopt)) {
- dpy.window_close = true;
- } else if (strstart(opts, "off", &nextopt)) {
- dpy.window_close = false;
- } else {
- goto invalid_sdl_args;
- }
- } else if (strstart(opts, ",show-cursor=", &nextopt)) {
- opts = nextopt;
- dpy.has_show_cursor = true;
- if (strstart(opts, "on", &nextopt)) {
- dpy.show_cursor = true;
- } else if (strstart(opts, "off", &nextopt)) {
- dpy.show_cursor = false;
- } else {
- goto invalid_sdl_args;
- }
- } else if (strstart(opts, ",gl=", &nextopt)) {
- opts = nextopt;
- dpy.has_gl = true;
- if (strstart(opts, "on", &nextopt)) {
- dpy.gl = DISPLAYGL_MODE_ON;
- } else if (strstart(opts, "core", &nextopt)) {
- dpy.gl = DISPLAYGL_MODE_CORE;
- } else if (strstart(opts, "es", &nextopt)) {
- dpy.gl = DISPLAYGL_MODE_ES;
- } else if (strstart(opts, "off", &nextopt)) {
- dpy.gl = DISPLAYGL_MODE_OFF;
- } else {
- goto invalid_sdl_args;
- }
- } else {
- invalid_sdl_args:
- error_report("invalid SDL option string");
- exit(1);
- }
- opts = nextopt;
- }
-#else
- error_report("SDL display supported is not available in this binary");
- exit(1);
-#endif
- } else if (strstart(p, "vnc", &opts)) {
+ if (strstart(p, "vnc", &opts)) {
/*
* vnc isn't a (local) DisplayType but a protocol for remote
* display access.
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;
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) {