diff mbox series

[v3,06/12] vl: drop no_quit variable

Message ID 20180202111022.19269-7-kraxel@redhat.com
State New
Headers show
Series rework display initialization, part one | expand

Commit Message

Gerd Hoffmann Feb. 2, 2018, 11:10 a.m. UTC
Not used any more, delete it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 vl.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Eric Blake Feb. 2, 2018, 3:35 p.m. UTC | #1
On 02/02/2018 05:10 AM, Gerd Hoffmann wrote:
> Not used any more, delete it.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  vl.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/vl.c b/vl.c

> @@ -4368,7 +4364,8 @@ int main(int argc, char **argv, char **envp)
>          error_report("-no-frame, -alt-grab and -ctrl-grab are only valid "
>                       "for SDL, ignoring option");
>      }
> -    if (no_quit && (display_type != DT_GTK && display_type != DT_SDL)) {
> +    if (dpy.has_window_close &&
> +        (display_type != DT_GTK && display_type != DT_SDL)) {
>          error_report("-no-quit is only valid for GTK and SDL, "
>                       "ignoring option");

Does this mean we should move the 'window-close' field out of the common
base type and into DisplayGTK/DisplaySDL instead (where sdl would need
its own type instead of DisplayNoOpts)?  I guess the difference is how
long we have been flagging this error message - if we rearrange the QAPI
type, this code is dead and you've broken the command line that tries to
do window type none combined with -no-quit; but if that command line has
already been documented as broken, it is no real loss.  But if we
haven't had enough of a deprecation period yet, then keeping
window-close global to all variants of the union and doing the runtime
rejection check lets us finish the deprecation period.
Gerd Hoffmann Feb. 5, 2018, 9:56 a.m. UTC | #2
On Fri, Feb 02, 2018 at 09:35:52AM -0600, Eric Blake wrote:
> On 02/02/2018 05:10 AM, Gerd Hoffmann wrote:
> > Not used any more, delete it.
> > 
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > ---
> >  vl.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> > 
> > diff --git a/vl.c b/vl.c
> 
> > @@ -4368,7 +4364,8 @@ int main(int argc, char **argv, char **envp)
> >          error_report("-no-frame, -alt-grab and -ctrl-grab are only valid "
> >                       "for SDL, ignoring option");
> >      }
> > -    if (no_quit && (display_type != DT_GTK && display_type != DT_SDL)) {
> > +    if (dpy.has_window_close &&
> > +        (display_type != DT_GTK && display_type != DT_SDL)) {
> >          error_report("-no-quit is only valid for GTK and SDL, "
> >                       "ignoring option");
> 
> Does this mean we should move the 'window-close' field out of the common
> base type and into DisplayGTK/DisplaySDL instead (where sdl would need
> its own type instead of DisplayNoOpts)?

Well, strictly speaking that would be more accurate, but backward
compatibility with -no-quit would become more messy then.  Also cocoa
could probably add support for the window-close option without too much
effort.

> I guess the difference is how
> long we have been flagging this error message -

The message is there as long as I remember.  It's a warning only though,
it will not prevent qemu from starting.

> if we rearrange the QAPI
> type, this code is dead and you've broken the command line that tries to
> do window type none combined with -no-quit;

Depends on how you code things up...

With window-close being in the common section you can just set it when
you see '-no-quit'.

With window-close being in the display specific options you have
remember you have seen '-no-quit', then later when we know what the
display type is run

  switch (displaytype) {
  case sdl: sdl.window_close = true; break;

At that point you can do whatever you want in the default branch ...

> but if that command line has
> already been documented as broken, it is no real loss.  But if we
> haven't had enough of a deprecation period yet, then keeping
> window-close global to all variants of the union and doing the runtime
> rejection check lets us finish the deprecation period.

Which deprecation period?  -no-quit isn't deprecated.

cheers,
  Gerd
diff mbox series

Patch

diff --git a/vl.c b/vl.c
index 25e784be63..c17dedfa4e 100644
--- a/vl.c
+++ b/vl.c
@@ -152,7 +152,6 @@  int vga_interface_type = VGA_NONE;
 static int full_screen = 0;
 static DisplayOptions dpy;
 int no_frame;
-int no_quit = 0;
 Chardev *serial_hds[MAX_SERIAL_PORTS];
 Chardev *parallel_hds[MAX_PARALLEL_PORTS];
 Chardev *virtcon_hds[MAX_VIRTIO_CONSOLES];
@@ -2141,10 +2140,8 @@  static LegacyDisplayType select_display(const char *p)
                 opts = nextopt;
                 dpy.has_window_close = true;
                 if (strstart(opts, "on", &nextopt)) {
-                    no_quit = 0;
                     dpy.window_close = true;
                 } else if (strstart(opts, "off", &nextopt)) {
-                    no_quit = 1;
                     dpy.window_close = false;
                 } else {
                     goto invalid_sdl_args;
@@ -3679,7 +3676,6 @@  int main(int argc, char **argv, char **envp)
                 ctrl_grab = 1;
                 break;
             case QEMU_OPTION_no_quit:
-                no_quit = 1;
                 dpy.has_window_close = true;
                 dpy.window_close = false;
                 break;
@@ -4368,7 +4364,8 @@  int main(int argc, char **argv, char **envp)
         error_report("-no-frame, -alt-grab and -ctrl-grab are only valid "
                      "for SDL, ignoring option");
     }
-    if (no_quit && (display_type != DT_GTK && display_type != DT_SDL)) {
+    if (dpy.has_window_close &&
+        (display_type != DT_GTK && display_type != DT_SDL)) {
         error_report("-no-quit is only valid for GTK and SDL, "
                      "ignoring option");
     }