diff --git a/src/protocols/rdp/Makefile.am b/src/protocols/rdp/Makefile.am index 65b7ab8c..eae0a94e 100644 --- a/src/protocols/rdp/Makefile.am +++ b/src/protocols/rdp/Makefile.am @@ -71,6 +71,7 @@ guacdr_sources = \ guac_rdpdr/rdpdr_service.c noinst_HEADERS = \ + compat/client-cliprdr.h \ guac_rdpdr/rdpdr_messages.h \ guac_rdpdr/rdpdr_printer.h \ guac_rdpdr/rdpdr_service.h \ diff --git a/src/protocols/rdp/compat/client-cliprdr.h b/src/protocols/rdp/compat/client-cliprdr.h new file mode 100644 index 00000000..3b9c8c53 --- /dev/null +++ b/src/protocols/rdp/compat/client-cliprdr.h @@ -0,0 +1,46 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is libguac-client-rdp. + * + * The Initial Developer of the Original Code is + * Michael Jumper. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef __GUAC_CLIENT_CLIPRDR_COMPAT_H +#define __GUAC_CLIENT_CLIPRDR_COMPAT_H + +#include + +#define CliprdrChannel_Class RDP_EVENT_CLASS_CLIPRDR +#define CliprdrChannel_FormatList RDP_EVENT_TYPE_CB_FORMAT_LIST + +#endif + diff --git a/src/protocols/rdp/guac_handlers.c b/src/protocols/rdp/guac_handlers.c index a0774512..2883a8b0 100644 --- a/src/protocols/rdp/guac_handlers.c +++ b/src/protocols/rdp/guac_handlers.c @@ -56,7 +56,7 @@ #ifdef HAVE_FREERDP_CLIENT_CLIPRDR_H #include #else -#include +#include "compat/client-cliprdr.h" #endif #ifdef ENABLE_WINPR @@ -201,7 +201,7 @@ int rdp_guac_client_handle_messages(guac_client* client) { /* Handle clipboard events */ #ifdef LEGACY_EVENT - if (event->event_class == RDP_EVENT_CLASS_CLIPRDR) + if (event->event_class == CliprdrChannel_Class) guac_rdp_process_cliprdr_event(client, event); #else if (GetMessageClass(event->id) == CliprdrChannel_Class) @@ -427,19 +427,11 @@ int rdp_guac_client_clipboard_handler(guac_client* client, char* data) { rdpChannels* channels = ((rdp_guac_client_data*) client->data)->rdp_inst->context->channels; -#ifdef LEGACY_EVENT - RDP_CB_FORMAT_LIST_EVENT* format_list = - (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new( - RDP_EVENT_CLASS_CLIPRDR, - RDP_EVENT_TYPE_CB_FORMAT_LIST, - NULL, NULL); -#else RDP_CB_FORMAT_LIST_EVENT* format_list = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new( CliprdrChannel_Class, CliprdrChannel_FormatList, NULL, NULL); -#endif /* Free existing data */ free(((rdp_guac_client_data*) client->data)->clipboard); diff --git a/src/protocols/rdp/rdp_bitmap.c b/src/protocols/rdp/rdp_bitmap.c index 6973f94f..be0c6b68 100644 --- a/src/protocols/rdp/rdp_bitmap.c +++ b/src/protocols/rdp/rdp_bitmap.c @@ -95,10 +95,14 @@ void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) { /* Convert image data if present */ if (bitmap->data != NULL) { + /* Get client data */ + guac_client* client = ((rdp_freerdp_context*) context)->client; + rdp_guac_client_data* client_data = (rdp_guac_client_data*) client->data; + /* Convert image data to 32-bit RGB */ unsigned char* image_buffer = freerdp_image_convert(bitmap->data, NULL, bitmap->width, bitmap->height, - context->instance->settings->color_depth, + client_data->settings.color_depth, 32, ((rdp_freerdp_context*) context)->clrconv); /* Free existing image, if any */ diff --git a/src/protocols/rdp/rdp_cliprdr.c b/src/protocols/rdp/rdp_cliprdr.c index 846913ec..ab2f1382 100644 --- a/src/protocols/rdp/rdp_cliprdr.c +++ b/src/protocols/rdp/rdp_cliprdr.c @@ -39,7 +39,12 @@ #include #include #include -#include + +#ifdef HAVE_FREERDP_CLIENT_CLIPRDR_H +#include +#else +#include "compat/client-cliprdr.h" +#endif #ifdef ENABLE_WINPR #include @@ -53,7 +58,7 @@ #include "client.h" #include "rdp_cliprdr.h" -void guac_rdp_process_cliprdr_event(guac_client* client, RDP_EVENT* event) { +void guac_rdp_process_cliprdr_event(guac_client* client, wMessage* event) { switch (event->event_type) { @@ -84,7 +89,7 @@ void guac_rdp_process_cliprdr_event(guac_client* client, RDP_EVENT* event) { } -void guac_rdp_process_cb_monitor_ready(guac_client* client, RDP_EVENT* event) { +void guac_rdp_process_cb_monitor_ready(guac_client* client, wMessage* event) { rdpChannels* channels = ((rdp_guac_client_data*) client->data)->rdp_inst->context->channels; @@ -102,7 +107,7 @@ void guac_rdp_process_cb_monitor_ready(guac_client* client, RDP_EVENT* event) { format_list->formats[0] = CB_FORMAT_TEXT; format_list->num_formats = 1; - freerdp_channels_send_event(channels, (RDP_EVENT*) format_list); + freerdp_channels_send_event(channels, (wMessage*) format_list); } @@ -131,7 +136,7 @@ void guac_rdp_process_cb_format_list(guac_client* client, data_request->format = CB_FORMAT_TEXT; /* Send request */ - freerdp_channels_send_event(channels, (RDP_EVENT*) data_request); + freerdp_channels_send_event(channels, (wMessage*) data_request); return; } @@ -174,7 +179,7 @@ void guac_rdp_process_cb_data_request(guac_client* client, } /* Send response */ - freerdp_channels_send_event(channels, (RDP_EVENT*) data_response); + freerdp_channels_send_event(channels, (wMessage*) data_response); }