Merge branch 'master' into return-context

This commit is contained in:
ealmloff authored and GitHub committed 2023-04-18 08:53:01 -05:00
commit 894246a04a
23 files changed
+437 -81

No files matched your search

+6 -2
View File
@@ -38,8 +38,8 @@ use tao::{
};
pub use wry;
pub use wry::application as tao;
use wry::application::window::WindowId;
use wry::webview::WebView;
use wry::{application::window::WindowId, webview::WebContext};
/// Launch the WebView and run the event loop.
///
@@ -285,7 +285,7 @@ fn create_new_window(
event_handlers: &WindowEventHandlers,
shortcut_manager: ShortcutRegistry,
) -> WebviewHandler {
let webview = webview::build(&mut cfg, event_loop, proxy.clone());
let (webview, web_context) = webview::build(&mut cfg, event_loop, proxy.clone());
let desktop_context = Rc::from(DesktopService::new(
webview,
proxy.clone(),
@@ -305,6 +305,7 @@ fn create_new_window(
desktop_context,
dom,
waker: waker::tao_waker(proxy, id),
web_context,
}
}
@@ -312,6 +313,9 @@ struct WebviewHandler {
dom: VirtualDom,
desktop_context: DesktopContext,
waker: Waker,
// This is nessisary because of a bug in wry. Wry assumes the webcontext is alive for the lifetime of the webview. We need to keep the webcontext alive, otherwise the webview will crash
#[allow(dead_code)]
web_context: WebContext,
}
/// Poll the virtualdom until it's pending