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

The Edge backend doesn't dispatch events when the window is being dragged around #268

Open
radekvit opened this issue Feb 21, 2021 · 0 comments

Comments

@radekvit
Copy link

When I drag the window around, my callbacks issued through the Handle don't get called.
This does not happen with the IE backend (without the "edge" feature).

From my very short debugging, the PostThreadMessage call inside webview-sys still returns TRUE even when this happens.

Cargo.toml

[dependencies]
web-view = { version = "0.7", features = ["edge"] }

main.rs

use std::time::Duration;
use web_view::*;

fn main() {
    let html = r#"
    <html>
    <body>
    <input type="button"
           id="mybutton"
           onClick="external.invoke('button_click')"
           value="Hello, World!" />
    <script>
        function change_text(text) {
            document.getElementById('mybutton').value = text;
        }
    </script>
    </body>
    </html>"#;
    builder()
        .content(Content::Html(html))
        .user_data(())
        .invoke_handler(|webview, arg| match arg {
            "button_click" => {
                {
                    let webview = webview.handle();
                    std::thread::spawn(move || {
                        std::thread::sleep(Duration::from_secs(2));
                        webview.dispatch(|webview| 
                        // if you are dragging the window around, this doesn't get invoked
                            webview.eval("change_text('Goodbye, world!')"))
                    });
                }
                Ok(())
            }
            _ => unimplemented!(),
        })
        .run()
        .unwrap();
}

Affected versions:\

  • 0.7.2
  • master
  • (possibly others)
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

No branches or pull requests

1 participant