[Spice-commits] 2 commits - src/channel-main.c src/spice-option.c src/spice-session.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 8 07:49:14 UTC 2019


 src/channel-main.c  |   27 +++++++++++++--------------
 src/spice-option.c  |   28 +++-------------------------
 src/spice-session.c |   13 +++++++------
 3 files changed, 23 insertions(+), 45 deletions(-)

New commits:
commit 223def160cdd03d4c8f821513bd86b746f090c2b
Author: Victor Toso <me at victortoso.com>
Date:   Tue Jan 8 16:31:27 2019 +0100

    option: Hide --spice-color-depth and warn on usage
    
    As this is NOP from previous patch and has been deprecated since v0.34
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/src/spice-option.c b/src/spice-option.c
index dc5ca4d..7df093d 100644
--- a/src/spice-option.c
+++ b/src/spice-option.c
@@ -26,7 +26,6 @@
 #include "usb-device-manager.h"
 
 static GStrv disable_effects = NULL;
-static gint color_depth = 0;
 static char *ca_file = NULL;
 static char *host_subject = NULL;
 static char *smartcard_db = NULL;
@@ -58,28 +57,8 @@ static gboolean option_debug(void)
 static gboolean parse_color_depth(const gchar *option_name, const gchar *value,
                                   gpointer data, GError **error)
 {
-    unsigned long parsed_depth;
-    char *end;
-
-    if (option_name == NULL) {
-        g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED, _("missing color depth, must be 16 or 32"));
-        return FALSE;
-    }
-
-    parsed_depth = strtoul(value, &end, 0);
-    if (*end != '\0')
-        goto error;
-
-    if ((parsed_depth != 16) && (parsed_depth != 32))
-        goto error;
-
-    color_depth = parsed_depth;
-
+    g_warning(_("--spice-color-depth is deprecated. Use guest's display settings instead"));
     return TRUE;
-
-error:
-    g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED, _("invalid color depth (%s), must be 16 or 32"), value);
-    return FALSE;
 }
 
 static gboolean parse_disable_effects(const gchar *option_name, const gchar *value,
@@ -183,7 +162,8 @@ GOptionGroup* spice_get_option_group(void)
           N_("Force the specified channels to be secured"), "<main,display,inputs,...,all>" },
         { "spice-disable-effects", '\0', 0, G_OPTION_ARG_CALLBACK, parse_disable_effects,
           N_("Disable guest display effects"), "<wallpaper,font-smooth,animation,all>" },
-        { "spice-color-depth", '\0', 0, G_OPTION_ARG_CALLBACK, parse_color_depth,
+        /* Deprecated */
+        { "spice-color-depth", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_CALLBACK, parse_color_depth,
           N_("Guest display color depth (deprecated)"), "<16,32>" },
         { "spice-ca-file", '\0', 0, G_OPTION_ARG_FILENAME, &ca_file,
           N_("Truststore file for secure connections"), N_("<file>") },
@@ -263,8 +243,6 @@ void spice_set_session_option(SpiceSession *session)
         g_strfreev(channels);
     }
 
-    if (color_depth)
-        g_object_set(session, "color-depth", color_depth, NULL);
     if (ca_file)
         g_object_set(session, "ca-file", ca_file, NULL);
     if (host_subject)
commit 33522e501eb83a7aa851cd5da9dcc5ed3d48250b
Author: Victor Toso <me at victortoso.com>
Date:   Tue Dec 11 13:48:14 2018 +0100

    Deprecate “color-depth” properties
    
    With commit 1a980f3712 we deprecated some command line options. The
    color-depth one is the only one which is not used for testing/debug
    purposes.
    
    The intention of this option is to set guest's video driver color
    configuration, currently only windows guest agent uses this feature up
    to Windows 7. Windows 8 and up, setting color depth below 32 would
    fail. We should not encourage the usage of this feature.
    
    Related: https://bugzilla.redhat.com/show_bug.cgi?id=1543538
    Related: https://bugzilla.redhat.com/show_bug.cgi?id=1350853
    
    This patch deprecates both SpiceMainChannel::color-depth and
    SpiceSession::color-depth while ignoring any set/get to it.
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/src/channel-main.c b/src/channel-main.c
index 6274b59..10c31ac 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -89,7 +89,6 @@ struct _SpiceMainChannelPrivate  {
     bool                        agent_caps_received;
 
     gboolean                    agent_display_config_sent;
-    guint8                      display_color_depth;
     gboolean                    display_disable_wallpaper:1;
     gboolean                    display_disable_font_smooth:1;
     gboolean                    display_disable_animation:1;
@@ -297,8 +296,8 @@ static void spice_main_get_property(GObject    *object,
     case PROP_DISPLAY_DISABLE_ANIMATION:
         g_value_set_boolean(value, c->display_disable_animation);
         break;
-    case PROP_DISPLAY_COLOR_DEPTH:
-        g_value_set_uint(value, c->display_color_depth);
+    case PROP_DISPLAY_COLOR_DEPTH: /* FIXME: deprecated */
+        g_value_set_uint(value, 32);
         break;
     case PROP_DISABLE_DISPLAY_POSITION:
         g_value_set_boolean(value, c->disable_display_position);
@@ -331,12 +330,9 @@ static void spice_main_set_property(GObject *gobject, guint prop_id,
     case PROP_DISPLAY_DISABLE_ANIMATION:
         c->display_disable_animation = g_value_get_boolean(value);
         break;
-    case PROP_DISPLAY_COLOR_DEPTH: {
-        guint color_depth = g_value_get_uint(value);
-        g_return_if_fail(color_depth % 8 == 0);
-        c->display_color_depth = color_depth;
+    case PROP_DISPLAY_COLOR_DEPTH:
+        spice_info("SpiceMainChannel::color-depth has been deprecated. Property is ignored");
         break;
-    }
     case PROP_DISABLE_DISPLAY_POSITION:
         c->disable_display_position = g_value_get_boolean(value);
         break;
@@ -550,11 +546,19 @@ static void spice_main_channel_class_init(SpiceMainChannelClass *klass)
                               G_PARAM_CONSTRUCT |
                               G_PARAM_STATIC_STRINGS));
 
+    /**
+     * SpiceMainChannel:color-depth:
+     *
+     * Deprecated: 0.37: Deprecated due lack of support in drivers, only Windows 7 and older.
+     * This option is currently ignored.
+     *
+     **/
     g_object_class_install_property
         (gobject_class, PROP_DISPLAY_COLOR_DEPTH,
          g_param_spec_uint("color-depth",
                            "Color depth",
                            "Color depth", 0, 32, 0,
+                           G_PARAM_DEPRECATED |
                            G_PARAM_READWRITE |
                            G_PARAM_CONSTRUCT |
                            G_PARAM_STATIC_STRINGS));
@@ -1137,7 +1141,7 @@ gboolean spice_main_channel_send_monitor_config(SpiceMainChannel *channel)
                 j++;
             continue;
         }
