diff --git a/CHANGELOG.md b/CHANGELOG.md index c3b34e2..7e1906c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/). - X11 communication and x11 based window handling. - Daemon GTK main loop. - Application of sticky and stacking propery of window on X11. -- Centerbox widget rendering logic. - The full implementation of eventbox widget. - GTK controller/signal handling. - Initialization logic of window. @@ -37,9 +36,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/). - `transform`, `graph`, and `circular_progress` widget (temporarily). - Application of css class on the window. - Legacy GTK3 related code. - -### Deprecated - - Centerbox widget. ## [0.2.0] - 2025-09-29 diff --git a/crates/ewwii/src/widgets/build_widget.rs b/crates/ewwii/src/widgets/build_widget.rs index 171f33b..1c15d3e 100644 --- a/crates/ewwii/src/widgets/build_widget.rs +++ b/crates/ewwii/src/widgets/build_widget.rs @@ -41,9 +41,6 @@ fn build_gtk_widget_from_node( let gtk_widget = match root_node { WidgetNode::Box { props, children } => build_gtk_box(props, children, widget_reg)?.upcast(), - WidgetNode::CenterBox { props, children } => { - build_center_box(props, children, widget_reg)?.upcast() - } WidgetNode::EventBox { props, children } => { build_event_box(props, children, widget_reg)?.upcast() } diff --git a/crates/ewwii/src/widgets/widget_definitions.rs b/crates/ewwii/src/widgets/widget_definitions.rs index 6f182cd..1ebdb5a 100644 --- a/crates/ewwii/src/widgets/widget_definitions.rs +++ b/crates/ewwii/src/widgets/widget_definitions.rs @@ -348,91 +348,6 @@ pub(super) fn build_tooltip( Ok(gtk_widget) } -pub(super) fn build_center_box( - props: &Map, - children: &Vec, - widget_registry: &mut WidgetRegistry, -) -> Result { - let orientation = props - .get("orientation") - .and_then(|v| v.clone().try_cast::()) - .map(|s| parse_orientation(&s)) - .transpose()? - .unwrap_or(gtk4::Orientation::Horizontal); - - let count = children.len(); - - if count < 3 { - bail!("centerbox must contain exactly 3 children"); - } else if count > 3 { - bail!("centerbox must contain exactly 3 children, but got more"); - } - - let first = build_gtk_widget( - &WidgetInput::Node(children.get(0).cloned().ok_or_else(|| anyhow!("missing child 0"))?), - widget_registry, - )?; - let center = build_gtk_widget( - &WidgetInput::Node(children.get(1).cloned().ok_or_else(|| anyhow!("missing child 1"))?), - widget_registry, - )?; - let end = build_gtk_widget( - &WidgetInput::Node(children.get(2).cloned().ok_or_else(|| anyhow!("missing child 2"))?), - widget_registry, - )?; - - let gtk_widget = gtk4::Box::new(orientation, 0); - - first.set_hexpand(true); - first.set_halign(gtk4::Align::Start); - - center.set_hexpand(true); - center.set_halign(gtk4::Align::Center); - - end.set_hexpand(true); - end.set_halign(gtk4::Align::End); - - gtk_widget.append(&first); - gtk_widget.append(¢er); - gtk_widget.append(&end); - - let gtk_widget_clone = gtk_widget.clone(); - - let update_fn: UpdateFn = Box::new(move |props: &Map| { - let orientation = match props - .get("orientation") - .and_then(|v| v.clone().try_cast::()) - .map(|s| parse_orientation(&s)) - .transpose() - { - Ok(opt) => opt.unwrap_or(gtk4::Orientation::Horizontal), - Err(e) => { - eprintln!("Error parsing orientation: {:?}", e); - gtk4::Orientation::Horizontal - } - }; - - gtk_widget_clone.set_orientation(orientation); - - // now re-apply generic widget attrs - if let Err(err) = - resolve_rhai_widget_attrs(>k_widget_clone.clone().upcast::(), &props) - { - eprintln!("Failed to update widget attrs: {:?}", err); - } - }); - - let id = hash_props_and_type(&props, "CenterBox"); - - widget_registry - .widgets - .insert(id, WidgetEntry { update_fn, widget: gtk_widget.clone().upcast() }); - - resolve_rhai_widget_attrs(>k_widget.clone().upcast::(), &props)?; - - Ok(gtk_widget) -} - struct EventBoxCtrlData { // hover controller data onhover_cmd: String, diff --git a/crates/rhai_impl/src/ast.rs b/crates/rhai_impl/src/ast.rs index e2fc9bc..2182c69 100644 --- a/crates/rhai_impl/src/ast.rs +++ b/crates/rhai_impl/src/ast.rs @@ -8,7 +8,6 @@ use std::hash::{Hash, Hasher}; pub enum WidgetNode { Label { props: Map }, Box { props: Map, children: Vec }, - CenterBox { props: Map, children: Vec }, Button { props: Map }, Image { props: Map }, Icon { props: Map }, @@ -73,20 +72,6 @@ pub fn get_id_to_widget_info<'a>( get_id_to_widget_info(child, id_to_props, Some(id))?; } } - WidgetNode::CenterBox { props, children } => { - let id = hash_props_and_type(props, "CenterBox"); - insert_wdgt_info( - node, - props, - "CenterBox", - children.as_slice(), - parent_id, - id_to_props, - )?; - for child in children { - get_id_to_widget_info(child, id_to_props, Some(id))?; - } - } WidgetNode::EventBox { props, children } => { let id = hash_props_and_type(props, "EventBox"); insert_wdgt_info(node, props, "EventBox", children.as_slice(), parent_id, id_to_props)?; diff --git a/crates/rhai_impl/src/builtins.rs b/crates/rhai_impl/src/builtins.rs index d207e70..fde3f36 100644 --- a/crates/rhai_impl/src/builtins.rs +++ b/crates/rhai_impl/src/builtins.rs @@ -67,7 +67,6 @@ pub fn register_all_widgets(engine: &mut Engine, all_nodes: &Rc WidgetNode::CenterBox { - props: with_dyn_id(props.clone(), parent_path), - children: process_children(children, parent_path, "centerbox"), - }, WidgetNode::Expander { props, children } => WidgetNode::Expander { props: with_dyn_id(props.clone(), parent_path), children: process_children(children, parent_path, "expander"), diff --git a/examples/ewwii-bar/ewwii.rhai b/examples/ewwii-bar/ewwii.rhai index fb25e6f..3378fbd 100644 --- a/examples/ewwii-bar/ewwii.rhai +++ b/examples/ewwii-bar/ewwii.rhai @@ -1,5 +1,5 @@ fn bar(music_var, volume, time) { - return centerbox(#{ orientation: "h" }, [ + return box(#{ orientation: "h" }, [ workspaces(), music(music_var), sidestuff(volume, time),