static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data) { struct spice_context *ctx = data; int id; g_object_get(channel, "channel-id", &id, NULL); ctx->channels++; SPICE_DEBUG("new channel (#%d)", id); g_signal_connect(channel, "open-fd", G_CALLBACK(channel_open_fd), ctx); if (SPICE_IS_MAIN_CHANNEL(channel)) { SPICE_DEBUG("new main channel"); g_signal_connect(channel, "channel-event", G_CALLBACK(main_channel_event), ctx); } if (SPICE_IS_DISPLAY_CHANNEL(channel)) { if (ctx->display != NULL) return; SPICE_DEBUG("new display channel (#%d)", id); ctx->display = spice_display_new(ctx, id); ctx->display_channel = id; } if (SPICE_IS_PLAYBACK_CHANNEL(channel)) { SPICE_DEBUG("new audio channel"); spice_audio_get(s, NULL); } }
static SpiceWindow *create_spice_window(spice_connection *conn, SpiceChannel *channel, int id) { SpiceWindow *win; win = g_new0 (SpiceWindow, 1); win->id = id; //win->monitor_id = monitor_id; win->conn = conn; win->display_channel = channel; win->spice = (spice_display_new(conn->session, id)); return win; }
static void channel_new(SpiceSession *s, SpiceChannel *c, gpointer *data) { int id = 0; g_object_get(c, "channel-id", &id, NULL); if (SPICE_IS_MAIN_CHANNEL(c)) { fprintf(stdout, "new main channel\n"); return; } if (SPICE_IS_DISPLAY_CHANNEL(c)) { fprintf(stdout, "new display channel (#%d), creating window\n", id); spice_display = spice_display_new(s, id); gtk_container_add(GTK_CONTAINER(main_window), GTK_WIDGET(spice_display)); gtk_widget_show_all(main_window); return; } }