All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] ui: Remove deprecated sdl parameters and switch to QAPI parser
@ 2022-05-18 13:44 Thomas Huth
  2022-05-18 13:44 ` [PATCH v2 1/3] ui: Remove deprecated parameters of the "-display sdl" option Thomas Huth
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Thomas Huth @ 2022-05-18 13:44 UTC (permalink / raw)
  To: qemu-devel, Gerd Hoffmann
  Cc: Markus Armbruster, Eric Blake, Paolo Bonzini, libvir-list,
	Daniel P . Berrangé

The "-display sdl" option still uses 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.

While we're at it, also remove the deprecated "-sdl" and "-curses" options.

v2:
 - Rebase to current master branch to resolve conflicts in docs/about/*.rst
 - Use an enum for the grab-mod parameter instead of a unconstrained string

Thomas Huth (3):
  ui: Remove deprecated parameters of the "-display sdl" option
  ui: Switch "-display sdl" to use the QAPI parser
  ui: Remove deprecated options "-sdl" and "-curses"

 docs/about/deprecated.rst       |  26 -------
 docs/about/removed-features.rst |  27 +++++++
 qapi/ui.json                    |  27 ++++++-
 include/sysemu/sysemu.h         |   2 -
 softmmu/globals.c               |   2 -
 softmmu/vl.c                    | 128 +-------------------------------
 ui/sdl2.c                       |  10 +++
 qemu-options.hx                 |  56 +-------------
 8 files changed, 68 insertions(+), 210 deletions(-)

-- 
2.27.0



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2 1/3] ui: Remove deprecated parameters of the "-display sdl" option
  2022-05-18 13:44 [PATCH v2 0/3] ui: Remove deprecated sdl parameters and switch to QAPI parser Thomas Huth
@ 2022-05-18 13:44 ` Thomas Huth
  2022-05-18 15:04   ` Markus Armbruster
  2022-05-18 13:44 ` [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser Thomas Huth
  2022-05-18 13:44 ` [PATCH v2 3/3] ui: Remove deprecated options "-sdl" and "-curses" Thomas Huth
  2 siblings, 1 reply; 19+ messages in thread
From: Thomas Huth @ 2022-05-18 13:44 UTC (permalink / raw)
  To: qemu-devel, Gerd Hoffmann
  Cc: Markus Armbruster, Eric Blake, Paolo Bonzini, libvir-list,
	Daniel P . Berrangé

These parameters are in the way for further refactoring (since they
use an underscore in the name which is forbidden in QAPI), so let's
remove these now that their deprecation period is over.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 docs/about/deprecated.rst       | 16 -------------
 docs/about/removed-features.rst | 17 ++++++++++++++
 softmmu/vl.c                    | 41 +--------------------------------
 qemu-options.hx                 | 32 ++-----------------------
 4 files changed, 20 insertions(+), 86 deletions(-)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index a92ae0f162..562a133f18 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -81,22 +81,6 @@ the process listing. This is replaced by the new ``password-secret``
 option which lets the password be securely provided on the command
 line using a ``secret`` object instance.
 
-``-display sdl,window_close=...`` (since 6.1)
-'''''''''''''''''''''''''''''''''''''''''''''
-
-Use ``-display sdl,window-close=...`` instead (i.e. with a minus instead of
-an underscore between "window" and "close").
-
-``-alt-grab`` and ``-display sdl,alt_grab=on`` (since 6.2)
-''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-Use ``-display sdl,grab-mod=lshift-lctrl-lalt`` instead.
-
-``-ctrl-grab`` and ``-display sdl,ctrl_grab=on`` (since 6.2)
-''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-Use ``-display sdl,grab-mod=rctrl`` instead.
-
 ``-sdl`` (since 6.2)
 ''''''''''''''''''''
 
diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
index eb76974347..4c9e001c35 100644
--- a/docs/about/removed-features.rst
+++ b/docs/about/removed-features.rst
@@ -370,6 +370,23 @@ The ``opened=on`` option in the command line or QMP ``object-add`` either had
 no effect (if ``opened`` was the last option) or caused errors.  The property
 is therefore useless and should simply be removed.
 
+``-display sdl,window_close=...`` (removed in 7.1)
+''''''''''''''''''''''''''''''''''''''''''''''''''
+
+Use ``-display sdl,window-close=...`` instead (i.e. with a minus instead of
+an underscore between "window" and "close").
+
+``-alt-grab`` and ``-display sdl,alt_grab=on`` (removed in 7.1)
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+Use ``-display sdl,grab-mod=lshift-lctrl-lalt`` instead.
+
+``-ctrl-grab`` and ``-display sdl,ctrl_grab=on`` (removed in 7.1)
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+Use ``-display sdl,grab-mod=rctrl`` instead.
+
+
 QEMU Machine Protocol (QMP) commands
 ------------------------------------
 
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 84a31eba76..57ab9d5322 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1079,32 +1079,7 @@ static void parse_display(const char *p)
                 } else {
                     goto invalid_sdl_args;
                 }
-            } else if (strstart(opts, ",alt_grab=", &nextopt)) {
-                opts = nextopt;
-                if (strstart(opts, "on", &nextopt)) {
-                    alt_grab = 1;
-                } else if (strstart(opts, "off", &nextopt)) {
-                    alt_grab = 0;
-                } else {
-                    goto invalid_sdl_args;
-                }
-                warn_report("alt_grab is deprecated, use grab-mod instead.");
-            } else if (strstart(opts, ",ctrl_grab=", &nextopt)) {
-                opts = nextopt;
-                if (strstart(opts, "on", &nextopt)) {
-                    ctrl_grab = 1;
-                } else if (strstart(opts, "off", &nextopt)) {
-                    ctrl_grab = 0;
-                } else {
-                    goto invalid_sdl_args;
-                }
-                warn_report("ctrl_grab is deprecated, use grab-mod instead.");
-            } else if (strstart(opts, ",window_close=", &nextopt) ||
-                       strstart(opts, ",window-close=", &nextopt)) {
-                if (strstart(opts, ",window_close=", NULL)) {
-                    warn_report("window_close with an underscore is deprecated,"
-                                " please use window-close instead.");
-                }
+            } else if (strstart(opts, ",window-close=", &nextopt)) {
                 opts = nextopt;
                 dpy.has_window_close = true;
                 if (strstart(opts, "on", &nextopt)) {
@@ -1962,10 +1937,6 @@ static void qemu_create_early_backends(void)
     const bool use_gtk = false;
 #endif
 
-    if ((alt_grab || ctrl_grab) && !use_sdl) {
-        error_report("-alt-grab and -ctrl-grab are only valid "
-                     "for SDL, ignoring option");
-    }
     if (dpy.has_window_close && !use_gtk && !use_sdl) {
         error_report("window-close is only valid for GTK and SDL, "
                      "ignoring option");
@@ -3273,16 +3244,6 @@ void qemu_init(int argc, char **argv, char **envp)
                 dpy.has_full_screen = true;
                 dpy.full_screen = true;
                 break;
-            case QEMU_OPTION_alt_grab:
-                alt_grab = 1;
-                warn_report("-alt-grab is deprecated, please use "
-                            "-display sdl,grab-mod=lshift-lctrl-lalt instead.");
-                break;
-            case QEMU_OPTION_ctrl_grab:
-                ctrl_grab = 1;
-                warn_report("-ctrl-grab is deprecated, please use "
-                            "-display sdl,grab-mod=rctrl instead.");
-                break;
             case QEMU_OPTION_sdl:
                 warn_report("-sdl is deprecated, use -display sdl instead.");
 #ifdef CONFIG_SDL
diff --git a/qemu-options.hx b/qemu-options.hx
index b484640067..011caad530 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1938,8 +1938,8 @@ DEF("display", HAS_ARG, QEMU_OPTION_display,
     "-display spice-app[,gl=on|off]\n"
 #endif
 #if defined(CONFIG_SDL)
-    "-display sdl[,alt_grab=on|off][,ctrl_grab=on|off][,gl=on|core|es|off]\n"
-    "            [,grab-mod=<mod>][,show-cursor=on|off][,window-close=on|off]\n"
+    "-display sdl[,gl=on|core|es|off][,grab-mod=<mod>][,show-cursor=on|off]\n"
+    "            [,window-close=on|off]\n"
 #endif
 #if defined(CONFIG_GTK)
     "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off]\n"
@@ -2012,12 +2012,6 @@ SRST
         the mouse grabbing in conjunction with the "g" key. ``<mods>`` can be
         either ``lshift-lctrl-lalt`` or ``rctrl``.
 
-        ``alt_grab=on|off`` : Use Control+Alt+Shift-g to toggle mouse grabbing.
-        This parameter is deprecated - use ``grab-mod`` instead.
-
-        ``ctrl_grab=on|off`` : Use Right-Control-g to toggle mouse grabbing.
-        This parameter is deprecated - use ``grab-mod`` instead.
-
         ``gl=on|off|core|es`` : Use OpenGL for displaying
 
         ``show-cursor=on|off`` :  Force showing the mouse cursor
@@ -2103,28 +2097,6 @@ SRST
     is displayed in graphical mode.
 ERST
 
-DEF("alt-grab", 0, QEMU_OPTION_alt_grab,
-    "-alt-grab       use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt)\n",
-    QEMU_ARCH_ALL)
-SRST
-``-alt-grab``
-    Use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt). Note that
-    this also affects the special keys (for fullscreen, monitor-mode
-    switching, etc). This option is deprecated - please use
-    ``-display sdl,grab-mod=lshift-lctrl-lalt`` instead.
-ERST
-
-DEF("ctrl-grab", 0, QEMU_OPTION_ctrl_grab,
-    "-ctrl-grab      use Right-Ctrl to grab mouse (instead of Ctrl-Alt)\n",
-    QEMU_ARCH_ALL)
-SRST
-``-ctrl-grab``
-    Use Right-Ctrl to grab mouse (instead of Ctrl-Alt). Note that this
-    also affects the special keys (for fullscreen, monitor-mode
-    switching, etc). This option is deprecated - please use
-    ``-display sdl,grab-mod=rctrl`` instead.
-ERST
-
 DEF("sdl", 0, QEMU_OPTION_sdl,
     "-sdl            shorthand for -display sdl\n", QEMU_ARCH_ALL)
 SRST
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-18 13:44 [PATCH v2 0/3] ui: Remove deprecated sdl parameters and switch to QAPI parser Thomas Huth
  2022-05-18 13:44 ` [PATCH v2 1/3] ui: Remove deprecated parameters of the "-display sdl" option Thomas Huth
@ 2022-05-18 13:44 ` Thomas Huth
  2022-05-18 15:08   ` Markus Armbruster
  2022-05-18 15:41   ` Eric Blake
  2022-05-18 13:44 ` [PATCH v2 3/3] ui: Remove deprecated options "-sdl" and "-curses" Thomas Huth
  2 siblings, 2 replies; 19+ messages in thread
From: Thomas Huth @ 2022-05-18 13:44 UTC (permalink / raw)
  To: qemu-devel, Gerd Hoffmann
  Cc: Markus Armbruster, Eric Blake, Paolo Bonzini, libvir-list,
	Daniel P . Berrangé

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.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 qapi/ui.json            | 27 +++++++++++++++-
 include/sysemu/sysemu.h |  2 --
 softmmu/globals.c       |  2 --
 softmmu/vl.c            | 70 +----------------------------------------
 ui/sdl2.c               | 10 ++++++
 5 files changed, 37 insertions(+), 74 deletions(-)

diff --git a/qapi/ui.json b/qapi/ui.json
index 11a827d10f..a244e26e0f 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -1295,6 +1295,30 @@
       '*swap-opt-cmd': 'bool'
   } }
 
