perf: reduce memory allocations

This also changes `widget::column::with_children` and
`widget::row::with_children` to take an `impl IntoIterator` instead
of a `Vec`, like the `iced` variants of these functions do.

This shouldn't be a breaking change since passing in a `Vec` will still
compile and function exactly as before.

(Using `iced::widget::Column::from_vec` or
`iced::widget::Row::from_vec` isn't possible, since the elements of the
`Vec` aren't checked, so the size of the resulting `Column` or `Row`
won't adapt to the size of its children. Perhaps a new function could
be added to mirror `iced`'s?)
This commit is contained in:
Cheong Lau 2025-10-11 13:36:35 +10:00 committed by Michael Murphy
parent 840ef21e4d
commit bd438a8581
20 changed files with 83 additions and 88 deletions

View file

@ -76,7 +76,7 @@ impl From<String> for PanelType {
match value.as_str() {
"Panel" => PanelType::Panel,
"Dock" => PanelType::Dock,
other => PanelType::Other(other.to_string()),
_ => PanelType::Other(value),
}
}
}
@ -470,8 +470,8 @@ pub fn run<App: Application>(flags: App::Flags) -> iced::Result {
crate::malloc::limit_mmap_threshold(threshold);
}
if let Some(icon_theme) = settings.default_icon_theme.clone() {
crate::icon_theme::set_default(icon_theme);
if let Some(icon_theme) = settings.default_icon_theme.as_ref() {
crate::icon_theme::set_default(icon_theme.clone());
}
THEME

View file

@ -162,8 +162,8 @@ pub(crate) fn wayland_handler(
exit: false,
tx,
seat_state: SeatState::new(&globals, &qh),
queue_handle: qh.clone(),
activation_state: ActivationState::bind::<AppData>(&globals, &qh).ok(),
queue_handle: qh,
registry_state,
};