Skip to content

Upgrade bevy's version to v0.16.0 #49

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

Merged
merged 6 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
with:
toolchain: 'nightly'
components: 'clippy,rust-docs'

- name: Install alsa and udev
run: |
sudo apt-get update && sudo apt-get install --no-install-recommends libasound2-dev \
Expand All @@ -40,10 +41,10 @@ jobs:
uses: Swatinem/rust-cache@v2

- name: Clippy all features
run: cargo clippy --all-features --tests -- -D warnings
run: cargo clippy --all --all-features --tests -- -D warnings

- name: Test all features
run: cargo test --all-features
run: cargo test --all-features --all

- name: Doc lint
run: cargo +nightly doc --all-features --no-deps
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ license = "MIT OR Apache-2.0"
edition = "2021"

[workspace.dependencies]
bevy = { version = "0.15", default-features = false }
bevy_flurx = { version = "0.9" }
bevy = { version = "0.16", default-features = false }
bevy_flurx = { version = "0.11" }
bevy_flurx_ipc = { path = "crates/bevy_flurx_ipc", version = "0.3" }
bevy_flurx_ipc_macro = { path = "crates/bevy_flurx_ipc_macro", version = "0.3" }
bevy_webview_core = { path = "crates/bevy_webview_core", version = "0.3" }
Expand Down
6 changes: 6 additions & 0 deletions crates/bevy_flurx_api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased

## Features

- Support for bevy's v0.16

## v0.3.0

[Release notes](https://github.com/not-elm/bevy_webview_projects/releases/tag/v0.3.0)
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_flurx_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ notification = ["dep:notify-rust"]
os = ["dep:sysinfo", "dep:sys-locale"]
monitor = []
web_window = ["dep:winit"]
http = ["bevy_flurx/tokio", "bevy_flurx/effect", "dep:reqwest"]
http = ["bevy_flurx/tokio", "bevy_flurx/side-effect", "dep:reqwest"]
full = [
"fs",
"clipboard",
Expand All @@ -40,13 +40,13 @@ dirs = { version = "6", optional = true }
arboard = { version = "3", optional = true }
rfd = { version = "0.15", default-features = false, optional = true }
notify-rust = { version = "4", optional = true }
sysinfo = { version = "0.33", optional = true }
sysinfo = { version = "0.34", optional = true }
sys-locale = { version = "0.3", optional = true }
winit = { version = "0.30", features = ["serde"], optional = true }
reqwest = { version = "0.12", features = ["json"], optional = true }

[dev-dependencies]
bevy = "0.15"
bevy = "0.16"
bevy_webview_wry = { path = "../bevy_webview_wry" }

[lints]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_flurx_api/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use crate::error::http::DenyOrigin;
use crate::error::ApiResult;
use crate::macros::api_plugin;
use bevy::app::PluginGroupBuilder;
use bevy::platform::collections::hash_map::HashMap;
use bevy::prelude::{In, PluginGroup, Reflect, ReflectDefault, ReflectDeserialize, ReflectResource, ReflectSerialize, Res, Resource, Update};
use bevy::utils::HashMap;
use bevy_flurx::prelude::{once, side_effect, Pipe};
use bevy_flurx::task::ReactorTask;
use bevy_flurx_ipc::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_flurx_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ mod tests {
});
app.update();
app.world_mut().run_system_once(move |handlers: Query<&IpcHandlers>| {
assert!(handlers.single().get(ipc_id).is_some());
assert!(handlers.single().expect("Parent window not found").get(ipc_id).is_some());
}).expect("Failed to run system");
}
}
3 changes: 1 addition & 2 deletions crates/bevy_flurx_api/src/web_window/create.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::macros::api_plugin;
use bevy::core::Name;
use bevy::prelude::{Commands, In};
use bevy::prelude::{Commands, In, Name};
use bevy::utils::default;
use bevy::window::{Window, WindowResolution};
use bevy_flurx::action::once;
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_flurx_api/src/web_window/set_window_mode.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::macros::api_plugin;
use crate::web_window::WebWinitWindowParams;
use bevy::prelude::{In, MonitorSelection};
use bevy::prelude::{In, MonitorSelection, VideoModeSelection};
use bevy::window::WindowMode;
use bevy_flurx::action::{once, Action};
use serde::Deserialize;
use bevy_flurx_ipc::prelude::*;
use serde::Deserialize;

