Merge upstream/master (COSMIC 1.6) into main
Aligne le fork sur epoch-1.6.0 (63 commits amont) en preservant les 19 commits yoda. Resolutions notables : - les cfg `all(feature = "wayland", target_os = "linux")` deviennent l alias `wayland_platform` introduit en amont ; il exclut winit comme le faisait le patch yoda45eaaf16, l intention est donc preservee ; - les features iced `cctk` ont ete renommees `wayland` en amont, la feature `wayland` locale est adaptee ; `winit` reste un marqueur vide et `iced/winit` est liste explicitement ; - cctk/ashpd gardent leurs chemins locaux dans la section conditionnelle unix introduite en amont ; - la garde anti-crashc0b653f5(context_menu non assigne) est conservee par-dessus la nouvelle structure amont ; - traductions ca/oc restaurees depuis amont. Le submodule iced suit (merge + correctif du cfg cctk residuel). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
commit
9535ada4d0
60 changed files with 3187 additions and 1528 deletions
|
|
@ -5,7 +5,7 @@ use crate::config::CosmicTk;
|
|||
use crate::theme::Theme;
|
||||
use crate::widget::nav_bar;
|
||||
use crate::{keyboard_nav, surface};
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
use cctk::sctk::reexports::csd_frame::{WindowManagerCapabilities, WindowState};
|
||||
use cosmic_theme::ThemeMode;
|
||||
|
||||
|
|
@ -71,11 +71,11 @@ pub enum Action {
|
|||
/// Updates the tracked window geometry.
|
||||
WindowResize(iced::window::Id, f32, f32),
|
||||
/// Tracks updates to window state.
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
WindowState(iced::window::Id, WindowState),
|
||||
/// Capabilities the window manager supports
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
WmCapabilities(iced::window::Id, WindowManagerCapabilities),
|
||||
#[cfg(feature = "xdg-portal")]
|
||||
#[cfg(xdg_portal)]
|
||||
DesktopSettings(crate::theme::portal::Desktop),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,20 +6,20 @@ use std::collections::HashMap;
|
|||
use std::sync::Arc;
|
||||
|
||||
use super::{Action, Application, ApplicationExt, Subscription};
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
use crate::core::Auto;
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
use crate::surface::action::LiveSettings;
|
||||
use crate::theme::{THEME, Theme, ThemeType};
|
||||
use crate::{Core, Element, keyboard_nav};
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
use cctk::sctk::reexports::csd_frame::{WindowManagerCapabilities, WindowState};
|
||||
use cosmic_theme::ThemeMode;
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
use enumflags2::BitFlags;
|
||||
#[cfg(not(any(feature = "multi-window", feature = "wayland", target_os = "linux")))]
|
||||
#[cfg(not(any(feature = "multi-window", wayland_platform)))]
|
||||
use iced::Application as IcedApplication;
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
use iced::event::wayland;
|
||||
use iced::{Task, theme, window};
|
||||
use iced_futures::event::listen_with;
|
||||
|
|
@ -157,8 +157,8 @@ where
|
|||
) -> iced::Task<crate::Action<T::Message>> {
|
||||
#[cfg(feature = "surface-message")]
|
||||
match _surface_message {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
crate::surface::Action::AppSubsurface(settings, _live_settings, view) => {
|
||||
#[cfg(wayland_platform)]
|
||||
crate::surface::Action::AppSubsurface(settings, live_settings, view) => {
|
||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||
.ok()
|
||||
.and_then(|s| s.downcast::<Box<dyn Fn(&mut T) -> iced_runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings + Send + Sync>>().ok()) else {
|
||||
|
|
@ -184,8 +184,8 @@ where
|
|||
});
|
||||
self.get_subsurface(settings, view.map(|v| *v))
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
crate::surface::Action::Subsurface(settings, _live_settings, view) => {
|
||||
#[cfg(wayland_platform)]
|
||||
crate::surface::Action::Subsurface(settings, live_settings, view) => {
|
||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||
.ok()
|
||||
.and_then(|s| s.downcast::<Box<dyn Fn() -> iced_runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings + Send + Sync>>().ok()) else {
|
||||
|
|
@ -211,7 +211,7 @@ where
|
|||
self.get_subsurface(settings, None)
|
||||
}
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
crate::surface::Action::AppPopup(settings, live_settings, view) => {
|
||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||
.ok()
|
||||
|
|
@ -248,11 +248,11 @@ where
|
|||
|
||||
self.get_popup(settings, *live_settings, view.map(|v| *v))
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
crate::surface::Action::DestroyPopup(id) => {
|
||||
iced_winit::commands::popup::destroy_popup(id)
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
crate::surface::Action::DestroyTooltipPopup => {
|
||||
#[cfg(feature = "applet")]
|
||||
{
|
||||
|
|
@ -263,11 +263,11 @@ where
|
|||
Task::none()
|
||||
}
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
crate::surface::Action::DestroySubsurface(id) => {
|
||||
iced_winit::commands::subsurface::destroy_subsurface(id)
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
crate::surface::Action::DestroyWindow(id) => iced::window::close(id),
|
||||
crate::surface::Action::ResponsiveMenuBar {
|
||||
menu_bar,
|
||||
|
|
@ -278,7 +278,7 @@ where
|
|||
core.menu_bars.insert(menu_bar, (limits, size));
|
||||
iced::Task::none()
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
crate::surface::Action::Popup(settings, live_settings, view) => {
|
||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||
.ok()
|
||||
|
|
@ -317,7 +317,7 @@ where
|
|||
self.get_popup(settings, live_settings, None)
|
||||
}
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
crate::surface::Action::AppWindow(id, settings, live_settings, view) => {
|
||||
let Some(settings) = std::sync::Arc::try_unwrap(settings).ok().and_then(|s| {
|
||||
s.downcast::<Box<dyn Fn(&mut T) -> iced::window::Settings + Send + Sync>>()
|
||||
|
|
@ -355,7 +355,7 @@ where
|
|||
|
||||
self.get_window(id, settings, *live_settings, view.map(|v| *v))
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
crate::surface::Action::Window(id, settings, live_settings, view) => {
|
||||
let Some(settings) = std::sync::Arc::try_unwrap(settings).ok().and_then(|s| {
|
||||
s.downcast::<Box<dyn Fn() -> iced::window::Settings + Send + Sync>>()
|
||||
|
|
@ -412,7 +412,7 @@ where
|
|||
crate::surface::Action::Task(f) => {
|
||||
f().map(|sm| crate::Action::Cosmic(Action::Surface(sm)))
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
crate::surface::Action::AppLayerShell(settings, live_settings, view) => {
|
||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||
.ok()
|
||||
|
|
@ -450,7 +450,7 @@ where
|
|||
|
||||
self.get_layer_shell(settings, *live_settings, view.map(|v| *v))
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
crate::surface::Action::LayerShell(settings, live_settings, view) => {
|
||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||
.ok()
|
||||
|
|
@ -490,7 +490,7 @@ where
|
|||
self.get_layer_shell(settings, live_settings, None)
|
||||
}
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
crate::surface::Action::DestroyLayerShell(id) => {
|
||||
iced_winit::commands::layer_surface::destroy_layer_surface(id)
|
||||
}
|
||||
|
|
@ -512,7 +512,7 @@ where
|
|||
&mut self,
|
||||
message: crate::Action<T::Message>,
|
||||
) -> iced::Task<crate::Action<T::Message>> {
|
||||
let message = match message {
|
||||
let mut task = match message {
|
||||
crate::Action::App(message) => self.app.update(message),
|
||||
crate::Action::Cosmic(message) => self.cosmic_update(message),
|
||||
crate::Action::None => iced::Task::none(),
|
||||
|
|
@ -529,10 +529,33 @@ where
|
|||
}
|
||||
};
|
||||
|
||||
// Drain any text context-menu popup teardown requests queued by
|
||||
// widgets during `app.update()` and destroy them through the normal
|
||||
// popup pipeline. Drained before the creation queue so a
|
||||
// destroy-then-recreate (a second right-click reusing the same id)
|
||||
// keeps its order.
|
||||
#[cfg(all(wayland_platform, target_os = "linux"))]
|
||||
for id in crate::widget::text_context_menu::take_popup_destroys() {
|
||||
task = task.chain(iced_winit::commands::popup::destroy_popup(id));
|
||||
}
|
||||
|
||||
// Drain any text context-menu popup requests queued by widgets during
|
||||
// `app.update()` and create them through the normal popup pipeline.
|
||||
#[cfg(all(wayland_platform, target_os = "linux"))]
|
||||
for req in crate::widget::text_context_menu::take_popup_requests() {
|
||||
let (live_settings, settings, view) =
|
||||
crate::widget::text_context_menu::into_popup_view::<T::Message>(req);
|
||||
task = task.chain(self.get_popup(
|
||||
settings,
|
||||
Box::new(move |_| live_settings),
|
||||
Some(Box::new(move |_| view())),
|
||||
));
|
||||
}
|
||||
|
||||
#[cfg(all(target_env = "gnu", not(target_os = "windows")))]
|
||||
crate::malloc::trim(0);
|
||||
|
||||
message
|
||||
task
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "multi-window"))]
|
||||
|
|
@ -548,16 +571,16 @@ where
|
|||
pub fn style(&self, _theme: &Theme) -> theme::Style {
|
||||
if let Some(style) = self.app.style() {
|
||||
style
|
||||
} else if self.app.core().window.is_maximized {
|
||||
let theme = THEME.lock().unwrap();
|
||||
crate::style::iced::application::style(theme.borrow())
|
||||
} else {
|
||||
let theme = THEME.lock().unwrap();
|
||||
|
||||
theme::Style {
|
||||
background_color: iced_core::Color::TRANSPARENT,
|
||||
icon_color: theme.cosmic().on_bg_color().into(),
|
||||
text_color: theme.cosmic().on_bg_color().into(),
|
||||
if self.app.core().window.is_maximized && !theme.cosmic().frosted_maximized_apps {
|
||||
crate::style::iced::application::style(theme.borrow())
|
||||
} else {
|
||||
theme::Style {
|
||||
background_color: iced_core::Color::TRANSPARENT,
|
||||
icon_color: theme.cosmic().on_bg_color().into(),
|
||||
text_color: theme.cosmic().on_bg_color().into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -578,7 +601,7 @@ where
|
|||
}
|
||||
iced::Event::Window(window::Event::Focused) => return Some(Action::Focus(id)),
|
||||
iced::Event::Window(window::Event::Unfocused) => return Some(Action::Unfocus(id)),
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
iced::Event::PlatformSpecific(iced::event::PlatformSpecific::Wayland(event)) => {
|
||||
match event {
|
||||
wayland::Event::Popup(wayland::PopupEvent::Done, _, id)
|
||||
|
|
@ -591,7 +614,7 @@ where
|
|||
) => {
|
||||
return Some(Action::SuggestedBounds(b));
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
wayland::Event::Window(iced::event::wayland::WindowEvent::WindowState(
|
||||
s,
|
||||
)) => {
|
||||
|
|
@ -677,7 +700,7 @@ where
|
|||
})
|
||||
.map(crate::Action::Cosmic),
|
||||
window_events.map(crate::Action::Cosmic),
|
||||
#[cfg(feature = "xdg-portal")]
|
||||
#[cfg(xdg_portal)]
|
||||
crate::theme::portal::desktop_settings()
|
||||
.map(Action::DesktopSettings)
|
||||
.map(crate::Action::Cosmic),
|
||||
|
|
@ -696,6 +719,14 @@ where
|
|||
subscriptions.push(crate::dbus_activation::subscription::<T>());
|
||||
}
|
||||
|
||||
// Drives the text context-menu popup queues: a right-click queues a
|
||||
// popup but publishes no message, so this re-emits `Action::None` to
|
||||
// make `update()` run and drain the queue.
|
||||
#[cfg(all(wayland_platform, target_os = "linux"))]
|
||||
subscriptions.push(crate::widget::text_context_menu::wake_subscription::<
|
||||
T::Message,
|
||||
>());
|
||||
|
||||
Subscription::batch(subscriptions)
|
||||
}
|
||||
|
||||
|
|
@ -711,6 +742,8 @@ where
|
|||
|
||||
#[cfg(feature = "multi-window")]
|
||||
pub fn view(&self, id: window::Id) -> Element<'_, crate::Action<T::Message>> {
|
||||
crate::widget::text_context_menu::set_current_window_id(id);
|
||||
#[cfg(all(wayland_platform, target_os = "linux"))]
|
||||
if let Some((_, _, _, Some(v))) = self.surface_views.get(&id) {
|
||||
return v(&self.app);
|
||||
}
|
||||
|
|
@ -737,6 +770,9 @@ where
|
|||
|
||||
#[cfg(not(feature = "multi-window"))]
|
||||
pub fn view(&self) -> Element<crate::Action<T::Message>> {
|
||||
if let Some(id) = self.app.core().main_window_id() {
|
||||
crate::widget::text_context_menu::set_current_window_id(id);
|
||||
}
|
||||
let view = self.app.view_main();
|
||||
|
||||
#[cfg(all(target_env = "gnu", not(target_os = "windows")))]
|
||||
|
|
@ -760,8 +796,8 @@ impl<T: Application> Cosmic<T> {
|
|||
#[allow(clippy::too_many_lines)]
|
||||
fn cosmic_update(&mut self, message: Action) -> iced::Task<crate::Action<T::Message>> {
|
||||
match message {
|
||||
Action::WindowMaximized(_id, _maximized) => {
|
||||
#[cfg(not(all(feature = "wayland", target_os = "linux")))]
|
||||
Action::WindowMaximized(id, maximized) => {
|
||||
#[cfg(not(wayland_platform))]
|
||||
if self
|
||||
.app
|
||||
.core()
|
||||
|
|
@ -791,7 +827,7 @@ impl<T: Application> Cosmic<T> {
|
|||
});
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
Action::WindowState(id, state) => {
|
||||
if self
|
||||
.app
|
||||
|
|
@ -823,7 +859,7 @@ impl<T: Application> Cosmic<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
Action::WmCapabilities(id, capabilities) => {
|
||||
if self
|
||||
.app
|
||||
|
|
@ -895,14 +931,7 @@ impl<T: Application> Cosmic<T> {
|
|||
}
|
||||
}
|
||||
|
||||
let new_blur = self.blur_enabled && {
|
||||
let t = theme.cosmic();
|
||||
match self.app.core().app_type() {
|
||||
crate::core::AppType::Window => t.frosted_windows,
|
||||
crate::core::AppType::System => t.frosted_system_interface,
|
||||
crate::core::AppType::Applet => t.frosted_applets,
|
||||
}
|
||||
};
|
||||
let new_blur = self.blur_enabled && self.app.core().frosted(theme.cosmic());
|
||||
|
||||
theme.transparent = new_blur;
|
||||
let mut guard = THEME.lock().unwrap();
|
||||
|
|
@ -910,7 +939,7 @@ impl<T: Application> Cosmic<T> {
|
|||
guard.transparent = new_blur;
|
||||
drop(guard);
|
||||
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
{
|
||||
let core = self.app.core();
|
||||
let mut cmds = Vec::with_capacity(1 + self.surface_views.len());
|
||||
|
|
@ -940,20 +969,13 @@ impl<T: Application> Cosmic<T> {
|
|||
}
|
||||
|
||||
Action::SystemThemeChange(keys, mut theme) => {
|
||||
let cur_is_dark = THEME.lock().unwrap().theme_type.is_dark();
|
||||
let cur_is_dark = self.app.core().system_theme_mode.is_dark;
|
||||
// Ignore updates if the current theme mode does not match.
|
||||
if cur_is_dark != theme.cosmic().is_dark {
|
||||
return iced::Task::none();
|
||||
}
|
||||
// update transparent
|
||||
let new_blur = self.blur_enabled && {
|
||||
let t = theme.cosmic();
|
||||
match self.app.core().app_type() {
|
||||
crate::core::AppType::Window => t.frosted_windows,
|
||||
crate::core::AppType::System => t.frosted_system_interface,
|
||||
crate::core::AppType::Applet => t.frosted_applets,
|
||||
}
|
||||
};
|
||||
let new_blur = self.blur_enabled && self.app.core().frosted(theme.cosmic());
|
||||
theme.transparent = new_blur;
|
||||
|
||||
let cmd = self.app.system_theme_update(&keys, theme.cosmic());
|
||||
|
|
@ -985,7 +1007,7 @@ impl<T: Application> Cosmic<T> {
|
|||
cosmic_theme.set_theme(new_theme.theme_type);
|
||||
cosmic_theme.transparent = new_blur;
|
||||
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
{
|
||||
use iced_winit::platform_specific::commands::corner_radius::corner_radius;
|
||||
|
||||
|
|
@ -1020,6 +1042,29 @@ impl<T: Application> Cosmic<T> {
|
|||
cmds.push(corner_radius(*id, cur_rad).discard());
|
||||
}
|
||||
|
||||
let blur = if new_blur {
|
||||
iced::window::enable_blur
|
||||
} else {
|
||||
iced::window::disable_blur
|
||||
};
|
||||
|
||||
cmds.push(blur(
|
||||
self.app
|
||||
.core()
|
||||
.main_window_id()
|
||||
.unwrap_or(window::Id::RESERVED),
|
||||
));
|
||||
|
||||
for (id, wrapper, ..) in &self.surface_views {
|
||||
let overriden = wrapper.2(&self.app);
|
||||
if self.app.core().blur(&cosmic_theme, Some(wrapper.1))
|
||||
&& overriden.blur.unwrap_or(true)
|
||||
{
|
||||
cmds.push(blur(*id));
|
||||
} else if overriden.blur.is_some_and(|b| !b) {
|
||||
cmds.push(iced::window::disable_blur(*id));
|
||||
}
|
||||
}
|
||||
return Task::batch(cmds);
|
||||
}
|
||||
}
|
||||
|
|
@ -1077,14 +1122,7 @@ impl<T: Application> Cosmic<T> {
|
|||
} else {
|
||||
new_theme
|
||||
};
|
||||
let new_blur = self.blur_enabled && {
|
||||
let t = new_theme.cosmic();
|
||||
match core.app_type() {
|
||||
crate::core::AppType::Window => t.frosted_windows,
|
||||
crate::core::AppType::System => t.frosted_system_interface,
|
||||
crate::core::AppType::Applet => t.frosted_applets,
|
||||
}
|
||||
};
|
||||
let new_blur = self.blur_enabled && core.frosted(new_theme.cosmic());
|
||||
new_theme.transparent = new_blur;
|
||||
|
||||
core.system_theme = new_theme.clone();
|
||||
|
|
@ -1095,7 +1133,7 @@ impl<T: Application> Cosmic<T> {
|
|||
if let ThemeType::System { .. } = cosmic_theme.theme_type {
|
||||
cosmic_theme.set_theme(new_theme.theme_type);
|
||||
cosmic_theme.transparent = new_blur;
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
{
|
||||
use iced_winit::platform_specific::commands::corner_radius::corner_radius;
|
||||
|
||||
|
|
@ -1169,7 +1207,7 @@ impl<T: Application> Cosmic<T> {
|
|||
// Unminimize window before requesting to activate it.
|
||||
let mut task = iced_runtime::window::minimize(id, false);
|
||||
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
{
|
||||
task = task.chain(
|
||||
iced_winit::platform_specific::commands::activation::activate(
|
||||
|
|
@ -1180,7 +1218,7 @@ impl<T: Application> Cosmic<T> {
|
|||
);
|
||||
}
|
||||
|
||||
#[cfg(not(all(feature = "wayland", target_os = "linux")))]
|
||||
#[cfg(not(wayland_platform))]
|
||||
{
|
||||
task = task.chain(iced_runtime::window::gain_focus(id));
|
||||
}
|
||||
|
|
@ -1226,7 +1264,7 @@ impl<T: Application> Cosmic<T> {
|
|||
return self.app.dbus_connection(conn);
|
||||
}
|
||||
|
||||
#[cfg(feature = "xdg-portal")]
|
||||
#[cfg(xdg_portal)]
|
||||
Action::DesktopSettings(crate::theme::portal::Desktop::ColorScheme(s)) => {
|
||||
use ashpd::desktop::settings::ColorScheme;
|
||||
if match THEME.lock().unwrap().theme_type {
|
||||
|
|
@ -1259,14 +1297,7 @@ impl<T: Application> Cosmic<T> {
|
|||
crate::theme::system_light()
|
||||
};
|
||||
if let ThemeType::System { .. } = new_theme.theme_type {
|
||||
let new_blur = self.blur_enabled && {
|
||||
let t = new_theme.cosmic();
|
||||
match core.app_type() {
|
||||
crate::core::AppType::Window => t.frosted_windows,
|
||||
crate::core::AppType::System => t.frosted_system_interface,
|
||||
crate::core::AppType::Applet => t.frosted_applets,
|
||||
}
|
||||
};
|
||||
let new_blur = self.blur_enabled && core.frosted(new_theme.cosmic());
|
||||
new_theme.transparent = new_blur;
|
||||
}
|
||||
core.system_theme = new_theme.clone();
|
||||
|
|
@ -1277,7 +1308,7 @@ impl<T: Application> Cosmic<T> {
|
|||
// Only apply update if the theme is set to load a system theme
|
||||
if let ThemeType::System { theme: _, .. } = cosmic_theme.theme_type {
|
||||
let mut cmds = Vec::with_capacity(1);
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
{
|
||||
let blur = if cosmic_theme.transparent {
|
||||
iced::window::enable_blur
|
||||
|
|
@ -1308,7 +1339,7 @@ impl<T: Application> Cosmic<T> {
|
|||
}
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "xdg-portal")]
|
||||
#[cfg(xdg_portal)]
|
||||
Action::DesktopSettings(crate::theme::portal::Desktop::Accent(c)) => {
|
||||
use palette::Srgba;
|
||||
let c = Srgba::new(c.red() as f32, c.green() as f32, c.blue() as f32, 1.0);
|
||||
|
|
@ -1337,7 +1368,7 @@ impl<T: Application> Cosmic<T> {
|
|||
}
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "xdg-portal")]
|
||||
#[cfg(xdg_portal)]
|
||||
Action::DesktopSettings(crate::theme::portal::Desktop::Contrast(_)) => {
|
||||
// TODO when high contrast is integrated in settings and all custom themes
|
||||
}
|
||||
|
|
@ -1354,12 +1385,7 @@ impl<T: Application> Cosmic<T> {
|
|||
}
|
||||
|
||||
Action::Focus(f) => {
|
||||
#[cfg(all(
|
||||
feature = "wayland",
|
||||
feature = "multi-window",
|
||||
feature = "surface-message",
|
||||
target_os = "linux"
|
||||
))]
|
||||
#[cfg(wayland_platform)]
|
||||
if let Some((
|
||||
parent,
|
||||
SurfaceIdWrapper::Subsurface(_) | SurfaceIdWrapper::Popup(_),
|
||||
|
|
@ -1404,7 +1430,7 @@ impl<T: Application> Cosmic<T> {
|
|||
core.applet.suggested_bounds = b;
|
||||
}
|
||||
Action::Opened(id) => {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
{
|
||||
use iced_winit::platform_specific::commands::corner_radius::corner_radius;
|
||||
|
||||
|
|
@ -1422,14 +1448,7 @@ impl<T: Application> Cosmic<T> {
|
|||
SurfaceIdWrapper::Popup(_) | SurfaceIdWrapper::LayerSurface(_)
|
||||
)
|
||||
});
|
||||
let new_blur = self.blur_enabled && {
|
||||
let t = theme.cosmic();
|
||||
match self.app.core().app_type() {
|
||||
crate::core::AppType::Window => t.frosted_windows,
|
||||
crate::core::AppType::System => t.frosted_system_interface,
|
||||
crate::core::AppType::Applet => t.frosted_applets,
|
||||
}
|
||||
};
|
||||
let new_blur = self.blur_enabled && self.app.core().frosted(theme.cosmic());
|
||||
|
||||
let wrapper = self.surface_views.get(&id).map(|s| s.1);
|
||||
|
||||
|
|
@ -1487,20 +1506,13 @@ impl<T: Application> Cosmic<T> {
|
|||
}
|
||||
return iced_runtime::window::run_with_handle(id, init_windowing_system);
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
Action::BlurEnabled => {
|
||||
// TODO do this after blur event confirms support instead of for all wayland windows
|
||||
self.blur_enabled = true;
|
||||
let mut t = THEME.lock().unwrap();
|
||||
|
||||
let new_blur = self.blur_enabled && {
|
||||
let t = t.cosmic();
|
||||
match self.app.core().app_type() {
|
||||
crate::core::AppType::Window => t.frosted_windows,
|
||||
crate::core::AppType::System => t.frosted_system_interface,
|
||||
crate::core::AppType::Applet => t.frosted_applets,
|
||||
}
|
||||
};
|
||||
let new_blur = self.blur_enabled && self.app.core().frosted(t.cosmic());
|
||||
|
||||
t.transparent = new_blur;
|
||||
|
||||
|
|
@ -1567,7 +1579,7 @@ impl<App: Application> Cosmic<App> {
|
|||
if matches!(id_wrapper, SurfaceIdWrapper::Window(_)) {
|
||||
window::enable_blur(id)
|
||||
} else {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
{
|
||||
iced_winit::commands::blur::blur(
|
||||
id,
|
||||
|
|
@ -1578,7 +1590,7 @@ impl<App: Application> Cosmic<App> {
|
|||
)
|
||||
.discard()
|
||||
}
|
||||
#[cfg(not(all(feature = "wayland", target_os = "linux")))]
|
||||
#[cfg(not(wayland_platform))]
|
||||
{
|
||||
iced::window::enable_blur(id)
|
||||
}
|
||||
|
|
@ -1586,11 +1598,11 @@ impl<App: Application> Cosmic<App> {
|
|||
} else if matches!(id_wrapper, SurfaceIdWrapper::Window(_)) {
|
||||
window::disable_blur(id)
|
||||
} else {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
{
|
||||
iced_winit::commands::blur::blur(id, None).discard()
|
||||
}
|
||||
#[cfg(not(all(feature = "wayland", target_os = "linux")))]
|
||||
#[cfg(not(wayland_platform))]
|
||||
{
|
||||
iced::window::disable_blur(id)
|
||||
}
|
||||
|
|
@ -1600,7 +1612,7 @@ impl<App: Application> Cosmic<App> {
|
|||
cmds.push(if matches!(id_wrapper, SurfaceIdWrapper::Window(_)) {
|
||||
window::enable_blur(id)
|
||||
} else {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
{
|
||||
iced_winit::commands::blur::blur(
|
||||
id,
|
||||
|
|
@ -1611,13 +1623,13 @@ impl<App: Application> Cosmic<App> {
|
|||
)
|
||||
.discard()
|
||||
}
|
||||
#[cfg(not(all(feature = "wayland", target_os = "linux")))]
|
||||
#[cfg(not(wayland_platform))]
|
||||
{
|
||||
iced::window::enable_blur(id)
|
||||
}
|
||||
});
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
if let Some(corners) = live_settings.corners {
|
||||
cmds.push(
|
||||
iced_winit::commands::corner_radius::corner_radius(id, Some(corners)).discard(),
|
||||
|
|
@ -1633,7 +1645,7 @@ impl<App: Application> Cosmic<App> {
|
|||
);
|
||||
}
|
||||
}
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
if let (SurfaceIdWrapper::LayerSurface(id), Some(padding)) =
|
||||
(id_wrapper, live_settings.padding)
|
||||
{
|
||||
|
|
@ -1644,7 +1656,7 @@ impl<App: Application> Cosmic<App> {
|
|||
Task::batch(cmds)
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
/// Create a subsurface
|
||||
pub fn get_subsurface(
|
||||
&mut self,
|
||||
|
|
@ -1659,7 +1671,7 @@ impl<App: Application> Cosmic<App> {
|
|||
let live_settings_task = self.apply_live_settings(
|
||||
SurfaceIdWrapper::Subsurface(settings.id),
|
||||
&LiveSettings {
|
||||
blur: Some(self.blur_enabled),
|
||||
blur: None,
|
||||
corners: None,
|
||||
padding: None,
|
||||
},
|
||||
|
|
@ -1676,7 +1688,7 @@ impl<App: Application> Cosmic<App> {
|
|||
Task::batch([live_settings_task, get_subsurface(settings)])
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
/// Create a subsurface
|
||||
pub fn get_popup(
|
||||
&mut self,
|
||||
|
|
@ -1704,7 +1716,7 @@ impl<App: Application> Cosmic<App> {
|
|||
live_settings_task.chain(get_popup(settings)).discard()
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
/// Create a window surface
|
||||
pub fn get_window(
|
||||
&mut self,
|
||||
|
|
@ -1741,7 +1753,7 @@ impl<App: Application> Cosmic<App> {
|
|||
])
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
pub fn get_layer_shell(
|
||||
&mut self,
|
||||
settings: iced_runtime::platform_specific::wayland::layer_surface::SctkLayerSurfaceSettings,
|
||||
|
|
@ -1770,7 +1782,7 @@ impl<App: Application> Cosmic<App> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
fn corners(
|
||||
surface_type: SurfaceIdWrapper,
|
||||
rounded: bool,
|
||||
|
|
|
|||
|
|
@ -390,12 +390,7 @@ where
|
|||
crate::widget::nav_bar(nav_model, |id| crate::Action::Cosmic(Action::NavBar(id)))
|
||||
.on_context(|id| crate::Action::Cosmic(Action::NavBarContext(id)))
|
||||
.context_menu(self.nav_context_menu());
|
||||
#[cfg(all(
|
||||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
#[cfg(wayland_platform)]
|
||||
{
|
||||
nav = nav
|
||||
.window_id_maybe(self.core().main_window_id())
|
||||
|
|
@ -624,21 +619,23 @@ impl<App: Application> ApplicationExt for App {
|
|||
let content_container = core.window.content_container;
|
||||
let show_context = core.window.show_context;
|
||||
let nav_bar_active = core.nav_bar_active();
|
||||
let transparent_header = core.window.transparent_header;
|
||||
let focused = core
|
||||
.focus_chain()
|
||||
.iter()
|
||||
.any(|i| Some(*i) == self.core().main_window_id());
|
||||
.any(|i| Some(*i) == core.main_window_id());
|
||||
|
||||
let border_padding = if maximized { 8 } else { 7 };
|
||||
let border_padding = core
|
||||
.window
|
||||
.border_padding
|
||||
.unwrap_or(if maximized { 8 } else { 7 });
|
||||
|
||||
let main_content_padding = if !content_container {
|
||||
[0, 0, 0, 0]
|
||||
} else {
|
||||
let main_content_padding = if content_container {
|
||||
let right_padding = if show_context { 0 } else { border_padding };
|
||||
let left_padding = if nav_bar_active { 0 } else { border_padding };
|
||||
|
||||
[0, right_padding, 0, left_padding]
|
||||
} else {
|
||||
[0, 0, 0, 0]
|
||||
};
|
||||
|
||||
let content_row = crate::widget::row::with_children({
|
||||
|
|
@ -833,11 +830,7 @@ impl<App: Application> ApplicationExt for App {
|
|||
let cosmic = theme.cosmic();
|
||||
container::Style {
|
||||
background: Some(iced::Background::Color(
|
||||
if transparent_header {
|
||||
Color::TRANSPARENT
|
||||
} else {
|
||||
cosmic.background(theme.transparent).base.into()
|
||||
},
|
||||
cosmic.background(theme.transparent).base.into(),
|
||||
)),
|
||||
border: iced::Border {
|
||||
radius: [
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub struct Settings {
|
|||
pub(crate) antialiasing: bool,
|
||||
|
||||
/// Autosize the window to fit its contents
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
pub(crate) autosize: bool,
|
||||
|
||||
/// Set the application to not create a main window
|
||||
|
|
@ -80,7 +80,7 @@ impl Default for Settings {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
antialiasing: true,
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(wayland_platform)]
|
||||
autosize: false,
|
||||
no_main_window: false,
|
||||
client_decorations: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue