Skip to content

Commit fb1a538

Browse files
committed
chore: Update GPUI, GPUI Component deps and add note to README.
1 parent b6454b2 commit fb1a538

7 files changed

Lines changed: 21 additions & 20 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,16 @@ resolver = "2"
1313
[workspace.dependencies]
1414
wef = { path = "crates/wef" }
1515
gpui-webview = { path = "crates/webview" }
16-
ropey = { version = "=2.0.0-beta.1", features = ["metric_utf16", "metric_lines_lf"] }
1716

1817
anyhow = "1"
1918
log = "0.4"
2019
serde = { version = "1.0.219", features = ["derive"] }
21-
serde_repr = "0.1"
2220
serde_json = "1"
23-
schemars = "1"
2421
smallvec = "1"
25-
rust-i18n = "3"
2622
raw-window-handle = "0.6.2"
2723
smol = "1"
2824
tracing = "0.1.41"
2925
notify = "7.0.0"
30-
lsp-types = "0.97.0"
3126

3227
[workspace.dependencies.windows]
3328
features = ["Wdk", "Wdk_System", "Wdk_System_SystemServices"]
@@ -59,6 +54,3 @@ split-debuginfo = "unpacked"
5954
image = { opt-level = 3 }
6055
png = { opt-level = 3 }
6156
reqwest = { opt-level = 3 }
62-
63-
[workspace.metadata.typos]
64-
files.extend-exclude = ["**/fixtures/*"]

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
> Web Embedding Framework
44
5+
> [!WARNING]
6+
> This is an experimental project, we was tried to build a offscreen rendering WebView for solve GPUI render level issues in game engine, but there still not good enough.
7+
>
8+
> For example, the app size (included a CEF Framework increase 1GB), development experience, etc.
9+
>
10+
> So, we are still use [Wry](https://github.com/longbridge/gpui-component/blob/main/crates/ui/src/webview.rs) in [Longbridge](https://longbridge.com/desktop) desktop app for now.
11+
512
![CI](https://github.com/longbridge/wef/workflows/CI/badge.svg)
613
[![Crates.io](https://img.shields.io/crates/v/wef.svg)](https://crates.io/crates/wef)
714
[![Documentation](https://docs.rs/wef/badge.svg)](https://docs.rs/wef)

crates/webview/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ homepage = "https://github.com/longbridge/wef"
88
repository = "https://github.com/longbridge/wef"
99

1010
[dependencies]
11-
gpui-component = { git = "https://github.com/longbridge/gpui-component.git" }
12-
gpui = { git = "https://github.com/zed-industries/zed.git" }
11+
gpui-component = "0.2.0"
12+
gpui = "0.2.0"
1313
wef = { path = "../wef" }
1414
schemars = "1"
1515
serde = { version = "1.0.219", features = ["derive"] }

crates/webview/src/browser_handler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::{rc::Rc, sync::Arc};
22

33
use gpui::{AnyWindowHandle, AppContext, AsyncApp, ParentElement, RenderImage, Styled, WeakEntity};
44
use gpui_component::{
5-
ContextModal,
5+
ContextModal, PixelsExt,
66
input::{InputState, TextInput},
77
v_flex,
88
};
@@ -236,8 +236,8 @@ impl BrowserHandler for WebViewHandler {
236236
cx.update_entity(&entity, |webview, cx| {
237237
webview.context_menu = Some(ContextMenuInfo {
238238
crood: Point::new(
239-
LogicalUnit(params.crood.x.0 + webview.bounds.origin.x.0 as i32),
240-
LogicalUnit(params.crood.y.0 + webview.bounds.origin.y.0 as i32),
239+
LogicalUnit(params.crood.x.0 + webview.bounds.origin.x.as_f32() as i32),
240+
LogicalUnit(params.crood.y.0 + webview.bounds.origin.y.as_f32() as i32),
241241
),
242242
frame,
243243
menu: build_context_menu(webview, &params, window, cx),

crates/webview/src/element.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use gpui::{
66
IntoElement, LayoutId, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, RenderImage, Size,
77
StyleRefinement, Styled, Window, hsla, point, px, size,
88
};
9+
use gpui_component::PixelsExt;
910
use wef::{Browser, LogicalUnit, Rect};
1011

1112
use crate::{WebView, utils::*};
@@ -138,8 +139,8 @@ impl Element for WebViewElement {
138139
|_, window, _cx| {
139140
let scale_factor = window.scale_factor();
140141
self.browser.resize(wef::Size::new(
141-
wef::PhysicalUnit((bounds.size.width.0 * scale_factor) as i32),
142-
wef::PhysicalUnit((bounds.size.height.0 * scale_factor) as i32),
142+
wef::PhysicalUnit((bounds.size.width.as_f32() * scale_factor) as i32),
143+
wef::PhysicalUnit((bounds.size.height.as_f32() * scale_factor) as i32),
143144
));
144145

145146
let image_size = self.view_image.size(0);
@@ -197,8 +198,8 @@ impl Element for WebViewElement {
197198
let position = event.position - bounds.origin;
198199
webview.browser().send_mouse_move_event(
199200
wef::Point::new(
200-
wef::LogicalUnit(position.x.0 as i32),
201-
wef::LogicalUnit(position.y.0 as i32),
201+
wef::LogicalUnit(position.x.as_f32() as i32),
202+
wef::LogicalUnit(position.y.as_f32() as i32),
202203
),
203204
to_wef_key_modifiers(&event.modifiers),
204205
);

crates/webview/src/webview.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use gpui::{
66
Subscription, UTF16Selection, WeakEntity, Window, anchored, deferred, div, point, prelude::*,
77
px,
88
};
9+
use gpui_component::PixelsExt;
910
use wef::{Browser, FuncRegistry, LogicalUnit, Point, Rect};
1011

1112
use crate::{
@@ -114,7 +115,7 @@ impl WebView {
114115
_cx: &mut Context<Self>,
115116
) {
116117
let (delta_x, delta_y) = match event.delta {
117-
gpui::ScrollDelta::Pixels(point) => (point.x.0, point.y.0),
118+
gpui::ScrollDelta::Pixels(point) => (point.x.as_f32(), point.y.as_f32()),
118119
gpui::ScrollDelta::Lines(point) => (point.x * 20.0, point.y * 20.0),
119120
};
120121
self.browser().send_mouse_wheel_event(Point::new(

examples/wef-example/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ embed-manifest = "1.4.0"
99
[dependencies]
1010
wef = { path = "../../crates/wef" }
1111
gpui-webview = { path = "../../crates/webview" }
12-
gpui-component = { git = "https://github.com/longbridge/gpui-component.git" }
13-
gpui = { git = "https://github.com/zed-industries/zed.git" }
12+
gpui-component = "0.2.0"
13+
gpui = "0.2.0"
1414
futures-util = "0.3.31"
1515
serde = { version = "1.0.219", features = ["derive"] }
1616
flume = "0.11.1"

0 commit comments

Comments
 (0)