From 6e4a7299de8eebbe942d2943e65a4094c4b3ae5c Mon Sep 17 00:00:00 2001 From: matt335672 <30179339+matt335672@users.noreply.github.com> Date: Thu, 1 Feb 2024 00:06:59 +0000 Subject: [PATCH] Fix regression in using window message names (#2925) FreeRDP defines macros WM_LBUTTONUP, WM_LBUTTONDOWN, WM_RBUTTONUP and WM_RBUTTONDOWN. These conflict with the definitions we have in xrdp_constants.h. Because the FreeRDP system includes followed the local includes however, the compiler did not emit a diagnostic for this - see gcc bug #16358. This PR rearranges the includes for NeutrinoRDP so the macro redefinitions are flagged by the compiler. --- neutrinordp/xrdp-color.c | 4 ++++ neutrinordp/xrdp-neutrinordp.c | 13 ++++++++++++- neutrinordp/xrdp-neutrinordp.h | 19 ++++++------------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/neutrinordp/xrdp-color.c b/neutrinordp/xrdp-color.c index e2ee3ae67a..b0f94c7c90 100644 --- a/neutrinordp/xrdp-color.c +++ b/neutrinordp/xrdp-color.c @@ -22,6 +22,10 @@ #endif #include "xrdp-neutrinordp.h" +#include "defines.h" +#include "log.h" +#include "os_calls.h" +#include "string_calls.h" char * convert_bitmap(int in_bpp, int out_bpp, char *bmpdata, diff --git a/neutrinordp/xrdp-neutrinordp.c b/neutrinordp/xrdp-neutrinordp.c index 859b29b586..5e6c1216f2 100644 --- a/neutrinordp/xrdp-neutrinordp.c +++ b/neutrinordp/xrdp-neutrinordp.c @@ -17,6 +17,17 @@ * limitations under the License. */ +#include +#include + +// FreeRDP defines some macros that we have different values for. +// To catch this we need to include the freerdp includes before our +// local ones (see gcc bug #16358) +#undef WM_LBUTTONUP +#undef WM_LBUTTONDOWN +#undef WM_RBUTTONUP +#undef WM_RBUTTONDOWN + #if defined(HAVE_CONFIG_H) #include #endif @@ -26,8 +37,8 @@ #include "xrdp_rail.h" #include "trans.h" #include "log.h" +#include "os_calls.h" #include "string_calls.h" -#include #if defined(VERSION_STRUCT_RDP_FREERDP) #if VERSION_STRUCT_RDP_FREERDP > 1 diff --git a/neutrinordp/xrdp-neutrinordp.h b/neutrinordp/xrdp-neutrinordp.h index 9cce063c42..2837131fdd 100644 --- a/neutrinordp/xrdp-neutrinordp.h +++ b/neutrinordp/xrdp-neutrinordp.h @@ -20,22 +20,15 @@ #ifndef XRDP_NEUTRINORDP_H #define XRDP_NEUTRINORDP_H -/* include other h files */ #include "arch.h" -#include "parse.h" -#include "os_calls.h" -#include "defines.h" -#include "xrdp_rail.h" -#include "xrdp_client_info.h" #include "xrdp_constants.h" +#include "xrdp_client_info.h" -/* this is the freerdp main header */ -#include -#include -#include -#include -//#include -//#include "/home/jay/git/jsorg71/staging/include/freerdp/freerdp.h" +/* Incomplete type definitions, referenced below */ +struct rail_window_state_order; +struct rail_notify_state_order; +struct rail_monitored_desktop_order; +struct rail_icon_info; struct bitmap_item {