+##
+# @GrabMod:
+#
+# Set of modifier keys that need to be hold for shortcut key actions.
+#
+# Since: 7.1
+##
+{ 'enum'  : 'GrabMod',
+  'data'  : [ 'lctrl-lalt', 'lshift-lctrl-lalt', 'rctrl' ] }
+
+##
+# @DisplaySDL:
+#
+# SDL2 display options.
+#
+# @grab-mod:  String with modifier keys that should be pressed together with
+#             the "G" key to release the mouse grab. Only "lshift-lctrl-lalt"
+#             and "rctrl" are currently supported.
+#
+# Since: 7.1
+##
+{ 'struct'  : 'DisplaySDL',
+  'data'    : { '*grab-mod'   : 'GrabMod' } }
+
 ##
 # @DisplayType:
 #
@@ -1374,7 +1398,8 @@
       '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' }
   }
 }
 
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index b4030acd74..812f66a31a 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -42,8 +42,6 @@ extern int graphic_depth;
 extern int display_opengl;
 extern const char *keyboard_layout;
 extern int win2k_install_hack;
-extern int alt_grab;
-extern int ctrl_grab;
 extern int graphic_rotate;
 extern int old_param;
 extern uint8_t *boot_splash_filedata;
diff --git a/softmmu/globals.c b/softmmu/globals.c
index 916bc12e2b..527edbefdd 100644
--- a/softmmu/globals.c
+++ b/softmmu/globals.c
@@ -50,8 +50,6 @@ QEMUOptionRom option_rom[MAX_OPTION_ROMS];
 int nb_option_roms;
 int old_param;
 const char *qemu_name;
