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

MacOS clipboard support in ironrdp-cliprdr-native/ironrdp-client #359

Open
pacmancoder opened this issue Jan 29, 2024 · 2 comments
Open
Labels
A-native-client Area: Native client (ironrdp-client) A-virtual-channel Area: Static or dynamic virtual channel enhancement New feature or request P-low Low priority

Comments

@pacmancoder
Copy link
Contributor

pacmancoder commented Jan 29, 2024

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 pacmancoder added A-native-client Area: Native client (ironrdp-client) A-virtual-channel Area: Static or dynamic virtual channel labels Jan 29, 2024
@pacmancoder pacmancoder changed the title MacOS clipboard support in ironrdp-clipboard-native/ironrdp-client MacOS clipboard support in ironrdp-cliprdr-native/ironrdp-client Jan 29, 2024
@pacmancoder pacmancoder added the enhancement New feature or request label Jan 29, 2024
@CBenoit CBenoit added the P-low Low priority label Jan 29, 2024
@thenextman
Copy link
Member

@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!

@pacmancoder
Copy link
Contributor Author

Thank you for your input @thenextman !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-native-client Area: Native client (ironrdp-client) A-virtual-channel Area: Static or dynamic virtual channel enhancement New feature or request P-low Low priority
Development

No branches or pull requests

3 participants