Detect event interface, fix cliprdr.

This commit is contained in:
Michael Jumper 2013-07-18 11:54:22 -07:00
parent c0f681066e
commit f3f0900de9
3 changed files with 49 additions and 4 deletions

View File

@ -218,6 +218,7 @@ have_freerdp=yes
legacy_freerdp_extensions=no legacy_freerdp_extensions=no
rdpsettings_interface=unknown rdpsettings_interface=unknown
freerdp_interface=unknown freerdp_interface=unknown
event_interface=unknown
RDP_LIBS= RDP_LIBS=
# libfreerdp-cache # libfreerdp-cache
@ -362,6 +363,31 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <winpr/wtypes.h>
rdpBitmap b = { .Decompress = __decompress };]])],, rdpBitmap b = { .Decompress = __decompress };]])],,
[AC_DEFINE([LEGACY_RDPBITMAP])]) [AC_DEFINE([LEGACY_RDPBITMAP])])
#
# FreeRDP: wMessage / RDP_EVENT
#
# Check for current (as of 1.1) wMessage interface
AC_CHECK_MEMBERS([wMessage.id],
[event_interface=stable],,
[[#include <winpr/collections.h>]])
# If not current, check for legacy (RDP_EVENT) interface
if test "x${event_interface}" = "xunknown"
then
AC_CHECK_MEMBERS([RDP_EVENT.event_class],
[event_interface=legacy],,
[[#include <freerdp/types.h>]])
fi
# Set defines based on interface type, warn if unknown
if test "x${event_interface}" = "xlegacy"; then
AC_DEFINE([LEGACY_EVENT])
elif test "x${event_interface}" = "xunknown"; then
have_freerdp=no
fi
AM_CONDITIONAL([LEGACY_FREERDP_EXTENSIONS], [test "x${legacy_freerdp_extensions}" = "xyes"]) AM_CONDITIONAL([LEGACY_FREERDP_EXTENSIONS], [test "x${legacy_freerdp_extensions}" = "xyes"])
AM_CONDITIONAL([ENABLE_WINPR], [test "x${have_winpr}" = "xyes"]) AM_CONDITIONAL([ENABLE_WINPR], [test "x${have_winpr}" = "xyes"])
AM_CONDITIONAL([ENABLE_RDP], [test "x${have_freerdp}" = "xyes"]) AM_CONDITIONAL([ENABLE_RDP], [test "x${have_freerdp}" = "xyes"])

View File

@ -118,7 +118,7 @@ int rdp_guac_client_handle_messages(guac_client* client) {
int read_count = 0; int read_count = 0;
int write_count = 0; int write_count = 0;
fd_set rfds, wfds; fd_set rfds, wfds;
RDP_EVENT* event; wMessage* event;
struct timeval timeout = { struct timeval timeout = {
.tv_sec = 0, .tv_sec = 0,
@ -200,8 +200,13 @@ int rdp_guac_client_handle_messages(guac_client* client) {
if (event) { if (event) {
/* Handle clipboard events */ /* Handle clipboard events */
#ifdef LEGACY_EVENT
if (event->event_class == RDP_EVENT_CLASS_CLIPRDR) if (event->event_class == RDP_EVENT_CLASS_CLIPRDR)
guac_rdp_process_cliprdr_event(client, event); guac_rdp_process_cliprdr_event(client, event);
#else
if (GetMessageClass(event->id) == CliprdrChannel_Class)
guac_rdp_process_cliprdr_event(client, event);
#endif
freerdp_event_free(event); freerdp_event_free(event);
@ -422,11 +427,19 @@ int rdp_guac_client_clipboard_handler(guac_client* client, char* data) {
rdpChannels* channels = rdpChannels* channels =
((rdp_guac_client_data*) client->data)->rdp_inst->context->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* format_list =
(RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new( (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(
RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_CLASS_CLIPRDR,
RDP_EVENT_TYPE_CB_FORMAT_LIST, RDP_EVENT_TYPE_CB_FORMAT_LIST,
NULL, NULL); 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 existing data */
free(((rdp_guac_client_data*) client->data)->clipboard); free(((rdp_guac_client_data*) client->data)->clipboard);
@ -439,7 +452,7 @@ int rdp_guac_client_clipboard_handler(guac_client* client, char* data) {
format_list->formats[0] = CB_FORMAT_TEXT; format_list->formats[0] = CB_FORMAT_TEXT;
format_list->num_formats = 1; format_list->num_formats = 1;
freerdp_channels_send_event(channels, (RDP_EVENT*) format_list); freerdp_channels_send_event(channels, (wMessage*) format_list);
return 0; return 0;

View File

@ -38,10 +38,16 @@
#ifndef __GUAC_RDP_RDP_CLIPRDR_H #ifndef __GUAC_RDP_RDP_CLIPRDR_H
#define __GUAC_RDP_RDP_CLIPRDR_H #define __GUAC_RDP_RDP_CLIPRDR_H
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
#else
#include "compat/winpr-wtypes.h"
#endif
#include <freerdp/freerdp.h> #include <freerdp/freerdp.h>
void guac_rdp_process_cliprdr_event(guac_client* client, RDP_EVENT* event); void guac_rdp_process_cliprdr_event(guac_client* client, wMessage* 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);
void guac_rdp_process_cb_format_list(guac_client* client, void guac_rdp_process_cb_format_list(guac_client* client,
RDP_CB_FORMAT_LIST_EVENT* event); RDP_CB_FORMAT_LIST_EVENT* event);