-int alt_grab;
-int ctrl_grab;
 unsigned int nb_prom_envs;
 const char *prom_envs[MAX_PROM_ENVS];
 uint8_t *boot_splash_filedata;
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 57ab9d5322..484e9d9921 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1056,75 +1056,7 @@ static void parse_display(const char *p)
         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.
diff --git a/ui/sdl2.c b/ui/sdl2.c
index d3741f9b75..dc39b24a67 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 == GRAB_MOD_LSHIFT_LCTRL_LALT) {
+            alt_grab = true;
+        } else if (o->u.sdl.grab_mod == GRAB_MOD_RCTRL) {
+            ctrl_grab = true;
+        }
+    }
+
     for (i = 0;; i++) {
         QemuConsole *con = qemu_console_lookup_by_index(i);
         if (!con) {
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 3/3] ui: Remove deprecated options "-sdl" and "-curses"
  2022-05-18 13:44 [PATCH v2 0/3] ui: Remove deprecated sdl parameters and switch to QAPI parser Thomas Huth
  2022-05-18 13:44 ` [PATCH v2 1/3] ui: Remove deprecated parameters of the "-display sdl" option Thomas Huth
  2022-05-18 13:44 ` [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser Thomas Huth
@ 2022-05-18 13:44 ` Thomas Huth
  2 siblings, 0 replies; 19+ messages in thread
From: Thomas Huth @ 2022-05-18 13:44 UTC (permalink / raw)
  To: qemu-devel, Gerd Hoffmann
  Cc: Markus Armbruster, Eric Blake, Paolo Bonzini, libvir-list,
	Daniel P . Berrangé

We have "-sdl" and "-curses", but no "-gtk" and no "-cocoa" ...
these old-style options are rather confusing than helpful nowadays.
Now that the deprecation period is over, let's remove them, so we
get a cleaner interface (where "-display" is the only way to select
the user interface).

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 docs/about/deprecated.rst       | 10 ----------
 docs/about/removed-features.rst | 10 ++++++++++
 softmmu/vl.c                    | 19 -------------------
 qemu-options.hx                 | 24 ++----------------------
 4 files changed, 12 insertions(+), 51 deletions(-)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 562a133f18..e19bcba242 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -81,16 +81,6 @@ the process listing. This is replaced by the new ``password-secret``
 option which lets the password be securely provided on the command
 line using a ``secret`` object instance.
 
-``-sdl`` (since 6.2)
-''''''''''''''''''''
-
-Use ``-display sdl`` instead.
-
-``-curses`` (since 6.2)
-'''''''''''''''''''''''
-
-Use ``-display curses`` instead.
-
 ``-watchdog`` (since 6.2)
 '''''''''''''''''''''''''
 
diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
index 4c9e001c35..c7b9dadd5d 100644
--- a/docs/about/removed-features.rst
+++ b/docs/about/removed-features.rst
@@ -386,6 +386,16 @@ Use ``-display sdl,grab-mod=lshift-lctrl-lalt`` instead.
 
 Use ``-display sdl,grab-mod=rctrl`` instead.
 
+``-sdl`` (removed in 7.1)
+'''''''''''''''''''''''''
+
+Use ``-display sdl`` instead.
+
+``-curses`` (removed in 7.1)
+''''''''''''''''''''''''''''
+
+Use ``-display curses`` instead.
+
 
 QEMU Machine Protocol (QMP) commands
 ------------------------------------
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 484e9d9921..4c1e94b00e 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2800,16 +2800,6 @@ void qemu_init(int argc, char **argv, char **envp)
                 nographic = true;
                 dpy.type = DISPLAY_TYPE_NONE;
                 break;
-            case QEMU_OPTION_curses:
-                warn_report("-curses is deprecated, "
-                            "use -display curses instead.");
-#ifdef CONFIG_CURSES
-                dpy.type = DISPLAY_TYPE_CURSES;
-#else
-                error_report("curses or iconv support is disabled");
-                exit(1);
-#endif
-                break;
             case QEMU_OPTION_portrait:
                 graphic_rotate = 90;
                 break;
@@ -3176,15 +3166,6 @@ void qemu_init(int argc, char **argv, char **envp)
                 dpy.has_full_screen = true;
                 dpy.full_screen = true;
                 break;
-            case QEMU_OPTION_sdl:
-                warn_report("-sdl is deprecated, use -display sdl instead.");
-#ifdef CONFIG_SDL
-                dpy.type = DISPLAY_TYPE_SDL;
-                break;
-#else
-                error_report("SDL support is disabled");
-                exit(1);
-#endif
             case QEMU_OPTION_pidfile:
                 pid_file = optarg;
                 break;
diff --git a/qemu-options.hx b/qemu-options.hx
index 011caad530..3efca0e7f9 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1981,9 +1981,8 @@ DEF("display", HAS_ARG, QEMU_OPTION_display,
     , QEMU_ARCH_ALL)
 SRST
 ``-display type``
-    Select type of display to use. This option is a replacement for the
-    old style -sdl/-curses/... options. Use ``-display help`` to list
-    the available display types. Valid values for type are
+    Select type of display to use. Use ``-display help`` to list the available
+    display types. Valid values for type are
 
     ``spice-app[,gl=on|off]``
         Start QEMU as a Spice server and launch the default Spice client
@@ -2085,25 +2084,6 @@ SRST
     Use C-a h for help on switching between the console and monitor.
 ERST
 
-DEF("curses", 0, QEMU_OPTION_curses,
-    "-curses         shorthand for -display curses\n",
-    QEMU_ARCH_ALL)
-SRST
-``-curses``
-    Normally, if QEMU is compiled with graphical window support, it
-    displays output such as guest graphics, guest console, and the QEMU
-    monitor in a window. With this option, QEMU can display the VGA
-    output when in text mode using a curses/ncurses interface. Nothing
-    is displayed in graphical mode.
-ERST
-
-DEF("sdl", 0, QEMU_OPTION_sdl,
-    "-sdl            shorthand for -display sdl\n", QEMU_ARCH_ALL)
-SRST
-``-sdl``
-    Enable SDL.
-ERST
-
 #ifdef CONFIG_SPICE
 DEF("spice", HAS_ARG, QEMU_OPTION_spice,
     "-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]\n"
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 1/3] ui: Remove deprecated parameters of the "-display sdl" option
  2022-05-18 13:44 ` [PATCH v2 1/3] ui: Remove deprecated parameters of the "-display sdl" option Thomas Huth
@ 2022-05-18 15:04   ` Markus Armbruster
  0 siblings, 0 replies; 19+ messages in thread
From: Markus Armbruster @ 2022-05-18 15:04 UTC (permalink / raw)
  To: Thomas Huth
  Cc: qemu-devel, Gerd Hoffmann, Eric Blake, Paolo Bonzini,
	libvir-list, Daniel P . Berrangé

Thomas Huth <thuth@redhat.com> writes:

> These parameters are in the way for further refactoring (since they
> use an underscore in the name which is forbidden in QAPI), so let's
> remove these now that their deprecation period is over.

Forbidden, but there's an exception mechanism, so this reason isn't
compelling.  I believe the actual reason is they are "too ugly and
inflexible to drag them along into the QAPI world" (your words).

Suggest:

  Dropping these deprecated parameters now simplifies further
  refactoring.

> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Patch looks good to me, so
Reviewed-by: Markus Armbruster <armbru@redhat.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-18 13:44 ` [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser Thomas Huth
@ 2022-05-18 15:08   ` Markus Armbruster
  2022-05-19  6:39     ` Thomas Huth
  2022-05-18 15:41   ` Eric Blake
  1 sibling, 1 reply; 19+ messages in thread
From: Markus Armbruster @ 2022-05-18 15:08 UTC (permalink / raw)
  To: Thomas Huth
  Cc: qemu-devel, Gerd Hoffmann, Eric Blake, Paolo Bonzini,
	libvir-list, Daniel P . Berrangé

Thomas Huth <thuth@redhat.com> writes:

> 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.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  qapi/ui.json            | 27 +++++++++++++++-
>  include/sysemu/sysemu.h |  2 --
>  softmmu/globals.c       |  2 --
>  softmmu/vl.c            | 70 +----------------------------------------
>  ui/sdl2.c               | 10 ++++++
>  5 files changed, 37 insertions(+), 74 deletions(-)
>
> diff --git a/qapi/ui.json b/qapi/ui.json
> index 11a827d10f..a244e26e0f 100644
> --- a/qapi/ui.json
> +++ b/qapi/ui.json
> @@ -1295,6 +1295,30 @@
>        '*swap-opt-cmd': 'bool'
>    } }
>  
> +##
> +# @GrabMod:
> +#
> +# Set of modifier keys that need to be hold for shortcut key actions.
> +#
> +# Since: 7.1
> +##
> +{ 'enum'  : 'GrabMod',
> +  'data'  : [ 'lctrl-lalt', 'lshift-lctrl-lalt', 'rctrl' ] }

This is fine now.  If we ever generalize to "arbitrary set of modifier
keys", it'll become somewhat awkward.  No objection from me.

> +
> +##
> +# @DisplaySDL:
> +#
> +# SDL2 display options.
> +#
> +# @grab-mod:  String with modifier keys that should be pressed together with

s/String with modifier keys/Modifier keys/

> +#             the "G" key to release the mouse grab. Only "lshift-lctrl-lalt"
> +#             and "rctrl" are currently supported.

Why do we define lctrl-lalt if it's not supported?

> +#
> +# Since: 7.1
> +##
> +{ 'struct'  : 'DisplaySDL',
> +  'data'    : { '*grab-mod'   : 'GrabMod' } }
> +
>  ##
>  # @DisplayType:
>  #
> @@ -1374,7 +1398,8 @@
>        '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' }
>    }
>  }

[...]



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-18 13:44 ` [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser Thomas Huth
  2022-05-18 15:08   ` Markus Armbruster
@ 2022-05-18 15:41   ` Eric Blake
  2022-05-19  6:41     ` Thomas Huth
  1 sibling, 1 reply; 19+ messages in thread
From: Eric Blake @ 2022-05-18 15:41 UTC (permalink / raw)
  To: Thomas Huth
  Cc: qemu-devel, Gerd Hoffmann, Markus Armbruster, Paolo Bonzini,
	libvir-list, Daniel P . Berrangé

On Wed, May 18, 2022 at 03:44:45PM +0200, Thomas Huth wrote:
> 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.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---

> +++ b/qapi/ui.json
> @@ -1295,6 +1295,30 @@
>        '*swap-opt-cmd': 'bool'
>    } }
>  
> +##
> +# @GrabMod:
> +#
> +# Set of modifier keys that need to be hold for shortcut key actions.

s/hold/held/

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-18 15:08   ` Markus Armbruster
@ 2022-05-19  6:39     ` Thomas Huth
  2022-05-19  7:08       ` Thomas Huth
  2022-05-19  7:33       ` Markus Armbruster
  0 siblings, 2 replies; 19+ messages in thread
From: Thomas Huth @ 2022-05-19  6:39 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: qemu-devel, Gerd Hoffmann, Eric Blake, Paolo Bonzini,
	libvir-list, Daniel P.Berrangé

On 18/05/2022 17.08, Markus Armbruster wrote:
> Thomas Huth <thuth@redhat.com> writes:
> 
>> 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.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>   qapi/ui.json            | 27 +++++++++++++++-
>>   include/sysemu/sysemu.h |  2 --
>>   softmmu/globals.c       |  2 --
>>   softmmu/vl.c            | 70 +----------------------------------------
>>   ui/sdl2.c               | 10 ++++++
>>   5 files changed, 37 insertions(+), 74 deletions(-)
>>
>> diff --git a/qapi/ui.json b/qapi/ui.json
>> index 11a827d10f..a244e26e0f 100644
>> --- a/qapi/ui.json
>> +++ b/qapi/ui.json
>> @@ -1295,6 +1295,30 @@
>>         '*swap-opt-cmd': 'bool'
>>     } }
>>   
>> +##
>> +# @GrabMod:
>> +#
>> +# Set of modifier keys that need to be hold for shortcut key actions.
>> +#
>> +# Since: 7.1
>> +##
>> +{ 'enum'  : 'GrabMod',
>> +  'data'  : [ 'lctrl-lalt', 'lshift-lctrl-lalt', 'rctrl' ] }
> 
> This is fine now.  If we ever generalize to "arbitrary set of modifier
> keys", it'll become somewhat awkward.  No objection from me.
> 
>> +
>> +##
>> +# @DisplaySDL:
>> +#
>> +# SDL2 display options.
>> +#
>> +# @grab-mod:  String with modifier keys that should be pressed together with
> 
> s/String with modifier keys/Modifier keys/
> 
>> +#             the "G" key to release the mouse grab. Only "lshift-lctrl-lalt"
>> +#             and "rctrl" are currently supported.
> 
> Why do we define lctrl-lalt if it's not supported?

It's the default value if you don't specify the grab-mod parameter. So it's 
supported, you get this mode if you use "grab-mod=lctrl-lalt" or no grab-mod 
parameter at all.

  Thomas



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-18 15:41   ` Eric Blake
@ 2022-05-19  6:41     ` Thomas Huth
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Huth @ 2022-05-19  6:41 UTC (permalink / raw)
  To: Eric Blake
  Cc: qemu-devel, Gerd Hoffmann, Markus Armbruster, Paolo Bonzini,
	libvir-list, Daniel P. Berrangé

On 18/05/2022 17.41, Eric Blake wrote:
> On Wed, May 18, 2022 at 03:44:45PM +0200, Thomas Huth wrote:
>> 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.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
> 
>> +++ b/qapi/ui.json
>> @@ -1295,6 +1295,30 @@
>>         '*swap-opt-cmd': 'bool'
>>     } }
>>   
>> +##
>> +# @GrabMod:
>> +#
>> +# Set of modifier keys that need to be hold for shortcut key actions.
> 
> s/hold/held/

Thanks, I'll send a v3 with this (and the nits found by Markus) fixed.

  Thomas




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-19  6:39     ` Thomas Huth
@ 2022-05-19  7:08       ` Thomas Huth
  2022-05-19  7:27         ` Thomas Huth
  2022-05-19  7:33       ` Markus Armbruster
  1 sibling, 1 reply; 19+ messages in thread
From: Thomas Huth @ 2022-05-19  7:08 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: qemu-devel, Gerd Hoffmann, Eric Blake, Paolo Bonzini,
	libvir-list, Daniel P.Berrangé

On 19/05/2022 08.39, Thomas Huth wrote:
> On 18/05/2022 17.08, Markus Armbruster wrote:
>> Thomas Huth <thuth@redhat.com> writes:
>>
>>> 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.
>>>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>> ---
>>>   qapi/ui.json            | 27 +++++++++++++++-
>>>   include/sysemu/sysemu.h |  2 --
>>>   softmmu/globals.c       |  2 --
>>>   softmmu/vl.c            | 70 +----------------------------------------
>>>   ui/sdl2.c               | 10 ++++++
>>>   5 files changed, 37 insertions(+), 74 deletions(-)
>>>
>>> diff --git a/qapi/ui.json b/qapi/ui.json
>>> index 11a827d10f..a244e26e0f 100644
>>> --- a/qapi/ui.json
>>> +++ b/qapi/ui.json
>>> @@ -1295,6 +1295,30 @@
>>>         '*swap-opt-cmd': 'bool'
>>>     } }
>>> +##
>>> +# @GrabMod:
>>> +#
>>> +# Set of modifier keys that need to be hold for shortcut key actions.
>>> +#
>>> +# Since: 7.1
>>> +##
>>> +{ 'enum'  : 'GrabMod',
>>> +  'data'  : [ 'lctrl-lalt', 'lshift-lctrl-lalt', 'rctrl' ] }
>>
>> This is fine now.  If we ever generalize to "arbitrary set of modifier
>> keys", it'll become somewhat awkward.  No objection from me.
>>
>>> +
>>> +##
>>> +# @DisplaySDL:
>>> +#
>>> +# SDL2 display options.
>>> +#
>>> +# @grab-mod:  String with modifier keys that should be pressed together 
>>> with
>>
>> s/String with modifier keys/Modifier keys/
>>
>>> +#             the "G" key to release the mouse grab. Only 
>>> "lshift-lctrl-lalt"
>>> +#             and "rctrl" are currently supported.
>>
>> Why do we define lctrl-lalt if it's not supported?
> 
> It's the default value if you don't specify the grab-mod parameter. So it's 
> supported, you get this mode if you use "grab-mod=lctrl-lalt" or no grab-mod 
> parameter at all.

Forgot to mention: I'll drop that sentence in v3. Since there is the enum 
now, people can look up the valid combinations there instead.

  Thomas



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-19  7:08       ` Thomas Huth
@ 2022-05-19  7:27         ` Thomas Huth
  2022-05-19  7:51           ` Daniel P. Berrangé
  2022-05-19 10:48           ` Gerd Hoffmann
  0 siblings, 2 replies; 19+ messages in thread
From: Thomas Huth @ 2022-05-19  7:27 UTC (permalink / raw)
  To: Markus Armbruster, Gerd Hoffmann, qemu-devel
  Cc: Eric Blake, Paolo Bonzini, libvir-list, Daniel P.Berrangé,
	Ryan El Kochta

On 19/05/2022 09.08, Thomas Huth wrote:
> On 19/05/2022 08.39, Thomas Huth wrote:
>> On 18/05/2022 17.08, Markus Armbruster wrote:
>>> Thomas Huth <thuth@redhat.com> writes:
>>>
>>>> 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.
>>>>
>>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>>> ---
>>>>   qapi/ui.json            | 27 +++++++++++++++-
>>>>   include/sysemu/sysemu.h |  2 --
>>>>   softmmu/globals.c       |  2 --
>>>>   softmmu/vl.c            | 70 +----------------------------------------
>>>>   ui/sdl2.c               | 10 ++++++
>>>>   5 files changed, 37 insertions(+), 74 deletions(-)
>>>>
>>>> diff --git a/qapi/ui.json b/qapi/ui.json
>>>> index 11a827d10f..a244e26e0f 100644
>>>> --- a/qapi/ui.json
>>>> +++ b/qapi/ui.json
>>>> @@ -1295,6 +1295,30 @@
>>>>         '*swap-opt-cmd': 'bool'
>>>>     } }
>>>> +##
>>>> +# @GrabMod:
>>>> +#
>>>> +# Set of modifier keys that need to be hold for shortcut key actions.
>>>> +#
>>>> +# Since: 7.1
>>>> +##
>>>> +{ 'enum'  : 'GrabMod',
>>>> +  'data'  : [ 'lctrl-lalt', 'lshift-lctrl-lalt', 'rctrl' ] }
>>>
>>> This is fine now.  If we ever generalize to "arbitrary set of modifier
>>> keys", it'll become somewhat awkward.  No objection from me.

Oh well, I just noticed that we already have a GrabToggleKeys enum in 
qapi/common.json ... I wonder whether I should try to use that instead? It 
seems to be used in a slightly different context, though, if I get that 
right ...?

  Thomas



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-19  6:39     ` Thomas Huth
  2022-05-19  7:08       ` Thomas Huth
@ 2022-05-19  7:33       ` Markus Armbruster
  1 sibling, 0 replies; 19+ messages in thread
From: Markus Armbruster @ 2022-05-19  7:33 UTC (permalink / raw)
  To: Thomas Huth
  Cc: qemu-devel, Gerd Hoffmann, Eric Blake, Paolo Bonzini,
	libvir-list, Daniel P.Berrangé

Thomas Huth <thuth@redhat.com> writes:

> On 18/05/2022 17.08, Markus Armbruster wrote:
>> Thomas Huth <thuth@redhat.com> writes:
>> 
>>> 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.
>>>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>> ---
>>>   qapi/ui.json            | 27 +++++++++++++++-
>>>   include/sysemu/sysemu.h |  2 --
>>>   softmmu/globals.c       |  2 --
>>>   softmmu/vl.c            | 70 +----------------------------------------
>>>   ui/sdl2.c               | 10 ++++++
>>>   5 files changed, 37 insertions(+), 74 deletions(-)
>>>
>>> diff --git a/qapi/ui.json b/qapi/ui.json
>>> index 11a827d10f..a244e26e0f 100644
>>> --- a/qapi/ui.json
>>> +++ b/qapi/ui.json
>>> @@ -1295,6 +1295,30 @@
>>>         '*swap-opt-cmd': 'bool'
>>>     } }
>>>   
>>> +##
>>> +# @GrabMod:
>>> +#
>>> +# Set of modifier keys that need to be hold for shortcut key actions.
>>> +#
>>> +# Since: 7.1
>>> +##
>>> +{ 'enum'  : 'GrabMod',
>>> +  'data'  : [ 'lctrl-lalt', 'lshift-lctrl-lalt', 'rctrl' ] }
>> 
>> This is fine now.  If we ever generalize to "arbitrary set of modifier
>> keys", it'll become somewhat awkward.  No objection from me.
>> 
>>> +
>>> +##
>>> +# @DisplaySDL:
>>> +#
>>> +# SDL2 display options.
>>> +#
>>> +# @grab-mod:  String with modifier keys that should be pressed together with
>> 
>> s/String with modifier keys/Modifier keys/
>> 
>>> +#             the "G" key to release the mouse grab. Only "lshift-lctrl-lalt"
>>> +#             and "rctrl" are currently supported.
>> 
>> Why do we define lctrl-lalt if it's not supported?
>
> It's the default value if you don't specify the grab-mod parameter. So it's 
> supported, you get this mode if you use "grab-mod=lctrl-lalt" or no grab-mod 
> parameter at all.

That's not how I understood the comment...

Suggest

    # @grab-mod: Modifier keys that should be pressed together with the "G"
    #            key to release the mouse grab (default "lctrl-lalt")



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-19  7:27         ` Thomas Huth
@ 2022-05-19  7:51           ` Daniel P. Berrangé
  2022-05-19  8:57             ` Markus Armbruster
  2022-05-19  9:13             ` Thomas Huth
  2022-05-19 10:48           ` Gerd Hoffmann
  1 sibling, 2 replies; 19+ messages in thread
From: Daniel P. Berrangé @ 2022-05-19  7:51 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Markus Armbruster, Gerd Hoffmann, qemu-devel, Eric Blake,
	Paolo Bonzini, libvir-list, Ryan El Kochta

On Thu, May 19, 2022 at 09:27:08AM +0200, Thomas Huth wrote:
> On 19/05/2022 09.08, Thomas Huth wrote:
> > On 19/05/2022 08.39, Thomas Huth wrote:
> > > On 18/05/2022 17.08, Markus Armbruster wrote:
> > > > Thomas Huth <thuth@redhat.com> writes:
> > > > 
> > > > > 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.
> > > > > 
> > > > > Signed-off-by: Thomas Huth <thuth@redhat.com>
> > > > > ---
> > > > >   qapi/ui.json            | 27 +++++++++++++++-
> > > > >   include/sysemu/sysemu.h |  2 --
> > > > >   softmmu/globals.c       |  2 --
> > > > >   softmmu/vl.c            | 70 +----------------------------------------
> > > > >   ui/sdl2.c               | 10 ++++++
> > > > >   5 files changed, 37 insertions(+), 74 deletions(-)
> > > > > 
> > > > > diff --git a/qapi/ui.json b/qapi/ui.json
> > > > > index 11a827d10f..a244e26e0f 100644
> > > > > --- a/qapi/ui.json
> > > > > +++ b/qapi/ui.json
> > > > > @@ -1295,6 +1295,30 @@
> > > > >         '*swap-opt-cmd': 'bool'
> > > > >     } }
> > > > > +##
> > > > > +# @GrabMod:
> > > > > +#
> > > > > +# Set of modifier keys that need to be hold for shortcut key actions.
> > > > > +#
> > > > > +# Since: 7.1
> > > > > +##
> > > > > +{ 'enum'  : 'GrabMod',
> > > > > +  'data'  : [ 'lctrl-lalt', 'lshift-lctrl-lalt', 'rctrl' ] }
> > > > 
> > > > This is fine now.  If we ever generalize to "arbitrary set of modifier
> > > > keys", it'll become somewhat awkward.  No objection from me.
> 
> Oh well, I just noticed that we already have a GrabToggleKeys enum in
> qapi/common.json ... I wonder whether I should try to use that instead? It
> seems to be used in a slightly different context, though, if I get that
> right ...?

It also doesn't distinguish left & right control/alt/shift keys
for some reason.  So you would end up having to add more enum
entries for SDL, none of which overlap with existing enum entries.
Rather a pity, as the consistency would have been nice

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-19  7:51           ` Daniel P. Berrangé
@ 2022-05-19  8:57             ` Markus Armbruster
  2022-05-19  9:09               ` Thomas Huth
  2022-05-19  9:13             ` Thomas Huth
  1 sibling, 1 reply; 19+ messages in thread
From: Markus Armbruster @ 2022-05-19  8:57 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Thomas Huth, Markus Armbruster, Gerd Hoffmann, qemu-devel,
	Eric Blake, Paolo Bonzini, libvir-list, Ryan El Kochta

Daniel P. Berrangé <berrange@redhat.com> writes:

> On Thu, May 19, 2022 at 09:27:08AM +0200, Thomas Huth wrote:
>> On 19/05/2022 09.08, Thomas Huth wrote:
>> > On 19/05/2022 08.39, Thomas Huth wrote:
>> > > On 18/05/2022 17.08, Markus Armbruster wrote:
>> > > > Thomas Huth <thuth@redhat.com> writes:
>> > > > 
>> > > > > 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.
>> > > > > 
>> > > > > Signed-off-by: Thomas Huth <thuth@redhat.com>
>> > > > > ---
>> > > > >   qapi/ui.json            | 27 +++++++++++++++-
>> > > > >   include/sysemu/sysemu.h |  2 --
>> > > > >   softmmu/globals.c       |  2 --
>> > > > >   softmmu/vl.c            | 70 +----------------------------------------
>> > > > >   ui/sdl2.c               | 10 ++++++
>> > > > >   5 files changed, 37 insertions(+), 74 deletions(-)
>> > > > > 
>> > > > > diff --git a/qapi/ui.json b/qapi/ui.json
>> > > > > index 11a827d10f..a244e26e0f 100644
>> > > > > --- a/qapi/ui.json
>> > > > > +++ b/qapi/ui.json
>> > > > > @@ -1295,6 +1295,30 @@
>> > > > >         '*swap-opt-cmd': 'bool'
>> > > > >     } }
>> > > > > +##
>> > > > > +# @GrabMod:
>> > > > > +#
>> > > > > +# Set of modifier keys that need to be hold for shortcut key actions.
>> > > > > +#
>> > > > > +# Since: 7.1
>> > > > > +##
>> > > > > +{ 'enum'  : 'GrabMod',
>> > > > > +  'data'  : [ 'lctrl-lalt', 'lshift-lctrl-lalt', 'rctrl' ] }
>> > > > 
>> > > > This is fine now.  If we ever generalize to "arbitrary set of modifier
>> > > > keys", it'll become somewhat awkward.  No objection from me.
>> 
>> Oh well, I just noticed that we already have a GrabToggleKeys enum in
>> qapi/common.json ... I wonder whether I should try to use that instead? It
>> seems to be used in a slightly different context, though, if I get that
>> right ...?
>
> It also doesn't distinguish left & right control/alt/shift keys
> for some reason.  So you would end up having to add more enum
> entries for SDL, none of which overlap with existing enum entries.
> Rather a pity, as the consistency would have been nice

Speaking of consistency: stick to the key names we use in QKeyCode?
Sadly, they contain '_'.



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-19  8:57             ` Markus Armbruster
@ 2022-05-19  9:09               ` Thomas Huth
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Huth @ 2022-05-19  9:09 UTC (permalink / raw)
  To: Markus Armbruster, Daniel P. Berrangé
  Cc: Gerd Hoffmann, qemu-devel, Eric Blake, Paolo Bonzini,
	libvir-list, Ryan El Kochta

On 19/05/2022 10.57, Markus Armbruster wrote:
> Daniel P. Berrangé <berrange@redhat.com> writes:
> 
>> On Thu, May 19, 2022 at 09:27:08AM +0200, Thomas Huth wrote:
>>> On 19/05/2022 09.08, Thomas Huth wrote:
>>>> On 19/05/2022 08.39, Thomas Huth wrote:
>>>>> On 18/05/2022 17.08, Markus Armbruster wrote:
>>>>>> Thomas Huth <thuth@redhat.com> writes:
>>>>>>
>>>>>>> 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.
>>>>>>>
>>>>>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>>>>>> ---
>>>>>>>    qapi/ui.json            | 27 +++++++++++++++-
>>>>>>>    include/sysemu/sysemu.h |  2 --
>>>>>>>    softmmu/globals.c       |  2 --
>>>>>>>    softmmu/vl.c            | 70 +----------------------------------------
>>>>>>>    ui/sdl2.c               | 10 ++++++
>>>>>>>    5 files changed, 37 insertions(+), 74 deletions(-)
>>>>>>>
>>>>>>> diff --git a/qapi/ui.json b/qapi/ui.json
>>>>>>> index 11a827d10f..a244e26e0f 100644
>>>>>>> --- a/qapi/ui.json
>>>>>>> +++ b/qapi/ui.json
>>>>>>> @@ -1295,6 +1295,30 @@
>>>>>>>          '*swap-opt-cmd': 'bool'
>>>>>>>      } }
>>>>>>> +##
>>>>>>> +# @GrabMod:
>>>>>>> +#
>>>>>>> +# Set of modifier keys that need to be hold for shortcut key actions.
>>>>>>> +#
>>>>>>> +# Since: 7.1
>>>>>>> +##
>>>>>>> +{ 'enum'  : 'GrabMod',
>>>>>>> +  'data'  : [ 'lctrl-lalt', 'lshift-lctrl-lalt', 'rctrl' ] }
>>>>>>
>>>>>> This is fine now.  If we ever generalize to "arbitrary set of modifier
>>>>>> keys", it'll become somewhat awkward.  No objection from me.
>>>
>>> Oh well, I just noticed that we already have a GrabToggleKeys enum in
>>> qapi/common.json ... I wonder whether I should try to use that instead? It
>>> seems to be used in a slightly different context, though, if I get that
>>> right ...?
>>
>> It also doesn't distinguish left & right control/alt/shift keys
>> for some reason.  So you would end up having to add more enum
>> entries for SDL, none of which overlap with existing enum entries.
>> Rather a pity, as the consistency would have been nice
> 
> Speaking of consistency: stick to the key names we use in QKeyCode?
> Sadly, they contain '_'.

The "grab-mod" with the current name already exists, so if we want to switch 
to those names, we need to deprecate the current ones again ... and the 
enums would really look ugly in the code, too, e.g. CTRL_L_ALT_L ... hard to 
tell where the "L" really belongs to ... so I'd rather stick with the 
current names, I think.

  Thomas



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-19  7:51           ` Daniel P. Berrangé
  2022-05-19  8:57             ` Markus Armbruster
@ 2022-05-19  9:13             ` Thomas Huth
  1 sibling, 0 replies; 19+ messages in thread
From: Thomas Huth @ 2022-05-19  9:13 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Markus Armbruster, Gerd Hoffmann, qemu-devel, Eric Blake,
	Paolo Bonzini, libvir-list, Ryan El Kochta

On 19/05/2022 09.51, Daniel P. Berrangé wrote:
> On Thu, May 19, 2022 at 09:27:08AM +0200, Thomas Huth wrote:
>> On 19/05/2022 09.08, Thomas Huth wrote:
>>> On 19/05/2022 08.39, Thomas Huth wrote:
>>>> On 18/05/2022 17.08, Markus Armbruster wrote:
>>>>> Thomas Huth <thuth@redhat.com> writes:
>>>>>
>>>>>> 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.
>>>>>>
>>>>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>>>>> ---
>>>>>>    qapi/ui.json            | 27 +++++++++++++++-
>>>>>>    include/sysemu/sysemu.h |  2 --
>>>>>>    softmmu/globals.c       |  2 --
>>>>>>    softmmu/vl.c            | 70 +----------------------------------------
>>>>>>    ui/sdl2.c               | 10 ++++++
>>>>>>    5 files changed, 37 insertions(+), 74 deletions(-)
>>>>>>
>>>>>> diff --git a/qapi/ui.json b/qapi/ui.json
>>>>>> index 11a827d10f..a244e26e0f 100644
>>>>>> --- a/qapi/ui.json
>>>>>> +++ b/qapi/ui.json
>>>>>> @@ -1295,6 +1295,30 @@
>>>>>>          '*swap-opt-cmd': 'bool'
>>>>>>      } }
>>>>>> +##
>>>>>> +# @GrabMod:
>>>>>> +#
>>>>>> +# Set of modifier keys that need to be hold for shortcut key actions.
>>>>>> +#
>>>>>> +# Since: 7.1
>>>>>> +##
>>>>>> +{ 'enum'  : 'GrabMod',
>>>>>> +  'data'  : [ 'lctrl-lalt', 'lshift-lctrl-lalt', 'rctrl' ] }
>>>>>
>>>>> This is fine now.  If we ever generalize to "arbitrary set of modifier
>>>>> keys", it'll become somewhat awkward.  No objection from me.
>>
>> Oh well, I just noticed that we already have a GrabToggleKeys enum in
>> qapi/common.json ... I wonder whether I should try to use that instead? It
>> seems to be used in a slightly different context, though, if I get that
>> right ...?
> 
> It also doesn't distinguish left & right control/alt/shift keys
> for some reason.  So you would end up having to add more enum
> entries for SDL, none of which overlap with existing enum entries.

We could also extend the SDL code to work with the other combos from 
GrabToggleKeys, I guess.

> Rather a pity, as the consistency would have been nice

I wonder which way would cause less "WTF?" situations in the future ... if 
we have one enum with slightly different naming between the entries, or if 
we have two enums that seems to be there for the same or at least very 
similar things, which still have still inconsistent namings between the 
entries...
I'm slightly inclined to go for the unified GrabToggleKeys enum, I think...

  Thomas



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-19  7:27         ` Thomas Huth
  2022-05-19  7:51           ` Daniel P. Berrangé
@ 2022-05-19 10:48           ` Gerd Hoffmann
  2022-05-19 11:00             ` Thomas Huth
  1 sibling, 1 reply; 19+ messages in thread
From: Gerd Hoffmann @ 2022-05-19 10:48 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Markus Armbruster, qemu-devel, libvir-list, Paolo Bonzini,
	Eric Blake, Ryan El Kochta

  Hi,

> Oh well, I just noticed that we already have a GrabToggleKeys enum in
> qapi/common.json ... I wonder whether I should try to use that instead? It
> seems to be used in a slightly different context, though, if I get that
> right ...?

qemu/ui/input-linux.c

Those switch the input routing between host and guest, and they act on
their own (i.e. by default both control keys without anything else).

