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

Unable to paste from clipboard while egui application is running #2109

Closed
apexys opened this issue Oct 5, 2022 · 6 comments · Fixed by #2120
Closed

Unable to paste from clipboard while egui application is running #2109

apexys opened this issue Oct 5, 2022 · 6 comments · Fixed by #2120
Labels
bug Something is broken native-windows Running on native Windows OS

Comments

@apexys
Copy link

apexys commented Oct 5, 2022

Describe the bug
I'm building an application based on egui (master branch).
While this application is running, I am unable to use the clipboard on Windows 10.0.19043.
If I copy text, I can not paste it.
When I take a screenshot with Win-Shift-S, I get the pop-up, even showing the screenshot, but I am unable to paste it.
If it helps, it seems the application I'm pasting into hangs for a very short time (500ms?) after Ctrl-V.

To Reproduce
Steps to reproduce the behavior:

  1. Clone the egui repo and run the demo app with cargo run --release -p egui_demo_app
  2. Copy text from any window or take a screenshot
  3. Try to paste it somewhere

Expected behavior
The copied content is inserted.

@apexys apexys added the bug Something is broken label Oct 5, 2022
@emilk
Copy link
Owner

emilk commented Oct 7, 2022

Pasting images is not yet supported (see #2108), but copy-pasting of text should work. Since nobody else has reported copy-paste not working on Windows, I would suggest this is something weird with your system.

Look in crates/egui-winit/src/lib.rs:538 and see if is_paste_command detect Ctrl-V, and if so, if self.clipboard.get() returns anything.

Also: run with RUST_LOG=debug and see if the log gives any clues

@emilk emilk added the native-windows Running on native Windows OS label Oct 7, 2022
@apexys
Copy link
Author

apexys commented Oct 7, 2022

Thank you for your answer!

Maybe my issue was a bit non-specific:
I'm not talking about copying and pasting within egui, but between completely unrelated applications while an egui application is running in the background.
I tried disabling the clipboard feature in egui_glow, but since I'm using eframe, it just gets enabled again in https://github.com/emilk/egui/blob/master/crates/eframe/Cargo.toml#L82
Is there a way to completely disable clipboard integration with eframe?

I tried this on several computers running Windows 10 and the issue happens everywhere.

@apexys
Copy link
Author

apexys commented Oct 7, 2022

I guess this is related to #1031

EDIT: This seems to be the issue in arboard 1Password/arboard#84

I managed to get my application to work again by reverting to commit 2b0bf82 and I'll try to get a pull request done that requests a new arboard Clipboard for each clipboard operation in

fn init_arboard() -> Option<arboard::Clipboard> {
instead of doing so once.

@emilk
Copy link
Owner

emilk commented Oct 7, 2022

Oh wow, that's an "interesting" breaking change in arboard 😆

@emilk
Copy link
Owner

emilk commented Oct 7, 2022

The commit that broke it should be #2067

emilk added a commit that referenced this issue Oct 7, 2022
Closes #2109

Since arboard 3.0 you must absolutely not hold onto `arboard::Clipbaord`
longer than you are using it.

See 1Password/arboard#84
emilk added a commit that referenced this issue Oct 7, 2022
Closes #2109

Since arboard 3.0 you must absolutely not hold onto `arboard::Clipbaord`
longer than you are using it.

See 1Password/arboard#84
@apexys
Copy link
Author

apexys commented Oct 10, 2022

Thank you for the quick fix!

sidit77 pushed a commit to sidit77/egui-tao that referenced this issue May 6, 2023
Closes emilk/egui#2109

Since arboard 3.0 you must absolutely not hold onto `arboard::Clipbaord`
longer than you are using it.

See 1Password/arboard#84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken native-windows Running on native Windows OS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants