new rendering engine

This commit is contained in:
2026-06-19 02:55:33 +02:00
parent 0a90d6a5d7
commit 81a4167382
53 changed files with 1668 additions and 378 deletions

View File

@@ -1,6 +1,6 @@
use crate::error::TcpServerError;
use domain::{BroadcastPort, Layout, WidgetId, WidgetState};
use protocol::{ServerMessage, WidgetDescriptor, WireDisplayHint, WireLayoutNode, encode};
use domain::{BroadcastPort, DisplayHint, Layout, WidgetId, WidgetState};
use protocol::{ServerMessage, WidgetDescriptor, WireLayoutNode, encode};
use tokio::sync::broadcast;
pub struct TcpBroadcaster {
@@ -29,14 +29,14 @@ impl BroadcastPort for TcpBroadcaster {
async fn push_screen_update(
&self,
layout: &Layout,
widgets: &[(WidgetId, WidgetState)],
widgets: &[(WidgetId, DisplayHint, WidgetState)],
) -> Result<(), Self::Error> {
let wire_layout: WireLayoutNode = (&layout.root).into();
let wire_widgets: Vec<WidgetDescriptor> = widgets
.iter()
.map(|(id, state)| WidgetDescriptor {
.map(|(id, hint, state)| WidgetDescriptor {
id: *id,
display_hint: WireDisplayHint::IconValue,
display_hint: hint.into(),
state: state.into(),
})
.collect();
@@ -52,13 +52,13 @@ impl BroadcastPort for TcpBroadcaster {
async fn push_data_update(
&self,
updates: &[(WidgetId, WidgetState)],
updates: &[(WidgetId, DisplayHint, WidgetState)],
) -> Result<(), Self::Error> {
let wire_widgets: Vec<WidgetDescriptor> = updates
.iter()
.map(|(id, state)| WidgetDescriptor {
.map(|(id, hint, state)| WidgetDescriptor {
id: *id,
display_hint: WireDisplayHint::IconValue,
display_hint: hint.into(),
state: state.into(),
})
.collect();

View File

@@ -1,7 +1,7 @@
use crate::client_tracker::ClientTracker;
use crate::error::TcpServerError;
use domain::{ConfigRepository, WidgetStateReader};
use protocol::{ServerMessage, WidgetDescriptor, WireDisplayHint, WireLayoutNode, encode};
use protocol::{ServerMessage, WidgetDescriptor, WireLayoutNode, encode};
use std::sync::Arc;
use tokio::io::AsyncWriteExt;
use tokio::net::TcpListener;
@@ -92,7 +92,7 @@ where
if let Some(s) = widget_states.get_widget_state(w.id).await {
wire_widgets.push(WidgetDescriptor {
id: w.id,
display_hint: WireDisplayHint::IconValue,
display_hint: (&w.display_hint).into(),
state: (&s).into(),
});
}