chore: update dependencies and examples
This commit is contained in:
parent
6c6d16d34a
commit
54bcb9ec12
10 changed files with 76 additions and 87 deletions
19
Cargo.toml
19
Cargo.toml
|
|
@ -115,10 +115,10 @@ x11 = ["iced/x11", "iced_winit/x11"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
apply = "0.3.0"
|
apply = "0.3.0"
|
||||||
ashpd = { version = "0.12.1", default-features = false, optional = true }
|
ashpd = { version = "0.12.3", default-features = false, optional = true }
|
||||||
async-fs = { version = "2.2", optional = true }
|
async-fs = { version = "2.2", optional = true }
|
||||||
async-std = { version = "1.13", optional = true }
|
async-std = { version = "1.13", optional = true }
|
||||||
auto_enums = "0.8.7"
|
auto_enums = "0.8.8"
|
||||||
cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "160b086", optional = true }
|
cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "160b086", optional = true }
|
||||||
jiff = "0.2"
|
jiff = "0.2"
|
||||||
cosmic-config = { path = "cosmic-config" }
|
cosmic-config = { path = "cosmic-config" }
|
||||||
|
|
@ -131,17 +131,16 @@ i18n-embed = { version = "0.16.0", features = [
|
||||||
i18n-embed-fl = "0.10"
|
i18n-embed-fl = "0.10"
|
||||||
rust-embed = "8.11.0"
|
rust-embed = "8.11.0"
|
||||||
css-color = "0.2.8"
|
css-color = "0.2.8"
|
||||||
derive_setters = "0.1.8"
|
derive_setters = "0.1.9"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
image = { version = "0.25.9", default-features = false, features = [
|
image = { version = "0.25.10", default-features = false, features = [
|
||||||
"jpeg",
|
"jpeg",
|
||||||
"png",
|
"png",
|
||||||
] }
|
] }
|
||||||
libc = { version = "0.2.180", optional = true }
|
libc = { version = "0.2.183", optional = true }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
mime = { version = "0.3.17", optional = true }
|
mime = { version = "0.3.17", optional = true }
|
||||||
palette = "0.7.6"
|
palette = "0.7.6"
|
||||||
raw-window-handle = "0.6"
|
|
||||||
rfd = { version = "0.16.0", default-features = false, features = [
|
rfd = { version = "0.16.0", default-features = false, features = [
|
||||||
"xdg-portal",
|
"xdg-portal",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
|
|
@ -151,18 +150,18 @@ slotmap = "1.1.1"
|
||||||
smol = { version = "2.0.2", optional = true }
|
smol = { version = "2.0.2", optional = true }
|
||||||
thiserror = "2.0.18"
|
thiserror = "2.0.18"
|
||||||
taffy = { version = "0.9.2", features = ["grid"] }
|
taffy = { version = "0.9.2", features = ["grid"] }
|
||||||
tokio = { version = "1.49.0", optional = true }
|
tokio = { version = "1.50.0", optional = true }
|
||||||
tracing = "0.1.44"
|
tracing = "0.1.44"
|
||||||
unicode-segmentation = "1.12"
|
unicode-segmentation = "1.12"
|
||||||
url = "2.5.8"
|
url = "2.5.8"
|
||||||
zbus = { version = "5.13.2", default-features = false, optional = true }
|
zbus = { version = "5.14.0", default-features = false, optional = true }
|
||||||
float-cmp = "0.10.0"
|
float-cmp = "0.10.0"
|
||||||
|
|
||||||
# Enable DBus feature on Linux targets
|
# Enable DBus feature on Linux targets
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
cosmic-config = { path = "cosmic-config", features = ["dbus"] }
|
cosmic-config = { path = "cosmic-config", features = ["dbus"] }
|
||||||
cosmic-settings-daemon = { git = "https://github.com/pop-os/dbus-settings-bindings" }
|
cosmic-settings-daemon = { git = "https://github.com/pop-os/dbus-settings-bindings" }
|
||||||
zbus = { version = "5.13.2", default-features = false }
|
zbus = { version = "5.14.0", default-features = false }
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
freedesktop-icons = { package = "cosmic-freedesktop-icons", git = "https://github.com/pop-os/freedesktop-icons" }
|
freedesktop-icons = { package = "cosmic-freedesktop-icons", git = "https://github.com/pop-os/freedesktop-icons" }
|
||||||
|
|
@ -242,4 +241,4 @@ exclude = ["iced"]
|
||||||
dirs = "6.0.0"
|
dirs = "6.0.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3.24.0"
|
tempfile = "3.27.0"
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ subscription = ["iced_futures"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cosmic-settings-daemon = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
|
cosmic-settings-daemon = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
|
||||||
zbus = { version = "5.13.2", default-features = false, optional = true }
|
zbus = { version = "5.14.0", default-features = false, optional = true }
|
||||||
atomicwrites = { git = "https://github.com/jackpot51/rust-atomicwrites" }
|
atomicwrites = { git = "https://github.com/jackpot51/rust-atomicwrites" }
|
||||||
calloop = { version = "0.14.3", optional = true }
|
calloop = { version = "0.14.4", optional = true }
|
||||||
notify = "8.2.0"
|
notify = "8.2.0"
|
||||||
ron = "0.12.0"
|
ron = "0.12.0"
|
||||||
serde = "1.0.228"
|
serde = "1.0.228"
|
||||||
|
|
@ -22,7 +22,7 @@ iced = { path = "../iced/", default-features = false, optional = true }
|
||||||
iced_futures = { path = "../iced/futures/", default-features = false, optional = true }
|
iced_futures = { path = "../iced/futures/", default-features = false, optional = true }
|
||||||
futures-util = { version = "0.3", optional = true }
|
futures-util = { version = "0.3", optional = true }
|
||||||
dirs.workspace = true
|
dirs.workspace = true
|
||||||
tokio = { version = "1.49", optional = true, features = ["time"] }
|
tokio = { version = "1.50", optional = true, features = ["time"] }
|
||||||
async-std = { version = "1.13", optional = true }
|
async-std = { version = "1.13", optional = true }
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
|
|
||||||
|
|
@ -30,4 +30,4 @@ tracing = "0.1"
|
||||||
xdg = "3.0"
|
xdg = "3.0"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
known-folders = "1.4.0"
|
known-folders = "1.4.2"
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ serde_json = { version = "1.0.149", optional = true, features = [
|
||||||
"preserve_order",
|
"preserve_order",
|
||||||
] }
|
] }
|
||||||
ron = "0.12.0"
|
ron = "0.12.0"
|
||||||
csscolorparser = { version = "0.8.1", features = ["serde"] }
|
csscolorparser = { version = "0.8.3", features = ["serde"] }
|
||||||
cosmic-config = { path = "../cosmic-config/", default-features = false, features = [
|
cosmic-config = { path = "../cosmic-config/", default-features = false, features = [
|
||||||
"subscription",
|
"subscription",
|
||||||
"macro",
|
"macro",
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,14 @@ impl State {
|
||||||
column!(
|
column!(
|
||||||
list_column().add(settings::item(
|
list_column().add(settings::item(
|
||||||
"Bluetooth",
|
"Bluetooth",
|
||||||
toggler(None, self.enabled, Message::Enable)
|
toggler(self.enabled).on_toggle(Message::Enable)
|
||||||
)),
|
)),
|
||||||
text("Now visible as \"TODO\", just kidding")
|
text("Now visible as \"TODO\", just kidding")
|
||||||
)
|
)
|
||||||
.spacing(8)
|
.spacing(8)
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Devices")
|
settings::section()
|
||||||
|
.title("Devices")
|
||||||
.add(settings::item("No devices found", text("")))
|
.add(settings::item("No devices found", text("")))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
|
|
||||||
|
|
@ -258,12 +258,13 @@ impl State {
|
||||||
match self.tab_bar.active_data() {
|
match self.tab_bar.active_data() {
|
||||||
None => panic!("no tab is active"),
|
None => panic!("no tab is active"),
|
||||||
Some(DemoView::TabA) => settings::view_column(vec![
|
Some(DemoView::TabA) => settings::view_column(vec![
|
||||||
settings::view_section("Debug")
|
settings::section()
|
||||||
|
.title("Debug")
|
||||||
.add(settings::item("Debug theme", choose_theme))
|
.add(settings::item("Debug theme", choose_theme))
|
||||||
.add(settings::item("Debug icon theme", choose_icon_theme))
|
.add(settings::item("Debug icon theme", choose_icon_theme))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Debug layout",
|
"Debug layout",
|
||||||
toggler(None, window.debug, Message::Debug),
|
toggler(window.debug).on_toggle(Message::Debug),
|
||||||
))
|
))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Scaling Factor",
|
"Scaling Factor",
|
||||||
|
|
@ -276,10 +277,11 @@ impl State {
|
||||||
.into(),
|
.into(),
|
||||||
]))
|
]))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Controls")
|
settings::section()
|
||||||
|
.title("Controls")
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Toggler",
|
"Toggler",
|
||||||
toggler(None, self.toggler_value, Message::TogglerToggled),
|
toggler(self.toggler_value).on_toggle(Message::TogglerToggled),
|
||||||
))
|
))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Pick List (TODO)",
|
"Pick List (TODO)",
|
||||||
|
|
@ -299,14 +301,12 @@ impl State {
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Progress",
|
"Progress",
|
||||||
progress_bar(0.0..=100.0, self.slider_value)
|
progress_bar(0.0..=100.0, self.slider_value)
|
||||||
.width(Length::Fixed(250.0))
|
.length(Length::Fixed(250.0))
|
||||||
.height(Length::Fixed(4.0)),
|
.girth(Length::Fixed(4.0)),
|
||||||
))
|
))
|
||||||
.add(settings::item_row(vec![checkbox(
|
.add(settings::item_row(vec![checkbox(self.checkbox_value)
|
||||||
"Checkbox",
|
.label("Checkbox")
|
||||||
self.checkbox_value,
|
.on_toggle(Message::CheckboxToggled)
|
||||||
Message::CheckboxToggled,
|
|
||||||
)
|
|
||||||
.into()]))
|
.into()]))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
format!(
|
format!(
|
||||||
|
|
@ -354,8 +354,7 @@ impl State {
|
||||||
.width(Length::Shrink)
|
.width(Length::Shrink)
|
||||||
.on_activate(Message::MultiSelection)
|
.on_activate(Message::MultiSelection)
|
||||||
.apply(container)
|
.apply(container)
|
||||||
.center_x()
|
.center_x(Length::Fill)
|
||||||
.width(Length::Fill)
|
|
||||||
.into(),
|
.into(),
|
||||||
text("Vertical With Spacing").into(),
|
text("Vertical With Spacing").into(),
|
||||||
cosmic::iced::widget::row(vec![
|
cosmic::iced::widget::row(vec![
|
||||||
|
|
@ -424,13 +423,12 @@ impl State {
|
||||||
])
|
])
|
||||||
.padding(0)
|
.padding(0)
|
||||||
.into(),
|
.into(),
|
||||||
Some(DemoView::TabC) => {
|
Some(DemoView::TabC) => settings::view_column(vec![settings::section()
|
||||||
settings::view_column(vec![settings::view_section("Tab C")
|
.title("Tab C")
|
||||||
.add(text("Nothing here yet").width(Length::Fill))
|
.add(text("Nothing here yet").width(Length::Fill))
|
||||||
.into()])
|
.into()])
|
||||||
.padding(0)
|
.padding(0)
|
||||||
.into()
|
.into(),
|
||||||
}
|
|
||||||
},
|
},
|
||||||
container(text("Background container with some text").size(24))
|
container(text("Background container with some text").size(24))
|
||||||
.layer(cosmic_theme::Layer::Background)
|
.layer(cosmic_theme::Layer::Background)
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,8 @@ impl State {
|
||||||
fn view_desktop_options<'a>(&'a self, window: &'a Window) -> Element<'a, Message> {
|
fn view_desktop_options<'a>(&'a self, window: &'a Window) -> Element<'a, Message> {
|
||||||
settings::view_column(vec![
|
settings::view_column(vec![
|
||||||
window.parent_page_button(DesktopPage::DesktopOptions),
|
window.parent_page_button(DesktopPage::DesktopOptions),
|
||||||
settings::view_section("Super Key Action")
|
settings::section()
|
||||||
|
.title("Super Key Action")
|
||||||
.add(settings::item("Launcher", horizontal_space(Length::Fill)))
|
.add(settings::item("Launcher", horizontal_space(Length::Fill)))
|
||||||
.add(settings::item("Workspaces", horizontal_space(Length::Fill)))
|
.add(settings::item("Workspaces", horizontal_space(Length::Fill)))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
|
|
@ -155,38 +156,34 @@ impl State {
|
||||||
horizontal_space(Length::Fill),
|
horizontal_space(Length::Fill),
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Hot Corner")
|
settings::section()
|
||||||
|
.title("Hot Corner")
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Enable top-left hot corner for Workspaces",
|
"Enable top-left hot corner for Workspaces",
|
||||||
toggler(None, self.top_left_hot_corner, Message::TopLeftHotCorner),
|
toggler(self.top_left_hot_corner).on_toggle(Message::TopLeftHotCorner),
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Top Panel")
|
settings::section()
|
||||||
|
.title("Top Panel")
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Show Workspaces Button",
|
"Show Workspaces Button",
|
||||||
toggler(
|
toggler(self.show_workspaces_button).on_toggle(Message::ShowWorkspacesButton),
|
||||||
None,
|
|
||||||
self.show_workspaces_button,
|
|
||||||
Message::ShowWorkspacesButton,
|
|
||||||
),
|
|
||||||
))
|
))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Show Applications Button",
|
"Show Applications Button",
|
||||||
toggler(
|
toggler(self.show_applications_button)
|
||||||
None,
|
.on_toggle(Message::ShowApplicationsButton),
|
||||||
self.show_applications_button,
|
|
||||||
Message::ShowApplicationsButton,
|
|
||||||
),
|
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Window Controls")
|
settings::section()
|
||||||
|
.title("Window Controls")
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Show Minimize Button",
|
"Show Minimize Button",
|
||||||
toggler(None, self.show_minimize_button, Message::ShowMinimizeButton),
|
toggler(self.show_minimize_button).on_toggle(Message::ShowMinimizeButton),
|
||||||
))
|
))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Show Maximize Button",
|
"Show Maximize Button",
|
||||||
toggler(None, self.show_maximize_button, Message::ShowMaximizeButton),
|
toggler(self.show_maximize_button).on_toggle(Message::ShowMaximizeButton),
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
|
@ -245,12 +242,12 @@ impl State {
|
||||||
list_column()
|
list_column()
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Same background on all displays",
|
"Same background on all displays",
|
||||||
toggler(None, self.same_background, Message::SameBackground),
|
toggler(self.same_background).on_toggle(Message::SameBackground),
|
||||||
))
|
))
|
||||||
.add(settings::item("Background fit", text("TODO")))
|
.add(settings::item("Background fit", text("TODO")))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Slideshow",
|
"Slideshow",
|
||||||
toggler(None, self.slideshow, Message::Slideshow),
|
toggler(self.slideshow).on_toggle(Message::Slideshow),
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
column(image_column).spacing(16).into(),
|
column(image_column).spacing(16).into(),
|
||||||
|
|
@ -261,7 +258,8 @@ impl State {
|
||||||
fn view_desktop_workspaces<'a>(&'a self, window: &'a Window) -> Element<'a, Message> {
|
fn view_desktop_workspaces<'a>(&'a self, window: &'a Window) -> Element<'a, Message> {
|
||||||
settings::view_column(vec![
|
settings::view_column(vec![
|
||||||
window.parent_page_button(DesktopPage::Wallpaper),
|
window.parent_page_button(DesktopPage::Wallpaper),
|
||||||
settings::view_section("Workspace Behavior")
|
settings::section()
|
||||||
|
.title("Workspace Behavior")
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Dynamic workspaces",
|
"Dynamic workspaces",
|
||||||
horizontal_space(Length::Fill),
|
horizontal_space(Length::Fill),
|
||||||
|
|
@ -271,7 +269,8 @@ impl State {
|
||||||
horizontal_space(Length::Fill),
|
horizontal_space(Length::Fill),
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Multi-monitor Behavior")
|
settings::section()
|
||||||
|
.title("Multi-monitor Behavior")
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Workspaces Span Displays",
|
"Workspaces Span Displays",
|
||||||
horizontal_space(Length::Fill),
|
horizontal_space(Length::Fill),
|
||||||
|
|
|
||||||
|
|
@ -69,14 +69,16 @@ impl State {
|
||||||
list_column()
|
list_column()
|
||||||
.add(settings::item("Device name", text("TODO")))
|
.add(settings::item("Device name", text("TODO")))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Hardware")
|
settings::section()
|
||||||
|
.title("Hardware")
|
||||||
.add(settings::item("Hardware model", text("TODO")))
|
.add(settings::item("Hardware model", text("TODO")))
|
||||||
.add(settings::item("Memory", text("TODO")))
|
.add(settings::item("Memory", text("TODO")))
|
||||||
.add(settings::item("Processor", text("TODO")))
|
.add(settings::item("Processor", text("TODO")))
|
||||||
.add(settings::item("Graphics", text("TODO")))
|
.add(settings::item("Graphics", text("TODO")))
|
||||||
.add(settings::item("Disk Capacity", text("TODO")))
|
.add(settings::item("Disk Capacity", text("TODO")))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Operating System")
|
settings::section()
|
||||||
|
.title("Operating System")
|
||||||
.add(settings::item("Operating system", text("TODO")))
|
.add(settings::item("Operating system", text("TODO")))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Operating system architecture",
|
"Operating system architecture",
|
||||||
|
|
@ -85,7 +87,8 @@ impl State {
|
||||||
.add(settings::item("Desktop environment", text("TODO")))
|
.add(settings::item("Desktop environment", text("TODO")))
|
||||||
.add(settings::item("Windowing system", text("TODO")))
|
.add(settings::item("Windowing system", text("TODO")))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Related settings")
|
settings::section()
|
||||||
|
.title("Related settings")
|
||||||
.add(settings::item("Get support", text("TODO")))
|
.add(settings::item("Get support", text("TODO")))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ pub fn windowing_system() -> Option<WindowingSystem> {
|
||||||
WINDOWING_SYSTEM.get().copied()
|
WINDOWING_SYSTEM.get().copied()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init_windowing_system<M>(handle: raw_window_handle::WindowHandle) -> crate::Action<M> {
|
fn init_windowing_system<M>(handle: window::raw_window_handle::WindowHandle) -> crate::Action<M> {
|
||||||
let raw: &raw_window_handle::RawWindowHandle = handle.as_ref();
|
let raw = handle.as_ref();
|
||||||
let system = match raw {
|
let system = match raw {
|
||||||
window::raw_window_handle::RawWindowHandle::UiKit(_) => WindowingSystem::UiKit,
|
window::raw_window_handle::RawWindowHandle::UiKit(_) => WindowingSystem::UiKit,
|
||||||
window::raw_window_handle::RawWindowHandle::AppKit(_) => WindowingSystem::AppKit,
|
window::raw_window_handle::RawWindowHandle::AppKit(_) => WindowingSystem::AppKit,
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,16 @@ impl<'a, Message: Clone + 'static> Widget<Message, crate::Theme, crate::Renderer
|
||||||
);
|
);
|
||||||
let start_width = start_node.size().width;
|
let start_width = start_node.size().width;
|
||||||
|
|
||||||
let (center_node, center_x) = if let Some(center) = &mut self.center {
|
let vcenter = |node: layout::Node, x: f32| -> layout::Node {
|
||||||
|
let dy = ((height - node.size().height) / 2.0).max(0.0);
|
||||||
|
node.translate(Vector::new(x, dy))
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut child_nodes = Vec::with_capacity(3);
|
||||||
|
child_nodes.push(vcenter(start_node, 0.0));
|
||||||
|
child_nodes.push(vcenter(end_node, width - end_width));
|
||||||
|
|
||||||
|
if let Some(center) = &mut self.center {
|
||||||
let slot_start = start_width + gap;
|
let slot_start = start_width + gap;
|
||||||
let slot_end = (width - end_width - gap).max(slot_start);
|
let slot_end = (width - end_width - gap).max(slot_start);
|
||||||
let slot_width = slot_end - slot_start;
|
let slot_width = slot_end - slot_start;
|
||||||
|
|
@ -217,21 +226,8 @@ impl<'a, Message: Clone + 'static> Widget<Message, crate::Theme, crate::Renderer
|
||||||
let ideal_x = (width - natural_width) / 2.0;
|
let ideal_x = (width - natural_width) / 2.0;
|
||||||
let max_x = (width - end_width - gap - natural_width).max(slot_start);
|
let max_x = (width - end_width - gap - natural_width).max(slot_start);
|
||||||
let center_x = ideal_x.clamp(slot_start, max_x);
|
let center_x = ideal_x.clamp(slot_start, max_x);
|
||||||
(Some(node), center_x)
|
|
||||||
} else {
|
|
||||||
(None, 0.0)
|
|
||||||
};
|
|
||||||
|
|
||||||
let vcenter = |node: layout::Node, x: f32| -> layout::Node {
|
child_nodes.push(vcenter(node, center_x))
|
||||||
let dy = ((height - node.size().height) / 2.0).max(0.0);
|
|
||||||
node.translate(Vector::new(x, dy))
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut child_nodes = Vec::with_capacity(3);
|
|
||||||
child_nodes.push(vcenter(start_node, 0.0));
|
|
||||||
child_nodes.push(vcenter(end_node, width - end_width));
|
|
||||||
if let Some(cn) = center_node {
|
|
||||||
child_nodes.push(vcenter(cn, center_x));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
layout::Node::with_children(Size::new(width, height), child_nodes)
|
layout::Node::with_children(Size::new(width, height), child_nodes)
|
||||||
|
|
@ -398,8 +394,7 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
|
||||||
} else {
|
} else {
|
||||||
match (
|
match (
|
||||||
self.density.unwrap_or_else(crate::config::header_size),
|
self.density.unwrap_or_else(crate::config::header_size),
|
||||||
// Center content depending on window border
|
self.maximized, // window border handling
|
||||||
self.maximized,
|
|
||||||
) {
|
) {
|
||||||
(Density::Compact, true) => [4, 8, 4, 8],
|
(Density::Compact, true) => [4, 8, 4, 8],
|
||||||
(Density::Compact, false) => [3, 7, 4, 7],
|
(Density::Compact, false) => [3, 7, 4, 7],
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,6 @@ use crate::Element;
|
||||||
use crate::widget::{ListColumn, column, text};
|
use crate::widget::{ListColumn, column, text};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
/// A section within a settings view column.
|
|
||||||
#[deprecated(note = "use `settings::section().title()` instead")]
|
|
||||||
pub fn view_section<'a, Message: 'static>(title: impl Into<Cow<'a, str>>) -> Section<'a, Message> {
|
|
||||||
section().title(title)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A section within a settings view column.
|
/// A section within a settings view column.
|
||||||
pub fn section<'a, Message: 'static>() -> Section<'a, Message> {
|
pub fn section<'a, Message: 'static>() -> Section<'a, Message> {
|
||||||
with_column(ListColumn::default())
|
with_column(ListColumn::default())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue