GUACAMOLE-249: Support rdpGlyph callback format used in FreeRDP 2.0.0-rc3 and older (used UINT32 instead of INT32).

This commit is contained in:
Michael Jumper 2020-01-13 16:09:44 -08:00
parent 9a34caf40f
commit 308d7a09a8
3 changed files with 71 additions and 12 deletions

View File

@ -564,6 +564,39 @@ then
fi fi
# Glyph callback variants
if test "x${have_freerdp2}" = "xyes"
then
# FreeRDP 2.0.0-rc3 and older used UINT32 for integer parameters to all
# rdpGlyph callbacks
AC_MSG_CHECKING([whether rdpGlyph callbacks accept INT32 integer parameters])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <freerdp/freerdp.h>
#include <freerdp/graphics.h>
#include <winpr/wtypes.h>
BOOL test_begindraw(rdpContext* context, INT32 x, INT32 y,
INT32 width, INT32 height, UINT32 fgcolor, UINT32 bgcolor,
BOOL redundant);
rdpGlyph glyph = {
.BeginDraw = test_begindraw
};
int main() {
return (int) glyph.BeginDraw(NULL, 0, 0, 0, 0, 0, 0, FALSE);
}
]])],
[AC_MSG_RESULT([yes])]
[AC_DEFINE([FREERDP_GLYPH_CALLBACKS_ACCEPT_INT32],,
[Whether rdpGlyph callbacks accept INT32 integer parameters])],
[AC_MSG_RESULT([no])])
fi
AM_CONDITIONAL([ENABLE_RDP], [test "x${have_freerdp2}" = "xyes"]) AM_CONDITIONAL([ENABLE_RDP], [test "x${have_freerdp2}" = "xyes"])
# #

View File