api_plugin!(
/// You'll be able to set fullscreen state of the window decorations from a webview.
Expand Down Expand Up @@ -41,7 +41,7 @@ fn system(
return;
};
window.mode = match args.1 {
VideoModeState::Fullscreen => WindowMode::Fullscreen(MonitorSelection::Current),
VideoModeState::Fullscreen => WindowMode::Fullscreen(MonitorSelection::Current, VideoModeSelection::Current),
VideoModeState::Borderless => WindowMode::BorderlessFullscreen(MonitorSelection::Current),
VideoModeState::Windowed => WindowMode::Windowed
};
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_flurx_ipc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ name = "progress"
path = "tests/index.rs"

[dependencies]
bevy = { workspace = true, features = ["serialize"] }
bevy = { workspace = true, features = ["serialize", "bevy_log"] }
bevy_flurx_ipc_macro = { workspace = true }
bevy_flurx = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }

[dev-dependencies]
trybuild = "1"
bevy = "0.15"
bevy = { workspace = true }

[lints]
workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_flurx_ipc/src/component.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Defines a handler that executes the [`Action`](bevy_flurx::prelude::Action) of the command.

use crate::ipc_commands::IpcCommand;
use bevy::platform::collections::HashMap;
use bevy::prelude::{Commands, Component, Entity, Reflect, ReflectComponent, ReflectDeserialize, ReflectSerialize};
use bevy::utils::HashMap;
use serde::{Deserialize, Serialize};

/// The ipc invoke handlers.
Expand Down
7 changes: 4 additions & 3 deletions crates/bevy_flurx_ipc/src/ipc_events.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! Defines the ipc commands and the queue to execute them.

