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

occasionally the clipboard is set to a display number #14

Open
dnut opened this issue Oct 6, 2022 · 1 comment
Open

occasionally the clipboard is set to a display number #14

dnut opened this issue Oct 6, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@dnut
Copy link
Owner

dnut commented Oct 6, 2022

This happens during the necessary stage of identifying new clipboards. To do this, it sets values to the clipboard and then retrieves the value from the same or other clipboards. It's hard to completely avoid this but ideally it can be reduced somehow.

there's already this to reset it back to the value from before checking

    for c in clipboards.iter() {
        c.set(&start)?;
    }

but occasionally i hit the clipboard in the middle of the search and get a display number anyway. this would restore it sooner but i don't know how much better it would be. need to weigh this against the fact that it's reading and writing to all the clipboards ~twice as many times

fn are_same(one: &Box<dyn Clipboard>, two: &Box<dyn Clipboard>) -> MyResult<bool> {
    let one_orig = one.get()?;
    let two_orig = two.get()?;
    let d1 = &one.display();
    let d2 = &two.display();
    one.set(d1)?;
    if d1 != &two.get()? {
        one.set(&one_orig)?;
        return Ok(false);
    }
    two.set(d2)?;
    if d2 != &one.get()? {
        one.set(&one_orig)?;
        two.set(&two_orig)?;
        return Ok(false);
    }
    one.set(&one_orig)?;

    Ok(true)
}
@dnut
Copy link
Owner Author

dnut commented Nov 15, 2022

this isn't a big deal because it's set back to the prior state pretty quickly

@dnut dnut added the bug Something isn't working label Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant