IronRDP
IronRDP copied to clipboard
MacOS clipboard support in `ironrdp-cliprdr-native`/`ironrdp-client`
Add support for the native clipboard for MacOS clients in ironrdp-cliprdr-native
/ironrdp-client
.
See existing Windows and ironrdp-web
implementation for reference.
I am not too familiar with MacOS development, but maybe @thenextman could add some additional details here about possible pitfalls that could be encountered with MacOS clipboard implementation.
@pacmancoder A few things come to mind:
- There is no possibility to get a callback when the local clipboard changes. The only option you have is to run a timer and check the pasteboard's
changeCount
property to know if something has changed, and make your own callback - Any interaction with
NSPasteboard
has to be done on the main thread; access from another thread is an error (either an exception or undefined behaviour) - Pay attention to the UTF16 pasteboard formats - there are two commonly seen ("public.utf16-plain-text" and "public.utf16-external-plain-text"). IIRC the difference is that one has a BOM.
- For images,
NSBitmapImageRep
can easily go between BMP and TIFF - In the Apple Developer downloads (https://developer.apple.com/download/all/ - login required) you can find "Additional Tools for Xcode X.X". The Utilities folder in that disk image has a clipboard viewer app that is very useful.
- I think it's out of scope fore now, but file transfers, server > client is quite challenging. We have a c# implementation but it's somewhat of a hack to workaround the system API limitations (the pasteboard doesn't want you to paste a file if it does not yet exist on disk). Ping me for more details.
The last time we used Cocoa APIs from rust, the available options were not very ergonomic. Hopefully things have moved forward (this was a few years ago).
If I think of something else I'll add it, but don't be afraid to poke me with specific questions!
Thank you for your input @thenextman !