-        mon->monitors[j].depth  = c->display_color_depth ? c->display_color_depth : 32;
+        mon->monitors[j].depth  = 32;
         mon->monitors[j].width  = c->display[i].width;
         mon->monitors[j].height = c->display[i].height;
         mon->monitors[j].x = c->display[i].x;
@@ -1301,11 +1305,6 @@ static void agent_display_config(SpiceMainChannel *channel)
         config.flags |= VD_AGENT_DISPLAY_CONFIG_FLAG_DISABLE_ANIMATION;
     }
 
-    if (c->display_color_depth != 0) {
-        config.flags |= VD_AGENT_DISPLAY_CONFIG_FLAG_SET_COLOR_DEPTH;
-        config.depth = c->display_color_depth;
-    }
-
     CHANNEL_DEBUG(channel, "display_config: flags: %u, depth: %u", config.flags, config.depth);
 
     agent_msg_queue(channel, VD_AGENT_DISPLAY_CONFIG, sizeof(VDAgentDisplayConfig), &config);
diff --git a/src/spice-session.c b/src/spice-session.c
index 5609c9b..8952897 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -85,7 +85,6 @@ struct _SpiceSessionPrivate {
 
     GStrv             disable_effects;
     GStrv             secure_channels;
-    gint              color_depth;
 
     int               connection_id;
     int               protocol;
@@ -670,8 +669,8 @@ static void spice_session_get_property(GObject    *gobject,
     case PROP_SECURE_CHANNELS:
         g_value_set_boxed(value, s->secure_channels);
         break;
-    case PROP_COLOR_DEPTH:
-        g_value_set_int(value, s->color_depth);
+    case PROP_COLOR_DEPTH: /* FIXME: deprecated */
+        g_value_set_int(value, 0);
         break;
     case PROP_AUDIO:
         g_value_set_boolean(value, s->audio);
@@ -814,7 +813,7 @@ static void spice_session_set_property(GObject      *gobject,
         s->secure_channels = g_value_dup_boxed(value);
         break;
     case PROP_COLOR_DEPTH:
-        s->color_depth = g_value_get_int(value);
+        spice_info("SpiceSession::color-depth has been deprecated. Property is ignored");
         break;
     case PROP_AUDIO:
         s->audio = g_value_get_boolean(value);
@@ -1119,6 +1118,9 @@ static void spice_session_class_init(SpiceSessionClass *klass)
      * Display color depth to set on new display channels. If 0, don't set.
      *
      * Since: 0.7
+     *
+     * Deprecated: 0.37: Deprecated due lack of support in drivers, only Windows 7 and older.
+     * This option is currently ignored.
      **/
     g_object_class_install_property
         (gobject_class, PROP_COLOR_DEPTH,
@@ -1126,6 +1128,7 @@ static void spice_session_class_init(SpiceSessionClass *klass)
                           "Color depth",
                           "Display channel color depth",
                           0, 32, 0,
+                          G_PARAM_DEPRECATED |
                           G_PARAM_READWRITE |
                           G_PARAM_STATIC_STRINGS));
 
@@ -2276,8 +2279,6 @@ void spice_session_channel_new(SpiceSession *session, SpiceChannel *channel)
                      "disable-font-smooth", all || spice_strv_contains(s->disable_effects, "font-smooth"),
                      "disable-animation", all || spice_strv_contains(s->disable_effects, "animation"),
                      NULL);
-        if (s->color_depth != 0)
-            g_object_set(channel, "color-depth", s->color_depth, NULL);
 
         CHANNEL_DEBUG(channel, "new main channel, switching");
         s->cmain = channel;


More information about the Spice-commits mailing list