Add conditional support for freerdp3
This MR adds the possibility to build with both freeRDP2 (default) or freeRDP3.
FreeRDP3 support can be enabled with cmake .. -DWITH_RDP=OFF -DWITH_RDP3=ON
.
Two notes before the MR description:
- This is heavily based on @akallabeth 's work from #30
- sorry for the big MR, but I had to completely refactor the code to get it working with both freeRDP versions
The changes can be summarized ah such:
- added a separate cmake option to enable freeRDP3 support;
- refactored RdpSession and RdpClipboard to use static methods instead of friend c functions;
- migrate to opaque freerdp settings (es. using freerdp_settings_set_string() instead of modifying the value directly) and use UTF8;
- add support for FreeRDP 3 using conditional code (
#if FREERDP_VERSION_MAJOR == 3
) where needed (eg. changes in constness in function signatures); - RdpSession: switch from rdpContext to rdpClientContext to benefit from freeRDP common code;
- RdpSession: FreeRDP3 already calls freerdp_client_load_addins(), no need for us to call it again;
- RdpSession: don't set username and password before connection, otherway onAutenticate won't be called if credentials are wrong. Rework the authenticate workflow accordingly (see
m_firstPasswordTry
); - RdpSession: keep some TODO comments from @akallabeth 's fork as an hint for future implementations;
- RdpView: fix crash on disconnect from toolbar button (no need to notify the user of disconnection error if they pressed disconnect)
- RdpClipboard: use the CF_TEXT formatId for text (aka UTF8 text, works on both freeRDP2 and FreeRDP3);
- RdpClipboard::onSendClientFormatList: fix msgFlags value (must be 0);
Edited by Fabio Bas