From 207cd10dccda47fa37baa82096dcd51e01c66661 Mon Sep 17 00:00:00 2001 From: Jonathon Jongsma Date: Mon, 31 Oct 2016 16:06:51 -0500 Subject: [PATCH] Limit maximum "n-surfaces" via param spec In commit beec1b41, we manually limited this property value in _set_property(). But there's a simpler way to do it: via the param spec for the property. This also means that we can remove the warning log in red_worker_new() since GObject will automatically warn if a property is assigned a value outside of its valid range. Change the minimum and default value for this property from 0 to 1 so that we always have a primary surface. Signed-off-by: Jonathon Jongsma Acked-by: Frediano Ziglio --- server/display-channel.c | 5 ++--- server/red-worker.c | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/server/display-channel.c b/server/display-channel.c index c1151464..bcdde134 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -60,7 +60,6 @@ display_channel_set_property(GObject *object, { case PROP_N_SURFACES: self->priv->n_surfaces = g_value_get_uint(value); - self->priv->n_surfaces = MIN(self->priv->n_surfaces, NUM_SURFACES); break; case PROP_VIDEO_CODECS: if (self->priv->video_codecs) { @@ -2238,8 +2237,8 @@ display_channel_class_init(DisplayChannelClass *klass) g_param_spec_uint("n-surfaces", "number of surfaces", "Number of surfaces for this channel", - 0, G_MAXUINT, - 0, + 1, NUM_SURFACES, + 1, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); diff --git a/server/red-worker.c b/server/red-worker.c index ab9d79c3..43836468 100644 --- a/server/red-worker.c +++ b/server/red-worker.c @@ -1358,8 +1358,6 @@ RedWorker* red_worker_new(QXLInstance *qxl, init_info.memslot_id_bits, init_info.internal_groupslot_id); - spice_warn_if_fail(init_info.n_surfaces <= NUM_SURFACES); - worker->event_timeout = INF_EVENT_WAIT; worker->cursor_channel = cursor_channel_new(reds, qxl,