@ -91,7 +91,9 @@ BOOL guac_rdp_glyph_new(rdpContext* context, const rdpGlyph* glyph) {
} }
BOOL guac_rdp_glyph_draw(rdpContext* context, const rdpGlyph* glyph, BOOL guac_rdp_glyph_draw(rdpContext* context, const rdpGlyph* glyph,
INT32 x, INT32 y, INT32 w, INT32 h, INT32 sx, INT32 sy, GLYPH_CALLBACK_INT32 x, GLYPH_CALLBACK_INT32 y,
GLYPH_CALLBACK_INT32 w, GLYPH_CALLBACK_INT32 h,
GLYPH_CALLBACK_INT32 sx, GLYPH_CALLBACK_INT32 sy,
BOOL redundant) { BOOL redundant) {
guac_client* client = ((rdp_freerdp_context*) context)->client; guac_client* client = ((rdp_freerdp_context*) context)->client;
@ -127,9 +129,10 @@ void guac_rdp_glyph_free(rdpContext* context, rdpGlyph* glyph) {
} }
BOOL guac_rdp_glyph_begindraw(rdpContext* context, INT32 x, INT32 y, BOOL guac_rdp_glyph_begindraw(rdpContext* context,
INT32 width, INT32 height, UINT32 fgcolor, UINT32 bgcolor, GLYPH_CALLBACK_INT32 x, GLYPH_CALLBACK_INT32 y,
BOOL redundant) { GLYPH_CALLBACK_INT32 width, GLYPH_CALLBACK_INT32 height,
UINT32 fgcolor, UINT32 bgcolor, BOOL redundant) {
guac_client* client = ((rdp_freerdp_context*) context)->client; guac_client* client = ((rdp_freerdp_context*) context)->client;
guac_rdp_client* rdp_client = guac_rdp_client* rdp_client =
@ -157,8 +160,10 @@ BOOL guac_rdp_glyph_begindraw(rdpContext* context, INT32 x, INT32 y,
} }
BOOL guac_rdp_glyph_enddraw(rdpContext* context, INT32 x, INT32 y, BOOL guac_rdp_glyph_enddraw(rdpContext* context,
INT32 width, INT32 height, UINT32 fgcolor, UINT32 bgcolor) { GLYPH_CALLBACK_INT32 x, GLYPH_CALLBACK_INT32 y,
GLYPH_CALLBACK_INT32 width, GLYPH_CALLBACK_INT32 height,
UINT32 fgcolor, UINT32 bgcolor) {
/* IGNORE */ /* IGNORE */
return TRUE; return TRUE;
} }

View File

@ -20,11 +20,27 @@
#ifndef GUAC_RDP_GLYPH_H #ifndef GUAC_RDP_GLYPH_H
#define GUAC_RDP_GLYPH_H #define GUAC_RDP_GLYPH_H
#include "config.h"
#include <cairo/cairo.h> #include <cairo/cairo.h>
#include <freerdp/freerdp.h> #include <freerdp/freerdp.h>
#include <freerdp/graphics.h> #include <freerdp/graphics.h>
#include <winpr/wtypes.h> #include <winpr/wtypes.h>
#ifdef FREERDP_GLYPH_CALLBACKS_ACCEPT_INT32
/**
* FreeRDP 2.0.0-rc4 and newer requires INT32 for all integer arguments of
* glyph callbacks.
*/
#define GLYPH_CALLBACK_INT32 INT32
#else
/**
* FreeRDP 2.0.0-rc3 and older requires UINT32 for all integer arguments of
* glyph callbacks.
*/
#define GLYPH_CALLBACK_INT32 UINT32
#endif
/** /**
* Guacamole-specific rdpGlyph data. * Guacamole-specific rdpGlyph data.
*/ */
@ -94,7 +110,9 @@ BOOL guac_rdp_glyph_new(rdpContext* context, const rdpGlyph* glyph);
* TRUE if successful, FALSE otherwise. * TRUE if successful, FALSE otherwise.
*/ */
BOOL guac_rdp_glyph_draw(rdpContext* context, const rdpGlyph* glyph, BOOL guac_rdp_glyph_draw(rdpContext* context, const rdpGlyph* glyph,
INT32 x, INT32 y, INT32 w, INT32 h, INT32 sx, INT32 sy, GLYPH_CALLBACK_INT32 x, GLYPH_CALLBACK_INT32 y,
GLYPH_CALLBACK_INT32 w, GLYPH_CALLBACK_INT32 h,
GLYPH_CALLBACK_INT32 sx, GLYPH_CALLBACK_INT32 sy,
BOOL redundant); BOOL redundant);
/** /**
@ -150,9 +168,10 @@ void guac_rdp_glyph_free(rdpContext* context, rdpGlyph* glyph);
* @return * @return
* TRUE if successful, FALSE otherwise. * TRUE if successful, FALSE otherwise.
*/ */
BOOL guac_rdp_glyph_begindraw(rdpContext* context, INT32 x, INT32 y, BOOL guac_rdp_glyph_begindraw(rdpContext* context,
INT32 width, INT32 height, UINT32 fgcolor, UINT32 bgcolor, GLYPH_CALLBACK_INT32 x, GLYPH_CALLBACK_INT32 y,
BOOL redundant); GLYPH_CALLBACK_INT32 width, GLYPH_CALLBACK_INT32 height,
UINT32 fgcolor, UINT32 bgcolor, BOOL redundant);
/** /**
* Called immediately after rendering a series of glyphs. Unlike * Called immediately after rendering a series of glyphs. Unlike
@ -191,7 +210,9 @@ BOOL guac_rdp_glyph_begindraw(rdpContext* context, INT32 x, INT32 y,
* @return * @return
* TRUE if successful, FALSE otherwise. * TRUE if successful, FALSE otherwise.
*/ */
BOOL guac_rdp_glyph_enddraw(rdpContext* context, INT32 x, INT32 y, BOOL guac_rdp_glyph_enddraw(rdpContext* context,
INT32 width, INT32 height, UINT32 fgcolor, UINT32 bgcolor); GLYPH_CALLBACK_INT32 x, GLYPH_CALLBACK_INT32 y,
GLYPH_CALLBACK_INT32 width, GLYPH_CALLBACK_INT32 height,
UINT32 fgcolor, UINT32 bgcolor);
#endif #endif