git.lucas.co / cce-designer
graphic design tool
git clone https://git.lucas.co/cce-designer.git

commit43cb7ce20c2f30718b3d83084e1b5ff6bccc4399
parente67536f3c9
authorLucas Galante <[email protected]>
date2026-06-01 06:55
Update config path to ccec, change wgpu power preference to LowPower, and add inspector integration

 Cargo.lock  |  2 ++
 src/main.rs | 32 +++++++++++++++++++++++++++++---
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 1171472..f1c8216 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -213,7 +213,9 @@ dependencies = [
  "serde",
  "smithay-client-toolkit",
  "tokio",
+ "wayland-backend",
  "wayland-client",
+ "wayland-scanner",
  "wgpu",
  "xkeysym",
 ]
diff --git a/src/main.rs b/src/main.rs
index 3f30616..7e472c8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -332,7 +332,7 @@ impl DesignSettings {
         let home = std::env::var("HOME").unwrap_or_else(|_| "/home/lsgalante".to_string());
         let mut path = std::path::PathBuf::from(home);
         path.push(".config");
-        path.push("clearwm");
+        path.push("ccec");
         path.push("design.json");
         path
     }
@@ -923,7 +923,7 @@ impl Widget for ConfigDialog {
         px >= self.x && px <= self.x + self.w && py >= self.y && py <= self.y + self.h
     }
 
-    fn cursor_moved(&mut self, px: f32, py: f32) -> bool {
+    fn on_cursor_moved(&mut self, px: f32, py: f32) -> bool {
         let was = self.hovered;
         self.hovered = self.hit_test(px, py);
         let (ppx, ppy, pw, _ph) = self.panel_rect();
@@ -2314,7 +2314,7 @@ fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec<Vec<String
 
         let adapter = instance
             .request_adapter(&wgpu::RequestAdapterOptions {
-                power_preference: wgpu::PowerPreference::HighPerformance,
+                power_preference: wgpu::PowerPreference::LowPower,
                 compatible_surface: Some(&surface),
                 force_fallback_adapter: false,
             })
@@ -4523,6 +4523,7 @@ struct AppState {
     exit: bool,
     redraw: bool,
     pressed_key: Option<PressedKey>,
+    inspector: Option<clear_ui::protocol::zclear_inspector_v1::ZclearInspectorV1>,
 }
 
 impl CompositorHandler for AppState {
@@ -4838,6 +4839,17 @@ impl ProvidesRegistryState for AppState {
     ) {}
 }
 
+impl wayland_client::Dispatch<clear_ui::protocol::zclear_inspector_v1::ZclearInspectorV1, ()> for AppState {
+    fn event(
+        _state: &mut Self,
+        _proxy: &clear_ui::protocol::zclear_inspector_v1::ZclearInspectorV1,
+        _event: clear_ui::protocol::zclear_inspector_v1::Event,
+        _data: &(),
+        _conn: &Connection,
+        _qh: &QueueHandle<Self>,
+    ) {}
+}
+
 delegate_compositor!(AppState);
 delegate_xdg_shell!(AppState);
 delegate_xdg_window!(AppState);
@@ -5411,6 +5423,7 @@ fn main() {
     let shm_state = Shm::bind(&globals, &qh).unwrap();
     let seat_state = SeatState::new(&globals, &qh);
     let output_state = OutputState::new(&globals, &qh);
+    let inspector = globals.bind(&qh, 1..=1, ()).ok();
 
     let mut app = AppState {
         registry_state: RegistryState::new(&globals),
@@ -5428,6 +5441,7 @@ fn main() {
         exit: false,
         redraw: true,
         pressed_key: None,
+        inspector,
     };
 
     // Perform a roundtrip to populate output_state with active output scales
@@ -5451,6 +5465,12 @@ fn main() {
     app.surface = Some(state.wl_surface.clone());
     app.state = Some(state);
 
+    if let Some(ref inspector) = app.inspector {
+        if let Some(ref surface) = app.surface {
+            inspector.register_client(surface);
+        }
+    }
+
     let (sender, channel) = calloop::channel::channel::<CustomEvent>();
 
     let server_sender = sender.clone();
@@ -5656,6 +5676,12 @@ fn main() {
                 if state.render() {
                     app.redraw = true;
                 }
+                if let Some(ref inspector) = app.inspector {
+                    if let Some(ref surface) = app.surface {
+                        let json = clear_ui::widget::serialize_widgets(&state.widgets);
+                        inspector.update_state(surface, json);
+                    }
+                }
             }
         }
     }