ohos: Bump ohos-sys to v0.2.1 (#32834)

* ohos: Use ohos-sys from crates.io

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

* ohos: Bump ohos-sys to v0.2.1

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
Jonathan Schwender 2024-07-23 09:58:54 +02:00 committed by GitHub
parent 2a31e62e2c
commit d46c66f9da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 9 deletions

5
Cargo.lock generated
View file

@ -4418,8 +4418,9 @@ dependencies = [
[[package]] [[package]]
name = "ohos-sys" name = "ohos-sys"
version = "0.1.0" version = "0.2.1"
source = "git+https://github.com/jschwe/ohos-sys.git#bf0625fc7ea8035c2991626fb0a593e06c9c8c21" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "576650788dcfcb1321ce967707fea478dece87c2c02bbd1e99ddddc4e53a4b8d"
[[package]] [[package]]
name = "once_cell" name = "once_cell"

View file

@ -87,7 +87,7 @@ napi-ohos = "0.1"
serde_json = { workspace = true } serde_json = { workspace = true }
surfman = { workspace = true, features = ["sm-angle-default"] } surfman = { workspace = true, features = ["sm-angle-default"] }
webxr = { git = "https://github.com/servo/webxr" } webxr = { git = "https://github.com/servo/webxr" }
ohos-sys = { git = "https://github.com/jschwe/ohos-sys.git" } ohos-sys = { version = "0.2.1", features = ["xcomponent"] }
[target.'cfg(not(any(target_os = "android", target_env = "ohos")))'.dependencies] [target.'cfg(not(any(target_os = "android", target_env = "ohos")))'.dependencies]

View file

@ -18,9 +18,10 @@ use napi_ohos::threadsafe_function::{
ErrorStrategy, ThreadsafeFunction, ThreadsafeFunctionCallMode, ErrorStrategy, ThreadsafeFunction, ThreadsafeFunctionCallMode,
}; };
use napi_ohos::{Env, JsFunction, JsObject, JsString, NapiRaw}; use napi_ohos::{Env, JsFunction, JsObject, JsString, NapiRaw};
use ohos_sys::ace::xcomponent::native_interface_xcomponent::{ use ohos_sys::xcomponent::{
OH_NativeXComponent, OH_NativeXComponent_Callback, OH_NativeXComponent_GetTouchEvent, OH_NativeXComponent, OH_NativeXComponent_Callback, OH_NativeXComponent_GetTouchEvent,
OH_NativeXComponent_TouchEvent, OH_NativeXComponent_TouchEventType, OH_NativeXComponent_RegisterCallback, OH_NativeXComponent_TouchEvent,
OH_NativeXComponent_TouchEventType,
}; };
use servo::embedder_traits::PromptResult; use servo::embedder_traits::PromptResult;
use servo::euclid::Point2D; use servo::euclid::Point2D;
@ -395,7 +396,6 @@ fn register_xcomponent_callbacks(env: &Env, xcomponent: &JsObject) -> napi_ohos:
OnSurfaceDestroyed: Some(on_surface_destroyed_cb), OnSurfaceDestroyed: Some(on_surface_destroyed_cb),
DispatchTouchEvent: Some(on_dispatch_touch_event_cb), DispatchTouchEvent: Some(on_dispatch_touch_event_cb),
}); });
use ohos_sys::ace::xcomponent::native_interface_xcomponent::OH_NativeXComponent_RegisterCallback;
let res = let res =
unsafe { OH_NativeXComponent_RegisterCallback(nativeXComponent, Box::leak(cbs) as *mut _) }; unsafe { OH_NativeXComponent_RegisterCallback(nativeXComponent, Box::leak(cbs) as *mut _) };
if res != 0 { if res != 0 {

View file

@ -8,9 +8,7 @@ use std::path::PathBuf;
use std::rc::Rc; use std::rc::Rc;
use log::{debug, error, info}; use log::{debug, error, info};
use ohos_sys::ace::xcomponent::native_interface_xcomponent::{ use ohos_sys::xcomponent::{OH_NativeXComponent, OH_NativeXComponent_GetXComponentSize};
OH_NativeXComponent, OH_NativeXComponent_GetXComponentSize,
};
use servo::compositing::windowing::EmbedderEvent; use servo::compositing::windowing::EmbedderEvent;
use servo::compositing::CompositeTarget; use servo::compositing::CompositeTarget;
use servo::embedder_traits::resources; use servo::embedder_traits::resources;