web-view
web-view copied to clipboard
The Edge backend doesn't dispatch events when the window is being dragged around
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)