For SDL it defines the modifiers to press in addition to the hotkeys
(i.e. ctrl + shift + 'G' for grab release, IIRC there a are more, 'F'
for fullscreen?).

So I don't think it makes sense to merge them.

take care,
  Gerd



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-19 10:48           ` Gerd Hoffmann
@ 2022-05-19 11:00             ` Thomas Huth
  2022-05-19 11:19               ` Gerd Hoffmann
  0 siblings, 1 reply; 19+ messages in thread
From: Thomas Huth @ 2022-05-19 11:00 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Markus Armbruster, qemu-devel, libvir-list, Paolo Bonzini,
	Eric Blake, Ryan El Kochta

On 19/05/2022 12.48, Gerd Hoffmann wrote:
>    Hi,
> 
>> Oh well, I just noticed that we already have a GrabToggleKeys enum in
>> qapi/common.json ... I wonder whether I should try to use that instead? It
>> seems to be used in a slightly different context, though, if I get that
>> right ...?
> 
> qemu/ui/input-linux.c
> 
> Those switch the input routing between host and guest, and they act on
> their own (i.e. by default both control keys without anything else).
> 
> For SDL it defines the modifiers to press in addition to the hotkeys
> (i.e. ctrl + shift + 'G' for grab release, IIRC there a are more, 'F'
> for fullscreen?).
> 
> So I don't think it makes sense to merge them.

Hmm, ok ... but maybe I should call the new enum HotKeyMod instead of 
GrabMod to make it more obvious that it is something different?

  Thomas




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser
  2022-05-19 11:00             ` Thomas Huth
