Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up alternative definitions for some window messages #2925

Merged

Conversation

matt335672
Copy link
Member

This fixes a regression introduced by #2864

FreeRDP silently redefines WM_LBUTTONUP, WM_LBUTTONDOWN, WM_RBUTTONUP and WM_RBUTTONDOWN. Consequently on my neutrinordp build at least, the right and left buttons don't work.

This is the least disruptive change. Renaming the defines totally will break xorgxrdp.

This probably needs backporting to v0.9 - I'll test that tomorrow.

@Nexarian Nexarian self-requested a review January 25, 2024 23:40
@matt335672
Copy link
Member Author

Thanks both.

This doesn't affect V0.9 directly as I didn't implement the user of the named constants for neutrinordp in that branch.

@matt335672
Copy link
Member Author

I'm going to add a note to this, as I don't understand why the definition of WM_LBUTTONDOWN in /usr/local/include/freerdp/rail.h is not triggering a macro replacement error.

Consider these files:-

// temp.h
#define WM_LBUTTONDOWN 0x202
// temp.c
#define WM_LBUTTONDOWN 102
#include <temp.h>

int main()
{
    return 0;
}

Then :-

$ gcc -I. -g temp.c
In file included from temp.c:4:
./temp.h:1: warning: "WM_LBUTTONDOWN" redefined
    1 | #define WM_LBUTTONDOWN 0x202
      | 
temp.c:1: note: this is the location of the previous definition
    1 | #define WM_LBUTTONDOWN 102
      | 

However, if I move temp.h to the compiler's default include path:-

sudo cp temp.h /usr/local/include
gcc -g temp.c

I don't get any errors, despite the macro definition still being accepted. The replacement is happening silently:-

gcc -E -dM temp.c | grep WM_LBUTTONDOWN
#define WM_LBUTTONDOWN 0x202

I assume this is some gcc specialisation - clang does the same thing so I'm assuming it's not a bug. Anyone got any thoughts?

@matt335672
Copy link
Member Author

Outstanding gcc bug request #16358 from 2004

That suggests moving the freerdp includes before the local includes will catch this. I'll rework this PR so the compiler does more of the work for us.

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.
@matt335672 matt335672 force-pushed the fix_neutrinordp_mouse_buttons branch from b569293 to 7fb70fb Compare January 26, 2024 15:37
@matt335672
Copy link
Member Author

I've reworked this so the compiler now catches the macro redefinitions. Consequently it's necessary to add some #undef directives for the re-used macros.

@Nexarian Nexarian merged commit 8af430e into neutrinolabs:devel Feb 1, 2024
13 checks passed
metalefty pushed a commit to metalefty/xrdp that referenced this pull request Feb 8, 2024
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.
@matt335672 matt335672 deleted the fix_neutrinordp_mouse_buttons branch February 20, 2024 17:34
seflerZ pushed a commit to seflerZ/xrdp that referenced this pull request May 3, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants