Update CEF version to 144.2.0+144.0.11 (#14)

* update: enable message loop work for Windows and Linux

* update: upgrade Bevy to version 0.18 and adjust asset loader for path handling

* update: rename bevy_picking to picking in Cargo.toml

* update: remove pull_request trigger from CI and change AmbientLight to GlobalAmbientLight

* update: remove demo example from workspace and exclude it from tests

* update: remove demo package from Cargo.lock

* update: refactor paths and dependencies for Chromium Embedded Framework integration

* fmt

* update: remove unnecessary type casting for event flags in mouse and keyboard handling

* update: remove unnecessary type casting for event flags in mouse and keyboard handling

* update: comment out GPU-related command line switches in app.rs

* update: allow unnecessary cast lint warning in mouse button modifiers test

---------

Co-authored-by: not-elm <elmgameinfo@gmail.com>
This commit is contained in:
elm
2026-01-29 00:19:54 +09:00
committed by GitHub
parent e623a90351
commit 231c44995b
12 changed files with 156 additions and 64 deletions

View File

@@ -28,7 +28,7 @@ jobs:
if: runner.os == 'linux'
- name: Build & run tests
run: |
cargo test --workspace --no-default-features --tests --exclude demo
cargo test --workspace --no-default-features --tests
all-doc-tests:
runs-on: ubuntu-latest
steps:

149
Cargo.lock generated
View File

@@ -47,7 +47,7 @@ dependencies = [
"accesskit",
"accesskit_consumer",
"hashbrown 0.15.5",
"objc2",
"objc2 0.5.2",
"objc2-app-kit",
"objc2-foundation",
]
@@ -260,7 +260,7 @@ version = "0.38.0+1.3.281"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
dependencies = [
"libloading",
"libloading 0.8.9",
]
[[package]]
@@ -1788,7 +1788,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
dependencies = [
"objc2",
"objc2 0.5.2",
]
[[package]]
@@ -1883,6 +1883,39 @@ dependencies = [
"wayland-client",
]
[[package]]
name = "camino"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48"
dependencies = [
"serde_core",
]
[[package]]
name = "cargo-platform"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87a0c0e6148f11f01f32650a2ea02d532b2ad4e81d8bd41e6e565b5adc5e6082"
dependencies = [
"serde",
"serde_core",
]
[[package]]
name = "cargo_metadata"
version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef987d17b0a113becdd19d3d0022d04d7ef41f9efe4f3fb63ac44ba61df3ade9"
dependencies = [
"camino",
"cargo-platform",
"semver",
"serde",
"serde_json",
"thiserror 2.0.17",
]
[[package]]
name = "cc"
version = "1.2.43"
@@ -1897,20 +1930,29 @@ dependencies = [
[[package]]
name = "cef"
version = "139.8.0+139.0.40"
version = "144.2.0+144.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c04e0abf502cba8e3642d0d38551c49a3bfa9eba8a74f83f8dca39e249ccf657"
checksum = "8743b7a17569f5a0b27a1ef72a2275dc096ae32263bf35fc5541f46e73084ec5"
dependencies = [
"anyhow",
"cargo_metadata",
"cef-dll-sys",
"libloading",
"clap",
"libloading 0.9.0",
"objc2 0.6.3",
"plist",
"semver",
"serde",
"serde_json",
"thiserror 2.0.17",
"windows-sys 0.61.2",
]
[[package]]
name = "cef-dll-sys"
version = "139.8.0+139.0.40"
version = "144.2.0+144.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0478a63d0a32b000a34d7905367fbcb805cc75e6b5c14b8e3bfdb4184ff4e417"
checksum = "cf6882e1e10fe7ff0c9b1815e8a2943c0975be5bb48f15ca3b4cbb9dc4329d0e"
dependencies = [
"anyhow",
"cmake",
@@ -1953,7 +1995,7 @@ checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
dependencies = [
"glob",
"libc",
"libloading",
"libloading 0.8.9",
]
[[package]]
@@ -2400,7 +2442,7 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
dependencies = [
"libloading",
"libloading 0.8.9",
]
[[package]]
@@ -2426,9 +2468,9 @@ checksum = "117240f60069e65410b3ae1bb213295bd828f707b5bec6596a1afc8793ce0cbc"
[[package]]
name = "download-cef"
version = "2.2.0"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d98178d9254efef0f69c1f584713d69c790ec00668cd98f783a5085fbefdbddc"
checksum = "6002a6b95f9f3bbe5693ac02a03221a8e3af6c9f5f4539f5734a8d6cde1a3616"
dependencies = [
"bzip2",
"clap",
@@ -3430,7 +3472,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
dependencies = [
"libc",
"libloading",
"libloading 0.8.9",
"pkg-config",
]
@@ -3508,6 +3550,16 @@ dependencies = [
"windows-link 0.2.1",
]
[[package]]
name = "libloading"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60"
dependencies = [
"cfg-if",
"windows-link 0.2.1",
]
[[package]]
name = "libm"
version = "0.2.15"
@@ -3929,6 +3981,15 @@ dependencies = [
"objc2-encode",
]
[[package]]
name = "objc2"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05"
dependencies = [
"objc2-encode",
]
[[package]]
name = "objc2-app-kit"
version = "0.2.2"
@@ -3938,7 +3999,7 @@ dependencies = [
"bitflags 2.10.0",
"block2",
"libc",
"objc2",
"objc2 0.5.2",
"objc2-core-data",
"objc2-core-image",
"objc2-foundation",
@@ -3953,7 +4014,7 @@ checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009"
dependencies = [
"bitflags 2.10.0",
"block2",
"objc2",
"objc2 0.5.2",
"objc2-core-location",
"objc2-foundation",
]
@@ -3965,7 +4026,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889"
dependencies = [
"block2",
"objc2",
"objc2 0.5.2",
"objc2-foundation",
]
@@ -3977,7 +4038,7 @@ checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef"
dependencies = [
"bitflags 2.10.0",
"block2",
"objc2",
"objc2 0.5.2",
"objc2-foundation",
]
@@ -3997,7 +4058,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80"
dependencies = [
"block2",
"objc2",
"objc2 0.5.2",
"objc2-foundation",
"objc2-metal",
]
@@ -4009,7 +4070,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781"
dependencies = [
"block2",
"objc2",
"objc2 0.5.2",
"objc2-contacts",
"objc2-foundation",
]
@@ -4030,7 +4091,7 @@ dependencies = [
"block2",
"dispatch",
"libc",
"objc2",
"objc2 0.5.2",
]
[[package]]
@@ -4050,7 +4111,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398"
dependencies = [
"block2",
"objc2",
"objc2 0.5.2",
"objc2-app-kit",
"objc2-foundation",
]
@@ -4063,7 +4124,7 @@ checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6"
dependencies = [
"bitflags 2.10.0",
"block2",
"objc2",
"objc2 0.5.2",
"objc2-foundation",
]
@@ -4075,7 +4136,7 @@ checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a"
dependencies = [
"bitflags 2.10.0",
"block2",
"objc2",
"objc2 0.5.2",
"objc2-foundation",
"objc2-metal",
]
@@ -4086,7 +4147,7 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc"
dependencies = [
"objc2",
"objc2 0.5.2",
"objc2-foundation",
]
@@ -4098,7 +4159,7 @@ checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f"
dependencies = [
"bitflags 2.10.0",
"block2",
"objc2",
"objc2 0.5.2",
"objc2-cloud-kit",
"objc2-core-data",
"objc2-core-image",
@@ -4118,7 +4179,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe"
dependencies = [
"block2",
"objc2",
"objc2 0.5.2",
"objc2-foundation",
]
@@ -4130,7 +4191,7 @@ checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3"
dependencies = [
"bitflags 2.10.0",
"block2",
"objc2",
"objc2 0.5.2",
"objc2-core-location",
"objc2-foundation",
]
@@ -4319,6 +4380,19 @@ version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
[[package]]
name = "plist"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07"
dependencies = [
"base64",
"indexmap",
"quick-xml 0.38.4",
"serde",
"time",
]
[[package]]
name = "png"
version = "0.18.0"
@@ -4442,6 +4516,15 @@ dependencies = [
"memchr",
]
[[package]]
name = "quick-xml"
version = "0.38.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b66c2058c55a409d601666cffe35f04333cf1013010882cec174a7467cd4e21c"
dependencies = [
"memchr",
]
[[package]]
name = "quote"
version = "1.0.41"
@@ -4792,6 +4875,10 @@ name = "semver"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
dependencies = [
"serde",
"serde_core",
]
[[package]]
name = "send_wrapper"
@@ -5735,7 +5822,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54cb1e9dc49da91950bdfd8b848c49330536d9d1fb03d4bfec8cae50caa50ae3"
dependencies = [
"proc-macro2",
"quick-xml",
"quick-xml 0.37.5",
"quote",
]
@@ -5890,7 +5977,7 @@ dependencies = [
"js-sys",
"khronos-egl",
"libc",
"libloading",
"libloading 0.8.9",
"log",
"metal",
"naga",
@@ -6506,7 +6593,7 @@ dependencies = [
"libc",
"memmap2",
"ndk 0.9.0",
"objc2",
"objc2 0.5.2",
"objc2-app-kit",
"objc2-foundation",
"objc2-ui-kit",
@@ -6576,7 +6663,7 @@ dependencies = [
"as-raw-xcb-connection",
"gethostname",
"libc",
"libloading",
"libloading 0.8.9",
"once_cell",
"rustix 1.1.2",
"x11rb-protocol",

View File

@@ -38,8 +38,8 @@ bevy = { version = "0.18", default-features = false, features = [
"picking",
] }
bevy_remote = "0.18"
cef = { version = "139" }
cef-dll-sys = { version = "139.0", features = ["sandbox"] }
cef = { version = "144.2.0+144.0.11" }
cef-dll-sys = { version = "144.2.0+144.0.11", features = ["sandbox"] }
bevy_cef = { path = "." , version = "0.2.0-dev" }
bevy_cef_core = { path = "crates/bevy_cef_core", version = "0.2.0-dev" }
async-channel = { version = "2.5" }

View File

@@ -1,13 +1,13 @@
.PHONY: fix install
BIN := bevy_cef_debug_render_process
CEF_LIB := $(HOME)/.local/share/cef/Chromium Embedded Framework.framework/Libraries
CEF_LIB := $(HOME)/.local/share/Chromium Embedded Framework.framework/Libraries
.PHONY: fix install
BIN := bevy_cef_debug_render_process
CEF_LIB := $(HOME)/.local/share/cef/Chromium Embedded Framework.framework/Libraries
CEF_LIB := $(HOME)/.local/share/Chromium Embedded Framework.framework/Libraries
CARGO_BIN := $(HOME)/.cargo/bin
fix:

View File

@@ -53,6 +53,9 @@ impl ImplApp for BrowserProcessAppBuilder {
return;
};
command_line.append_switch(Some(&"use-mock-keychain".into()));
// command_line.append_switch(Some(&"disable-gpu".into()));
// command_line.append_switch(Some(&"disable-gpu-compositing".into()));
// command_line.append_switch(Some(&" disable-gpu-shader-disk-cache".into()));
}
fn browser_process_handler(&self) -> Option<BrowserProcessHandler> {

View File

@@ -148,9 +148,9 @@ impl Browsers {
x: position.x as i32,
y: position.y as i32,
modifiers: match button {
PointerButton::Primary => cef_event_flags_t::EVENTFLAG_LEFT_MOUSE_BUTTON,
PointerButton::Secondary => cef_event_flags_t::EVENTFLAG_RIGHT_MOUSE_BUTTON,
PointerButton::Middle => cef_event_flags_t::EVENTFLAG_MIDDLE_MOUSE_BUTTON,
PointerButton::Primary => cef_event_flags_t::EVENTFLAG_LEFT_MOUSE_BUTTON.0,
PointerButton::Secondary => cef_event_flags_t::EVENTFLAG_RIGHT_MOUSE_BUTTON.0,
PointerButton::Middle => cef_event_flags_t::EVENTFLAG_MIDDLE_MOUSE_BUTTON.0,
} as _, // No modifiers for simplicity
};
let mouse_button = match button {
@@ -335,8 +335,7 @@ impl Browsers {
let replacement_range = Self::ime_caret_range_for(browser);
browser.host.ime_set_composition(
Some(&text.into()),
underlines.len(),
Some(&underlines[0]),
Some(&underlines),
Some(&replacement_range),
Some(&selection_range),
);
@@ -434,16 +433,19 @@ impl Browsers {
}
}
#[allow(clippy::unnecessary_cast)]
pub fn modifiers_from_mouse_buttons<'a>(buttons: impl IntoIterator<Item = &'a MouseButton>) -> u32 {
let mut modifiers = cef_event_flags_t::EVENTFLAG_NONE as u32;
let mut modifiers = cef_event_flags_t::EVENTFLAG_NONE.0 as u32;
for button in buttons {
match button {
MouseButton::Left => modifiers |= cef_event_flags_t::EVENTFLAG_LEFT_MOUSE_BUTTON as u32,
MouseButton::Left => {
modifiers |= cef_event_flags_t::EVENTFLAG_LEFT_MOUSE_BUTTON.0 as u32
}
MouseButton::Right => {
modifiers |= cef_event_flags_t::EVENTFLAG_RIGHT_MOUSE_BUTTON as u32
modifiers |= cef_event_flags_t::EVENTFLAG_RIGHT_MOUSE_BUTTON.0 as u32
}
MouseButton::Middle => {
modifiers |= cef_event_flags_t::EVENTFLAG_MIDDLE_MOUSE_BUTTON as u32
modifiers |= cef_event_flags_t::EVENTFLAG_MIDDLE_MOUSE_BUTTON.0 as u32
}
_ => {}
}
@@ -498,13 +500,14 @@ mod tests {
use bevy::prelude::*;
#[test]
#[allow(clippy::unnecessary_cast)]
fn test_modifiers_from_mouse_buttons() {
let buttons = vec![&MouseButton::Left, &MouseButton::Right];
let modifiers = modifiers_from_mouse_buttons(buttons);
assert_eq!(
modifiers,
cef_dll_sys::cef_event_flags_t::EVENTFLAG_LEFT_MOUSE_BUTTON as u32
| cef_dll_sys::cef_event_flags_t::EVENTFLAG_RIGHT_MOUSE_BUTTON as u32
cef_dll_sys::cef_event_flags_t::EVENTFLAG_LEFT_MOUSE_BUTTON.0 as u32
| cef_dll_sys::cef_event_flags_t::EVENTFLAG_RIGHT_MOUSE_BUTTON.0 as u32
);
}
}

View File

@@ -8,26 +8,27 @@ use bevy::input::keyboard::KeyboardInput;
use bevy::prelude::{ButtonInput, KeyCode};
use cef_dll_sys::{cef_event_flags_t, cef_key_event_t, cef_key_event_type_t};
#[allow(clippy::unnecessary_cast)]
pub fn keyboard_modifiers(input: &ButtonInput<KeyCode>) -> u32 {
let mut flags = 0u32;
if input.pressed(KeyCode::ControlLeft) || input.pressed(KeyCode::ControlRight) {
flags |= cef_event_flags_t::EVENTFLAG_CONTROL_DOWN as u32;
flags |= cef_event_flags_t::EVENTFLAG_CONTROL_DOWN.0 as u32;
}
if input.pressed(KeyCode::AltLeft) || input.pressed(KeyCode::AltRight) {
flags |= cef_event_flags_t::EVENTFLAG_ALT_DOWN as u32;
flags |= cef_event_flags_t::EVENTFLAG_ALT_DOWN.0 as u32;
}
if input.pressed(KeyCode::ShiftLeft) || input.pressed(KeyCode::ShiftRight) {
flags |= cef_event_flags_t::EVENTFLAG_SHIFT_DOWN as u32;
flags |= cef_event_flags_t::EVENTFLAG_SHIFT_DOWN.0 as u32;
}
if input.pressed(KeyCode::SuperLeft) || input.pressed(KeyCode::SuperRight) {
flags |= cef_event_flags_t::EVENTFLAG_COMMAND_DOWN as u32;
flags |= cef_event_flags_t::EVENTFLAG_COMMAND_DOWN.0 as u32;
}
if input.pressed(KeyCode::CapsLock) {
flags |= cef_event_flags_t::EVENTFLAG_CAPS_LOCK_ON as u32;
flags |= cef_event_flags_t::EVENTFLAG_CAPS_LOCK_ON.0 as u32;
}
if input.pressed(KeyCode::NumLock) {
flags |= cef_event_flags_t::EVENTFLAG_NUM_LOCK_ON as u32;
flags |= cef_event_flags_t::EVENTFLAG_NUM_LOCK_ON.0 as u32;
}
flags

View File

@@ -110,8 +110,7 @@ impl ImplRenderHandler for RenderHandlerBuilder {
&self,
_browser: Option<&mut Browser>,
type_: PaintElementType,
_dirty_rects_count: usize,
_dirty_rects: Option<&cef::Rect>,
_dirty_rects: Option<&[cef::Rect]>,
buffer: *const u8,
width: c_int,
height: c_int,

View File

@@ -21,7 +21,6 @@ impl DebugLibraryLoader {
.unwrap()
.join(".local")
.join("share")
.join("cef")
.join(Self::FRAMEWORK_PATH)
.canonicalize()
.unwrap();

View File

@@ -35,11 +35,11 @@ pub fn debug_chromium_libraries_path() -> PathBuf {
}
pub fn debug_chromium_embedded_framework_dir_path() -> PathBuf {
debug_cef_path().join("Chromium Embedded Framework.framework")
}
pub fn debug_cef_path() -> PathBuf {
home_dir().unwrap().join(".local").join("share").join("cef")
home_dir()
.unwrap()
.join(".local")
.join("share")
.join("Chromium Embedded Framework.framework")
}
pub fn debug_render_process_path() -> PathBuf {

View File

@@ -12,5 +12,5 @@ categories.workspace = true
[dependencies]
cef = { workspace = true }
bevy_cef_core = { workspace = true }
bevy_cef_core = { workspace = true, features = ["debug"] }
cef-dll-sys = { workspace = true }

View File

@@ -3,10 +3,10 @@ use cef::{args::Args, *};
fn main() {
let args = Args::new();
#[cfg(target_os = "macos")]
let _loader = {
let loader =
cef::library_loader::LibraryLoader::new(&std::env::current_exe().unwrap(), true);
let loader = DebugLibraryLoader::new();
assert!(loader.load());
loader
};