Skip to content

Commit 9216358

Browse files
authored
Merge branch 'main' into feat/set-cursor-shortcut
2 parents b433db0 + 437afa8 commit 9216358

37 files changed

+293
-230
lines changed

.github/workflows/rust.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ jobs:
5252
if: runner.os == 'Linux'
5353
with:
5454
token: ${{ secrets.CODECOV_TOKEN }}
55+
- name: Make sure the mocked Skia bindings are on sync
56+
if: runner.os == 'Linux'
57+
run: cargo build --package freya --features mocked-engine-development --no-default-features

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"rust-analyzer.cargo.features": [
33
"devtools",
4-
"log"
4+
"log",
5+
"use_camera"
56
]
67
}

Cargo.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,21 @@ dioxus-core = { version = "0.4" }
3737
dioxus-hot-reload = { version = "0.4", features = ["file_watcher"] }
3838
dioxus-router = { version = "0.4", default-features = false }
3939

40-
skia-safe = { version = "0.66.3", features = ["gl", "textlayout", "svg"] }
40+
skia-safe = { version = "0.67.0", features = ["gl", "textlayout", "svg"] }
4141

4242
gl = "0.14.0"
43-
glutin = "0.30.6"
43+
glutin = "0.30.10"
4444
glutin-winit = "0.3.0"
4545
raw-window-handle = "0.5.1"
46-
winit = "0.28.2"
47-
tokio = { version = "1.23.0", features = ["sync", "rt-multi-thread", "time", "macros"] }
46+
winit = "0.28.7"
47+
tokio = { version = "1.33.0", features = ["sync", "rt-multi-thread", "time", "macros"] }
4848
accesskit = { version = "0.11.0", features = ["serde"]}
4949
accesskit_winit = "0.14.1"
50-
zbus = "3.13.1"
50+
zbus = "3.14.1"
5151

52-
euclid = "0.22.7"
53-
uuid = { version = "1.2.2", features = ["v4"]}
54-
futures = "0.3.25"
52+
euclid = "0.22.9"
53+
uuid = { version = "1.4.1", features = ["v4"]}
54+
futures = "0.3.28"
5555
anymap = "0.12.1"
5656
tracing = "0.1"
5757
tracing-subscriber = "0.3.17"
@@ -64,9 +64,9 @@ tokio = { workspace = true }
6464
dioxus = { workspace = true }
6565
freya = { workspace = true }
6666
freya-node-state = { workspace = true }
67-
reqwest = { version = "0.11.13", features = ["json"] }
68-
serde = "1.0.152"
69-
tracing-subscriber = "0.2.25"
67+
reqwest = { version = "0.11.22", features = ["json"] }
68+
serde = "1.0.189"
69+
tracing-subscriber = "0.3.17"
7070
dioxus-std = { version = "0.4", features = ["utils", "i18n"] }
7171
rand = "0.8.5"
7272
dioxus-router = { workspace = true }

crates/components/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ tokio = { workspace = true }
3434
tracing = { workspace = true }
3535

3636
open = "5"
37-
reqwest = { version = "0.11.13", features = ["json"] }
37+
reqwest = { version = "0.11.22", features = ["json"] }
3838

3939
[dev-dependencies]
4040
freya = { path = "../freya" }

crates/components/src/input.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ pub fn Input<'a>(cx: Scope<'a, InputProps<'a>>) -> Element {
8484
let theme = use_get_theme(cx);
8585
let focus_manager = use_focus(cx);
8686

87+
if &cx.props.value != editable.editor().current().rope() {
88+
editable.editor().with_mut(|editor| {
89+
editor.set(&cx.props.value);
90+
});
91+
}
92+
8793
let text = match cx.props.hidden {
8894
InputMode::Hidden(ch) => ch.to_string().repeat(cx.props.value.len()),
8995
InputMode::Shown => cx.props.value.clone(),
@@ -94,15 +100,6 @@ pub fn Input<'a>(cx: Scope<'a, InputProps<'a>>) -> Element {
94100
let height = &cx.props.height;
95101
let max_lines = &cx.props.max_lines;
96102

97-
use_memo(cx, &(cx.props.value.to_string(),), {
98-
to_owned![editable];
99-
move |(text,)| {
100-
editable.editor().with_mut(|editor| {
101-
editor.set(&text);
102-
});
103-
}
104-
});
105-
106103
let onkeydown = {
107104
to_owned![editable, focus_manager];
108105
move |e: Event<KeyboardData>| {

crates/elements/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ winit = { workspace = true }
2525
tokio = { workspace = true }
2626
accesskit = { workspace = true }
2727

28-
keyboard-types = "0.6.2"
28+
keyboard-types = "0.7.0"

crates/engine/src/mocked.rs

Lines changed: 35 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![allow(non_upper_case_globals)]
33
#![allow(clippy::upper_case_acronyms)]
44
#![allow(non_camel_case_types)]
5+
#![allow(unused_variables)]
56

67
use std::ops::*;
78

@@ -167,7 +168,7 @@ impl Matrix {
167168
unimplemented!("This is mocked")
168169
}
169170

170-
pub fn set_rotate(&self, _degrees: f32, _pivot: impl Into<Option<Point>>) -> &mut Self {
171+
pub fn set_rotate(&mut self, _degrees: f32, _pivot: impl Into<Option<Point>>) -> &mut Self {
171172
unimplemented!("This is mocked")
172173
}
173174
}
@@ -420,7 +421,7 @@ impl TextStyle {
420421
unimplemented!("This is mocked")
421422
}
422423

423-
pub fn decoration_mut(&mut self) -> &mut Decoration {
424+
pub fn set_decoration(&mut self, decoration: &Decoration) {
424425
unimplemented!("This is mocked")
425426
}
426427

@@ -708,7 +709,7 @@ impl Paragraph {
708709
unimplemented!("This is mocked")
709710
}
710711

711-
pub fn paint(&self, _canvas: &mut Canvas, _p: impl Into<Point>) {
712+
pub fn paint(&self, _canvas: &Canvas, _p: impl Into<Point>) {
712713
unimplemented!("This is mocked")
713714
}
714715

@@ -947,43 +948,43 @@ impl Canvas {
947948
unimplemented!("This is mocked")
948949
}
949950

950-
pub fn concat(&mut self, _matrix: &Matrix) {
951+
pub fn concat(&self, _matrix: &Matrix) {
951952
unimplemented!("This is mocked")
952953
}
953954

954-
pub fn clip_rect(&mut self, _rect: Rect, _clip: ClipOp, _: bool) {
955+
pub fn clip_rect(&self, _rect: Rect, _clip: ClipOp, _: bool) {
955956
unimplemented!("This is mocked")
956957
}
957958

958959
pub fn draw_image_nine(
959-
&mut self,
960+
&self,
960961
_image: Image,
961962
_center: IRect,
962963
_dst: Rect,
963964
_filter_mode: FilterMode,
964965
_paint: Option<&Paint>,
965-
) -> &mut Self {
966+
) -> &Self {
966967
unimplemented!("This is mocked")
967968
}
968969

969-
pub fn draw_rect(&mut self, _rect: Rect, _paint: &Paint) -> &mut Self {
970+
pub fn draw_rect(&self, _rect: Rect, _paint: &Paint) -> &Self {
970971
unimplemented!("This is mocked")
971972
}
972973

973-
pub fn draw_path(&mut self, _path: &Path, _paint: &Paint) -> &mut Self {
974+
pub fn draw_path(&self, _path: &Path, _paint: &Paint) -> &Self {
974975
unimplemented!("This is mocked")
975976
}
976977

977978
pub fn clip_path(
978-
&mut self,
979+
&self,
979980
_path: &Path,
980981
_op: impl Into<Option<ClipOp>>,
981982
_do_anti_alias: impl Into<Option<bool>>,
982-
) -> &mut Self {
983+
) -> &Self {
983984
unimplemented!("This is mocked")
984985
}
985986

986-
pub fn translate(&mut self, _d: impl Into<Point>) -> &mut Self {
987+
pub fn translate(&self, _d: impl Into<Point>) -> &Self {
987988
unimplemented!("This is mocked")
988989
}
989990

@@ -995,21 +996,11 @@ impl Canvas {
995996
unimplemented!("This is mocked")
996997
}
997998

998-
pub fn draw_line(
999-
&mut self,
1000-
_p1: impl Into<Point>,
1001-
_p2: impl Into<Point>,
1002-
_paint: &Paint,
1003-
) -> &mut Self {
999+
pub fn draw_line(&self, _p1: impl Into<Point>, _p2: impl Into<Point>, _paint: &Paint) -> &Self {
10041000
unimplemented!("This is mocked")
10051001
}
10061002

1007-
pub fn draw_circle(
1008-
&mut self,
1009-
_center: impl Into<Point>,
1010-
_radius: f32,
1011-
_paint: &Paint,
1012-
) -> &mut Self {
1003+
pub fn draw_circle(&self, _center: impl Into<Point>, _radius: f32, _paint: &Paint) -> &Self {
10131004
unimplemented!("This is mocked")
10141005
}
10151006
}
@@ -1132,7 +1123,7 @@ impl Image {
11321123
pub struct Data;
11331124

11341125
impl Data {
1135-
pub fn new_bytes(_bytes: &[u8]) -> Self {
1126+
pub unsafe fn new_bytes(_bytes: &[u8]) -> Self {
11361127
unimplemented!("This is mocked")
11371128
}
11381129
}
@@ -1328,7 +1319,7 @@ pub mod svg {
13281319
unimplemented!("This is mocked")
13291320
}
13301321

1331-
pub fn render(&self, _canvas: &mut Canvas) {
1322+
pub fn render(&self, _canvas: &Canvas) {
13321323
unimplemented!("This is mocked")
13331324
}
13341325
}
@@ -1353,7 +1344,7 @@ impl From<(i32, i32)> for Size {
13531344
pub struct Surface;
13541345

13551346
impl Surface {
1356-
pub fn canvas(&self) -> Canvas {
1347+
pub fn canvas(&mut self) -> Canvas {
13571348
unimplemented!("This is mocked")
13581349
}
13591350

@@ -1436,12 +1427,14 @@ impl DirectContext {
14361427
use std::ffi::c_void;
14371428

14381429
#[repr(u8)]
1430+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
14391431
pub enum Protected {
14401432
No,
14411433
Yes,
14421434
}
14431435

1444-
#[derive(Clone, Copy)]
1436+
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
1437+
#[repr(C)]
14451438
pub struct FramebufferInfo {
14461439
pub fboid: i32,
14471440
pub format: Format,
@@ -1450,11 +1443,7 @@ pub struct FramebufferInfo {
14501443

14511444
impl Default for FramebufferInfo {
14521445
fn default() -> Self {
1453-
Self {
1454-
fboid: 0,
1455-
format: 0,
1456-
protected: Protected::No,
1457-
}
1446+
unimplemented!("This is mocked")
14581447
}
14591448
}
14601449

@@ -1466,16 +1455,7 @@ pub fn wrap_backend_render_target(
14661455
color_space: impl Into<Option<ColorSpace>>,
14671456
surface_props: Option<&SurfaceProps>,
14681457
) -> Option<Surface> {
1469-
Surface::from_ptr(unsafe {
1470-
sb::C_SkSurfaces_WrapBackendRenderTarget(
1471-
context.native_mut(),
1472-
backend_render_target.native(),
1473-
origin,
1474-
color_type.into_native(),
1475-
color_space.into().into_ptr_or_null(),
1476-
surface_props.native_ptr_or_null(),
1477-
)
1478-
})
1458+
unimplemented!("This is mocked")
14791459
}
14801460

14811461
pub struct Interface;
@@ -1534,3 +1514,15 @@ impl BackendRenderTarget {
15341514
unimplemented!("This is mocked")
15351515
}
15361516
}
1517+
1518+
pub mod backend_render_targets {
1519+
use crate::prelude::*;
1520+
pub fn make_gl(
1521+
(width, height): (i32, i32),
1522+
sample_count: impl Into<Option<usize>>,
1523+
stencil_bits: usize,
1524+
info: FramebufferInfo,
1525+
) -> BackendRenderTarget {
1526+
unimplemented!("This is mocked")
1527+
}
1528+
}

crates/engine/src/skia.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pub use skia_safe::{
22
font_style::{Slant, Weight, Width},
33
gpu::{
4+
backend_render_targets,
45
gl::{Format, FramebufferInfo, Interface},
56
surfaces::wrap_backend_render_target,
67
BackendRenderTarget, DirectContext, RecordingContext, SurfaceOrigin,

crates/freya/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ no-default-features = true
1919
log = ["dep:tracing", "dep:tracing-subscriber"]
2020
devtools = ["dep:freya-devtools", "freya-dom/shared"]
2121
use_camera = ["freya-hooks/use_camera"]
22+
mocked-engine-development = ["freya-engine/mocked-engine"] # This is just for the CI
2223
default = ["freya-engine/skia-engine"]
2324

2425
[dependencies]

crates/hooks/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ accesskit = { workspace = true }
3838

3939
euclid = { workspace = true }
4040
uuid = { workspace = true }
41-
tween = "2.0.0"
41+
tween = "2.0.1"
4242
ropey = "1.6.0"
4343
nokhwa = { version = "0.10.4", features = ["input-native"], optional = true }
44-
bytes = "1.3.0"
44+
bytes = "1.5.0"
4545

4646
[dev-dependencies]
4747
dioxus = { workspace = true }

0 commit comments

Comments
 (0)