static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data) { //__android_log_write(ANDROID_LOG_DEBUG, TAG, "channel_new"); SpiceDisplay *display = data; SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display); int id; g_object_get(channel, "channel-id", &id, NULL); if (SPICE_IS_MAIN_CHANNEL(channel)) { d->main = SPICE_MAIN_CHANNEL(channel); spice_g_signal_connect_object(channel, "main-mouse-update", G_CALLBACK(update_mouse_mode), display, 0); update_mouse_mode(channel, display); // TODO: For now, connect to this signal with a callback that disables // any secondary displays that crop up. g_signal_connect(channel, "main-agent-update", G_CALLBACK(disable_secondary_displays), display); return; } if (SPICE_IS_DISPLAY_CHANNEL(channel)) { if (id != d->channel_id) return; d->display = channel; g_signal_connect(channel, "display-primary-create", G_CALLBACK(primary_create), display); g_signal_connect(channel, "display-primary-destroy", G_CALLBACK(primary_destroy), display); g_signal_connect(channel, "display-invalidate", G_CALLBACK(invalidate), display); spice_channel_connect(channel); return; } if (SPICE_IS_CURSOR_CHANNEL(channel)) { if (id != d->channel_id) return; d->cursor = SPICE_CURSOR_CHANNEL(channel); g_signal_connect(channel, "cursor-set", G_CALLBACK(cursor_set), display); g_signal_connect(channel, "cursor-hide", G_CALLBACK(cursor_hide), display); g_signal_connect(channel, "cursor-reset", G_CALLBACK(cursor_reset), display); spice_channel_connect(channel); return; } if (SPICE_IS_INPUTS_CHANNEL(channel)) { d->inputs = SPICE_INPUTS_CHANNEL(channel); spice_channel_connect(channel); return; } }
static void channel_new(SpiceSession *session, SpiceChannel *channel, gpointer user_data) { g_return_if_fail(SPICE_IS_GTK_SESSION(user_data)); SpiceGtkSession *self = user_data; SpiceGtkSessionPrivate *s = self->priv; if (SPICE_IS_MAIN_CHANNEL(channel)) { SPICE_DEBUG("Changing main channel from %p to %p", s->main, channel); s->main = SPICE_MAIN_CHANNEL(channel); g_signal_connect(channel, "main-clipboard-selection-grab", G_CALLBACK(clipboard_grab), self); g_signal_connect(channel, "main-clipboard-selection-request", G_CALLBACK(clipboard_request), self); g_signal_connect(channel, "main-clipboard-selection-release", G_CALLBACK(clipboard_release), self); } }
static void channel_destroy(SpiceSession *session, SpiceChannel *channel, gpointer user_data) { g_return_if_fail(SPICE_IS_GTK_SESSION(user_data)); SpiceGtkSession *self = user_data; SpiceGtkSessionPrivate *s = self->priv; guint i; if (SPICE_IS_MAIN_CHANNEL(channel) && SPICE_MAIN_CHANNEL(channel) == s->main) { s->main = NULL; for (i = 0; i < CLIPBOARD_LAST; ++i) { if (s->clipboard_by_guest[i]) { GtkClipboard *cb = get_clipboard_from_selection(s, i); if (cb) gtk_clipboard_clear(cb); s->clipboard_by_guest[i] = FALSE; } s->clip_grabbed[i] = FALSE; s->nclip_targets[i] = 0; } } }
static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data) { __android_log_write(6, "android-spice", "channel_new"); SpiceDisplay *display = data; SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display); int id; g_object_get(channel, "channel-id", &id, NULL); if (SPICE_IS_MAIN_CHANNEL(channel)) { d->main = SPICE_MAIN_CHANNEL(channel); spice_g_signal_connect_object(channel, "main-mouse-update", G_CALLBACK(update_mouse_mode), display, 0); update_mouse_mode(channel, display); // TODO: For now, connect to this signal with a callback that disables // any secondary displays that crop up. g_signal_connect(channel, "main-agent-update", G_CALLBACK(disable_secondary_displays), display); return; } if (SPICE_IS_DISPLAY_CHANNEL(channel)) { if (id != d->channel_id) return; d->display = channel; g_signal_connect(channel, "display-primary-create", G_CALLBACK(primary_create), display); g_signal_connect(channel, "display-primary-destroy", G_CALLBACK(primary_destroy), display); g_signal_connect(channel, "display-invalidate", G_CALLBACK(invalidate), display); g_signal_connect(channel, "display-mark", G_CALLBACK(mark), display); spice_channel_connect(channel); return; } //if (SPICE_IS_CURSOR_CHANNEL(channel)) { // if (id != d->channel_id) // return; // d->cursor = SPICE_CURSOR_CHANNEL(channel); // g_signal_connect(channel, "cursor-set", // G_CALLBACK(cursor_set), display); // g_signal_connect(channel, "cursor-move", // G_CALLBACK(cursor_move), display); // g_signal_connect(channel, "cursor-hide", // G_CALLBACK(cursor_hide), display); // g_signal_connect(channel, "cursor-reset", // G_CALLBACK(cursor_reset), display); // spice_channel_connect(channel); // return; //} if (SPICE_IS_INPUTS_CHANNEL(channel)) { d->inputs = SPICE_INPUTS_CHANNEL(channel); spice_channel_connect(channel); //sync_keyboard_lock_modifiers(display); return; } #ifdef USE_SMARTCARD if (SPICE_IS_SMARTCARD_CHANNEL(channel)) { d->smartcard = SPICE_SMARTCARD_CHANNEL(channel); spice_channel_connect(channel); return; } #endif return; }
static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data) { spice_connection *conn = data; int id; g_object_get(channel, "channel-id", &id, NULL); conn->channels++; SPICE_DEBUG("new channel (#%d)", id); if (SPICE_IS_MAIN_CHANNEL(channel)) { SPICE_DEBUG("new main channel"); conn->main = SPICE_MAIN_CHANNEL(channel); g_signal_connect(channel, "channel-event", G_CALLBACK(main_channel_event), conn); //g_signal_connect(channel, "main-mouse-update", // G_CALLBACK(main_mouse_update), conn); //g_signal_connect(channel, "main-agent-update", // G_CALLBACK(main_agent_update), conn); //main_mouse_update(channel, conn); //main_agent_update(channel, conn); } if (SPICE_IS_DISPLAY_CHANNEL(channel)) { if (id >= SPICE_N_ELEMENTS(conn->wins)) return; if (conn->wins[id] != NULL) return; SPICE_DEBUG("new display channel (#%d)", id); conn->wins[id] = create_spice_window(conn, channel, id); //g_signal_connect(channel, "display-mark", // G_CALLBACK(display_mark), conn->wins[id]); //update_auto_usbredir_sensitive(conn); } if (SPICE_IS_INPUTS_CHANNEL(channel)) { SPICE_DEBUG("new inputs channel"); //g_signal_connect(channel, "inputs-modifiers", // G_CALLBACK(inputs_modifiers), conn); } if (soundEnabled && SPICE_IS_PLAYBACK_CHANNEL(channel)) { SPICE_DEBUG("new audio channel"); conn->audio = spice_audio_get(s, NULL); } if (SPICE_IS_USBREDIR_CHANNEL(channel)) { __android_log_write(ANDROID_LOG_INFO, "android-spice", "Created USB channel, attempting to add devices"); SpiceUsbDeviceManager *manager = spice_usb_device_manager_get(s, NULL); GPtrArray *devices = spice_usb_device_manager_get_devices(manager); if (devices) { for (int i = 0; i < devices->len; i++) { __android_log_write(ANDROID_LOG_INFO, "android-spicy", "Devices found, connecting..."); usb_device_added(manager, g_ptr_array_index(devices, i), NULL); } g_ptr_array_unref(devices); } } //if (SPICE_IS_PORT_CHANNEL(channel)) { // g_signal_connect(channel, "notify::port-opened", // G_CALLBACK(port_opened), conn); // g_signal_connect(channel, "port-data", // G_CALLBACK(port_data), conn); // spice_channel_connect(channel); //} }