diff -Naur Remmina-65d2ca4872150942cced1fbe92248dd933e9c0cb/remmina-plugins/rdp/rdp_cliprdr.c Remmina-65d2ca4872150942cced1fbe92248dd933e9c0cb.WORK/remmina-plugins/rdp/rdp_cliprdr.c --- Remmina-65d2ca4872150942cced1fbe92248dd933e9c0cb/remmina-plugins/rdp/rdp_cliprdr.c 2014-07-30 00:07:46.000000000 +0400 +++ Remmina-65d2ca4872150942cced1fbe92248dd933e9c0cb.WORK/remmina-plugins/rdp/rdp_cliprdr.c 2014-08-15 20:47:19.713200549 +0400 @@ -266,12 +266,12 @@ data = Stream_Buffer(s); size = Stream_Length(s); - Stream_Free(s, TRUE); + pixbuf = gdk_pixbuf_loader_new(); gdk_pixbuf_loader_write(pixbuf, data, size, NULL); + gdk_pixbuf_loader_close(pixbuf, NULL); Stream_Free(s, TRUE); output = g_object_ref(gdk_pixbuf_loader_get_pixbuf(pixbuf)); - gdk_pixbuf_loader_close(pixbuf, NULL); g_object_unref(pixbuf); break; } @@ -328,7 +328,7 @@ event = (RDP_CB_DATA_REQUEST_EVENT*) freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_DataRequest, NULL, NULL); event->format = rfi->format; - freerdp_channels_send_event(rfi->channels, (wMessage*) event); + freerdp_channels_send_event(rfi->instance->context->channels, (wMessage*) event); data = g_async_queue_timeout_pop(rfi->clipboard_queue, 1000000); if (data != NULL) @@ -373,16 +373,20 @@ result = gtk_clipboard_wait_for_targets(clipboard, &targets, &count); } - if (!result) - return 0; event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_FormatList, NULL, NULL); - remmina_rdp_cliprdr_get_target_types(&event->formats, &event->num_formats, targets, count); - g_free(targets); + if (result) + { + remmina_rdp_cliprdr_get_target_types(&event->formats, &event->num_formats, targets, count); + g_free(targets); + } + else + event->num_formats = 0; + - return freerdp_channels_send_event(rfi->channels, (wMessage*) event); + return freerdp_channels_send_event(rfi->instance->context->channels, (wMessage*) event); } void remmina_rdp_cliprdr_get_clipboard_data(RemminaProtocolWidget* gp, RemminaPluginRdpUiObject* ui) @@ -478,7 +482,7 @@ freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_DataResponse, NULL, NULL); event->data = outbuf; event->size = size; - freerdp_channels_send_event(rfi->channels, (wMessage*) event); + freerdp_channels_send_event(rfi->instance->context->channels, (wMessage*) event); } void remmina_rdp_cliprdr_set_clipboard_data(RemminaProtocolWidget* gp, RemminaPluginRdpUiObject* ui) diff -Naur Remmina-65d2ca4872150942cced1fbe92248dd933e9c0cb/remmina-plugins/rdp/rdp_plugin.c Remmina-65d2ca4872150942cced1fbe92248dd933e9c0cb.WORK/remmina-plugins/rdp/rdp_plugin.c --- Remmina-65d2ca4872150942cced1fbe92248dd933e9c0cb/remmina-plugins/rdp/rdp_plugin.c 2014-07-30 00:07:46.000000000 +0400 +++ Remmina-65d2ca4872150942cced1fbe92248dd933e9c0cb.WORK/remmina-plugins/rdp/rdp_plugin.c 2014-08-15 20:50:39.602705732 +0400 @@ -212,10 +212,12 @@ rfContext* rfi; ALIGN64 rdpSettings* settings; RemminaProtocolWidget* gp; + rdpChannels *channels; rfi = (rfContext*) instance->context; settings = instance->settings; gp = rfi->protocol_widget; + channels = instance->context->channels; settings->BitmapCacheEnabled = True; settings->OffscreenSupportLevel = True; @@ -254,9 +256,7 @@ rfi->rfx_context = rfx_context_new(FALSE); } - freerdp_register_addin_provider(freerdp_channels_load_static_addin_entry, 0); - - freerdp_channels_pre_connect(rfi->channels, instance); + freerdp_channels_pre_connect(instance->context->channels, instance); rfi->clrconv = freerdp_clrconv_new(CLRCONV_ALPHA); @@ -337,7 +337,7 @@ instance->update->EndPaint = rf_end_paint; instance->update->DesktopResize = rf_desktop_resize; - freerdp_channels_post_connect(rfi->channels, instance); + freerdp_channels_post_connect(instance->context->channels, instance); remmina_plugin_service->protocol_plugin_emit_signal(gp, "connect"); @@ -464,11 +464,15 @@ fd_set wfds_set; rfContext* rfi; wMessage* event; + + rdpChannels *channels; + memset(rfds, 0, sizeof(rfds)); memset(wfds, 0, sizeof(wfds)); rfi = GET_DATA(gp); + channels = rfi->instance->context->channels; while (1) { @@ -479,7 +483,7 @@ { break; } - if (!freerdp_channels_get_fds(rfi->channels, rfi->instance, rfds, &rcount, wfds, &wcount)) + if (!freerdp_channels_get_fds(channels, rfi->instance, rfds, &rcount, wfds, &wcount)) { break; } @@ -533,13 +537,13 @@ break; } /* check channel fds */ - if (!freerdp_channels_check_fds(rfi->channels, rfi->instance)) + if (!freerdp_channels_check_fds(channels, rfi->instance)) { break; } else { - event = freerdp_channels_pop_event(rfi->channels); + event = freerdp_channels_pop_event(channels); if (event) remmina_rdp_channels_process_event(gp, event); } @@ -572,6 +576,48 @@ return TRUE; } +int remmina_rdp_load_static_channel_addin(rdpChannels* channels, rdpSettings* settings, char* name, void* data) +{ + void* entry; + + entry = freerdp_load_channel_addin_entry(name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC); + + + + + if (entry) + { + + if (freerdp_channels_client_load(channels, settings, entry, data) == 0) + { + fprintf(stderr, "loading channel %s\n", name); + return 0; + } + } + + return -1; +} + + +int remmina_rdp_add_static_channel(rdpSettings* settings, int count, char** params) +{ + int index; + ADDIN_ARGV* args; + + args = (ADDIN_ARGV*) malloc(sizeof(ADDIN_ARGV)); + + args->argc = count; + args->argv = (char**) malloc(sizeof(char*) * args->argc); + + for (index = 0; index < args->argc; index++) + args->argv[index] = _strdup(params[index]); + + freerdp_static_channel_collection_add(settings, args); + + return 0; +} + + static gboolean remmina_rdp_main(RemminaProtocolWidget* gp) { gchar* s; @@ -584,6 +630,8 @@ const gchar* cs; RemminaFile* remminafile; rfContext* rfi; + ADDIN_ARGV* args; + gint index; rfi = GET_DATA(gp); remminafile = remmina_plugin_service->protocol_plugin_get_file(gp); @@ -750,7 +798,7 @@ */ /* remmina_rdp_load_plugin(rfi->channels, rfi->settings, "rdpsnd", rfi->rdpsnd_data); */ - remmina_rdp_load_plugin(rfi->channels, rfi->settings, "rdpsnd", rfi->settings); + remmina_rdp_load_plugin(rfi->instance->context->channels, rfi->settings, "rdpsnd", rfi->settings); /* TODO: Fix/Check this - Removed because of issue #280 rfi->drdynvc_data[drdynvc_num].size = sizeof(RDP_PLUGIN_DATA); rfi->drdynvc_data[drdynvc_num].data[0] = "audin"; @@ -760,12 +808,21 @@ if (drdynvc_num) { - remmina_rdp_load_plugin(rfi->channels, rfi->settings, "drdynvc", rfi->drdynvc_data); + remmina_rdp_load_plugin(rfi->instance->context->channels, rfi->settings, "drdynvc", rfi->drdynvc_data); } if (!remmina_plugin_service->file_get_int(remminafile, "disableclipboard", FALSE)) { - remmina_rdp_load_plugin(rfi->channels, rfi->settings, "cliprdr", NULL); + + if (!freerdp_static_channel_collection_find(rfi->settings, "cliprdr")) + { + char* params[1]; + params[0] = "cliprdr"; + remmina_rdp_add_static_channel(rfi->settings, 1, (char**) params); + } + + // Old version: remmina_rdp_load_plugin(rfi->instance->context->channels, rfi->settings, "cliprdr", NULL); + } rdpdr_num = 0; @@ -804,9 +861,19 @@ if (rdpdr_num) { //remmina_rdp_load_plugin(rfi->channels, rfi->settings, "rdpdr", rfi->rdpdr_data); - remmina_rdp_load_plugin(rfi->channels, rfi->settings, "rdpdr", rfi->settings); + remmina_rdp_load_plugin(rfi->instance->context->channels, rfi->settings, "rdpdr", rfi->settings); } + + for (index = 0; index < rfi->settings->StaticChannelCount; index++) + { + args = rfi->settings->StaticChannelArray[index]; + remmina_rdp_load_static_channel_addin(rfi->instance->context->channels, rfi->settings, args->argv[0], args); + + } + + + if (!freerdp_connect(rfi->instance)) { if (!rfi->user_cancelled) @@ -817,6 +884,8 @@ return FALSE; } + + remmina_rdp_main_loop(gp); @@ -843,6 +912,8 @@ { freerdp* instance; rfContext* rfi; + + freerdp_register_addin_provider(freerdp_channels_load_static_addin_entry, 0); instance = freerdp_new(); instance->PreConnect = remmina_rdp_pre_connect; @@ -861,7 +932,7 @@ rfi->protocol_widget = gp; rfi->instance = instance; rfi->settings = instance->settings; - rfi->channels = freerdp_channels_new(); + rfi->instance->context->channels = freerdp_channels_new(); pthread_mutex_init(&rfi->mutex, NULL); @@ -896,6 +967,7 @@ { rfContext* rfi; freerdp* instance; + rfi = GET_DATA(gp); instance = rfi->instance; @@ -918,11 +990,11 @@ if (instance) { - if (rfi->channels) + if (instance->context->channels) { //freerdp_channels_close(rfi->channels, instance); - freerdp_channels_free(rfi->channels); - rfi->channels = NULL; + freerdp_channels_free(instance->context->channels); + instance->context->channels = NULL; } if (freerdp_shall_disconnect(instance)) { diff -Naur Remmina-65d2ca4872150942cced1fbe92248dd933e9c0cb/remmina-plugins/rdp/rdp_plugin.h Remmina-65d2ca4872150942cced1fbe92248dd933e9c0cb.WORK/remmina-plugins/rdp/rdp_plugin.h --- Remmina-65d2ca4872150942cced1fbe92248dd933e9c0cb/remmina-plugins/rdp/rdp_plugin.h 2014-07-30 00:07:46.000000000 +0400 +++ Remmina-65d2ca4872150942cced1fbe92248dd933e9c0cb.WORK/remmina-plugins/rdp/rdp_plugin.h 2014-08-15 20:47:19.714200567 +0400 @@ -90,7 +90,7 @@ /* main */ rdpSettings* settings; freerdp* instance; - rdpChannels* channels; + // rdpChannels* channels; pthread_t thread; pthread_mutex_t mutex;