|
@@ -64,7 +64,7 @@ use wry::{
|
|
|
},
|
|
|
},
|
|
|
http::{Request as WryRequest, Response as WryResponse},
|
|
|
- webview::{FileDropEvent as WryFileDropEvent, WebContext, WebView, WebViewBuilder},
|
|
|
+ webview::{FileDropEvent as WryFileDropEvent, Url, WebContext, WebView, WebViewBuilder},
|
|
|
};
|
|
|
|
|
|
pub use wry::application::window::{Window, WindowBuilder as WryWindowBuilder, WindowId};
|
|
@@ -1037,6 +1037,7 @@ pub enum WindowMessage {
|
|
|
#[cfg(any(debug_assertions, feature = "devtools"))]
|
|
|
IsDevToolsOpen(Sender<bool>),
|
|
|
// Getters
|
|
|
+ Url(Sender<Url>),
|
|
|
ScaleFactor(Sender<f64>),
|
|
|
InnerPosition(Sender<Result<PhysicalPosition<i32>>>),
|
|
|
OuterPosition(Sender<Result<PhysicalPosition<i32>>>),
|
|
@@ -1238,6 +1239,10 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
|
|
|
|
|
|
// Getters
|
|
|
|
|
|
+ fn url(&self) -> Result<Url> {
|
|
|
+ window_getter!(self, WindowMessage::Url)
|
|
|
+ }
|
|
|
+
|
|
|
fn scale_factor(&self) -> Result<f64> {
|
|
|
window_getter!(self, WindowMessage::ScaleFactor)
|
|
|
}
|
|
@@ -2362,6 +2367,11 @@ fn handle_user_message<T: UserEvent>(
|
|
|
}
|
|
|
}
|
|
|
// Getters
|
|
|
+ WindowMessage::Url(tx) => {
|
|
|
+ if let WindowHandle::Webview { inner: w, .. } = &window {
|
|
|
+ tx.send(w.url()).unwrap();
|
|
|
+ }
|
|
|
+ }
|
|
|
WindowMessage::ScaleFactor(tx) => tx.send(window.scale_factor()).unwrap(),
|
|
|
WindowMessage::InnerPosition(tx) => tx
|
|
|
.send(
|