diff options
Diffstat (limited to 'gtk/spice-widget.c')
-rw-r--r-- | gtk/spice-widget.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c index fa4bd1d..7e5812f 100644 --- a/gtk/spice-widget.c +++ b/gtk/spice-widget.c @@ -963,7 +963,6 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data) { SpiceDisplay *display = data; spice_display *d = SPICE_DISPLAY_GET_PRIVATE(display); - int type = spice_channel_type(channel); int id = spice_channel_id(channel); if (SPICE_IS_MAIN_CHANNEL(channel)) { @@ -975,6 +974,21 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data) return; } + if (SPICE_IS_DISPLAY_CHANNEL(channel)) { + fprintf(stderr, "%s: display channel\n", __FUNCTION__); + if (id != d->channel_id) + return; + d->display = channel; + g_signal_connect(channel, "spice-display-primary-create", + G_CALLBACK(primary_create), display); + g_signal_connect(channel, "spice-display-primary-destroy", + G_CALLBACK(primary_destroy), display); + g_signal_connect(channel, "spice-display-invalidate", + G_CALLBACK(invalidate), display); + spice_channel_connect(channel); + return; + } + if (SPICE_IS_CURSOR_CHANNEL(channel)) { fprintf(stderr, "%s: cursor channel\n", __FUNCTION__); if (id != d->channel_id) @@ -999,24 +1013,8 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data) return; } - switch (type) { - case SPICE_CHANNEL_DISPLAY: - fprintf(stderr, "%s: display channel\n", __FUNCTION__); - if (id != d->channel_id) - return; - d->display = channel; - g_signal_connect(channel, "spice-display-primary-create", - G_CALLBACK(primary_create), display); - g_signal_connect(channel, "spice-display-primary-destroy", - G_CALLBACK(primary_destroy), display); - g_signal_connect(channel, "spice-display-invalidate", - G_CALLBACK(invalidate), display); - spice_channel_connect(channel); - break; - default: - fprintf(stderr, "%s: other channel (type %d)\n", __FUNCTION__, type); - return; - } + fprintf(stderr, "%s: unknown channel object\n", __FUNCTION__); + return; } GtkWidget *spice_display_new(SpiceSession *session, int id) |