-
Notifications
You must be signed in to change notification settings - Fork 568
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
X11 shell does not support clipboards. #937
Comments
The relevant standard here is ICCCM. I recently-ish had the joy of implementing support for this. Since this X11, of course you need to create windows. Read the sections of ICCCM about selections. The general process (for getting the selection) is that you send a For setting a selection, you create a window and make it the selection owner with The relevant selections are Edit: And of course ICCCM makes things more complicated. You are not supposed to just call |
I took another look at the API and... I really would prefer a callback-based clipboard API in druid. That would be easier to implement. The GTK backend uses
Something similar would be needed for the x11 backend for a synchronous API. And no idea what then should happen when "the other end" does not reply to a clipboard event. Perhaps one could just "collect" all X11 events and stuff them into a list for later processing, waiting only for clipboard events. On the other hand, a synchronous API is likely way nicer for the API user, so... yeah, I'm not really sure. At least I'll remove this from my list of "things to try to implement in druid-x11 during vacation". |
#1805 handles the "get clipboard contents"-part. I also implemented setting clipboard contents: https://github.com/linebender/druid/compare/master...psychon:x11-put-clipboard?expand=1 I want to wait for #1805 to "go through" before tackling setting the clipboard contents. So far I only tested this with something like the following (I also tested this with a shorter string): fn main() {
tracing_subscriber::fmt().init();
let app = druid_shell::Application::new().unwrap();
let mut contents = String::from("1234567890");
while contents.len() < 17 * 1024 * 1024 {
let copy = contents.clone();
contents = contents + ©
}
app.clipboard().put_string(contents);
app.run(None);
} (A first version of my code forgot to update the "current position" in incremental transfers. Providing an "infinite paste" made
|
Fixes: linebender#937 Signed-off-by: Uli Schlachter <psychon@znc.in>
* x11: Turn Clipboard into a singleton This commit renames the current Clipboard to ClipboardState and adds a new Clipboard(Rc<RefCell<ClipboardState>>). This is in preparation for setting the clipboard contents where we need to keep the clipboard contents in ClipboardState. * Preparations for setting the clipboard Signed-off-by: Uli Schlachter <psychon@znc.in> * x11: Implement putting things into the clipboard Fixes: #937 Signed-off-by: Uli Schlachter <psychon@znc.in> * Add CHANGELOG.md entry Signed-off-by: Uli Schlachter <psychon@znc.in>
No description provided.
The text was updated successfully, but these errors were encountered: