node-based graph editor
git clone https://git.lucas.co/cce-graph.git
refactor: build the app with Application::create
Application::new(qh, sender) took the session's Wayland queue handle,
which no client ever used, and calloop's sender; cce-ui is retiring it
for create(sender: AppSender<_>), which names no window system. The
body is unchanged: an app that keeps calloop's sender converts the
AppSender into it on the first line, and the now-unused QueueHandle and
EngineState imports go.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
src/main.rs | 9 +++++----
src/vault.rs | 7 ++++---
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 8a9d2b6..d3646f7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,6 +1,5 @@
-use wayland_client::QueueHandle;
use cce_ui::widget::Owned;
-use cce_ui::engine::{Application, EngineState, LogicalPosition, LogicalSize, WindowSettings};
+use cce_ui::engine::{Application, LogicalPosition, LogicalSize, WindowSettings};
mod linkgraph;
mod vault;
mod wiring;
@@ -804,7 +803,9 @@ impl Application for GraphApp {
Some(&mut self.ui_context)
}
- fn new(_qh: &QueueHandle<EngineState<Self>>, _sender: calloop::channel::Sender<Self::Message>) -> Self {
+ fn create(_sender: cce_ui::engine::AppSender<Self::Message>) -> Self {
+ // The app keeps calloop's sender; `AppSender` converts into it.
+ let _sender: calloop::channel::Sender<Self::Message> = _sender.into();
let mut graph = Graph::new();
let (show_grid, snap_enabled, opacity, gap_width) = load_config();
@@ -880,7 +881,7 @@ impl Application for GraphApp {
loaded_project_path: None,
loaded_images: Vec::new(),
widgets_registered: false,
- message_sender: _sender.clone(),
+ message_sender: _sender.clone().into(),
dragging_image_idx: None,
drag_image_ox: 0.0,
drag_image_oy: 0.0,
diff --git a/src/vault.rs b/src/vault.rs
index f695440..337854d 100644
--- a/src/vault.rs
+++ b/src/vault.rs
@@ -19,14 +19,13 @@ use std::sync::OnceLock;
use std::time::{Duration, Instant};
use cce_ui::widget::Owned;
-use cce_ui::engine::{Application, CursorIcon, EngineState, LogicalPosition, LogicalSize, WindowSettings};
+use cce_ui::engine::{Application, CursorIcon, LogicalPosition, LogicalSize, WindowSettings};
use cce_ui::scene::layout::Rect;
use cce_ui::scene::paint::{Cap, DisplayList, PaintCtx};
use cce_ui::widget::{
Adapted, ElementState, Event, Key, KeyEvent, MouseButton, MouseScrollDelta, NamedKey, TextBox, WidgetHost,
};
use cce_vault::{Index, VaultWatcher};
-use wayland_client::QueueHandle;
use crate::linkgraph::{Filter, LinkGraph};
@@ -530,7 +529,9 @@ impl Application for VaultApp {
Some(&mut self.ui_context)
}
- fn new(_qh: &QueueHandle<EngineState<Self>>, sender: calloop::channel::Sender<Message>) -> Self {
+ fn create(sender: cce_ui::engine::AppSender<Message>) -> Self {
+ // The app keeps calloop's sender; `AppSender` converts into it.
+ let sender: calloop::channel::Sender<Message> = sender.into();
let args = ARGS.get().expect("args set in run");
let root = cce_vault::config::vault_root(args.vault.as_deref()).map_err(|e| {
format!("No vault: {e}\nSet `vault {{ path \"~/Notes\" }}` in ~/.config/cce/config.kdl, or pass --vault <dir>.")