Merge branch 'master' into binary-protocal
This commit is contained in:
commit
0e3fd225a8
109 files changed
+1661
-435
No files matched your search
@@ -61,6 +61,7 @@ transparent = ["wry/transparent"]
|
||||
devtools = ["wry/devtools"]
|
||||
dox = ["wry/dox"]
|
||||
hot-reload = ["dioxus-hot-reload"]
|
||||
gnu = []
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
default-features = false
|
||||
|
||||
@@ -13,7 +13,19 @@ const EDITS_PATH: &str = {
|
||||
}
|
||||
};
|
||||
|
||||
fn check_gnu() {
|
||||
// WARN about wry support on windows gnu targets. GNU windows targets don't work well in wry currently
|
||||
if std::env::var("CARGO_CFG_WINDOWS").is_ok()
|
||||
&& std::env::var("CARGO_CFG_TARGET_ENV").unwrap() == "gnu"
|
||||
&& !cfg!(feature = "gnu")
|
||||
{
|
||||
println!("cargo:warning=GNU windows targets have some limitations within Wry. Using the MSVC windows toolchain is recommended. If you would like to use continue using GNU, you can read https://github.com/wravery/webview2-rs#cross-compilation and disable this warning by adding the gnu feature to dioxus-desktop in your Cargo.toml")
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
check_gnu();
|
||||
|
||||
let prevent_file_upload = r#"// Prevent file inputs from opening the file dialog on click
|
||||
let inputs = document.querySelectorAll("input");
|
||||
for (let input of inputs) {
|
||||
|
||||
@@ -17,7 +17,7 @@ pub(crate) fn check_app_exits(app: Component) {
|
||||
|
||||
dioxus_desktop::launch_cfg(
|
||||
app,
|
||||
Config::new().with_window(WindowBuilder::new().with_visible(false)),
|
||||
Config::new().with_window(WindowBuilder::new().with_visible(true)),
|
||||
);
|
||||
|
||||
// Stop deadman's switch
|
||||
@@ -52,7 +52,7 @@ fn mock_event(cx: &ScopeState, id: &'static str, value: &'static str) {
|
||||
#[allow(deprecated)]
|
||||
fn app(cx: Scope) -> Element {
|
||||
let desktop_context: DesktopContext = cx.consume_context().unwrap();
|
||||
let recieved_events = use_state(cx, || 0);
|
||||
let received_events = use_state(cx, || 0);
|
||||
|
||||
// button
|
||||
mock_event(
|
||||
@@ -216,7 +216,7 @@ fn app(cx: Scope) -> Element {
|
||||
r#"new FocusEvent("focusout",{bubbles: true})"#,
|
||||
);
|
||||
|
||||
if **recieved_events == 12 {
|
||||
if **received_events == 12 {
|
||||
println!("all events recieved");
|
||||
desktop_context.close();
|
||||
}
|
||||
@@ -230,7 +230,7 @@ fn app(cx: Scope) -> Element {
|
||||
assert!(event.data.modifiers().is_empty());
|
||||
assert!(event.data.held_buttons().is_empty());
|
||||
assert_eq!(event.data.trigger_button(), Some(dioxus_html::input_data::MouseButton::Primary));
|
||||
recieved_events.modify(|x| *x + 1)
|
||||
received_events.modify(|x| *x + 1)
|
||||
},
|
||||
}
|
||||
div {
|
||||
@@ -239,7 +239,7 @@ fn app(cx: Scope) -> Element {
|
||||
println!("{:?}", event.data);
|
||||
assert!(event.data.modifiers().is_empty());
|
||||
assert!(event.data.held_buttons().contains(dioxus_html::input_data::MouseButton::Secondary));
|
||||
recieved_events.modify(|x| *x + 1)
|
||||
received_events.modify(|x| *x + 1)
|
||||
},
|
||||
}
|
||||
div {
|
||||
@@ -249,7 +249,7 @@ fn app(cx: Scope) -> Element {
|
||||
assert!(event.data.modifiers().is_empty());
|
||||
assert!(event.data.held_buttons().contains(dioxus_html::input_data::MouseButton::Secondary));
|
||||
assert_eq!(event.data.trigger_button(), Some(dioxus_html::input_data::MouseButton::Secondary));
|
||||
recieved_events.modify(|x| *x + 1)
|
||||
received_events.modify(|x| *x + 1)
|
||||
},
|
||||
}
|
||||
div{
|
||||
@@ -260,7 +260,7 @@ fn app(cx: Scope) -> Element {
|
||||
assert!(event.data.held_buttons().contains(dioxus_html::input_data::MouseButton::Primary));
|
||||
assert!(event.data.held_buttons().contains(dioxus_html::input_data::MouseButton::Secondary));
|
||||
assert_eq!(event.data.trigger_button(), Some(dioxus_html::input_data::MouseButton::Secondary));
|
||||
recieved_events.modify(|x| *x + 1)
|
||||
received_events.modify(|x| *x + 1)
|
||||
}
|
||||
}
|
||||
div{
|
||||
@@ -270,7 +270,7 @@ fn app(cx: Scope) -> Element {
|
||||
assert!(event.data.modifiers().is_empty());
|
||||
assert!(event.data.held_buttons().contains(dioxus_html::input_data::MouseButton::Secondary));
|
||||
assert_eq!(event.data.trigger_button(), Some(dioxus_html::input_data::MouseButton::Secondary));
|
||||
recieved_events.modify(|x| *x + 1)
|
||||
received_events.modify(|x| *x + 1)
|
||||
}
|
||||
}
|
||||
div{
|
||||
@@ -280,7 +280,7 @@ fn app(cx: Scope) -> Element {
|
||||
assert!(event.data.modifiers().is_empty());
|
||||
assert!(event.data.held_buttons().is_empty());
|
||||
assert_eq!(event.data.trigger_button(), Some(dioxus_html::input_data::MouseButton::Primary));
|
||||
recieved_events.modify(|x| *x + 1)
|
||||
received_events.modify(|x| *x + 1)
|
||||
}
|
||||
}
|
||||
div{
|
||||
@@ -294,7 +294,7 @@ fn app(cx: Scope) -> Element {
|
||||
panic!("Expected delta to be in pixels")
|
||||
};
|
||||
assert_eq!(delta, Vector3D::new(1.0, 2.0, 3.0));
|
||||
recieved_events.modify(|x| *x + 1)
|
||||
received_events.modify(|x| *x + 1)
|
||||
}
|
||||
}
|
||||
input{
|
||||
@@ -307,7 +307,7 @@ fn app(cx: Scope) -> Element {
|
||||
assert_eq!(event.data.location, 0);
|
||||
assert!(event.data.is_auto_repeating());
|
||||
|
||||
recieved_events.modify(|x| *x + 1)
|
||||
received_events.modify(|x| *x + 1)
|
||||
}
|
||||
}
|
||||
input{
|
||||
@@ -320,7 +320,7 @@ fn app(cx: Scope) -> Element {
|
||||
assert_eq!(event.data.location, 0);
|
||||
assert!(!event.data.is_auto_repeating());
|
||||
|
||||
recieved_events.modify(|x| *x + 1)
|
||||
received_events.modify(|x| *x + 1)
|
||||
}
|
||||
}
|
||||
input{
|
||||
@@ -333,21 +333,21 @@ fn app(cx: Scope) -> Element {
|
||||
assert_eq!(event.data.location, 0);
|
||||
assert!(!event.data.is_auto_repeating());
|
||||
|
||||
recieved_events.modify(|x| *x + 1)
|
||||
received_events.modify(|x| *x + 1)
|
||||
}
|
||||
}
|
||||
input{
|
||||
id: "focus_in_div",
|
||||
onfocusin: move |event| {
|
||||
println!("{:?}", event.data);
|
||||
recieved_events.modify(|x| *x + 1)
|
||||
received_events.modify(|x| *x + 1)
|
||||
}
|
||||
}
|
||||
input{
|
||||
id: "focus_out_div",
|
||||
onfocusout: move |event| {
|
||||
println!("{:?}", event.data);
|
||||
recieved_events.modify(|x| *x + 1)
|
||||
received_events.modify(|x| *x + 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ use wry::{application::window::WindowId, webview::WebContext};
|
||||
///
|
||||
/// This function will start a multithreaded Tokio runtime as well the WebView event loop.
|
||||
///
|
||||
/// ```rust, ignore
|
||||
/// ```rust, no_run
|
||||
/// use dioxus::prelude::*;
|
||||
///
|
||||
/// fn main() {
|
||||
@@ -81,11 +81,12 @@ pub fn launch(root: Component) {
|
||||
///
|
||||
/// You can configure the WebView window with a configuration closure
|
||||
///
|
||||
/// ```rust, ignore
|
||||
/// ```rust, no_run
|
||||
/// use dioxus::prelude::*;
|
||||
/// use dioxus_desktop::*;
|
||||
///
|
||||
/// fn main() {
|
||||
/// dioxus_desktop::launch_cfg(app, |c| c.with_window(|w| w.with_title("My App")));
|
||||
/// dioxus_desktop::launch_cfg(app, Config::default().with_window(WindowBuilder::new().with_title("My App")));
|
||||
/// }
|
||||
///
|
||||
/// fn app(cx: Scope) -> Element {
|
||||
@@ -104,8 +105,9 @@ pub fn launch_cfg(root: Component, config_builder: Config) {
|
||||
///
|
||||
/// You can configure the WebView window with a configuration closure
|
||||
///
|
||||
/// ```rust, ignore
|
||||
/// ```rust, no_run
|
||||
/// use dioxus::prelude::*;
|
||||
/// use dioxus_desktop::Config;
|
||||
///
|
||||
/// fn main() {
|
||||
/// dioxus_desktop::launch_with_props(app, AppProps { name: "asd" }, Config::default());
|
||||
|
||||
Reference in new issue
Block a user