use bevy::prelude::{error, App, Entity, Event, EventWriter, IntoSystemConfigs, Plugin, PreUpdate, Res, Resource};
use bevy::utils::HashMap;
use bevy::log::error;
use bevy::platform::collections::HashMap;
use bevy::prelude::{App, Entity, Event, EventWriter, IntoScheduleConfigs, Plugin, PreUpdate, Res, Resource};
use serde::de::DeserializeOwned;
use serde::Deserialize;
use std::sync::{Arc, Mutex};
Expand Down Expand Up @@ -127,7 +128,7 @@ fn send_ipc_events<E: DeserializeOwned + Send + Sync + 'static>(
ipc_events: Res<IpcEvents<E>>,
) {
if let Ok(mut guard) = ipc_events.0.try_lock() {
ew.send_batch(std::mem::take(&mut *guard));
ew.write_batch(std::mem::take(&mut *guard));
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_flurx_ipc_macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ proc-macro2 = "1"
syn = { version = "2", features = ["full", "extra-traits"] }
quote = "1"
darling = { version = "0.20" }
bevy = { version = "0.15", default-features = false, optional = true }
bevy = { workspace = true, default-features = false, optional = true }
serde = { workspace = true, optional = true }

[dev-dependencies]
bevy = { version = "0.15", default-features = false }
bevy = { version = "0.16.0-rc.3", default-features = false }
bevy_flurx = { workspace = true }
bevy_flurx_ipc = { path = "../bevy_flurx_ipc" }
serde = { workspace = true }
Expand Down
8 changes: 8 additions & 0 deletions crates/bevy_webview_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## Unreleased

## Features
Copy link
Preview

Copilot AI Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate changelog entries are present for 'Support for bevy's v0.16'. Consider removing one of the duplicate feature sections to avoid redundancy.

Copilot uses AI. Check for mistakes.


- Support for bevy's v0.16

## Features

- Support for bevy's v0.16

## v0.2.0

[Release notes](https://github.com/not-elm/bevy_webview_projects/releases/tag/v0.2.0)
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_webview_core/src/bundle/embedding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mod grip_zone;
/// ){
/// commands.spawn((
/// Webview::default(),
/// EmbedWithin(window.single()),
/// EmbedWithin(window.single().expect("Parent window not found")),
/// ));
/// }
#[repr(transparent)]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_webview_core/src/bundle/webview/webview_uri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::path::{Path, PathBuf};
///
/// fn spawn_webview(mut commands: Commands, window: Query<Entity, With<PrimaryWindow>>){
/// commands
/// .entity(window.single())
/// .entity(window.single().expect("Failed to obtain the window"))
/// // The actual URL is flurx://localhost/ui/example.html.
/// // show assets/ui/example.html
/// .insert(Webview::Uri(WebviewUri::relative_local("example.html")));
Expand Down
6 changes: 6 additions & 0 deletions crates/bevy_webview_wry/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased

## Features

- Support for bevy's v0.16

## v0.3.0

[Release notes](https://github.com/not-elm/bevy_webview_projects/releases/tag/v0.3.0)
Expand Down
20 changes: 6 additions & 14 deletions crates/bevy_webview_wry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,33 @@ bevy = { workspace = true, features = [
"bevy_color",
"serialize",
] }
bevy_flurx = { workspace = true }
bevy_webview_core = { workspace = true }
bevy_flurx_ipc = { workspace = true }
bevy_flurx_api = { workspace = true, optional = true, features = ["full"] }
serde = { workspace = true }
serde_json = { workspace = true }
rand = "0.9"
bevy_child_window = { version = "0.1", optional = true }
bevy_child_window = { version = "0.2", optional = true }
wry = { version = "0.51", features = ["transparent", "linux-body"] }

[target.'cfg(any(target_os="ios", target_os="macos"))'.dependencies]
objc2 = { version = "0.5" }
objc2-app-kit = { version = "0.2.0", features = [
objc2 = { version = "0.6" }
objc2-app-kit = { version = "0.3", features = [
"NSApplication",
"NSEvent",
"NSWindow",
"NSView",
"NSPanel",
"NSResponder",
] }
objc2-foundation = { version = "0.2.0" }

[dependencies.wry]
version = "0.48"
features = [
"transparent",
"linux-body",
]
objc2-foundation = { version = "0.3" }

[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))'.dependencies]
gtk = { version = "0.18" }
rfd = { version = "0.15", default-features = false, features = ["gtk3"] }

[dev-dependencies]
bevy = "0.15.0"
bevy_flurx = { workspace = true }
bevy = "0.16"
bevy_flurx_ipc = { path = "../bevy_flurx_ipc" }
serde = { workspace = true }
serde_json = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_webview_wry/src/embedding/grip_zone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bevy::ecs::system::SystemParam;
use bevy::input::common_conditions::input_just_released;
#[cfg(not(target_os = "linux"))]
use bevy::input::mouse::MouseMotion;
use bevy::prelude::{any_with_component, on_event, App, Changed, Commands, Condition, Entity, EventReader, IntoSystemConfigs, MouseButton, NonSend, Plugin, Query, Update, Vec2, Window, With};
use bevy::prelude::*;
use bevy::winit::WinitWindows;
use bevy_flurx_ipc::ipc_events::{IpcEvent, IpcEventExt};
use bevy_webview_core::bundle::embedding::{Bounds, EmbedWithin};
Expand Down
5 changes: 1 addition & 4 deletions crates/bevy_webview_wry/src/embedding/resize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ use crate::prelude::{WebviewInitialized, WryWebViews};
use crate::util::as_wry_rect;
use bevy::input::common_conditions::input_pressed;
use bevy::math::Vec2;
use bevy::prelude::{
not, Added, App, Changed, Commands, Entity, IntoSystemConfigs, MouseButton, NonSend, Or,
Plugin, Query, Update, Without,
};
use bevy::prelude::*;
use bevy::window::Window;
use bevy::winit::cursor::CursorIcon;
use bevy_webview_core::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_webview_wry/src/webview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use crate::webview::ipc_resolve::IpcResolvePlugin;
use crate::webview::load_webview::LoadWebviewPlugin;
use crate::webview::protocol::CustomProtocolPlugin;
use crate::webview::visible::VisiblePlugin;
use bevy::platform::collections::HashMap;
use bevy::prelude::{App, Deref, DerefMut, Entity, Plugin};
use bevy::utils::hashbrown::HashMap;
use bevy_flurx_ipc::FlurxIpcPlugin;

mod event_emitter;
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_webview_wry/src/webview/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,5 +330,5 @@ fn convert_drag_drop_event(

#[inline]
fn send_wry_events<E: Event>(mut ew: EventWriter<E>, events: Res<WryEvents<E>>) {
ew.send_batch(events.take_events());
ew.write_batch(events.take_events());
}
8 changes: 4 additions & 4 deletions crates/bevy_webview_wry/src/webview/handlers/dragdrop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ fn send_dragdrop_event(
for event in events.take_events() {
match event.event {
DragDropEvent::Enter(enter) => {
entered.send(enter);
entered.write(enter);
}
DragDropEvent::Over(event) => {
over.send(event);
over.write(event);
}
DragDropEvent::Drop(event) => {
dropped.send(event);
dropped.write(event);
}
DragDropEvent::Leave(event) => {
leaved.send(event);
leaved.write(event);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn open_new_window(
))
.id();

ew.send(NewWindowOpened {
ew.write(NewWindowOpened {
webview_entity: request.webview_entity,
opened_window_entity,
url: request.url,
Expand Down
14 changes: 7 additions & 7 deletions crates/bevy_webview_wry/src/webview/load_webview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl Plugin for LoadWebviewPlugin {

#[cfg(target_os = "macos")]
{
use bevy::prelude::IntoSystemConfigs;
use bevy::prelude::IntoScheduleConfigs;
app.add_systems(PreUpdate, (
resize_webview_inner_window.run_if(bevy::prelude::on_event::<bevy::window::WindowResized>),
));
Expand Down Expand Up @@ -174,7 +174,7 @@ fn feed_configs2<'a>(
let mut builder = builder
.with_focused(focused.0)
.with_hotkeys_zoom(hotkeys_zoom.0)
.with_initialization_script(&initialization_script(initialization_scripts, &identifier, is_embedded));
.with_initialization_script(initialization_script(initialization_scripts, &identifier, is_embedded));
if let Some(user_agent) = user_agent.0.as_ref() {
builder = builder.with_user_agent(user_agent);
}
Expand Down Expand Up @@ -263,8 +263,8 @@ unsafe fn attach_inner_window(

webview.removeFromSuperview();
webview.setAutoresizingMask(
NSAutoresizingMaskOptions::NSViewHeightSizable |
NSAutoresizingMaskOptions::NSViewWidthSizable,
NSAutoresizingMaskOptions::ViewHeightSizable |
NSAutoresizingMaskOptions::ViewWidthSizable,
);

let mtw = objc2_foundation::MainThreadMarker::new().unwrap();
Expand All @@ -285,14 +285,14 @@ unsafe fn attach_inner_window(
inner_window.setFrame_display(content_rect, true);
inner_window.setHidesOnDeactivate(false);
inner_window.setTitlebarAppearsTransparent(true);
inner_window.setTitleVisibility(objc2_app_kit::NSWindowTitleVisibility::NSWindowTitleHidden);
inner_window.setTitleVisibility(objc2_app_kit::NSWindowTitleVisibility::Hidden);

inner_window.setContentView(Some(webview));

inner_window.becomeKeyWindow();
inner_window.makeFirstResponder(Some(webview));

application_window.addChildWindow_ordered(&inner_window, objc2_app_kit::NSWindowOrderingMode::NSWindowAbove);
application_window.addChildWindow_ordered(&inner_window, objc2_app_kit::NSWindowOrderingMode::Above);
application_window.makeFirstResponder(Some(&inner_window));

inner_window.makeKeyAndOrderFront(None);
Expand Down Expand Up @@ -331,7 +331,7 @@ fn resize_webview_inner_window(
// that the `AppKitWindowHandle` contains a valid pointer to an
// `NSView`.
// Unwrap is fine, since the pointer came from `NonNull`.
let ns_view: objc2::rc::Id<objc2_app_kit::NSView> = unsafe { objc2::rc::Id::retain(ns_view.cast()) }.unwrap();
let ns_view: objc2::rc::Retained<objc2_app_kit::NSView> = unsafe { objc2::rc::Retained::retain(ns_view.cast()) }.unwrap();
let Some(ns_window) = ns_view.window() else {
continue;
};
Expand Down
Loading
Loading