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

Platform dependent use patterns of arboard #88

Closed
emilk opened this issue Oct 19, 2022 · 6 comments · Fixed by #89
Closed

Platform dependent use patterns of arboard #88

emilk opened this issue Oct 19, 2022 · 6 comments · Fixed by #89

Comments

@emilk
Copy link
Contributor

emilk commented Oct 19, 2022

Since 3.0, we should now create a new Clipboard, use it, then drop it right away on Windows.

However, I'm getting reports that that same code doesn't work on Linux X11, and that we there instead need to create a Clipboard once and then keep it around for the life of the program: emilk/egui#2138

If true, this makes using arboard suddenly very annoying as I need different paths depending on what platform I am compiling for (which is exactly what I want arboard to help me abstract).


From a users point of view, I just want access to functions to copy and paste text and images. I don't want to think about the lifetime of the Clipboard resource.

@complexspaces
Copy link
Collaborator

Thanks for opening an issue. I agree that this is problematic, and I think that I've now seen it cause enough problems that I'll be reverting the new default behavior introduced in #60 to what it was pre 3.0. Sorry for causing headaches downstream 😦. I did not think enough about how cross-platform users would be affected by the new usage pattern on Windows, which is entirely my bad. I'll be looking at this after work today.

@emilk
Copy link
Contributor Author

emilk commented Oct 19, 2022

Thanks @complexspaces ❤️

@derfarctor
Copy link

I have to say it is rather unclear from the repository the correct usage pattern for the Clipboard struct.

Can we expect to be able to (for all platforms and display server protocols) create multiple instances of Clipboard in numerous places in the program and drop them whenever we like without it affecting the underlying data that has either been written to or read from the Clipboard? I.e. create a new Clipboard, set some text, block ends and Clipboard is lost, and expect the text to remain paste-able.

Or must we create a single instance of Clipboard and use only that when set_text()ing or get_text()ing for the entirety of the program's lifespan?

@complexspaces
Copy link
Collaborator

@derfarctor The high-level answer to your question is "no." Linux uses too different of an architecture compared to the other platforms. Do you mind looking through the documentation changes in #89 and letting me know if it would answer your question and if there's anything else you would like to see called out?

@derfarctor
Copy link

@complexspaces The documentation is more clear there.

I've changed my program to only use a single instance of Clipboard but now, as I understand is expected, it does not work properly on Windows. I eagerly await the release of the fix such that this usage pattern can be fully cross platform friendly.

@complexspaces
Copy link
Collaborator

These fixes have been published as 3.2.0 on crates.io. Thanks again for opening this issue and contributing everyone.

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 a pull request may close this issue.

3 participants