Skip to content

Commit 2c89134

Browse files
Desktop: Move wrapper to separate crate (#3073)
Move desktop wrapper to separate crate
1 parent 30e5d66 commit 2c89134

14 files changed

+75
-32
lines changed

Cargo.lock

Lines changed: 19 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
members = [
33
"editor",
44
"desktop",
5+
"desktop/wrapper",
56
"proc-macros",
67
"frontend/wasm",
78
"node-graph/gapplication-io",

desktop/Cargo.toml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,11 @@ rust-version = "1.87"
1010

1111
[features]
1212
default = ["gpu"]
13-
gpu = ["graphite-editor/gpu"]
13+
gpu = ["graphite-desktop-wrapper/gpu"]
1414

1515
[dependencies]
1616
# # Local dependencies
17-
graphite-editor = { path = "../editor", features = [
18-
"gpu",
19-
"ron",
20-
"vello",
21-
] }
22-
graphene-std = { workspace = true }
23-
graph-craft = { workspace = true }
24-
wgpu-executor = { workspace = true }
17+
graphite-desktop-wrapper = { path = "wrapper" }
2518

2619
wgpu = { workspace = true }
2720
winit = { workspace = true, features = ["serde"] }
@@ -39,4 +32,3 @@ vello = { workspace = true }
3932
derivative = { workspace = true }
4033
rfd = { workspace = true }
4134
open = { workspace = true }
42-
image = { workspace = true }

desktop/src/app.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
use crate::CustomEvent;
2-
use crate::WindowSize;
2+
use crate::cef::WindowSize;
33
use crate::consts::APP_NAME;
4-
use crate::desktop_wrapper::DesktopWrapper;
5-
use crate::desktop_wrapper::NodeGraphExecutionResult;
6-
use crate::desktop_wrapper::WgpuContext;
7-
use crate::desktop_wrapper::messages::DesktopFrontendMessage;
8-
use crate::desktop_wrapper::messages::DesktopWrapperMessage;
9-
use crate::desktop_wrapper::serialize_frontend_messages;
104
use crate::render::GraphicsState;
5+
use graphite_desktop_wrapper::messages::{DesktopFrontendMessage, DesktopWrapperMessage};
6+
use graphite_desktop_wrapper::{DesktopWrapper, NodeGraphExecutionResult, WgpuContext, serialize_frontend_messages};
117
use rfd::AsyncFileDialog;
128
use std::sync::Arc;
139
use std::sync::mpsc::Sender;

desktop/src/cef.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::desktop_wrapper::WgpuContext;
1+
use crate::CustomEvent;
22
use crate::render::FrameBufferRef;
3-
use crate::{CustomEvent, desktop_wrapper::deserialize_editor_message};
3+
use graphite_desktop_wrapper::{WgpuContext, deserialize_editor_message};
44
use std::sync::mpsc::Receiver;
55
use std::sync::{Arc, Mutex};
66
use std::time::Instant;

desktop/src/main.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use winit::event_loop::EventLoop;
66
pub(crate) mod consts;
77

88
mod cef;
9-
use cef::{Setup, WindowSize};
9+
use cef::Setup;
1010

1111
mod render;
1212

@@ -15,9 +15,8 @@ use app::WinitApp;
1515

1616
mod dirs;
1717

18-
mod desktop_wrapper;
19-
use desktop_wrapper::messages::DesktopWrapperMessage;
20-
use desktop_wrapper::{DesktopWrapper, NodeGraphExecutionResult};
18+
use graphite_desktop_wrapper::messages::DesktopWrapperMessage;
19+
use graphite_desktop_wrapper::{DesktopWrapper, NodeGraphExecutionResult, WgpuContext};
2120

2221
pub(crate) enum CustomEvent {
2322
UiUpdate(wgpu::Texture),
@@ -42,7 +41,7 @@ fn main() {
4241

4342
let (window_size_sender, window_size_receiver) = std::sync::mpsc::channel();
4443

45-
let wgpu_context = futures::executor::block_on(desktop_wrapper::WgpuContext::new()).unwrap();
44+
let wgpu_context = futures::executor::block_on(WgpuContext::new()).unwrap();
4645
let cef_context = match cef_context.init(cef::CefHandler::new(window_size_receiver, event_loop.create_proxy(), wgpu_context.clone())) {
4746
Ok(c) => c,
4847
Err(cef::InitError::AlreadyRunning) => {

desktop/src/render/graphics_state.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
use graphene_std::Color;
21
use std::sync::Arc;
3-
use wgpu_executor::WgpuExecutor;
42
use winit::window::Window;
53

6-
use crate::desktop_wrapper::WgpuContext;
4+
use graphite_desktop_wrapper::{Color, WgpuContext, WgpuExecutor};
75

86
#[derive(derivative::Derivative)]
97
#[derivative(Debug)]

desktop/wrapper/Cargo.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[package]
2+
name = "graphite-desktop-wrapper"
3+
version = "0.1.0"
4+
description = "Graphite Desktop Wrapper"
5+
authors = ["Graphite Authors <[email protected]>"]
6+
license = "Apache-2.0"
7+
repository = ""
8+
edition = "2024"
9+
rust-version = "1.87"
10+
11+
[features]
12+
default = ["gpu"]
13+
gpu = ["graphite-editor/gpu"]
14+
15+
[dependencies]
16+
# Local dependencies
17+
graphite-editor = { path = "../../editor", features = [
18+
"gpu",
19+
"ron",
20+
"vello",
21+
] }
22+
graphene-std = { workspace = true }
23+
graph-craft = { workspace = true }
24+
wgpu-executor = { workspace = true }
25+
26+
wgpu = { workspace = true }
27+
thiserror = { workspace = true }
28+
futures = { workspace = true }
29+
tracing = { workspace = true }
30+
dirs = { workspace = true }
31+
ron = { workspace = true}
32+
vello = { workspace = true }
33+
image = { workspace = true }

0 commit comments

Comments
 (0)