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

@@ -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 {