diff --git a/configure.ac b/configure.ac index 2f833244..e37b4dbf 100644 --- a/configure.ac +++ b/configure.ac @@ -564,6 +564,39 @@ then 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 + #include + #include + + 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"]) # diff --git a/src/protocols/rdp/glyph.c b/src/protocols/rdp/glyph.c index cecaa8d9..d8413841 100644 --- a/src/protocols/rdp/glyph.c +++ b/src/protocols/rdp/glyph.c @@ -91,7 +91,9 @@ BOOL guac_rdp_glyph_new(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) { 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, - INT32 width, INT32 height, UINT32 fgcolor, UINT32 bgcolor, - BOOL redundant) { +BOOL guac_rdp_glyph_begindraw(rdpContext* context, + GLYPH_CALLBACK_INT32 x, GLYPH_CALLBACK_INT32 y, + GLYPH_CALLBACK_INT32 width, GLYPH_CALLBACK_INT32 height, + UINT32 fgcolor, UINT32 bgcolor, BOOL redundant) { guac_client* client = ((rdp_freerdp_context*) context)->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, - INT32 width, INT32 height, UINT32 fgcolor, UINT32 bgcolor) { +BOOL guac_rdp_glyph_enddraw(rdpContext* context, + GLYPH_CALLBACK_INT32 x, GLYPH_CALLBACK_INT32 y, + GLYPH_CALLBACK_INT32 width, GLYPH_CALLBACK_INT32 height, + UINT32 fgcolor, UINT32 bgcolor) { /* IGNORE */ return TRUE; } diff --git a/src/protocols/rdp/glyph.h b/src/protocols/rdp/glyph.h index 1e9b389b..85f2080d 100644 --- a/src/protocols/rdp/glyph.h +++ b/src/protocols/rdp/glyph.h @@ -20,11 +20,27 @@ #ifndef GUAC_RDP_GLYPH_H #define GUAC_RDP_GLYPH_H +#include "config.h" + #include #include #include #include +#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. */ @@ -94,7 +110,9 @@ BOOL guac_rdp_glyph_new(rdpContext* context, const rdpGlyph* glyph); * TRUE if successful, FALSE otherwise. */ 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); /** @@ -150,9 +168,10 @@ void guac_rdp_glyph_free(rdpContext* context, rdpGlyph* glyph); * @return * TRUE if successful, FALSE otherwise. */ -BOOL guac_rdp_glyph_begindraw(rdpContext* context, INT32 x, INT32 y, - INT32 width, INT32 height, UINT32 fgcolor, UINT32 bgcolor, - BOOL redundant); +BOOL guac_rdp_glyph_begindraw(rdpContext* context, + GLYPH_CALLBACK_INT32 x, GLYPH_CALLBACK_INT32 y, + GLYPH_CALLBACK_INT32 width, GLYPH_CALLBACK_INT32 height, + UINT32 fgcolor, UINT32 bgcolor, BOOL redundant); /** * 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 * TRUE if successful, FALSE otherwise. */ -BOOL guac_rdp_glyph_enddraw(rdpContext* context, INT32 x, INT32 y, - INT32 width, INT32 height, UINT32 fgcolor, UINT32 bgcolor); +BOOL guac_rdp_glyph_enddraw(rdpContext* context, + GLYPH_CALLBACK_INT32 x, GLYPH_CALLBACK_INT32 y, + GLYPH_CALLBACK_INT32 width, GLYPH_CALLBACK_INT32 height, + UINT32 fgcolor, UINT32 bgcolor); #endif