@@ -1982,12 +1982,12 @@ static UINT wf_cliprdr_server_format_list(CliprdrClientContext* context,
19821982 #pragma endregion
19831983 }
19841984
1985- #pragma region Myrtille
1985+ // #pragma region Myrtille
19861986
1987- if (context -> rdpcontext -> settings -> MyrtilleSessionId == NULL )
1988- {
1987+ // if (context->rdpcontext->settings->MyrtilleSessionId == NULL)
1988+ // {
19891989
1990- #pragma endregion
1990+ // #pragma endregion
19911991
19921992 if (file_transferring (clipboard ))
19931993 {
@@ -2013,19 +2013,21 @@ static UINT wf_cliprdr_server_format_list(CliprdrClientContext* context,
20132013
20142014 #pragma region Myrtille
20152015
2016- }
2017- else
2018- {
2019- wfContext * wfc = (wfContext * )context -> rdpcontext ;
2020-
2021- // the remote clipboard content has changed (copy)
2022- // invalidate it so that the next clipboard request (paste) will trigger a new content request then save the result
2023- // as long as the remote clipboard doesn't change, every request will send the saved content
2024- if (unicodeTextFormatMapping )
2025- wf_myrtille_reset_clipboard (wfc );
2016+ //}
2017+ //else
2018+ //{
2019+ if (context -> rdpcontext -> settings -> MyrtilleSessionId != NULL )
2020+ {
2021+ // the server clipboard content has changed (a copy action was triggered)
2022+ if (unicodeTextFormatMapping )
2023+ {
2024+ wfContext * wfc = (wfContext * )context -> rdpcontext ;
2025+ wf_myrtille_read_server_clipboard (wfc );
2026+ }
2027+ }
20262028
2027- rc = CHANNEL_RC_OK ;
2028- }
2029+ // rc = CHANNEL_RC_OK;
2030+ // }
20292031
20302032 #pragma endregion
20312033
@@ -2254,6 +2256,13 @@ static UINT wf_cliprdr_server_format_data_request(CliprdrClientContext* context,
22542256 }
22552257 else
22562258 {
2259+ //#pragma region Myrtille
2260+
2261+ //if (context->rdpcontext->settings->MyrtilleSessionId == NULL)
2262+ //{
2263+
2264+ //#pragma endregion
2265+
22572266 if (!OpenClipboard (clipboard -> hwnd ))
22582267 return ERROR_INTERNAL_ERROR ;
22592268
@@ -2271,6 +2280,29 @@ static UINT wf_cliprdr_server_format_data_request(CliprdrClientContext* context,
22712280 CopyMemory (buff , globlemem , size );
22722281 GlobalUnlock (hClipdata );
22732282 CloseClipboard ();
2283+
2284+ //#pragma region Myrtille
2285+
2286+ //}
2287+ //// when using myrtille, don't retrieve the client clipboard from the local machine (gateway)
2288+ //// instead, retrieve the value previously received from the browser
2289+ //else
2290+ //{
2291+ // wfContext* wfc = (wfContext*)context->rdpcontext;
2292+ // wchar_t* text;
2293+ //
2294+ // // retrieve the client clipboard
2295+ // wf_myrtille_read_client_clipboard(wfc, &text, &size);
2296+
2297+ // // copy it into the buffer (including the null terminator!)
2298+ // buff = malloc(size);
2299+ // CopyMemory(buff, text, size);
2300+ //
2301+ // // set the response type (missing from original code, intentionally?)
2302+ // response.msgType = CB_FORMAT_DATA_RESPONSE;
2303+ //}
2304+
2305+ #pragma endregion
22742306 }
22752307
22762308 response .msgFlags = CB_RESPONSE_OK ;
@@ -2335,11 +2367,11 @@ static UINT wf_cliprdr_server_format_data_response(CliprdrClientContext*
23352367
23362368 #pragma region Myrtille
23372369
2338- wfContext * wfc = ( wfContext * ) context -> rdpcontext ;
2370+ // the server clipboard was requested; send it
23392371 if (context -> rdpcontext -> settings -> MyrtilleSessionId != NULL )
23402372 {
2341- // remote clipboard content was requested; send the response
2342- wf_myrtille_send_clipboard (wfc , data , formatDataResponse -> dataLen );
2373+ wfContext * wfc = ( wfContext * ) context -> rdpcontext ;
2374+ wf_myrtille_send_server_clipboard (wfc , data , formatDataResponse -> dataLen );
23432375 }
23442376
23452377 #pragma endregion
0 commit comments