[Spice-devel] [PATCH spice-gtk 23/25] Handle MonitorsConfig::max_allowed

Alon Levy alevy at redhat.com
Sun Jul 15 23:48:44 PDT 2012


On Fri, Jul 13, 2012 at 12:29:20AM +0200, Marc-André Lureau wrote:

I'm not sure how, but it needs to be damn clear that this value can
change during the client lifetime. Documentation change suggested below.

> ---
>  gtk/channel-display.c |   27 +++++++++++++++++++++++++--
>  spice-common          |    2 +-
>  2 files changed, 26 insertions(+), 3 deletions(-)
> 
> diff --git a/gtk/channel-display.c b/gtk/channel-display.c
> index b701d1b..02650e4 100644
> --- a/gtk/channel-display.c
> +++ b/gtk/channel-display.c
> @@ -71,6 +71,7 @@ struct _SpiceDisplayChannelPrivate {
>      gboolean                    mark;
>      guint                       mark_false_event_id;
>      GArray                      *monitors;
> +    guint                       monitors_max;
>  #ifdef WIN32
>      HDC dc;
>  #endif
> @@ -83,7 +84,8 @@ enum {
>      PROP_0,
>      PROP_WIDTH,
>      PROP_HEIGHT,
> -    PROP_MONITORS
> +    PROP_MONITORS,
> +    PROP_MONITORS_MAX
>  };
>  
>  enum {
> @@ -176,6 +178,10 @@ static void spice_display_get_property(GObject    *object,
>          g_value_set_boxed(value, c->monitors);
>          break;
>      }
> +    case PROP_MONITORS_MAX: {
> +        g_value_set_uint(value, c->monitors_max);
> +        break;
> +    }
>      default:
>          G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
>          break;
> @@ -255,6 +261,22 @@ static void spice_display_channel_class_init(SpiceDisplayChannelClass *klass)
>                              G_PARAM_STATIC_STRINGS));
>  
>      /**
> +     * SpiceDisplayChannel:monitors-max:
> +     *
> +     * The maximum number of monitors the server or guest supports.

The maximum number of monitors the server or guest supports. May change
during client lifetime, for instance guest may reboot or dynamically
adjust this.

> +     *
> +     * Since: 0.13
> +     */
> +    g_object_class_install_property
> +        (gobject_class, PROP_MONITORS_MAX,
> +         g_param_spec_uint("monitors-max",
> +                           "Max display monitors",
> +                           "The maximum number of monitors",
"The current maximum number of monitors"

> +                           1, G_MAXINT16, 1,
> +                           G_PARAM_READABLE |
> +                           G_PARAM_STATIC_STRINGS));
> +
> +    /**
>       * SpiceDisplayChannel::display-primary-create:
>       * @display: the #SpiceDisplayChannel that emitted the signal
>       * @format: %SPICE_SURFACE_FMT_32_xRGB or %SPICE_SURFACE_FMT_16_555;
> @@ -1478,8 +1500,9 @@ static void display_handle_monitors_config(SpiceChannel *channel, SpiceMsgIn *in
>      g_return_if_fail(config != NULL);
>      g_return_if_fail(config->count > 0);
>  
> -    SPICE_DEBUG("monitors config: n: %d", config->count);
> +    SPICE_DEBUG("monitors config: n: %d/%d", config->count, config->max_allowed);
>  
> +    c->monitors_max = config->max_allowed;
>      c->monitors = g_array_set_size(c->monitors, config->count);
>  
>      for (i = 0; i < config->count; i++) {
> diff --git a/spice-common b/spice-common
> index 6a9d40f..6bcb4ff 160000
> --- a/spice-common
> +++ b/spice-common
> @@ -1 +1 @@
> -Subproject commit 6a9d40f7f03756599f4a3880c212a379be9e784e
> +Subproject commit 6bcb4fff0df7bbc8e708cc9c6022efff06a81ace
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list