fix: feature gates
This commit is contained in:
parent
511384f620
commit
8e6aea650a
23 changed files with 161 additions and 327 deletions
33
Cargo.toml
33
Cargo.toml
|
|
@ -14,7 +14,7 @@ default = [
|
||||||
"a11y",
|
"a11y",
|
||||||
"dbus-config",
|
"dbus-config",
|
||||||
"x11",
|
"x11",
|
||||||
"iced-wayland",
|
"wayland",
|
||||||
"multi-window",
|
"multi-window",
|
||||||
]
|
]
|
||||||
advanced-shaping = ["iced/advanced-shaping"]
|
advanced-shaping = ["iced/advanced-shaping"]
|
||||||
|
|
@ -72,6 +72,7 @@ serde-keycode = ["iced_core/serde"]
|
||||||
single-instance = ["iced_winit/single-instance", "zbus/blocking-api", "ron"]
|
single-instance = ["iced_winit/single-instance", "zbus/blocking-api", "ron"]
|
||||||
# smol async runtime
|
# smol async runtime
|
||||||
smol = ["dep:smol", "iced/smol", "zbus?/async-io", "rfd?/async-std"]
|
smol = ["dep:smol", "iced/smol", "zbus?/async-io", "rfd?/async-std"]
|
||||||
|
# Tokio async runtime
|
||||||
tokio = [
|
tokio = [
|
||||||
"dep:tokio",
|
"dep:tokio",
|
||||||
"ashpd?/tokio",
|
"ashpd?/tokio",
|
||||||
|
|
@ -80,22 +81,18 @@ tokio = [
|
||||||
"zbus?/tokio",
|
"zbus?/tokio",
|
||||||
"cosmic-config/tokio",
|
"cosmic-config/tokio",
|
||||||
]
|
]
|
||||||
# Tokio async runtime
|
|
||||||
# Wayland window support
|
# Wayland window support
|
||||||
iced-wayland = [
|
wayland = [
|
||||||
"ashpd?/wayland",
|
|
||||||
"autosize",
|
"autosize",
|
||||||
|
"surface-message",
|
||||||
|
"cctk",
|
||||||
|
"multi-window",
|
||||||
|
"winit",
|
||||||
|
"ashpd?/wayland",
|
||||||
"iced/wayland",
|
"iced/wayland",
|
||||||
"iced_winit/wayland",
|
"iced_winit/wayland",
|
||||||
"surface-message",
|
"iced_runtime/wayland",
|
||||||
]
|
"iced_wgpu/wayland",
|
||||||
wayland = [
|
|
||||||
"iced-wayland",
|
|
||||||
"iced_runtime/cctk",
|
|
||||||
"iced_winit/cctk",
|
|
||||||
"iced_wgpu/cctk",
|
|
||||||
"iced/cctk",
|
|
||||||
"dep:cctk",
|
|
||||||
]
|
]
|
||||||
surface-message = []
|
surface-message = []
|
||||||
# multi-window support
|
# multi-window support
|
||||||
|
|
@ -127,7 +124,6 @@ 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 = { workspace = true, optional = true }
|
async-std = { workspace = true, optional = true }
|
||||||
auto_enums = "0.8.8"
|
auto_enums = "0.8.8"
|
||||||
cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "32283d7", optional = true }
|
|
||||||
jiff = "0.2"
|
jiff = "0.2"
|
||||||
cosmic-config = { path = "cosmic-config" }
|
cosmic-config = { path = "cosmic-config" }
|
||||||
cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon", optional = true }
|
cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon", optional = true }
|
||||||
|
|
@ -173,7 +169,8 @@ ron = { workspace = true, optional = true }
|
||||||
enumflags2 = "0.7.12"
|
enumflags2 = "0.7.12"
|
||||||
|
|
||||||
# Enable DBus feature on Linux targets
|
# Enable DBus feature on Linux targets
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(all(unix, not(any(target_os = "redox", target_family = "wasm", target_os = "android", target_vendor = "apple"))))'.dependencies]
|
||||||
|
cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "32283d7", optional = true }
|
||||||
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.workspace = true
|
zbus.workspace = true
|
||||||
|
|
@ -261,3 +258,9 @@ zbus = { version = "5.15", default-features = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3.27.0"
|
tempfile = "3.27.0"
|
||||||
|
|
||||||
|
[workspace.package]
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
build_helpers = { path = "./iced/build_helpers" }
|
||||||
|
|
|
||||||
1
build.rs
1
build.rs
|
|
@ -8,6 +8,7 @@ fn main() {
|
||||||
{
|
{
|
||||||
generate_bundled_icons();
|
generate_bundled_icons();
|
||||||
}
|
}
|
||||||
|
build_helpers::cfg_aliases_setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generate_bundled_icons() {
|
fn generate_bundled_icons() {
|
||||||
|
|
|
||||||
2
iced
2
iced
|
|
@ -1 +1 @@
|
||||||
Subproject commit f6daee14ac8f7cf090a5413ee1576aa59649a956
|
Subproject commit 7177c92bb0b10382acafdec1af7441312138c69e
|
||||||
|
|
@ -5,7 +5,7 @@ use crate::config::CosmicTk;
|
||||||
use crate::theme::Theme;
|
use crate::theme::Theme;
|
||||||
use crate::widget::nav_bar;
|
use crate::widget::nav_bar;
|
||||||
use crate::{keyboard_nav, surface};
|
use crate::{keyboard_nav, surface};
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
use cctk::sctk::reexports::csd_frame::{WindowManagerCapabilities, WindowState};
|
use cctk::sctk::reexports::csd_frame::{WindowManagerCapabilities, WindowState};
|
||||||
use cosmic_theme::ThemeMode;
|
use cosmic_theme::ThemeMode;
|
||||||
|
|
||||||
|
|
@ -71,10 +71,10 @@ pub enum Action {
|
||||||
/// Updates the tracked window geometry.
|
/// Updates the tracked window geometry.
|
||||||
WindowResize(iced::window::Id, f32, f32),
|
WindowResize(iced::window::Id, f32, f32),
|
||||||
/// Tracks updates to window state.
|
/// Tracks updates to window state.
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
WindowState(iced::window::Id, WindowState),
|
WindowState(iced::window::Id, WindowState),
|
||||||
/// Capabilities the window manager supports
|
/// Capabilities the window manager supports
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
WmCapabilities(iced::window::Id, WindowManagerCapabilities),
|
WmCapabilities(iced::window::Id, WindowManagerCapabilities),
|
||||||
#[cfg(feature = "xdg-portal")]
|
#[cfg(feature = "xdg-portal")]
|
||||||
DesktopSettings(crate::theme::portal::Desktop),
|
DesktopSettings(crate::theme::portal::Desktop),
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,20 @@ use std::collections::HashMap;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use super::{Action, Application, ApplicationExt, Subscription};
|
use super::{Action, Application, ApplicationExt, Subscription};
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
use crate::core::Auto;
|
use crate::core::Auto;
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
use crate::surface::action::LiveSettings;
|
use crate::surface::action::LiveSettings;
|
||||||
use crate::theme::{THEME, Theme, ThemeType};
|
use crate::theme::{THEME, Theme, ThemeType};
|
||||||
use crate::{Core, Element, keyboard_nav};
|
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 cctk::sctk::reexports::csd_frame::{WindowManagerCapabilities, WindowState};
|
||||||
use cosmic_theme::ThemeMode;
|
use cosmic_theme::ThemeMode;
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
use enumflags2::BitFlags;
|
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;
|
use iced::Application as IcedApplication;
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
use iced::event::wayland;
|
use iced::event::wayland;
|
||||||
use iced::{Task, theme, window};
|
use iced::{Task, theme, window};
|
||||||
use iced_futures::event::listen_with;
|
use iced_futures::event::listen_with;
|
||||||
|
|
@ -158,7 +158,7 @@ where
|
||||||
) -> iced::Task<crate::Action<T::Message>> {
|
) -> iced::Task<crate::Action<T::Message>> {
|
||||||
#[cfg(feature = "surface-message")]
|
#[cfg(feature = "surface-message")]
|
||||||
match _surface_message {
|
match _surface_message {
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
crate::surface::Action::AppSubsurface(settings, live_settings, view) => {
|
crate::surface::Action::AppSubsurface(settings, live_settings, view) => {
|
||||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||||
.ok()
|
.ok()
|
||||||
|
|
@ -185,7 +185,7 @@ where
|
||||||
});
|
});
|
||||||
self.get_subsurface(settings, view.map(|v| *v))
|
self.get_subsurface(settings, view.map(|v| *v))
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
crate::surface::Action::Subsurface(settings, live_settings, view) => {
|
crate::surface::Action::Subsurface(settings, live_settings, view) => {
|
||||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||||
.ok()
|
.ok()
|
||||||
|
|
@ -212,7 +212,7 @@ where
|
||||||
self.get_subsurface(settings, None)
|
self.get_subsurface(settings, None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
crate::surface::Action::AppPopup(settings, live_settings, view) => {
|
crate::surface::Action::AppPopup(settings, live_settings, view) => {
|
||||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||||
.ok()
|
.ok()
|
||||||
|
|
@ -249,11 +249,11 @@ where
|
||||||
|
|
||||||
self.get_popup(settings, *live_settings, view.map(|v| *v))
|
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) => {
|
crate::surface::Action::DestroyPopup(id) => {
|
||||||
iced_winit::commands::popup::destroy_popup(id)
|
iced_winit::commands::popup::destroy_popup(id)
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
crate::surface::Action::DestroyTooltipPopup => {
|
crate::surface::Action::DestroyTooltipPopup => {
|
||||||
#[cfg(feature = "applet")]
|
#[cfg(feature = "applet")]
|
||||||
{
|
{
|
||||||
|
|
@ -264,11 +264,11 @@ where
|
||||||
Task::none()
|
Task::none()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
crate::surface::Action::DestroySubsurface(id) => {
|
crate::surface::Action::DestroySubsurface(id) => {
|
||||||
iced_winit::commands::subsurface::destroy_subsurface(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::DestroyWindow(id) => iced::window::close(id),
|
||||||
crate::surface::Action::ResponsiveMenuBar {
|
crate::surface::Action::ResponsiveMenuBar {
|
||||||
menu_bar,
|
menu_bar,
|
||||||
|
|
@ -279,7 +279,7 @@ where
|
||||||
core.menu_bars.insert(menu_bar, (limits, size));
|
core.menu_bars.insert(menu_bar, (limits, size));
|
||||||
iced::Task::none()
|
iced::Task::none()
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
crate::surface::Action::Popup(settings, live_settings, view) => {
|
crate::surface::Action::Popup(settings, live_settings, view) => {
|
||||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||||
.ok()
|
.ok()
|
||||||
|
|
@ -318,7 +318,7 @@ where
|
||||||
self.get_popup(settings, live_settings, None)
|
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) => {
|
crate::surface::Action::AppWindow(id, settings, live_settings, view) => {
|
||||||
let Some(settings) = std::sync::Arc::try_unwrap(settings).ok().and_then(|s| {
|
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>>()
|
s.downcast::<Box<dyn Fn(&mut T) -> iced::window::Settings + Send + Sync>>()
|
||||||
|
|
@ -356,7 +356,7 @@ where
|
||||||
|
|
||||||
self.get_window(id, settings, *live_settings, view.map(|v| *v))
|
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) => {
|
crate::surface::Action::Window(id, settings, live_settings, view) => {
|
||||||
let Some(settings) = std::sync::Arc::try_unwrap(settings).ok().and_then(|s| {
|
let Some(settings) = std::sync::Arc::try_unwrap(settings).ok().and_then(|s| {
|
||||||
s.downcast::<Box<dyn Fn() -> iced::window::Settings + Send + Sync>>()
|
s.downcast::<Box<dyn Fn() -> iced::window::Settings + Send + Sync>>()
|
||||||
|
|
@ -413,7 +413,7 @@ where
|
||||||
crate::surface::Action::Task(f) => {
|
crate::surface::Action::Task(f) => {
|
||||||
f().map(|sm| crate::Action::Cosmic(Action::Surface(sm)))
|
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) => {
|
crate::surface::Action::AppLayerShell(settings, live_settings, view) => {
|
||||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||||
.ok()
|
.ok()
|
||||||
|
|
@ -451,7 +451,7 @@ where
|
||||||
|
|
||||||
self.get_layer_shell(settings, *live_settings, view.map(|v| *v))
|
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) => {
|
crate::surface::Action::LayerShell(settings, live_settings, view) => {
|
||||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||||
.ok()
|
.ok()
|
||||||
|
|
@ -491,7 +491,7 @@ where
|
||||||
self.get_layer_shell(settings, live_settings, None)
|
self.get_layer_shell(settings, live_settings, None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
crate::surface::Action::DestroyLayerShell(id) => {
|
crate::surface::Action::DestroyLayerShell(id) => {
|
||||||
iced_winit::commands::layer_surface::destroy_layer_surface(id)
|
iced_winit::commands::layer_surface::destroy_layer_surface(id)
|
||||||
}
|
}
|
||||||
|
|
@ -579,7 +579,7 @@ where
|
||||||
}
|
}
|
||||||
iced::Event::Window(window::Event::Focused) => return Some(Action::Focus(id)),
|
iced::Event::Window(window::Event::Focused) => return Some(Action::Focus(id)),
|
||||||
iced::Event::Window(window::Event::Unfocused) => return Some(Action::Unfocus(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)) => {
|
iced::Event::PlatformSpecific(iced::event::PlatformSpecific::Wayland(event)) => {
|
||||||
match event {
|
match event {
|
||||||
wayland::Event::Popup(wayland::PopupEvent::Done, _, id)
|
wayland::Event::Popup(wayland::PopupEvent::Done, _, id)
|
||||||
|
|
@ -592,7 +592,7 @@ where
|
||||||
) => {
|
) => {
|
||||||
return Some(Action::SuggestedBounds(b));
|
return Some(Action::SuggestedBounds(b));
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
wayland::Event::Window(iced::event::wayland::WindowEvent::WindowState(
|
wayland::Event::Window(iced::event::wayland::WindowEvent::WindowState(
|
||||||
s,
|
s,
|
||||||
)) => {
|
)) => {
|
||||||
|
|
@ -762,7 +762,7 @@ impl<T: Application> Cosmic<T> {
|
||||||
fn cosmic_update(&mut self, message: Action) -> iced::Task<crate::Action<T::Message>> {
|
fn cosmic_update(&mut self, message: Action) -> iced::Task<crate::Action<T::Message>> {
|
||||||
match message {
|
match message {
|
||||||
Action::WindowMaximized(id, maximized) => {
|
Action::WindowMaximized(id, maximized) => {
|
||||||
#[cfg(not(all(feature = "wayland", target_os = "linux")))]
|
#[cfg(not(wayland_platform))]
|
||||||
if self
|
if self
|
||||||
.app
|
.app
|
||||||
.core()
|
.core()
|
||||||
|
|
@ -792,7 +792,7 @@ impl<T: Application> Cosmic<T> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
Action::WindowState(id, state) => {
|
Action::WindowState(id, state) => {
|
||||||
if self
|
if self
|
||||||
.app
|
.app
|
||||||
|
|
@ -824,7 +824,7 @@ impl<T: Application> Cosmic<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
Action::WmCapabilities(id, capabilities) => {
|
Action::WmCapabilities(id, capabilities) => {
|
||||||
if self
|
if self
|
||||||
.app
|
.app
|
||||||
|
|
@ -911,7 +911,7 @@ impl<T: Application> Cosmic<T> {
|
||||||
guard.transparent = new_blur;
|
guard.transparent = new_blur;
|
||||||
drop(guard);
|
drop(guard);
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
{
|
{
|
||||||
let core = self.app.core();
|
let core = self.app.core();
|
||||||
let mut cmds = Vec::with_capacity(1 + self.surface_views.len());
|
let mut cmds = Vec::with_capacity(1 + self.surface_views.len());
|
||||||
|
|
@ -986,7 +986,7 @@ impl<T: Application> Cosmic<T> {
|
||||||
cosmic_theme.set_theme(new_theme.theme_type);
|
cosmic_theme.set_theme(new_theme.theme_type);
|
||||||
cosmic_theme.transparent = new_blur;
|
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;
|
use iced_winit::platform_specific::commands::corner_radius::corner_radius;
|
||||||
|
|
||||||
|
|
@ -1119,7 +1119,7 @@ impl<T: Application> Cosmic<T> {
|
||||||
if let ThemeType::System { .. } = cosmic_theme.theme_type {
|
if let ThemeType::System { .. } = cosmic_theme.theme_type {
|
||||||
cosmic_theme.set_theme(new_theme.theme_type);
|
cosmic_theme.set_theme(new_theme.theme_type);
|
||||||
cosmic_theme.transparent = new_blur;
|
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;
|
use iced_winit::platform_specific::commands::corner_radius::corner_radius;
|
||||||
|
|
||||||
|
|
@ -1193,7 +1193,7 @@ impl<T: Application> Cosmic<T> {
|
||||||
// Unminimize window before requesting to activate it.
|
// Unminimize window before requesting to activate it.
|
||||||
let mut task = iced_runtime::window::minimize(id, false);
|
let mut task = iced_runtime::window::minimize(id, false);
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
{
|
{
|
||||||
task = task.chain(
|
task = task.chain(
|
||||||
iced_winit::platform_specific::commands::activation::activate(
|
iced_winit::platform_specific::commands::activation::activate(
|
||||||
|
|
@ -1204,7 +1204,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));
|
task = task.chain(iced_runtime::window::gain_focus(id));
|
||||||
}
|
}
|
||||||
|
|
@ -1301,7 +1301,7 @@ impl<T: Application> Cosmic<T> {
|
||||||
// Only apply update if the theme is set to load a system theme
|
// Only apply update if the theme is set to load a system theme
|
||||||
if let ThemeType::System { theme: _, .. } = cosmic_theme.theme_type {
|
if let ThemeType::System { theme: _, .. } = cosmic_theme.theme_type {
|
||||||
let mut cmds = Vec::with_capacity(1);
|
let mut cmds = Vec::with_capacity(1);
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
{
|
{
|
||||||
let blur = if cosmic_theme.transparent {
|
let blur = if cosmic_theme.transparent {
|
||||||
iced::window::enable_blur
|
iced::window::enable_blur
|
||||||
|
|
@ -1378,12 +1378,7 @@ impl<T: Application> Cosmic<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Action::Focus(f) => {
|
Action::Focus(f) => {
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "wayland",
|
|
||||||
feature = "multi-window",
|
|
||||||
feature = "surface-message",
|
|
||||||
target_os = "linux"
|
|
||||||
))]
|
|
||||||
if let Some((
|
if let Some((
|
||||||
parent,
|
parent,
|
||||||
SurfaceIdWrapper::Subsurface(_) | SurfaceIdWrapper::Popup(_),
|
SurfaceIdWrapper::Subsurface(_) | SurfaceIdWrapper::Popup(_),
|
||||||
|
|
@ -1428,7 +1423,7 @@ impl<T: Application> Cosmic<T> {
|
||||||
core.applet.suggested_bounds = b;
|
core.applet.suggested_bounds = b;
|
||||||
}
|
}
|
||||||
Action::Opened(id) => {
|
Action::Opened(id) => {
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
{
|
{
|
||||||
use iced_winit::platform_specific::commands::corner_radius::corner_radius;
|
use iced_winit::platform_specific::commands::corner_radius::corner_radius;
|
||||||
|
|
||||||
|
|
@ -1511,7 +1506,7 @@ impl<T: Application> Cosmic<T> {
|
||||||
}
|
}
|
||||||
return iced_runtime::window::run_with_handle(id, init_windowing_system);
|
return iced_runtime::window::run_with_handle(id, init_windowing_system);
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
Action::BlurEnabled => {
|
Action::BlurEnabled => {
|
||||||
// TODO do this after blur event confirms support instead of for all wayland windows
|
// TODO do this after blur event confirms support instead of for all wayland windows
|
||||||
self.blur_enabled = true;
|
self.blur_enabled = true;
|
||||||
|
|
@ -1591,7 +1586,7 @@ impl<App: Application> Cosmic<App> {
|
||||||
if matches!(id_wrapper, SurfaceIdWrapper::Window(_)) {
|
if matches!(id_wrapper, SurfaceIdWrapper::Window(_)) {
|
||||||
window::enable_blur(id)
|
window::enable_blur(id)
|
||||||
} else {
|
} else {
|
||||||
#[cfg(all(feature = "wayland", feature = "winit", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
{
|
{
|
||||||
iced_winit::commands::blur::blur(
|
iced_winit::commands::blur::blur(
|
||||||
id,
|
id,
|
||||||
|
|
@ -1602,7 +1597,7 @@ impl<App: Application> Cosmic<App> {
|
||||||
)
|
)
|
||||||
.discard()
|
.discard()
|
||||||
}
|
}
|
||||||
#[cfg(not(all(feature = "wayland", feature = "winit", target_os = "linux")))]
|
#[cfg(not(wayland_platform))]
|
||||||
{
|
{
|
||||||
iced::window::enable_blur(id)
|
iced::window::enable_blur(id)
|
||||||
}
|
}
|
||||||
|
|
@ -1610,11 +1605,11 @@ impl<App: Application> Cosmic<App> {
|
||||||
} else if matches!(id_wrapper, SurfaceIdWrapper::Window(_)) {
|
} else if matches!(id_wrapper, SurfaceIdWrapper::Window(_)) {
|
||||||
window::disable_blur(id)
|
window::disable_blur(id)
|
||||||
} else {
|
} else {
|
||||||
#[cfg(all(feature = "wayland", feature = "winit", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
{
|
{
|
||||||
iced_winit::commands::blur::blur(id, None).discard()
|
iced_winit::commands::blur::blur(id, None).discard()
|
||||||
}
|
}
|
||||||
#[cfg(not(all(feature = "wayland", feature = "winit", target_os = "linux")))]
|
#[cfg(not(wayland_platform))]
|
||||||
{
|
{
|
||||||
iced::window::disable_blur(id)
|
iced::window::disable_blur(id)
|
||||||
}
|
}
|
||||||
|
|
@ -1624,7 +1619,7 @@ impl<App: Application> Cosmic<App> {
|
||||||
cmds.push(if matches!(id_wrapper, SurfaceIdWrapper::Window(_)) {
|
cmds.push(if matches!(id_wrapper, SurfaceIdWrapper::Window(_)) {
|
||||||
window::enable_blur(id)
|
window::enable_blur(id)
|
||||||
} else {
|
} else {
|
||||||
#[cfg(all(feature = "wayland", feature = "winit", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
{
|
{
|
||||||
iced_winit::commands::blur::blur(
|
iced_winit::commands::blur::blur(
|
||||||
id,
|
id,
|
||||||
|
|
@ -1635,13 +1630,13 @@ impl<App: Application> Cosmic<App> {
|
||||||
)
|
)
|
||||||
.discard()
|
.discard()
|
||||||
}
|
}
|
||||||
#[cfg(not(all(feature = "wayland", feature = "winit", target_os = "linux")))]
|
#[cfg(not(wayland_platform))]
|
||||||
{
|
{
|
||||||
iced::window::enable_blur(id)
|
iced::window::enable_blur(id)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", feature = "winit", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
if let Some(corners) = live_settings.corners {
|
if let Some(corners) = live_settings.corners {
|
||||||
cmds.push(
|
cmds.push(
|
||||||
iced_winit::commands::corner_radius::corner_radius(id, Some(corners)).discard(),
|
iced_winit::commands::corner_radius::corner_radius(id, Some(corners)).discard(),
|
||||||
|
|
@ -1657,7 +1652,7 @@ impl<App: Application> Cosmic<App> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", feature = "winit", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
if let (SurfaceIdWrapper::LayerSurface(id), Some(padding)) =
|
if let (SurfaceIdWrapper::LayerSurface(id), Some(padding)) =
|
||||||
(id_wrapper, live_settings.padding)
|
(id_wrapper, live_settings.padding)
|
||||||
{
|
{
|
||||||
|
|
@ -1668,7 +1663,7 @@ impl<App: Application> Cosmic<App> {
|
||||||
Task::batch(cmds)
|
Task::batch(cmds)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
/// Create a subsurface
|
/// Create a subsurface
|
||||||
pub fn get_subsurface(
|
pub fn get_subsurface(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
@ -1700,7 +1695,7 @@ impl<App: Application> Cosmic<App> {
|
||||||
Task::batch([live_settings_task, get_subsurface(settings)])
|
Task::batch([live_settings_task, get_subsurface(settings)])
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
/// Create a subsurface
|
/// Create a subsurface
|
||||||
pub fn get_popup(
|
pub fn get_popup(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
@ -1728,7 +1723,7 @@ impl<App: Application> Cosmic<App> {
|
||||||
live_settings_task.chain(get_popup(settings)).discard()
|
live_settings_task.chain(get_popup(settings)).discard()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
/// Create a window surface
|
/// Create a window surface
|
||||||
pub fn get_window(
|
pub fn get_window(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
@ -1765,7 +1760,7 @@ impl<App: Application> Cosmic<App> {
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
pub fn get_layer_shell(
|
pub fn get_layer_shell(
|
||||||
&mut self,
|
&mut self,
|
||||||
settings: iced_runtime::platform_specific::wayland::layer_surface::SctkLayerSurfaceSettings,
|
settings: iced_runtime::platform_specific::wayland::layer_surface::SctkLayerSurfaceSettings,
|
||||||
|
|
@ -1794,7 +1789,7 @@ impl<App: Application> Cosmic<App> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
fn corners(
|
fn corners(
|
||||||
surface_type: SurfaceIdWrapper,
|
surface_type: SurfaceIdWrapper,
|
||||||
rounded: bool,
|
rounded: bool,
|
||||||
|
|
|
||||||
|
|
@ -390,13 +390,7 @@ where
|
||||||
crate::widget::nav_bar(nav_model, |id| crate::Action::Cosmic(Action::NavBar(id)))
|
crate::widget::nav_bar(nav_model, |id| crate::Action::Cosmic(Action::NavBar(id)))
|
||||||
.on_context(|id| crate::Action::Cosmic(Action::NavBarContext(id)))
|
.on_context(|id| crate::Action::Cosmic(Action::NavBarContext(id)))
|
||||||
.context_menu(self.nav_context_menu());
|
.context_menu(self.nav_context_menu());
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
{
|
{
|
||||||
nav = nav
|
nav = nav
|
||||||
.window_id_maybe(self.core().main_window_id())
|
.window_id_maybe(self.core().main_window_id())
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ pub struct Settings {
|
||||||
pub(crate) antialiasing: bool,
|
pub(crate) antialiasing: bool,
|
||||||
|
|
||||||
/// Autosize the window to fit its contents
|
/// Autosize the window to fit its contents
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
pub(crate) autosize: bool,
|
pub(crate) autosize: bool,
|
||||||
|
|
||||||
/// Set the application to not create a main window
|
/// Set the application to not create a main window
|
||||||
|
|
@ -80,7 +80,7 @@ impl Default for Settings {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
antialiasing: true,
|
antialiasing: true,
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
autosize: false,
|
autosize: false,
|
||||||
no_main_window: false,
|
no_main_window: false,
|
||||||
client_decorations: true,
|
client_decorations: true,
|
||||||
|
|
|
||||||
|
|
@ -521,7 +521,7 @@ impl Core {
|
||||||
crate::command::toggle_maximize(id)
|
crate::command::toggle_maximize(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
pub fn sync_window_border_radii_to_theme(&self) -> bool {
|
pub fn sync_window_border_radii_to_theme(&self) -> bool {
|
||||||
match self.app_type {
|
match self.app_type {
|
||||||
AppType::Window => self.auto_corner_radius.contains(Auto::Window),
|
AppType::Window => self.auto_corner_radius.contains(Auto::Window),
|
||||||
|
|
@ -591,7 +591,7 @@ impl Core {
|
||||||
|
|
||||||
/// Calculate suggested corners for each app type main window
|
/// Calculate suggested corners for each app type main window
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
pub fn corners(
|
pub fn corners(
|
||||||
&self,
|
&self,
|
||||||
theme: &Theme,
|
theme: &Theme,
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ pub(crate) mod malloc;
|
||||||
pub mod process;
|
pub mod process;
|
||||||
|
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
pub use cctk;
|
pub use cctk;
|
||||||
|
|
||||||
pub mod surface;
|
pub mod surface;
|
||||||
|
|
|
||||||
|
|
@ -6,33 +6,33 @@ use super::Action;
|
||||||
use crate::Application;
|
use crate::Application;
|
||||||
|
|
||||||
use iced::{Rectangle, window};
|
use iced::{Rectangle, window};
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(all(wayland_platform, feature = "winit"))]
|
||||||
use iced_runtime::platform_specific::wayland::CornerRadius;
|
use iced_runtime::platform_specific::wayland::CornerRadius;
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
use iced_runtime::platform_specific::wayland::layer_surface::IcedMargin;
|
use iced_runtime::platform_specific::wayland::layer_surface::IcedMargin;
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
/// Used to produce a destroy popup message from within a widget.
|
/// Used to produce a destroy popup message from within a widget.
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn destroy_popup(id: iced_core::window::Id) -> Action {
|
pub fn destroy_popup(id: iced_core::window::Id) -> Action {
|
||||||
Action::DestroyPopup(id)
|
Action::DestroyPopup(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn destroy_subsurface(id: iced_core::window::Id) -> Action {
|
pub fn destroy_subsurface(id: iced_core::window::Id) -> Action {
|
||||||
Action::DestroySubsurface(id)
|
Action::DestroySubsurface(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn destroy_window(id: iced_core::window::Id) -> Action {
|
pub fn destroy_window(id: iced_core::window::Id) -> Action {
|
||||||
Action::DestroyWindow(id)
|
Action::DestroyWindow(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn destroy_layer_shell(id: iced_core::window::Id) -> Action {
|
pub fn destroy_layer_shell(id: iced_core::window::Id) -> Action {
|
||||||
Action::DestroyLayerShell(id)
|
Action::DestroyLayerShell(id)
|
||||||
|
|
@ -40,17 +40,17 @@ pub fn destroy_layer_shell(id: iced_core::window::Id) -> Action {
|
||||||
|
|
||||||
#[derive(Debug, Default, Copy, Clone)]
|
#[derive(Debug, Default, Copy, Clone)]
|
||||||
pub struct LiveSettings {
|
pub struct LiveSettings {
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
/// Override the surface padding value for the surface type.
|
/// Override the surface padding value for the surface type.
|
||||||
pub padding: Option<IcedMargin>,
|
pub padding: Option<IcedMargin>,
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
/// Override the default corner radius value for the surface type.
|
/// Override the default corner radius value for the surface type.
|
||||||
pub corners: Option<CornerRadius>,
|
pub corners: Option<CornerRadius>,
|
||||||
/// Override the default blur setting for the surface type.
|
/// Override the default blur setting for the surface type.
|
||||||
pub blur: Option<bool>,
|
pub blur: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
type BoxedView<App> = Option<
|
type BoxedView<App> = Option<
|
||||||
Box<
|
Box<
|
||||||
dyn Fn(&App) -> crate::Element<'_, crate::Action<<App as Application>::Message>>
|
dyn Fn(&App) -> crate::Element<'_, crate::Action<<App as Application>::Message>>
|
||||||
|
|
@ -60,7 +60,7 @@ type BoxedView<App> = Option<
|
||||||
>,
|
>,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn app_window<App: Application>(
|
pub fn app_window<App: Application>(
|
||||||
live_settings: impl Fn(&App) -> LiveSettings + Send + Sync + 'static,
|
live_settings: impl Fn(&App) -> LiveSettings + Send + Sync + 'static,
|
||||||
|
|
@ -92,7 +92,7 @@ pub fn app_window<App: Application>(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used to create a window message from within a widget.
|
/// Used to create a window message from within a widget.
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn simple_window<Message: 'static>(
|
pub fn simple_window<Message: 'static>(
|
||||||
live_settings: impl Fn() -> LiveSettings + Send + Sync + 'static,
|
live_settings: impl Fn() -> LiveSettings + Send + Sync + 'static,
|
||||||
|
|
@ -129,7 +129,7 @@ pub fn simple_window<Message: 'static>(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn app_popup<App: Application>(
|
pub fn app_popup<App: Application>(
|
||||||
live_settings: impl Fn(&App) -> LiveSettings + Send + Sync + 'static,
|
live_settings: impl Fn(&App) -> LiveSettings + Send + Sync + 'static,
|
||||||
|
|
@ -162,7 +162,7 @@ pub fn app_popup<App: Application>(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used to create a subsurface message from within a widget.
|
/// Used to create a subsurface message from within a widget.
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn simple_subsurface<Message: 'static>(
|
pub fn simple_subsurface<Message: 'static>(
|
||||||
settings: impl Fn() -> iced_runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings
|
settings: impl Fn() -> iced_runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings
|
||||||
|
|
@ -192,7 +192,7 @@ pub fn simple_subsurface<Message: 'static>(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used to create a popup message from within a widget.
|
/// Used to create a popup message from within a widget.
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn simple_popup<Message: 'static>(
|
pub fn simple_popup<Message: 'static>(
|
||||||
live_settings: impl Fn() -> LiveSettings + Send + Sync + 'static,
|
live_settings: impl Fn() -> LiveSettings + Send + Sync + 'static,
|
||||||
|
|
@ -228,7 +228,7 @@ pub fn simple_popup<Message: 'static>(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn subsurface<App: Application>(
|
pub fn subsurface<App: Application>(
|
||||||
settings: impl Fn(
|
settings: impl Fn(
|
||||||
|
|
@ -262,7 +262,7 @@ pub fn subsurface<App: Application>(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn simple_layer_shell<Message: 'static>(
|
pub fn simple_layer_shell<Message: 'static>(
|
||||||
live_settings: impl Fn() -> LiveSettings + Send + Sync + 'static,
|
live_settings: impl Fn() -> LiveSettings + Send + Sync + 'static,
|
||||||
|
|
@ -298,7 +298,7 @@ pub fn simple_layer_shell<Message: 'static>(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn app_layer_shell<App: Application>(
|
pub fn app_layer_shell<App: Application>(
|
||||||
live_settings: impl Fn(&App) -> LiveSettings + Send + Sync + 'static,
|
live_settings: impl Fn(&App) -> LiveSettings + Send + Sync + 'static,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
pub mod action;
|
pub mod action;
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
pub mod corner_radius;
|
pub mod corner_radius;
|
||||||
|
|
||||||
use iced::{Limits, Size, Task};
|
use iced::{Limits, Size, Task};
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ mod text_input;
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use self::text_input::TextInput;
|
pub use self::text_input::TextInput;
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
pub mod tooltip;
|
pub mod tooltip;
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
pub use tooltip::Tooltip;
|
pub use tooltip::Tooltip;
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ where
|
||||||
shell: &mut Shell<'_, Message>,
|
shell: &mut Shell<'_, Message>,
|
||||||
viewport: &Rectangle,
|
viewport: &Rectangle,
|
||||||
) {
|
) {
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
if matches!(
|
if matches!(
|
||||||
event,
|
event,
|
||||||
Event::PlatformSpecific(event::PlatformSpecific::Wayland(
|
Event::PlatformSpecific(event::PlatformSpecific::Wayland(
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,7 @@
|
||||||
|
|
||||||
//! A context menu is a menu in a graphical user interface that appears upon user interaction, such as a right-click mouse operation.
|
//! A context menu is a menu in a graphical user interface that appears upon user interaction, such as a right-click mouse operation.
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
|
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
|
||||||
use crate::widget::menu::{
|
use crate::widget::menu::{
|
||||||
self, CloseCondition, Direction, ItemHeight, ItemWidth, MenuBarState, PathHighlight,
|
self, CloseCondition, Direction, ItemHeight, ItemWidth, MenuBarState, PathHighlight,
|
||||||
|
|
@ -64,12 +59,7 @@ pub struct ContextMenu<'a, Message> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Message: Clone + 'static> ContextMenu<'_, Message> {
|
impl<Message: Clone + 'static> ContextMenu<'_, Message> {
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
fn create_popup(
|
fn create_popup(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
@ -391,12 +381,7 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
||||||
state.active_root.clear();
|
state.active_root.clear();
|
||||||
state.open = false;
|
state.open = false;
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
||||||
&& let Some(id) = state.popup_id.remove(&self.window_id)
|
&& let Some(id) = state.popup_id.remove(&self.window_id)
|
||||||
{
|
{
|
||||||
|
|
@ -435,12 +420,7 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
||||||
state.open = true;
|
state.open = true;
|
||||||
state.view_cursor = cursor;
|
state.view_cursor = cursor;
|
||||||
});
|
});
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
|
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
|
||||||
self.create_popup(layout, cursor, renderer, shell, viewport, state);
|
self.create_popup(layout, cursor, renderer, shell, viewport, state);
|
||||||
}
|
}
|
||||||
|
|
@ -457,12 +437,7 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
||||||
state.active_root.clear();
|
state.active_root.clear();
|
||||||
state.open = false;
|
state.open = false;
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
||||||
&& let Some(id) = state.popup_id.remove(&self.window_id)
|
&& let Some(id) = state.popup_id.remove(&self.window_id)
|
||||||
{
|
{
|
||||||
|
|
@ -496,12 +471,7 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
||||||
_viewport: &iced::Rectangle,
|
_viewport: &iced::Rectangle,
|
||||||
translation: Vector,
|
translation: Vector,
|
||||||
) -> Option<iced_core::overlay::Element<'b, Message, crate::Theme, crate::Renderer>> {
|
) -> Option<iced_core::overlay::Element<'b, Message, crate::Theme, crate::Renderer>> {
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
||||||
&& self.window_id != window::Id::NONE
|
&& self.window_id != window::Id::NONE
|
||||||
&& self.on_surface_action.is_some()
|
&& self.on_surface_action.is_some()
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ pub fn popup_dropdown<
|
||||||
let dropdown: Dropdown<'_, S, Message, AppMessage> =
|
let dropdown: Dropdown<'_, S, Message, AppMessage> =
|
||||||
Dropdown::new(selections.into(), selected, on_selected);
|
Dropdown::new(selections.into(), selected, on_selected);
|
||||||
|
|
||||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
let dropdown = dropdown.with_popup(_parent_id, _on_surface_action, _map_action);
|
let dropdown = dropdown.with_popup(_parent_id, _on_surface_action, _map_action);
|
||||||
|
|
||||||
dropdown
|
dropdown
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ where
|
||||||
action_map: Option<Arc<dyn Fn(Message) -> AppMessage + 'static + Send + Sync>>,
|
action_map: Option<Arc<dyn Fn(Message) -> AppMessage + 'static + Send + Sync>>,
|
||||||
#[setters(strip_option)]
|
#[setters(strip_option)]
|
||||||
window_id: Option<window::Id>,
|
window_id: Option<window::Id>,
|
||||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,14 +96,14 @@ where
|
||||||
text_line_height: text::LineHeight::Relative(1.2),
|
text_line_height: text::LineHeight::Relative(1.2),
|
||||||
font: None,
|
font: None,
|
||||||
window_id: None,
|
window_id: None,
|
||||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner::default(),
|
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner::default(),
|
||||||
on_surface_action: None,
|
on_surface_action: None,
|
||||||
action_map: None,
|
action_map: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
/// Handle dropdown requests for popup creation.
|
/// Handle dropdown requests for popup creation.
|
||||||
/// Intended to be used with [`crate::app::message::get_popup`]
|
/// Intended to be used with [`crate::app::message::get_popup`]
|
||||||
pub fn with_popup<NewAppMessage>(
|
pub fn with_popup<NewAppMessage>(
|
||||||
|
|
@ -154,7 +154,7 @@ where
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
pub fn with_positioner(
|
pub fn with_positioner(
|
||||||
mut self,
|
mut self,
|
||||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
||||||
|
|
@ -268,7 +268,7 @@ where
|
||||||
layout,
|
layout,
|
||||||
cursor,
|
cursor,
|
||||||
shell,
|
shell,
|
||||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
self.positioner.clone(),
|
self.positioner.clone(),
|
||||||
self.on_selected.clone(),
|
self.on_selected.clone(),
|
||||||
self.selected,
|
self.selected,
|
||||||
|
|
@ -346,7 +346,7 @@ where
|
||||||
viewport: &Rectangle,
|
viewport: &Rectangle,
|
||||||
translation: Vector,
|
translation: Vector,
|
||||||
) -> Option<overlay::Element<'b, Message, crate::Theme, crate::Renderer>> {
|
) -> Option<overlay::Element<'b, Message, crate::Theme, crate::Renderer>> {
|
||||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
if self.window_id.is_some() || self.on_surface_action.is_some() {
|
if self.window_id.is_some() || self.on_surface_action.is_some() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +545,7 @@ pub fn update<
|
||||||
layout: Layout<'_>,
|
layout: Layout<'_>,
|
||||||
cursor: mouse::Cursor,
|
cursor: mouse::Cursor,
|
||||||
shell: &mut Shell<'_, Message>,
|
shell: &mut Shell<'_, Message>,
|
||||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
||||||
on_selected: Arc<dyn Fn(usize) -> Message + Send + Sync + 'static>,
|
on_selected: Arc<dyn Fn(usize) -> Message + Send + Sync + 'static>,
|
||||||
selected: Option<usize>,
|
selected: Option<usize>,
|
||||||
|
|
@ -571,7 +571,7 @@ pub fn update<
|
||||||
*hovered_guard = selected;
|
*hovered_guard = selected;
|
||||||
let id = window::Id::unique();
|
let id = window::Id::unique();
|
||||||
state.popup_id = id;
|
state.popup_id = id;
|
||||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
if let Some(((on_surface_action, parent), action_map)) = on_surface_action
|
if let Some(((on_surface_action, parent), action_map)) = on_surface_action
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.zip(_window_id)
|
.zip(_window_id)
|
||||||
|
|
@ -661,7 +661,7 @@ pub fn update<
|
||||||
state.close_operation = false;
|
state.close_operation = false;
|
||||||
state.is_open.store(false, Ordering::SeqCst);
|
state.is_open.store(false, Ordering::SeqCst);
|
||||||
if is_open {
|
if is_open {
|
||||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
if let Some(ref on_close) = on_surface_action {
|
if let Some(ref on_close) = on_surface_action {
|
||||||
shell.publish(on_close(surface::action::destroy_popup(state.popup_id)));
|
shell.publish(on_close(surface::action::destroy_popup(state.popup_id)));
|
||||||
}
|
}
|
||||||
|
|
@ -684,7 +684,7 @@ pub fn update<
|
||||||
// Event wasn't processed by overlay, so cursor was clicked either outside it's
|
// Event wasn't processed by overlay, so cursor was clicked either outside it's
|
||||||
// bounds or on the drop-down, either way we close the overlay.
|
// bounds or on the drop-down, either way we close the overlay.
|
||||||
state.is_open.store(false, Ordering::Relaxed);
|
state.is_open.store(false, Ordering::Relaxed);
|
||||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
if let Some(on_close) = on_surface_action {
|
if let Some(on_close) = on_surface_action {
|
||||||
shell.publish(on_close(surface::action::destroy_popup(state.popup_id)));
|
shell.publish(on_close(surface::action::destroy_popup(state.popup_id)));
|
||||||
}
|
}
|
||||||
|
|
@ -729,7 +729,7 @@ pub fn mouse_interaction(layout: Layout<'_>, cursor: mouse::Cursor) -> mouse::In
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
/// Returns the current menu widget of a [`Dropdown`].
|
/// Returns the current menu widget of a [`Dropdown`].
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn menu_widget<
|
pub fn menu_widget<
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,7 @@ use super::menu_inner::{
|
||||||
};
|
};
|
||||||
use super::menu_tree::MenuTree;
|
use super::menu_tree::MenuTree;
|
||||||
use crate::Renderer;
|
use crate::Renderer;
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
|
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
|
||||||
use crate::style::menu_bar::StyleSheet;
|
use crate::style::menu_bar::StyleSheet;
|
||||||
use crate::widget::RcWrapper;
|
use crate::widget::RcWrapper;
|
||||||
|
|
@ -191,12 +185,7 @@ pub struct MenuBar<Message> {
|
||||||
menu_roots: Vec<MenuTree<Message>>,
|
menu_roots: Vec<MenuTree<Message>>,
|
||||||
style: <crate::Theme as StyleSheet>::Style,
|
style: <crate::Theme as StyleSheet>::Style,
|
||||||
window_id: window::Id,
|
window_id: window::Id,
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
feature = "winit",
|
|
||||||
target_os = "linux"
|
|
||||||
))]
|
|
||||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
||||||
pub(crate) on_surface_action:
|
pub(crate) on_surface_action:
|
||||||
Option<Arc<dyn Fn(crate::surface::Action) -> Message + Send + Sync + 'static>>,
|
Option<Arc<dyn Fn(crate::surface::Action) -> Message + Send + Sync + 'static>>,
|
||||||
|
|
@ -231,12 +220,7 @@ where
|
||||||
menu_roots,
|
menu_roots,
|
||||||
style: <crate::Theme as StyleSheet>::Style::default(),
|
style: <crate::Theme as StyleSheet>::Style::default(),
|
||||||
window_id: window::Id::RESERVED,
|
window_id: window::Id::RESERVED,
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
feature = "winit",
|
|
||||||
target_os = "linux"
|
|
||||||
))]
|
|
||||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner::default(),
|
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner::default(),
|
||||||
on_surface_action: None,
|
on_surface_action: None,
|
||||||
}
|
}
|
||||||
|
|
@ -330,12 +314,7 @@ where
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
feature = "winit",
|
|
||||||
target_os = "linux"
|
|
||||||
))]
|
|
||||||
pub fn with_positioner(
|
pub fn with_positioner(
|
||||||
mut self,
|
mut self,
|
||||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
||||||
|
|
@ -367,13 +346,7 @@ where
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
fn create_popup(
|
fn create_popup(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
@ -657,12 +630,7 @@ where
|
||||||
state.menu_states.clear();
|
state.menu_states.clear();
|
||||||
state.active_root.clear();
|
state.active_root.clear();
|
||||||
state.open = false;
|
state.open = false;
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
{
|
{
|
||||||
let surface_action = self.on_surface_action.as_ref().unwrap();
|
let surface_action = self.on_surface_action.as_ref().unwrap();
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
|
|
@ -680,13 +648,7 @@ where
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
|
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
|
||||||
self.create_popup(layout, view_cursor, renderer, shell, viewport, my_state);
|
self.create_popup(layout, view_cursor, renderer, shell, viewport, my_state);
|
||||||
}
|
}
|
||||||
|
|
@ -695,13 +657,7 @@ where
|
||||||
if open && view_cursor.is_over(layout.bounds()) =>
|
if open && view_cursor.is_over(layout.bounds()) =>
|
||||||
{
|
{
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
|
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
|
||||||
self.create_popup(layout, view_cursor, renderer, shell, viewport, my_state);
|
self.create_popup(layout, view_cursor, renderer, shell, viewport, my_state);
|
||||||
}
|
}
|
||||||
|
|
@ -732,13 +688,7 @@ where
|
||||||
// draw path highlight
|
// draw path highlight
|
||||||
if self.path_highlight.is_some() {
|
if self.path_highlight.is_some() {
|
||||||
let mut is_overlay = true;
|
let mut is_overlay = true;
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
||||||
&& self.on_surface_action.is_some()
|
&& self.on_surface_action.is_some()
|
||||||
&& self.window_id != window::Id::NONE
|
&& self.window_id != window::Id::NONE
|
||||||
|
|
@ -792,13 +742,7 @@ where
|
||||||
viewport: &Rectangle,
|
viewport: &Rectangle,
|
||||||
translation: Vector,
|
translation: Vector,
|
||||||
) -> Option<overlay::Element<'b, Message, crate::Theme, Renderer>> {
|
) -> Option<overlay::Element<'b, Message, crate::Theme, Renderer>> {
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
||||||
&& self.on_surface_action.is_some()
|
&& self.on_surface_action.is_some()
|
||||||
&& self.window_id != window::Id::NONE
|
&& self.window_id != window::Id::NONE
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,7 @@ use std::sync::Arc;
|
||||||
|
|
||||||
use super::menu_bar::MenuBarState;
|
use super::menu_bar::MenuBarState;
|
||||||
use super::menu_tree::MenuTree;
|
use super::menu_tree::MenuTree;
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
|
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
|
||||||
use crate::style::menu_bar::StyleSheet;
|
use crate::style::menu_bar::StyleSheet;
|
||||||
|
|
||||||
|
|
@ -677,13 +671,7 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> {
|
||||||
needs_reset |= self.close_condition.click_outside && !is_inside;
|
needs_reset |= self.close_condition.click_outside && !is_inside;
|
||||||
|
|
||||||
if needs_reset {
|
if needs_reset {
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
||||||
&& let Some(handler) = self.on_surface_action.as_ref()
|
&& let Some(handler) = self.on_surface_action.as_ref()
|
||||||
{
|
{
|
||||||
|
|
@ -990,13 +978,7 @@ impl<Message: std::clone::Clone + 'static> Widget<Message, crate::Theme, crate::
|
||||||
) {
|
) {
|
||||||
let new_root = self.update(event, layout, cursor, renderer, clipboard, shell);
|
let new_root = self.update(event, layout, cursor, renderer, clipboard, shell);
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message",
|
|
||||||
target_os = "linux"
|
|
||||||
))]
|
|
||||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
||||||
&& let Some((new_root, new_ms)) = new_root
|
&& let Some((new_root, new_ms)) = new_root
|
||||||
{
|
{
|
||||||
|
|
@ -1271,13 +1253,7 @@ pub(crate) fn init_root_menu<Message: Clone>(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
pub(super) fn init_root_popup_menu<Message>(
|
pub(super) fn init_root_popup_menu<Message>(
|
||||||
menu: &mut Menu<'_, Message>,
|
menu: &mut Menu<'_, Message>,
|
||||||
renderer: &crate::Renderer,
|
renderer: &crate::Renderer,
|
||||||
|
|
@ -1572,7 +1548,7 @@ where
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.is_some_and(|i| *i != new_index && !active_menu[*i].children.is_empty());
|
.is_some_and(|i| *i != new_index && !active_menu[*i].children.is_empty());
|
||||||
|
|
||||||
#[cfg(all(feature = "multi-window", feature = "wayland",target_os = "linux", feature = "winit", feature = "surface-message"))]
|
#[cfg(wayland_platform)]
|
||||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) && remove {
|
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) && remove {
|
||||||
if let Some(id) = state.popup_id.remove(&menu.window_id) {
|
if let Some(id) = state.popup_id.remove(&menu.window_id) {
|
||||||
state.active_root.truncate(menu.depth + 1);
|
state.active_root.truncate(menu.depth + 1);
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,7 @@ pub use toggler::{Toggler, toggler};
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use tooltip::{Tooltip, tooltip};
|
pub use tooltip::{Tooltip, tooltip};
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
pub mod wayland;
|
pub mod wayland;
|
||||||
|
|
||||||
pub mod tooltip {
|
pub mod tooltip {
|
||||||
|
|
|
||||||
|
|
@ -134,12 +134,7 @@ impl<'a, Message: Clone + 'static> NavBar<'a, Message> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
feature = "winit",
|
|
||||||
target_os = "linux"
|
|
||||||
))]
|
|
||||||
pub fn with_positioner(
|
pub fn with_positioner(
|
||||||
mut self,
|
mut self,
|
||||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ impl Default for ResponsiveMenuBar {
|
||||||
fn default() -> ResponsiveMenuBar {
|
fn default() -> ResponsiveMenuBar {
|
||||||
ResponsiveMenuBar {
|
ResponsiveMenuBar {
|
||||||
collapsed_item_width: {
|
collapsed_item_width: {
|
||||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
if matches!(
|
if matches!(
|
||||||
crate::app::cosmic::WINDOWING_SYSTEM.get(),
|
crate::app::cosmic::WINDOWING_SYSTEM.get(),
|
||||||
Some(crate::app::cosmic::WindowingSystem::Wayland)
|
Some(crate::app::cosmic::WindowingSystem::Wayland)
|
||||||
|
|
@ -32,7 +32,7 @@ impl Default for ResponsiveMenuBar {
|
||||||
} else {
|
} else {
|
||||||
ItemWidth::Static(84)
|
ItemWidth::Static(84)
|
||||||
}
|
}
|
||||||
#[cfg(not(all(feature = "winit", feature = "wayland", target_os = "linux")))]
|
#[cfg(not(wayland_platform))]
|
||||||
{
|
{
|
||||||
ItemWidth::Static(84)
|
ItemWidth::Static(84)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -195,12 +195,7 @@ where
|
||||||
pub(super) on_reorder: Option<Box<dyn Fn(ReorderEvent) -> Message + 'static>>,
|
pub(super) on_reorder: Option<Box<dyn Fn(ReorderEvent) -> Message + 'static>>,
|
||||||
#[setters(skip)]
|
#[setters(skip)]
|
||||||
window_id: window::Id,
|
window_id: window::Id,
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
feature = "winit",
|
|
||||||
target_os = "linux"
|
|
||||||
))]
|
|
||||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
||||||
#[setters(skip)]
|
#[setters(skip)]
|
||||||
pub(crate) on_surface_action:
|
pub(crate) on_surface_action:
|
||||||
|
|
@ -259,12 +254,7 @@ where
|
||||||
on_drop_hint: None,
|
on_drop_hint: None,
|
||||||
on_reorder: None,
|
on_reorder: None,
|
||||||
window_id: window::Id::RESERVED,
|
window_id: window::Id::RESERVED,
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
feature = "winit",
|
|
||||||
target_os = "linux"
|
|
||||||
))]
|
|
||||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner::default(),
|
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner::default(),
|
||||||
on_surface_action: None,
|
on_surface_action: None,
|
||||||
}
|
}
|
||||||
|
|
@ -883,12 +873,7 @@ where
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
feature = "winit",
|
|
||||||
target_os = "linux"
|
|
||||||
))]
|
|
||||||
pub fn with_positioner(
|
pub fn with_positioner(
|
||||||
mut self,
|
mut self,
|
||||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
||||||
|
|
@ -920,13 +905,7 @@ where
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
fn create_popup<'b>(
|
fn create_popup<'b>(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
@ -1084,7 +1063,7 @@ where
|
||||||
let rad = styling.menu_border_radius;
|
let rad = styling.menu_border_radius;
|
||||||
|
|
||||||
/// Used to create a popup message from within a widget.
|
/// Used to create a popup message from within a widget.
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
#[cfg(wayland_platform)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn simple_popup<Message: 'static>(
|
pub fn simple_popup<Message: 'static>(
|
||||||
live_settings: impl Fn() -> LiveSettings + Send + Sync + 'static,
|
live_settings: impl Fn() -> LiveSettings + Send + Sync + 'static,
|
||||||
|
|
@ -1660,13 +1639,7 @@ where
|
||||||
state.unfocus();
|
state.unfocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
if is_pressed(event)
|
if is_pressed(event)
|
||||||
&& let Some(on_context) = self.on_context.as_ref()
|
&& let Some(on_context) = self.on_context.as_ref()
|
||||||
{
|
{
|
||||||
|
|
@ -1722,13 +1695,7 @@ where
|
||||||
shell.publish(on_context(key));
|
shell.publish(on_context(key));
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
if matches!(
|
if matches!(
|
||||||
crate::app::cosmic::WINDOWING_SYSTEM.get(),
|
crate::app::cosmic::WINDOWING_SYSTEM.get(),
|
||||||
Some(crate::app::cosmic::WindowingSystem::Wayland)
|
Some(crate::app::cosmic::WindowingSystem::Wayland)
|
||||||
|
|
@ -1867,12 +1834,7 @@ where
|
||||||
.inner
|
.inner
|
||||||
.with_data_mut(|ms| ms.popup_id.remove(&self.window_id))
|
.with_data_mut(|ms| ms.popup_id.remove(&self.window_id))
|
||||||
{
|
{
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
{
|
{
|
||||||
let surface_action = self.on_surface_action.as_ref().unwrap();
|
let surface_action = self.on_surface_action.as_ref().unwrap();
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
|
|
@ -2507,13 +2469,7 @@ where
|
||||||
_viewport: &iced_core::Rectangle,
|
_viewport: &iced_core::Rectangle,
|
||||||
translation: Vector,
|
translation: Vector,
|
||||||
) -> Option<iced_core::overlay::Element<'b, Message, crate::Theme, Renderer>> {
|
) -> Option<iced_core::overlay::Element<'b, Message, crate::Theme, Renderer>> {
|
||||||
#[cfg(all(
|
#[cfg(wayland_platform)]
|
||||||
feature = "multi-window",
|
|
||||||
feature = "wayland",
|
|
||||||
target_os = "linux",
|
|
||||||
feature = "winit",
|
|
||||||
feature = "surface-message"
|
|
||||||
))]
|
|
||||||
if matches!(
|
if matches!(
|
||||||
crate::app::cosmic::WINDOWING_SYSTEM.get(),
|
crate::app::cosmic::WINDOWING_SYSTEM.get(),
|
||||||
Some(crate::app::cosmic::WindowingSystem::Wayland)
|
Some(crate::app::cosmic::WindowingSystem::Wayland)
|
||||||
|
|
|
||||||
|
|
@ -525,7 +525,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the start dnd handler of the [`TextInput`].
|
/// Sets the start dnd handler of the [`TextInput`].
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
pub fn on_start_dnd(mut self, on_start_dnd: impl Fn(State) -> Message + 'a) -> Self {
|
pub fn on_start_dnd(mut self, on_start_dnd: impl Fn(State) -> Message + 'a) -> Self {
|
||||||
self.on_create_dnd_source = Some(Box::new(on_start_dnd));
|
self.on_create_dnd_source = Some(Box::new(on_start_dnd));
|
||||||
self
|
self
|
||||||
|
|
@ -1553,7 +1553,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
click.kind(),
|
click.kind(),
|
||||||
state.cursor().state(value),
|
state.cursor().state(value),
|
||||||
) {
|
) {
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
(None, click::Kind::Single, cursor::State::Selection { start, end }) => {
|
(None, click::Kind::Single, cursor::State::Selection { start, end }) => {
|
||||||
let left = start.min(end);
|
let left = start.min(end);
|
||||||
let right = end.max(start);
|
let right = end.max(start);
|
||||||
|
|
@ -1694,7 +1694,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
| Event::Touch(touch::Event::FingerLifted { .. } | touch::Event::FingerLost { .. }) => {
|
| Event::Touch(touch::Event::FingerLifted { .. } | touch::Event::FingerLost { .. }) => {
|
||||||
cold();
|
cold();
|
||||||
let state = state();
|
let state = state();
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
if matches!(state.dragging_state, Some(DraggingState::PrepareDnd(_))) {
|
if matches!(state.dragging_state, Some(DraggingState::PrepareDnd(_))) {
|
||||||
// clear selection and place cursor at click position
|
// clear selection and place cursor at click position
|
||||||
update_cache(state, value);
|
update_cache(state, value);
|
||||||
|
|
@ -1749,7 +1749,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
if let Some(DraggingState::PrepareDnd(start_position)) = state.dragging_state {
|
if let Some(DraggingState::PrepareDnd(start_position)) = state.dragging_state {
|
||||||
let distance = ((position.x - start_position.x).powi(2)
|
let distance = ((position.x - start_position.x).powi(2)
|
||||||
+ (position.y - start_position.y).powi(2))
|
+ (position.y - start_position.y).powi(2))
|
||||||
|
|
@ -2206,7 +2206,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
shell.request_redraw();
|
shell.request_redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
Event::Dnd(DndEvent::Source(SourceEvent::Finished | SourceEvent::Cancelled)) => {
|
Event::Dnd(DndEvent::Source(SourceEvent::Finished | SourceEvent::Cancelled)) => {
|
||||||
cold();
|
cold();
|
||||||
let state = state();
|
let state = state();
|
||||||
|
|
@ -2217,7 +2217,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
Event::Dnd(DndEvent::Offer(
|
Event::Dnd(DndEvent::Offer(
|
||||||
rectangle,
|
rectangle,
|
||||||
OfferEvent::Enter {
|
OfferEvent::Enter {
|
||||||
|
|
@ -2267,7 +2267,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
Event::Dnd(DndEvent::Offer(rectangle, OfferEvent::Motion { x, y }))
|
Event::Dnd(DndEvent::Offer(rectangle, OfferEvent::Motion { x, y }))
|
||||||
if *rectangle == Some(dnd_id) =>
|
if *rectangle == Some(dnd_id) =>
|
||||||
{
|
{
|
||||||
|
|
@ -2295,7 +2295,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
Event::Dnd(DndEvent::Offer(rectangle, OfferEvent::Drop)) if *rectangle == Some(dnd_id) => {
|
Event::Dnd(DndEvent::Offer(rectangle, OfferEvent::Drop)) if *rectangle == Some(dnd_id) => {
|
||||||
cold();
|
cold();
|
||||||
let state = state();
|
let state = state();
|
||||||
|
|
@ -2313,9 +2313,9 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
Event::Dnd(DndEvent::Offer(id, OfferEvent::LeaveDestination)) if Some(dnd_id) != *id => {}
|
Event::Dnd(DndEvent::Offer(id, OfferEvent::LeaveDestination)) if Some(dnd_id) != *id => {}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
Event::Dnd(DndEvent::Offer(
|
Event::Dnd(DndEvent::Offer(
|
||||||
rectangle,
|
rectangle,
|
||||||
OfferEvent::Leave | OfferEvent::LeaveDestination,
|
OfferEvent::Leave | OfferEvent::LeaveDestination,
|
||||||
|
|
@ -2333,7 +2333,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
Event::Dnd(DndEvent::Offer(rectangle, OfferEvent::Data { data, mime_type }))
|
Event::Dnd(DndEvent::Offer(rectangle, OfferEvent::Data { data, mime_type }))
|
||||||
if *rectangle == Some(dnd_id) =>
|
if *rectangle == Some(dnd_id) =>
|
||||||
{
|
{
|
||||||
|
|
@ -2616,9 +2616,9 @@ pub fn draw<'a, Message>(
|
||||||
let actual_width = text_width.max(text_bounds.width);
|
let actual_width = text_width.max(text_bounds.width);
|
||||||
|
|
||||||
let radius_0 = THEME.lock().unwrap().cosmic().corner_radii.radius_0.into();
|
let radius_0 = THEME.lock().unwrap().cosmic().corner_radii.radius_0.into();
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
let handling_dnd_offer = !matches!(state.dnd_offer, DndOfferState::None);
|
let handling_dnd_offer = !matches!(state.dnd_offer, DndOfferState::None);
|
||||||
#[cfg(not(all(feature = "wayland", target_os = "linux")))]
|
#[cfg(not(wayland_platform))]
|
||||||
let handling_dnd_offer = false;
|
let handling_dnd_offer = false;
|
||||||
let (cursors, offset, is_selecting) = if let Some(focus) =
|
let (cursors, offset, is_selecting) = if let Some(focus) =
|
||||||
state.is_focused.filter(|f| f.focused).or_else(|| {
|
state.is_focused.filter(|f| f.focused).or_else(|| {
|
||||||
|
|
@ -2868,7 +2868,7 @@ pub fn mouse_interaction(
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct TextInputString(pub String);
|
pub struct TextInputString(pub String);
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
impl AsMimeTypes for TextInputString {
|
impl AsMimeTypes for TextInputString {
|
||||||
fn available(&self) -> Cow<'static, [String]> {
|
fn available(&self) -> Cow<'static, [String]> {
|
||||||
Cow::Owned(
|
Cow::Owned(
|
||||||
|
|
@ -2892,13 +2892,13 @@ impl AsMimeTypes for TextInputString {
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub(crate) enum DraggingState {
|
pub(crate) enum DraggingState {
|
||||||
Selection,
|
Selection,
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
PrepareDnd(Point),
|
PrepareDnd(Point),
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
Dnd(DndAction, String),
|
Dnd(DndAction, String),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub(crate) enum DndOfferState {
|
pub(crate) enum DndOfferState {
|
||||||
#[default]
|
#[default]
|
||||||
|
|
@ -2907,7 +2907,7 @@ pub(crate) enum DndOfferState {
|
||||||
Dropped,
|
Dropped,
|
||||||
}
|
}
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
#[cfg(not(all(feature = "wayland", target_os = "linux")))]
|
#[cfg(not(wayland_platform))]
|
||||||
pub(crate) struct DndOfferState;
|
pub(crate) struct DndOfferState;
|
||||||
|
|
||||||
/// The state of a [`TextInput`].
|
/// The state of a [`TextInput`].
|
||||||
|
|
@ -2983,7 +2983,7 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(wayland_platform)]
|
||||||
/// Returns the current value of the dragged text in the [`TextInput`].
|
/// Returns the current value of the dragged text in the [`TextInput`].
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn dragged_text(&self) -> Option<String> {
|
pub fn dragged_text(&self) -> Option<String> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue