summary refs log tree commit diff stats
path: root/vl.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2009-05-20 13:01:02 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2009-05-21 08:47:48 -0500
commitf92f8afebe038a4eae9ad90a140c9529f94919a6 (patch)
tree308194d45c392caffd3121af25cd9fd2f41d24e1 /vl.c
parenteb0b64f7aa7f6f325aac878265ee9e6c2fc1bf51 (diff)
downloadfocaccia-qemu-f92f8afebe038a4eae9ad90a140c9529f94919a6.tar.gz
focaccia-qemu-f92f8afebe038a4eae9ad90a140c9529f94919a6.zip
Eliminate --disable-gfx-check and make VNC default when SDL not available
 --disable-gfx-check predates VNC server support.  It made sense back then
because the only thing you could do without SDL was use -nographic mode or
similar tricks.  Since this is a very advanced mode of operation, gfx-check
provided a good safety net for casual users.

A casual user is very likely to use VNC to interact with a guest.  In fact, it's
often frustrating to install QEMU on a server and have to specify
disable-gfx-check when you only want to use VNC.

This patch eliminates disable-gfx-check and makes SDL behave like every other
optional dependency.  If SDL is not available, instead of failing ungracefully
if no special options are specified, we default to -vnc localhost:0,to=99.
When we do default to VNC, we also print a message to tell the user that we've
done this include which port we're currently listening on.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/vl.c b/vl.c
index 9f25cd40d5..e28da7ed7d 100644
--- a/vl.c
+++ b/vl.c
@@ -203,7 +203,7 @@ enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
 static DisplayState *display_state;
 int nographic;
 static int curses;
-static int sdl;
+static int sdl = 1;
 const char* keyboard_layout = NULL;
 int64_t ticks_per_sec;
 ram_addr_t ram_size;
@@ -5952,25 +5952,36 @@ int main(int argc, char **argv, char **envp)
         }
     } else { 
 #if defined(CONFIG_CURSES)
-            if (curses) {
-                /* At the moment curses cannot be used with other displays */
-                curses_display_init(ds, full_screen);
-            } else
+        if (curses) {
+            /* At the moment curses cannot be used with other displays */
+            curses_display_init(ds, full_screen);
+        } else
 #endif
-            {
-                if (vnc_display != NULL) {
-                    vnc_display_init(ds);
-                    if (vnc_display_open(ds, vnc_display) < 0)
-                        exit(1);
-                }
+#if defined(CONFIG_SDL) || defined(CONFIG_COCOA)
+        if (sdl) {
 #if defined(CONFIG_SDL)
-                if (sdl || !vnc_display)
-                    sdl_display_init(ds, full_screen, no_frame);
+            sdl_display_init(ds, full_screen, no_frame);
 #elif defined(CONFIG_COCOA)
-                if (sdl || !vnc_display)
-                    cocoa_display_init(ds, full_screen);
+            cocoa_display_init(ds, full_screen);
+#endif
+        } else
 #endif
+        {
+            int print_port = 0;
+
+            if (vnc_display == NULL) {
+                vnc_display = "localhost:0,to=99";
+                print_port = 1;
             }
+
+            vnc_display_init(ds);
+            if (vnc_display_open(ds, vnc_display) < 0)
+                exit(1);
+
+            if (print_port) {
+                printf("VNC server running on `%s'\n", vnc_display_local_addr(ds));
+            }
+        }
     }
     dpy_resize(ds);