From 270a7db60d11b171e6f52dac8b128b0b70eebd17 Mon Sep 17 00:00:00 2001 From: lashman Date: Fri, 6 Mar 2026 18:44:41 +0200 Subject: [PATCH] Fix step indicator layout warnings on narrow windows --- pixstrip-gtk/src/app.rs | 8 +++++++- pixstrip-gtk/src/step_indicator.rs | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pixstrip-gtk/src/app.rs b/pixstrip-gtk/src/app.rs index 5617c57..7701843 100644 --- a/pixstrip-gtk/src/app.rs +++ b/pixstrip-gtk/src/app.rs @@ -508,7 +508,13 @@ fn build_ui(app: &adw::Application) { // Main content layout let content_box = gtk::Box::new(gtk::Orientation::Vertical, 0); - content_box.append(step_indicator.widget()); + let indicator_scroll = gtk::ScrolledWindow::builder() + .hscrollbar_policy(gtk::PolicyType::Automatic) + .vscrollbar_policy(gtk::PolicyType::Never) + .child(step_indicator.widget()) + .build(); + indicator_scroll.set_size_request(-1, 52); + content_box.append(&indicator_scroll); content_box.append(&nav_view); content_box.append(&watch_revealer); diff --git a/pixstrip-gtk/src/step_indicator.rs b/pixstrip-gtk/src/step_indicator.rs index b2d4bf5..ea1325f 100644 --- a/pixstrip-gtk/src/step_indicator.rs +++ b/pixstrip-gtk/src/step_indicator.rs @@ -27,6 +27,9 @@ impl StepIndicator { .margin_end(12) .build(); + // Prevent negative allocation warnings when window is narrow + container.set_overflow(gtk::Overflow::Hidden); + container.update_property(&[ gtk::accessible::Property::Label("Wizard step indicator"), ]); @@ -41,7 +44,7 @@ impl StepIndicator { .hexpand(false) .valign(gtk::Align::Center) .build(); - line.set_size_request(24, -1); + line.set_size_request(12, -1); container.append(&line); } @@ -69,6 +72,8 @@ impl StepIndicator { let label = gtk::Label::builder() .label(name) .css_classes(["caption"]) + .ellipsize(gtk::pango::EllipsizeMode::End) + .max_width_chars(8) .build(); dot_box.append(&button);