Fix cliprdr portability handling.

This commit is contained in:
Michael Jumper 2013-07-18 12:57:06 -07:00
parent f3f0900de9
commit 3e9f551c4e
5 changed files with 65 additions and 17 deletions

View File

@ -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 \

View File

@ -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 <freerdp/plugins/cliprdr.h>
#define CliprdrChannel_Class RDP_EVENT_CLASS_CLIPRDR
#define CliprdrChannel_FormatList RDP_EVENT_TYPE_CB_FORMAT_LIST
#endif

View File

@ -56,7 +56,7 @@
#ifdef HAVE_FREERDP_CLIENT_CLIPRDR_H
#include <freerdp/client/cliprdr.h>
#else
#include <freerdp/plugins/cliprdr.h>
#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);

View File

@ -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 */

View File

@ -39,7 +39,12 @@
#include <freerdp/freerdp.h>
#include <freerdp/channels/channels.h>
#include <freerdp/utils/event.h>
#include <freerdp/plugins/cliprdr.h>
#ifdef HAVE_FREERDP_CLIENT_CLIPRDR_H
#include <freerdp/client/cliprdr.h>
#else
#include "compat/client-cliprdr.h"
#endif
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
@ -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);
}