Patchwork [8/9] gtk: make default UI (v3)

login
register
mail settings
Submitter Anthony Liguori
Date Feb. 18, 2013, 11:57 p.m.
Message ID <1361231825-12037-9-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/221590/
State New
Headers show

Comments

Anthony Liguori - Feb. 18, 2013, 11:57 p.m.
A user can still enable SDL with '-sdl' or '-display sdl' but start making the
default display GTK by default.

I'd also like to deprecate the SDL display and remove it in a few releases.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v3:
 - fix -display gtk
 - fix -vnc none
---
 vl.c | 45 +++++++++++++++++++++++++++++++--------------
 1 file changed, 31 insertions(+), 14 deletions(-)
Andreas Färber - Feb. 19, 2013, 8:48 a.m.
Am 19.02.2013 00:57, schrieb Anthony Liguori:
> A user can still enable SDL with '-sdl' or '-display sdl' but start making the
> default display GTK by default.
> 
> I'd also like to deprecate the SDL display and remove it in a few releases.
> 
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
> v1 -> v3:
>  - fix -display gtk
>  - fix -vnc none
> ---
>  vl.c | 45 +++++++++++++++++++++++++++++++--------------
>  1 file changed, 31 insertions(+), 14 deletions(-)
> 
> diff --git a/vl.c b/vl.c
> index c5b0eea..d0fec59 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2206,6 +2206,13 @@ static DisplayType select_display(const char *p)
>          fprintf(stderr, "Curses support is disabled\n");
>          exit(1);
>  #endif
> +    } else if (strstart(p, "gtk", &opts)) {
> +#ifdef CONFIG_GTK
> +        display = DT_GTK;
> +#else
> +        fprintf(stderr, "GTK support is disabled\n");
> +        exit(1);
> +#endif
>      } else if (strstart(p, "none", &opts)) {
>          display = DT_NONE;
>      } else {
> @@ -3998,6 +4005,25 @@ int main(int argc, char **argv, char **envp)
>          }
>      }
>  
> +    if (display_type == DT_DEFAULT && !display_remote) {
> +#if defined(CONFIG_GTK)
> +        display_type = DT_GTK;
> +#elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
> +        display_type = DT_SDL;
> +#elif defined(CONFIG_VNC)
> +        vnc_display = "localhost:0,to=99";
> +        show_vnc_port = 1;
> +#else
> +        display_type = DT_NONE;
> +#endif
> +    }
> +
> +#if defined(CONFIG_GTK)
> +    if (display_type == DT_GTK) {
> +        early_gtk_display_init();
> +    }
> +#endif
> +
>      socket_init();
>  
>      if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, 1) != 0)
> @@ -4226,20 +4252,6 @@ int main(int argc, char **argv, char **envp)
>      /* just use the first displaystate for the moment */
>      ds = get_displaystate();
>  
> -    if (using_spice)
> -        display_remote++;

This seems to have gotten lost? At least no mention in the commit message.

Andreas

> -    if (display_type == DT_DEFAULT && !display_remote) {
> -#if defined(CONFIG_SDL) || defined(CONFIG_COCOA)
> -        display_type = DT_SDL;
> -#elif defined(CONFIG_VNC)
> -        vnc_display = "localhost:0,to=99";
> -        show_vnc_port = 1;
> -#else
> -        display_type = DT_NONE;
> -#endif
> -    }
> -
> -
>      /* init local displays */
>      switch (display_type) {
>      case DT_NOGRAPHIC:
> @@ -4258,6 +4270,11 @@ int main(int argc, char **argv, char **envp)
>          cocoa_display_init(ds, full_screen);
>          break;
>  #endif
> +#if defined(CONFIG_GTK)
> +    case DT_GTK:
> +        gtk_display_init(ds);
> +        break;
> +#endif
>      default:
>          break;
>      }
>
Anthony Liguori - Feb. 19, 2013, 4:30 p.m.
Andreas Färber <afaerber@suse.de> writes:

> Am 19.02.2013 00:57, schrieb Anthony Liguori:
>> A user can still enable SDL with '-sdl' or '-display sdl' but start making the
>> default display GTK by default.
>> 
>> I'd also like to deprecate the SDL display and remove it in a few releases.
>> 
>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>> ---
>> v1 -> v3:
>>  - fix -display gtk
>>  - fix -vnc none
>> ---
>>  vl.c | 45 +++++++++++++++++++++++++++++++--------------
>>  1 file changed, 31 insertions(+), 14 deletions(-)
>> 
>> diff --git a/vl.c b/vl.c
>> index c5b0eea..d0fec59 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -2206,6 +2206,13 @@ static DisplayType select_display(const char *p)
>>          fprintf(stderr, "Curses support is disabled\n");
>>          exit(1);
>>  #endif
>> +    } else if (strstart(p, "gtk", &opts)) {
>> +#ifdef CONFIG_GTK
>> +        display = DT_GTK;
>> +#else
>> +        fprintf(stderr, "GTK support is disabled\n");
>> +        exit(1);
>> +#endif
>>      } else if (strstart(p, "none", &opts)) {
>>          display = DT_NONE;
>>      } else {
>> @@ -3998,6 +4005,25 @@ int main(int argc, char **argv, char **envp)
>>          }
>>      }
>>  
>> +    if (display_type == DT_DEFAULT && !display_remote) {
>> +#if defined(CONFIG_GTK)
>> +        display_type = DT_GTK;
>> +#elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
>> +        display_type = DT_SDL;
>> +#elif defined(CONFIG_VNC)
>> +        vnc_display = "localhost:0,to=99";
>> +        show_vnc_port = 1;
>> +#else
>> +        display_type = DT_NONE;
>> +#endif
>> +    }
>> +
>> +#if defined(CONFIG_GTK)
>> +    if (display_type == DT_GTK) {
>> +        early_gtk_display_init();
>> +    }
>> +#endif
>> +
>>      socket_init();
>>  
>>      if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, 1) != 0)
>> @@ -4226,20 +4252,6 @@ int main(int argc, char **argv, char **envp)
>>      /* just use the first displaystate for the moment */
>>      ds = get_displaystate();
>>  
>> -    if (using_spice)
>> -        display_remote++;
>
> This seems to have gotten lost? At least no mention in the commit
> message.

Yup, a rebase artifact.  Thanks for spotting it!

Regards,

Anthony Liguori

>
> Andreas
>
>> -    if (display_type == DT_DEFAULT && !display_remote) {
>> -#if defined(CONFIG_SDL) || defined(CONFIG_COCOA)
>> -        display_type = DT_SDL;
>> -#elif defined(CONFIG_VNC)
>> -        vnc_display = "localhost:0,to=99";
>> -        show_vnc_port = 1;
>> -#else
>> -        display_type = DT_NONE;
>> -#endif
>> -    }
>> -
>> -
>>      /* init local displays */
>>      switch (display_type) {
>>      case DT_NOGRAPHIC:
>> @@ -4258,6 +4270,11 @@ int main(int argc, char **argv, char **envp)
>>          cocoa_display_init(ds, full_screen);
>>          break;
>>  #endif
>> +#if defined(CONFIG_GTK)
>> +    case DT_GTK:
>> +        gtk_display_init(ds);
>> +        break;
>> +#endif
>>      default:
>>          break;
>>      }
>> 
>
>
> -- 
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

Patch

diff --git a/vl.c b/vl.c
index c5b0eea..d0fec59 100644
--- a/vl.c
+++ b/vl.c
@@ -2206,6 +2206,13 @@  static DisplayType select_display(const char *p)
         fprintf(stderr, "Curses support is disabled\n");
         exit(1);
 #endif
+    } else if (strstart(p, "gtk", &opts)) {
+#ifdef CONFIG_GTK
+        display = DT_GTK;
+#else
+        fprintf(stderr, "GTK support is disabled\n");
+        exit(1);
+#endif
     } else if (strstart(p, "none", &opts)) {
         display = DT_NONE;
     } else {
@@ -3998,6 +4005,25 @@  int main(int argc, char **argv, char **envp)
         }
     }
 
+    if (display_type == DT_DEFAULT && !display_remote) {
+#if defined(CONFIG_GTK)
+        display_type = DT_GTK;
+#elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
+        display_type = DT_SDL;
+#elif defined(CONFIG_VNC)
+        vnc_display = "localhost:0,to=99";
+        show_vnc_port = 1;
+#else
+        display_type = DT_NONE;
+#endif
+    }
+
+#if defined(CONFIG_GTK)
+    if (display_type == DT_GTK) {
+        early_gtk_display_init();
+    }
+#endif
+
     socket_init();
 
     if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, 1) != 0)
@@ -4226,20 +4252,6 @@  int main(int argc, char **argv, char **envp)
     /* just use the first displaystate for the moment */
     ds = get_displaystate();
 
-    if (using_spice)
-        display_remote++;
-    if (display_type == DT_DEFAULT && !display_remote) {
-#if defined(CONFIG_SDL) || defined(CONFIG_COCOA)
-        display_type = DT_SDL;
-#elif defined(CONFIG_VNC)
-        vnc_display = "localhost:0,to=99";
-        show_vnc_port = 1;
-#else
-        display_type = DT_NONE;
-#endif
-    }
-
-
     /* init local displays */
     switch (display_type) {
     case DT_NOGRAPHIC:
@@ -4258,6 +4270,11 @@  int main(int argc, char **argv, char **envp)
         cocoa_display_init(ds, full_screen);
         break;
 #endif
+#if defined(CONFIG_GTK)
+    case DT_GTK:
+        gtk_display_init(ds);
+        break;
+#endif
     default:
         break;
     }