fix: absorb libcosmic theme-v2 API (nav_context_menu, app_popup LiveSettings)
Leyoda 2026 – GPLv3
This commit is contained in:
parent
2a74748083
commit
fd4a2ba610
4 changed files with 11 additions and 9 deletions
|
|
@ -2817,7 +2817,7 @@ impl Application for App {
|
|||
.on_middle_press(|entity| {
|
||||
cosmic::Action::App(Message::NavMenuAction(NavMenuAction::OpenInNewTab(entity)))
|
||||
})
|
||||
.context_menu(self.nav_context_menu(self.nav_bar_context_id))
|
||||
.context_menu(self.nav_context_menu())
|
||||
.close_icon(icon::from_name("media-eject-symbolic").size(16).icon())
|
||||
.into_container();
|
||||
|
||||
|
|
@ -2832,8 +2832,8 @@ impl Application for App {
|
|||
|
||||
fn nav_context_menu(
|
||||
&self,
|
||||
entity: widget::nav_bar::Id,
|
||||
) -> Option<Vec<widget::menu::Tree<cosmic::Action<Self::Message>>>> {
|
||||
let entity = self.nav_bar_context_id;
|
||||
let favorite_index_opt = self.nav_model.data::<FavoriteIndex>(entity);
|
||||
let location_opt = self.nav_model.data::<Location>(entity);
|
||||
|
||||
|
|
@ -4885,6 +4885,7 @@ impl Application for App {
|
|||
commands.push(self.update(Message::CheckClipboard));
|
||||
commands.push(self.update(Message::Surface(
|
||||
cosmic::surface::action::app_popup(
|
||||
|_: &Self| cosmic::surface::action::LiveSettings::default(),
|
||||
move |app: &mut Self| -> SctkPopupSettings {
|
||||
let anchor_rect = Rectangle {
|
||||
x: point.x as i32,
|
||||
|
|
|
|||
|
|
@ -1801,6 +1801,7 @@ impl Application for App {
|
|||
let autosize_id = widget::Id::unique();
|
||||
commands.push(self.update(Message::Surface(
|
||||
cosmic::surface::action::app_popup(
|
||||
|_: &Self| cosmic::surface::action::LiveSettings::default(),
|
||||
move |app: &mut Self| -> SctkPopupSettings {
|
||||
let anchor_rect = Rectangle {
|
||||
x: point.x as i32,
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ pub fn context_menu<'a>(
|
|||
String::new()
|
||||
};
|
||||
fn key_style(theme: &cosmic::Theme) -> TextStyle {
|
||||
let mut color = theme.cosmic().background.component.on;
|
||||
let mut color = theme.cosmic().background(false).component.on;
|
||||
color.alpha *= 0.75;
|
||||
TextStyle {
|
||||
color: Some(color.into()),
|
||||
|
|
@ -78,7 +78,7 @@ pub fn context_menu<'a>(
|
|||
}
|
||||
}
|
||||
fn disabled_style(theme: &cosmic::Theme) -> TextStyle {
|
||||
let mut color = theme.cosmic().background.component.on;
|
||||
let mut color = theme.cosmic().background(false).component.on;
|
||||
color.alpha *= 0.5;
|
||||
TextStyle {
|
||||
color: Some(color.into()),
|
||||
|
|
@ -442,7 +442,7 @@ pub fn context_menu<'a>(
|
|||
//TODO: move style to libcosmic
|
||||
.style(|theme| {
|
||||
let cosmic = theme.cosmic();
|
||||
let component = &cosmic.background.component;
|
||||
let component = &cosmic.background(false).component;
|
||||
container::Style {
|
||||
icon_color: Some(component.on.into()),
|
||||
text_color: Some(component.on.into()),
|
||||
|
|
@ -836,7 +836,7 @@ pub fn location_context_menu<'a>(ancestor_index: usize) -> Element<'a, tab::Mess
|
|||
.padding(1)
|
||||
.style(|theme| {
|
||||
let cosmic = theme.cosmic();
|
||||
let component = &cosmic.background.component;
|
||||
let component = &cosmic.background(false).component;
|
||||
container::Style {
|
||||
icon_color: Some(component.on.into()),
|
||||
text_color: Some(component.on.into()),
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ fn button_appearance(
|
|||
appearance.icon_color = Some(Color::from(cosmic.on_bg_component_color()));
|
||||
appearance.text_color = Some(Color::from(cosmic.on_bg_component_color()));
|
||||
if cut {
|
||||
appearance.text_color = Some(Color::from(cosmic.background.component.on_disabled));
|
||||
appearance.text_color = Some(Color::from(cosmic.background(false).component.on_disabled));
|
||||
} else {
|
||||
appearance.text_color = Some(Color::from(cosmic.on_bg_component_color()));
|
||||
}
|
||||
|
|
@ -192,12 +192,12 @@ fn button_appearance(
|
|||
appearance.background = Some(Color::from(cosmic.bg_color()).into());
|
||||
appearance.icon_color = Some(Color::from(cosmic.on_bg_color()));
|
||||
if cut {
|
||||
appearance.text_color = Some(Color::from(cosmic.background.component.disabled));
|
||||
appearance.text_color = Some(Color::from(cosmic.background(false).component.disabled));
|
||||
} else {
|
||||
appearance.text_color = Some(Color::from(cosmic.on_bg_color()));
|
||||
}
|
||||
} else if cut {
|
||||
appearance.text_color = Some(Color::from(cosmic.background.component.on_disabled));
|
||||
appearance.text_color = Some(Color::from(cosmic.background(false).component.on_disabled));
|
||||
}
|
||||
if focused && accent {
|
||||
appearance.outline_width = 1.0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue