git.lucas.co / cce-gallery
widget gallery and compositor test bench

commitb7c608f73792a5744d6bc90f5f9273d9594c9c80
parent9175cadb16
authorLucas Galante <[email protected]>
date2026-09-24 12:52
Root plate: the toolkit's standard spec, not a hand-rolled fill

The main window's base was a full-window rounded_rect at
root_plate_corner_radius over page_low_color, and the child windows'
RootPlate widget the same fill with root_plate_opacity hand-applied.
Both now emit cce-ui's PlateSpec::window — the DE root material at its
opacity, the shared silhouette arc on all four corners, the standard
rolled rim — the main window through PaintCtx::root_plate, the widget
through PlateSpec::root_at at its own rect (the child window's origin).

Co-Authored-By: Claude Fable 5.1 <[email protected]>

 src/gallery_widgets.rs | 27 +++++++++------------------
 src/main.rs            |  5 ++---
 2 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/src/gallery_widgets.rs b/src/gallery_widgets.rs
index 13910b6..8520d7c 100644
--- a/src/gallery_widgets.rs
+++ b/src/gallery_widgets.rs
@@ -5,7 +5,7 @@
 
 use cce_ui::colors;
 use cce_ui::scene::layout::Rect;
-use cce_ui::scene::paint::PaintCtx;
+use cce_ui::scene::paint::{PaintCtx, PlateSpec};
 use cce_ui::widget::*;
 
 /// Exhibit lookalike of the old cce-ui `Plate`: config plate colour (else page colour)
@@ -69,8 +69,9 @@ impl cce_ui::widget::Paint for Plate {
 
 impl cce_ui::widget::Input for Plate {}
 
-/// Child-window background, a lookalike of the old cce-ui root plate container: page colour at
-/// the configured root plate opacity, root plate corner radius, immovable.
+/// Child-window background: the DE's standard root plate (cce-ui `PlateSpec::window` — the
+/// root material at its opacity, the window silhouette on all four corners, the standard
+/// rolled rim), immovable.
 pub struct RootPlate;
 
 impl RootPlate {
@@ -79,21 +80,14 @@ impl RootPlate {
         bp.set_rect(x, y, w, h);
         bp
     }
-
-    fn root_plate_color(&self) -> [f32; 4] {
-        let mut c = cce_ui::color::page_low_color();
-        if c[3] > 0.001 {
-            c[3] = cce_ui::color::root_plate_opacity();
-        }
-        c
-    }
 }
 
 impl cce_ui::widget::Layout for RootPlate {}
 
 impl cce_ui::widget::Paint for RootPlate {
+    /// The legacy fill read only: the geometry is the plate `paint` emits.
     fn color(&self) -> [f32; 4] {
-        self.root_plate_color()
+        cce_ui::color::page_low_color()
     }
 
     fn corner_style(&self, _rect: Rect) -> Option<(f32, (bool, bool, bool, bool))> {
@@ -103,12 +97,9 @@ impl cce_ui::widget::Paint for RootPlate {
     }
 
     fn paint(&self, rect: Rect, pc: &mut PaintCtx) {
-        // Painted only while the radius is on.
-        let radius = cce_ui::color::root_plate_corner_radius();
-        let c = self.root_plate_color();
-        if radius > 0.1 && c[3].abs() > 0.001 {
-            pc.rounded_rect(rect, radius, (true, true, true, true), c);
-        }
+        // The standard root plate (cce-ui PlateSpec::window), placed at this widget's
+        // rect — the child window's origin, so `root_at(rect)` IS `window(w, h)`.
+        pc.plate_spec(&PlateSpec::root_at(rect));
     }
 }
 
diff --git a/src/main.rs b/src/main.rs
index 6d01539..e964606 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1410,9 +1410,8 @@ impl cce_ui::engine::Application for State {
 
         // ── Rounded geometry ──
         if !self.is_child && self.use_root_plate {
-            let r = cce_ui::color::root_plate_corner_radius();
-            let bg_color = cce_ui::color::page_low_color();
-            pc.rounded_rect(Rect { x: 0.0, y: 0.0, width: sw, height: sh }, r, (true, true, true, true), bg_color);
+            // The standard root plate (cce-ui PlateSpec::window).
+            pc.root_plate(sw, sh);
         }
         // The exhibit area is a well in the root plate: its floor under the
         // exhibits here, its rim over them below (`well_rim`), so an exhibit