status bar
git clone https://git.lucas.co/cce-status-interface.git
refactor: adapt Separator usage to the cce-ui Phase 5 migration
Separator's rect moved from public x/y/w/h fields onto the Adapted
base: store Vec<Adapted<Separator>> and transpose the vertical-bar
rotation via rect()/set_rect() instead of field swaps. Rendering is
unchanged (rect() + color(), both forwarded by the adapter).
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LkfJazPs9bRchkcozmxXCX
src/main.rs | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index cfe0b41..0cc02da 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,7 +8,7 @@ use glyphon::{
};
use cce_ui::color;
use cce_ui::widget::{
- TextItem, Separator, Element,
+ Adapted, TextItem, Separator, Element,
MouseButton, ElementState, MouseScrollDelta, KeyEvent,
};
@@ -281,7 +281,7 @@ struct StatusApp {
rects: Vec<RectWidget>,
overlay_rects: Vec<RectWidget>,
rounded_boxes: Vec<RoundedBox>,
- separators: Vec<Separator>,
+ separators: Vec<Adapted<Separator>>,
text_items: Vec<TextItem>,
scale_factor: f64,
@@ -670,16 +670,10 @@ impl StatusApp {
rb.w = old_h;
rb.h = old_w;
}
- // Rotate separators
+ // Rotate separators (rect lives on the Adapted base since the Phase 5 migration)
for sep in &mut self.separators {
- let old_x = sep.x;
- let old_y = sep.y;
- let old_w = sep.w;
- let old_h = sep.h;
- sep.x = old_y;
- sep.y = old_x;
- sep.w = old_h;
- sep.h = old_w;
+ let (old_x, old_y, old_w, old_h) = sep.rect();
+ sep.set_rect(old_y, old_x, old_h, old_w);
}
// Rotate rects
for r in &mut self.rects {