@ 2022-05-19 11:19               ` Gerd Hoffmann
  0 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2022-05-19 11:19 UTC (permalink / raw)
  To: Thomas Huth
  Cc: libvir-list, Markus Armbruster, qemu-devel, Paolo Bonzini,
	Eric Blake, Ryan El Kochta

  Hi,

> Hmm, ok ... but maybe I should call the new enum HotKeyMod instead of
> GrabMod to make it more obvious that it is something different?

Looks good to me.

take care,
  Gerd



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2022-05-19 11:21 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18 13:44 [PATCH v2 0/3] ui: Remove deprecated sdl parameters and switch to QAPI parser Thomas Huth
2022-05-18 13:44 ` [PATCH v2 1/3] ui: Remove deprecated parameters of the "-display sdl" option Thomas Huth
2022-05-18 15:04   ` Markus Armbruster
2022-05-18 13:44 ` [PATCH v2 2/3] ui: Switch "-display sdl" to use the QAPI parser Thomas Huth
2022-05-18 15:08   ` Markus Armbruster
2022-05-19  6:39     ` Thomas Huth
2022-05-19  7:08       ` Thomas Huth
2022-05-19  7:27         ` Thomas Huth
2022-05-19  7:51           ` Daniel P. Berrangé
2022-05-19  8:57             ` Markus Armbruster
2022-05-19  9:09               ` Thomas Huth
2022-05-19  9:13             ` Thomas Huth
2022-05-19 10:48           ` Gerd Hoffmann
2022-05-19 11:00             ` Thomas Huth
2022-05-19 11:19               ` Gerd Hoffmann
2022-05-19  7:33       ` Markus Armbruster
2022-05-18 15:41   ` Eric Blake
2022-05-19  6:41     ` Thomas Huth
2022-05-18 13:44 ` [PATCH v2 3/3] ui: Remove deprecated options "-sdl" and "-curses" Thomas Huth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.