chore: update features and feature gates
This commit is contained in:
parent
380b341bdc
commit
413e63f62a
18 changed files with 159 additions and 102 deletions
13
Cargo.toml
13
Cargo.toml
|
|
@ -14,7 +14,7 @@ default = [
|
|||
"a11y",
|
||||
"dbus-config",
|
||||
"x11",
|
||||
"wayland",
|
||||
"iced-wayland",
|
||||
"multi-window",
|
||||
] # default = ["dbus-config", "multi-window", "a11y"]
|
||||
# Accessibility support
|
||||
|
|
@ -80,15 +80,20 @@ tokio = [
|
|||
]
|
||||
# Tokio async runtime
|
||||
# Wayland window support
|
||||
wayland = [
|
||||
iced-wayland = [
|
||||
"ashpd?/wayland",
|
||||
"autosize",
|
||||
"iced_runtime/wayland",
|
||||
"iced/wayland",
|
||||
"iced_winit/wayland",
|
||||
"cctk",
|
||||
"surface-message",
|
||||
]
|
||||
wayland = [
|
||||
"iced-wayland",
|
||||
"iced_runtime/cctk",
|
||||
"iced_winit/cctk",
|
||||
"iced/cctk",
|
||||
"dep:cctk",
|
||||
]
|
||||
surface-message = []
|
||||
# multi-window support
|
||||
multi-window = []
|
||||
|
|
|
|||
2
iced
2
iced
|
|
@ -1 +1 @@
|
|||
Subproject commit a11b828280ccded9dd2c5d52fb4c71dc9a999e3d
|
||||
Subproject commit 1fdd24ab995a4d65ba83cc1957e992b57cc37fcd
|
||||
|
|
@ -5,7 +5,7 @@ use crate::surface;
|
|||
use crate::theme::Theme;
|
||||
use crate::widget::nav_bar;
|
||||
use crate::{config::CosmicTk, keyboard_nav};
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
use cctk::sctk::reexports::csd_frame::{WindowManagerCapabilities, WindowState};
|
||||
use cosmic_theme::ThemeMode;
|
||||
|
||||
|
|
@ -69,10 +69,10 @@ pub enum Action {
|
|||
/// Updates the tracked window geometry.
|
||||
WindowResize(iced::window::Id, f32, f32),
|
||||
/// Tracks updates to window state.
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
WindowState(iced::window::Id, WindowState),
|
||||
/// Capabilities the window manager supports
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
WmCapabilities(iced::window::Id, WindowManagerCapabilities),
|
||||
#[cfg(feature = "xdg-portal")]
|
||||
DesktopSettings(crate::theme::portal::Desktop),
|
||||
|
|
|
|||
|
|
@ -8,16 +8,16 @@ use std::sync::Arc;
|
|||
use super::{Action, Application, ApplicationExt, Subscription};
|
||||
use crate::theme::{THEME, Theme, ThemeType};
|
||||
use crate::{Core, Element, keyboard_nav};
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
use cctk::sctk::reexports::csd_frame::{WindowManagerCapabilities, WindowState};
|
||||
use cosmic_theme::ThemeMode;
|
||||
#[cfg(not(any(feature = "multi-window", feature = "wayland")))]
|
||||
#[cfg(not(any(feature = "multi-window", feature = "wayland", target_os = "linux")))]
|
||||
use iced::Application as IcedApplication;
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
use iced::event::wayland;
|
||||
use iced::{Task, theme, window};
|
||||
use iced_futures::event::listen_with;
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
use iced_winit::SurfaceIdWrapper;
|
||||
use palette::color_difference::EuclideanDistance;
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ fn init_windowing_system<M>(handle: window::raw_window_handle::WindowHandle) ->
|
|||
#[derive(Default)]
|
||||
pub struct Cosmic<App: Application> {
|
||||
pub app: App,
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
pub surface_views: HashMap<
|
||||
window::Id,
|
||||
(
|
||||
|
|
@ -138,7 +138,7 @@ where
|
|||
) -> iced::Task<crate::Action<T::Message>> {
|
||||
#[cfg(feature = "surface-message")]
|
||||
match _surface_message {
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
crate::surface::Action::AppSubsurface(settings, view) => {
|
||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||
.ok()
|
||||
|
|
@ -168,7 +168,7 @@ where
|
|||
iced_winit::commands::subsurface::get_subsurface(settings(&mut self.app))
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
crate::surface::Action::Subsurface(settings, view) => {
|
||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||
.ok()
|
||||
|
|
@ -196,7 +196,7 @@ where
|
|||
iced_winit::commands::subsurface::get_subsurface(settings())
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
crate::surface::Action::AppPopup(settings, view) => {
|
||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||
.ok()
|
||||
|
|
@ -225,15 +225,15 @@ where
|
|||
iced_winit::commands::popup::get_popup(settings(&mut self.app))
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
crate::surface::Action::DestroyPopup(id) => {
|
||||
iced_winit::commands::popup::destroy_popup(id)
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
crate::surface::Action::DestroySubsurface(id) => {
|
||||
iced_winit::commands::subsurface::destroy_subsurface(id)
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
crate::surface::Action::DestroyWindow(id) => iced::window::close(id),
|
||||
crate::surface::Action::ResponsiveMenuBar {
|
||||
menu_bar,
|
||||
|
|
@ -244,7 +244,7 @@ where
|
|||
core.menu_bars.insert(menu_bar, (limits, size));
|
||||
iced::Task::none()
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
crate::surface::Action::Popup(settings, view) => {
|
||||
let Some(settings) = std::sync::Arc::try_unwrap(settings)
|
||||
.ok()
|
||||
|
|
@ -271,7 +271,7 @@ where
|
|||
iced_winit::commands::popup::get_popup(settings())
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
crate::surface::Action::AppWindow(id, 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>>()
|
||||
|
|
@ -310,7 +310,7 @@ where
|
|||
.discard()
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
crate::surface::Action::Window(id, 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>>()
|
||||
|
|
@ -430,7 +430,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(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
iced::Event::PlatformSpecific(iced::event::PlatformSpecific::Wayland(event)) => {
|
||||
match event {
|
||||
wayland::Event::Popup(wayland::PopupEvent::Done, _, id)
|
||||
|
|
@ -443,7 +443,7 @@ where
|
|||
) => {
|
||||
return Some(Action::SuggestedBounds(b));
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
wayland::Event::Window(iced::event::wayland::WindowEvent::WindowState(
|
||||
s,
|
||||
)) => {
|
||||
|
|
@ -560,7 +560,7 @@ where
|
|||
|
||||
#[cfg(feature = "multi-window")]
|
||||
pub fn view(&self, id: window::Id) -> Element<'_, crate::Action<T::Message>> {
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
if let Some((_, _, v)) = self.surface_views.get(&id) {
|
||||
return v(&self.app);
|
||||
}
|
||||
|
|
@ -611,7 +611,7 @@ impl<T: Application> Cosmic<T> {
|
|||
fn cosmic_update(&mut self, message: Action) -> iced::Task<crate::Action<T::Message>> {
|
||||
match message {
|
||||
Action::WindowMaximized(id, maximized) => {
|
||||
#[cfg(not(feature = "wayland"))]
|
||||
#[cfg(not(all(feature = "wayland", target_os = "linux")))]
|
||||
if self
|
||||
.app
|
||||
.core()
|
||||
|
|
@ -641,7 +641,7 @@ impl<T: Application> Cosmic<T> {
|
|||
});
|
||||
}
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
Action::WindowState(id, state) => {
|
||||
if self
|
||||
.app
|
||||
|
|
@ -693,7 +693,7 @@ impl<T: Application> Cosmic<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
Action::WmCapabilities(id, capabilities) => {
|
||||
if self
|
||||
.app
|
||||
|
|
@ -800,7 +800,7 @@ impl<T: Application> Cosmic<T> {
|
|||
new_theme.theme_type.prefer_dark(prefer_dark);
|
||||
|
||||
cosmic_theme.set_theme(new_theme.theme_type);
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
if self.app.core().sync_window_border_radii_to_theme() {
|
||||
use iced_runtime::platform_specific::wayland::CornerRadius;
|
||||
use iced_winit::platform_specific::commands::corner_radius::corner_radius;
|
||||
|
|
@ -946,7 +946,7 @@ impl<T: Application> Cosmic<T> {
|
|||
// Only apply update if the theme is set to load a system theme
|
||||
if let ThemeType::System { .. } = cosmic_theme.theme_type {
|
||||
cosmic_theme.set_theme(new_theme.theme_type);
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
if self.app.core().sync_window_border_radii_to_theme() {
|
||||
use iced_runtime::platform_specific::wayland::CornerRadius;
|
||||
use iced_winit::platform_specific::commands::corner_radius::corner_radius;
|
||||
|
|
@ -1040,7 +1040,7 @@ impl<T: Application> Cosmic<T> {
|
|||
// Unminimize window before requesting to activate it.
|
||||
let mut task = iced_runtime::window::minimize(id, false);
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
{
|
||||
task = task.chain(
|
||||
iced_winit::platform_specific::commands::activation::activate(
|
||||
|
|
@ -1051,7 +1051,7 @@ impl<T: Application> Cosmic<T> {
|
|||
)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "wayland"))]
|
||||
#[cfg(not(all(feature = "wayland", target_os = "linux")))]
|
||||
{
|
||||
task = task.chain(iced_runtime::window::gain_focus(id));
|
||||
}
|
||||
|
|
@ -1068,7 +1068,7 @@ impl<T: Application> Cosmic<T> {
|
|||
*v == 0
|
||||
}) {
|
||||
self.opened_surfaces.remove(&id);
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
self.surface_views.remove(&id);
|
||||
self.tracked_windows.remove(&id);
|
||||
}
|
||||
|
|
@ -1190,7 +1190,8 @@ impl<T: Application> Cosmic<T> {
|
|||
#[cfg(all(
|
||||
feature = "wayland",
|
||||
feature = "multi-window",
|
||||
feature = "surface-message"
|
||||
feature = "surface-message",
|
||||
target_os = "linux"
|
||||
))]
|
||||
if let Some((
|
||||
parent,
|
||||
|
|
@ -1235,7 +1236,7 @@ impl<T: Application> Cosmic<T> {
|
|||
core.applet.suggested_bounds = b;
|
||||
}
|
||||
Action::Opened(id) => {
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
if self.app.core().sync_window_border_radii_to_theme() {
|
||||
use iced_runtime::platform_specific::wayland::CornerRadius;
|
||||
use iced_winit::platform_specific::commands::corner_radius::corner_radius;
|
||||
|
|
@ -1284,14 +1285,14 @@ impl<App: Application> Cosmic<App> {
|
|||
pub fn new(app: App) -> Self {
|
||||
Self {
|
||||
app,
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
surface_views: HashMap::new(),
|
||||
tracked_windows: HashSet::new(),
|
||||
opened_surfaces: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
/// Create a subsurface
|
||||
pub fn get_subsurface(
|
||||
&mut self,
|
||||
|
|
@ -1314,7 +1315,7 @@ impl<App: Application> Cosmic<App> {
|
|||
get_subsurface(settings)
|
||||
}
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
/// Create a subsurface
|
||||
pub fn get_popup(
|
||||
&mut self,
|
||||
|
|
@ -1336,7 +1337,7 @@ impl<App: Application> Cosmic<App> {
|
|||
get_popup(settings)
|
||||
}
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
/// Create a window surface
|
||||
pub fn get_window(
|
||||
&mut self,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub struct Settings {
|
|||
pub(crate) antialiasing: bool,
|
||||
|
||||
/// Autosize the window to fit its contents
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
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(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
autosize: false,
|
||||
no_main_window: false,
|
||||
client_decorations: true,
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ pub struct Core {
|
|||
|
||||
pub(crate) menu_bars: HashMap<crate::widget::Id, (Limits, Size)>,
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
pub(crate) sync_window_border_radii_to_theme: bool,
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ impl Default for Core {
|
|||
main_window: None,
|
||||
exit_on_main_window_closed: true,
|
||||
menu_bars: HashMap::new(),
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
sync_window_border_radii_to_theme: true,
|
||||
}
|
||||
}
|
||||
|
|
@ -493,12 +493,12 @@ impl Core {
|
|||
}
|
||||
|
||||
// TODO should we emit tasks setting the corner radius or unsetting it if this is changed?
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
pub fn set_sync_window_border_radii_to_theme(&mut self, sync: bool) {
|
||||
self.sync_window_border_radii_to_theme = sync;
|
||||
}
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
pub fn sync_window_border_radii_to_theme(&self) -> bool {
|
||||
self.sync_window_border_radii_to_theme
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ pub(crate) mod malloc;
|
|||
#[cfg(all(feature = "process", not(windows)))]
|
||||
pub mod process;
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
pub use cctk;
|
||||
|
||||
pub mod surface;
|
||||
|
|
|
|||
|
|
@ -9,25 +9,25 @@ use iced::window;
|
|||
use std::{any::Any, sync::Arc};
|
||||
|
||||
/// Used to produce a destroy popup message from within a widget.
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[must_use]
|
||||
pub fn destroy_popup(id: iced_core::window::Id) -> Action {
|
||||
Action::DestroyPopup(id)
|
||||
}
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[must_use]
|
||||
pub fn destroy_subsurface(id: iced_core::window::Id) -> Action {
|
||||
Action::DestroySubsurface(id)
|
||||
}
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[must_use]
|
||||
pub fn destroy_window(id: iced_core::window::Id) -> Action {
|
||||
Action::DestroyWindow(id)
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "wayland", feature = "winit"))]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
||||
#[must_use]
|
||||
pub fn app_window<App: Application>(
|
||||
settings: impl Fn(&mut App) -> window::Settings + Send + Sync + 'static,
|
||||
|
|
@ -60,7 +60,7 @@ pub fn app_window<App: Application>(
|
|||
}
|
||||
|
||||
/// Used to create a window message from within a widget.
|
||||
#[cfg(all(feature = "wayland", feature = "winit"))]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
||||
#[must_use]
|
||||
pub fn simple_window<Message: 'static>(
|
||||
settings: impl Fn() -> window::Settings + Send + Sync + 'static,
|
||||
|
|
@ -92,7 +92,7 @@ pub fn simple_window<Message: 'static>(
|
|||
)
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "wayland", feature = "winit"))]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
||||
#[must_use]
|
||||
pub fn app_popup<App: Application>(
|
||||
settings: impl Fn(&mut App) -> iced_runtime::platform_specific::wayland::popup::SctkPopupSettings
|
||||
|
|
@ -126,7 +126,7 @@ pub fn app_popup<App: Application>(
|
|||
}
|
||||
|
||||
/// Used to create a subsurface message from within a widget.
|
||||
#[cfg(all(feature = "wayland", feature = "winit"))]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
||||
#[must_use]
|
||||
pub fn simple_subsurface<Message: 'static, V>(
|
||||
settings: impl Fn() -> iced_runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings
|
||||
|
|
@ -155,7 +155,7 @@ pub fn simple_subsurface<Message: 'static, V>(
|
|||
}
|
||||
|
||||
/// Used to create a popup message from within a widget.
|
||||
#[cfg(all(feature = "wayland", feature = "winit"))]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
||||
#[must_use]
|
||||
pub fn simple_popup<Message: 'static>(
|
||||
settings: impl Fn() -> iced_runtime::platform_specific::wayland::popup::SctkPopupSettings
|
||||
|
|
@ -186,7 +186,7 @@ pub fn simple_popup<Message: 'static>(
|
|||
)
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "wayland", feature = "winit"))]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
||||
#[must_use]
|
||||
pub fn subsurface<App: Application>(
|
||||
settings: impl Fn(
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ mod text_input;
|
|||
#[doc(inline)]
|
||||
pub use self::text_input::TextInput;
|
||||
|
||||
#[cfg(all(feature = "wayland", feature = "winit"))]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
||||
pub mod tooltip;
|
||||
#[cfg(all(feature = "wayland", feature = "winit"))]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
||||
pub use tooltip::Tooltip;
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ where
|
|||
shell: &mut Shell<'_, Message>,
|
||||
viewport: &Rectangle,
|
||||
) {
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
if matches!(
|
||||
event,
|
||||
Event::PlatformSpecific(event::PlatformSpecific::Wayland(
|
||||
|
|
|
|||
|
|
@ -3,7 +3,12 @@
|
|||
|
||||
//! 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(feature = "wayland", feature = "winit", feature = "surface-message"))]
|
||||
#[cfg(all(
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
|
||||
use crate::widget::menu::{
|
||||
self, CloseCondition, Direction, ItemHeight, ItemWidth, MenuBarState, PathHighlight,
|
||||
|
|
@ -59,7 +64,12 @@ pub struct ContextMenu<'a, Message> {
|
|||
}
|
||||
|
||||
impl<Message: Clone + 'static> ContextMenu<'_, Message> {
|
||||
#[cfg(all(feature = "wayland", feature = "winit", feature = "surface-message"))]
|
||||
#[cfg(all(
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
#[allow(clippy::too_many_lines)]
|
||||
fn create_popup(
|
||||
&mut self,
|
||||
|
|
@ -364,7 +374,12 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
|||
state.active_root.clear();
|
||||
state.open = false;
|
||||
|
||||
#[cfg(all(feature = "wayland", feature = "winit", feature = "surface-message"))]
|
||||
#[cfg(all(
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
||||
&& let Some(id) = state.popup_id.remove(&self.window_id)
|
||||
{
|
||||
|
|
@ -403,7 +418,12 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
|||
state.open = true;
|
||||
state.view_cursor = cursor;
|
||||
});
|
||||
#[cfg(all(feature = "wayland", feature = "winit", feature = "surface-message"))]
|
||||
#[cfg(all(
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
|
||||
self.create_popup(layout, cursor, renderer, shell, viewport, state);
|
||||
}
|
||||
|
|
@ -422,6 +442,7 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
|||
|
||||
#[cfg(all(
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
|
|
@ -458,7 +479,12 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
|||
_viewport: &iced::Rectangle,
|
||||
translation: Vector,
|
||||
) -> Option<iced_core::overlay::Element<'b, Message, crate::Theme, crate::Renderer>> {
|
||||
#[cfg(all(feature = "wayland", feature = "winit", feature = "surface-message"))]
|
||||
#[cfg(all(
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
||||
&& self.window_id != window::Id::NONE
|
||||
&& self.on_surface_action.is_some()
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ pub fn popup_dropdown<
|
|||
let dropdown: Dropdown<'_, S, Message, AppMessage> =
|
||||
Dropdown::new(selections.into(), selected, on_selected);
|
||||
|
||||
#[cfg(all(feature = "winit", feature = "wayland"))]
|
||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
||||
let dropdown = dropdown.with_popup(_parent_id, _on_surface_action, _map_action);
|
||||
|
||||
dropdown
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ where
|
|||
action_map: Option<Arc<dyn Fn(Message) -> AppMessage + 'static + Send + Sync>>,
|
||||
#[setters(strip_option)]
|
||||
window_id: Option<window::Id>,
|
||||
#[cfg(all(feature = "winit", feature = "wayland"))]
|
||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
||||
}
|
||||
|
||||
|
|
@ -96,14 +96,14 @@ where
|
|||
text_line_height: text::LineHeight::Relative(1.2),
|
||||
font: None,
|
||||
window_id: None,
|
||||
#[cfg(all(feature = "winit", feature = "wayland"))]
|
||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner::default(),
|
||||
on_surface_action: None,
|
||||
action_map: None,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "winit", feature = "wayland"))]
|
||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
||||
/// Handle dropdown requests for popup creation.
|
||||
/// Intended to be used with [`crate::app::message::get_popup`]
|
||||
pub fn with_popup<NewAppMessage>(
|
||||
|
|
@ -154,7 +154,7 @@ where
|
|||
self
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "winit", feature = "wayland"))]
|
||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
||||
pub fn with_positioner(
|
||||
mut self,
|
||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
||||
|
|
@ -268,7 +268,7 @@ where
|
|||
layout,
|
||||
cursor,
|
||||
shell,
|
||||
#[cfg(all(feature = "winit", feature = "wayland"))]
|
||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
||||
self.positioner.clone(),
|
||||
self.on_selected.clone(),
|
||||
self.selected,
|
||||
|
|
@ -346,7 +346,7 @@ where
|
|||
viewport: &Rectangle,
|
||||
translation: Vector,
|
||||
) -> Option<overlay::Element<'b, Message, crate::Theme, crate::Renderer>> {
|
||||
#[cfg(all(feature = "winit", feature = "wayland"))]
|
||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
||||
if self.window_id.is_some() || self.on_surface_action.is_some() {
|
||||
return None;
|
||||
}
|
||||
|
|
@ -545,7 +545,7 @@ pub fn update<
|
|||
layout: Layout<'_>,
|
||||
cursor: mouse::Cursor,
|
||||
shell: &mut Shell<'_, Message>,
|
||||
#[cfg(all(feature = "winit", feature = "wayland"))]
|
||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
||||
on_selected: Arc<dyn Fn(usize) -> Message + Send + Sync + 'static>,
|
||||
selected: Option<usize>,
|
||||
|
|
@ -571,7 +571,7 @@ pub fn update<
|
|||
*hovered_guard = selected;
|
||||
let id = window::Id::unique();
|
||||
state.popup_id = id;
|
||||
#[cfg(all(feature = "winit", feature = "wayland"))]
|
||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
||||
if let Some(((on_surface_action, parent), action_map)) = on_surface_action
|
||||
.as_ref()
|
||||
.zip(_window_id)
|
||||
|
|
@ -658,7 +658,7 @@ pub fn update<
|
|||
state.close_operation = false;
|
||||
state.is_open.store(false, Ordering::SeqCst);
|
||||
if is_open {
|
||||
#[cfg(all(feature = "winit", feature = "wayland"))]
|
||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
||||
if let Some(ref on_close) = on_surface_action {
|
||||
shell.publish(on_close(surface::action::destroy_popup(state.popup_id)));
|
||||
}
|
||||
|
|
@ -681,7 +681,7 @@ pub fn update<
|
|||
// 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.
|
||||
state.is_open.store(false, Ordering::Relaxed);
|
||||
#[cfg(all(feature = "winit", feature = "wayland"))]
|
||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
||||
if let Some(on_close) = on_surface_action {
|
||||
shell.publish(on_close(surface::action::destroy_popup(state.popup_id)));
|
||||
}
|
||||
|
|
@ -726,7 +726,7 @@ pub fn mouse_interaction(layout: Layout<'_>, cursor: mouse::Cursor) -> mouse::In
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "winit", feature = "wayland"))]
|
||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
||||
/// Returns the current menu widget of a [`Dropdown`].
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn menu_widget<
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use super::{
|
|||
#[cfg(all(
|
||||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
|
|
@ -195,7 +196,12 @@ pub struct MenuBar<Message> {
|
|||
menu_roots: Vec<MenuTree<Message>>,
|
||||
style: <crate::Theme as StyleSheet>::Style,
|
||||
window_id: window::Id,
|
||||
#[cfg(all(feature = "multi-window", feature = "wayland", feature = "winit"))]
|
||||
#[cfg(all(
|
||||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
feature = "winit",
|
||||
target_os = "linux"
|
||||
))]
|
||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
||||
pub(crate) on_surface_action:
|
||||
Option<Arc<dyn Fn(crate::surface::Action) -> Message + Send + Sync + 'static>>,
|
||||
|
|
@ -230,7 +236,12 @@ where
|
|||
menu_roots,
|
||||
style: <crate::Theme as StyleSheet>::Style::default(),
|
||||
window_id: window::Id::NONE,
|
||||
#[cfg(all(feature = "multi-window", feature = "wayland", feature = "winit"))]
|
||||
#[cfg(all(
|
||||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
feature = "winit",
|
||||
target_os = "linux"
|
||||
))]
|
||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner::default(),
|
||||
on_surface_action: None,
|
||||
}
|
||||
|
|
@ -324,7 +335,12 @@ where
|
|||
self
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "multi-window", feature = "wayland", feature = "winit"))]
|
||||
#[cfg(all(
|
||||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
feature = "winit",
|
||||
target_os = "linux"
|
||||
))]
|
||||
pub fn with_positioner(
|
||||
mut self,
|
||||
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
|
||||
|
|
@ -359,6 +375,7 @@ where
|
|||
#[cfg(all(
|
||||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
|
|
@ -629,6 +646,7 @@ where
|
|||
state.open = false;
|
||||
#[cfg(all(
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
|
|
@ -652,6 +670,7 @@ where
|
|||
#[cfg(all(
|
||||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
|
|
@ -666,6 +685,7 @@ where
|
|||
#[cfg(all(
|
||||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
|
|
@ -748,6 +768,7 @@ where
|
|||
#[cfg(all(
|
||||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use super::{menu_bar::MenuBarState, menu_tree::MenuTree};
|
|||
#[cfg(all(
|
||||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
|
|
@ -680,6 +681,7 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> {
|
|||
#[cfg(all(
|
||||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
|
|
@ -966,7 +968,8 @@ impl<Message: std::clone::Clone + 'static> Widget<Message, crate::Theme, crate::
|
|||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
feature = "surface-message",
|
||||
target_os = "linux"
|
||||
))]
|
||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
|
||||
&& let Some((new_root, new_ms)) = new_root
|
||||
|
|
@ -1226,6 +1229,7 @@ pub(crate) fn init_root_menu<Message: Clone>(
|
|||
#[cfg(all(
|
||||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
|
|
@ -1523,7 +1527,7 @@ where
|
|||
.as_ref()
|
||||
.is_some_and(|i| *i != new_index && !active_menu[*i].children.is_empty());
|
||||
|
||||
#[cfg(all(feature = "multi-window", feature = "wayland", feature = "winit", feature = "surface-message"))]
|
||||
#[cfg(all(feature = "multi-window", feature = "wayland",target_os = "linux", feature = "winit", feature = "surface-message"))]
|
||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) && remove {
|
||||
if let Some(id) = state.popup_id.remove(&menu.window_id) {
|
||||
state.active_root.truncate(menu.depth + 1);
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ pub use toggler::{Toggler, toggler};
|
|||
#[doc(inline)]
|
||||
pub use tooltip::{Tooltip, tooltip};
|
||||
|
||||
#[cfg(all(feature = "wayland", feature = "winit"))]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
||||
pub mod wayland;
|
||||
|
||||
pub mod tooltip {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ impl Default for ResponsiveMenuBar {
|
|||
fn default() -> ResponsiveMenuBar {
|
||||
ResponsiveMenuBar {
|
||||
collapsed_item_width: {
|
||||
#[cfg(all(feature = "winit", feature = "wayland"))]
|
||||
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
|
||||
if matches!(
|
||||
crate::app::cosmic::WINDOWING_SYSTEM.get(),
|
||||
Some(crate::app::cosmic::WindowingSystem::Wayland)
|
||||
|
|
@ -34,7 +34,7 @@ impl Default for ResponsiveMenuBar {
|
|||
} else {
|
||||
ItemWidth::Static(84)
|
||||
}
|
||||
#[cfg(not(all(feature = "winit", feature = "wayland")))]
|
||||
#[cfg(not(all(feature = "winit", feature = "wayland", target_os = "linux")))]
|
||||
{
|
||||
ItemWidth::Static(84)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -513,7 +513,7 @@ where
|
|||
}
|
||||
|
||||
/// Sets the start dnd handler of the [`TextInput`].
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
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
|
||||
|
|
@ -1445,7 +1445,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
|||
click.kind(),
|
||||
state.cursor().state(value),
|
||||
) {
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
(None, click::Kind::Single, cursor::State::Selection { start, end }) => {
|
||||
let left = start.min(end);
|
||||
let right = end.max(start);
|
||||
|
|
@ -1556,7 +1556,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
|||
| Event::Touch(touch::Event::FingerLifted { .. } | touch::Event::FingerLost { .. }) => {
|
||||
cold();
|
||||
let state = state();
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
if matches!(state.dragging_state, Some(DraggingState::PrepareDnd(_))) {
|
||||
// clear selection and place cursor at click position
|
||||
update_cache(state, value);
|
||||
|
|
@ -1589,7 +1589,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
|||
shell.capture_event();
|
||||
return;
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
if let Some(DraggingState::PrepareDnd(start_position)) = state.dragging_state {
|
||||
let distance = ((position.x - start_position.x).powi(2)
|
||||
+ (position.y - start_position.y).powi(2))
|
||||
|
|
@ -1980,7 +1980,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
|||
shell.request_redraw();
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
Event::Dnd(DndEvent::Source(SourceEvent::Finished | SourceEvent::Cancelled)) => {
|
||||
cold();
|
||||
let state = state();
|
||||
|
|
@ -1991,7 +1991,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
|||
return;
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
Event::Dnd(DndEvent::Offer(
|
||||
rectangle,
|
||||
OfferEvent::Enter {
|
||||
|
|
@ -2032,7 +2032,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
|||
return;
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
Event::Dnd(DndEvent::Offer(rectangle, OfferEvent::Motion { x, y }))
|
||||
if *rectangle == Some(dnd_id) =>
|
||||
{
|
||||
|
|
@ -2051,7 +2051,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
|||
shell.capture_event();
|
||||
return;
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
Event::Dnd(DndEvent::Offer(rectangle, OfferEvent::Drop)) if *rectangle == Some(dnd_id) => {
|
||||
cold();
|
||||
let state = state();
|
||||
|
|
@ -2069,9 +2069,9 @@ pub fn update<'a, Message: Clone + 'static>(
|
|||
|
||||
return;
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
Event::Dnd(DndEvent::Offer(id, OfferEvent::LeaveDestination)) if Some(dnd_id) != *id => {}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
Event::Dnd(DndEvent::Offer(
|
||||
rectangle,
|
||||
OfferEvent::Leave | OfferEvent::LeaveDestination,
|
||||
|
|
@ -2089,7 +2089,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
|||
shell.capture_event();
|
||||
return;
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
Event::Dnd(DndEvent::Offer(rectangle, OfferEvent::Data { data, mime_type }))
|
||||
if *rectangle == Some(dnd_id) =>
|
||||
{
|
||||
|
|
@ -2336,9 +2336,9 @@ pub fn draw<'a, Message>(
|
|||
let actual_width = text_width.max(text_bounds.width);
|
||||
|
||||
let radius_0 = THEME.lock().unwrap().cosmic().corner_radii.radius_0.into();
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
let handling_dnd_offer = !matches!(state.dnd_offer, DndOfferState::None);
|
||||
#[cfg(not(feature = "wayland"))]
|
||||
#[cfg(not(all(feature = "wayland", target_os = "linux")))]
|
||||
let handling_dnd_offer = false;
|
||||
let (cursor, offset) = if let Some(focus) =
|
||||
state.is_focused.filter(|f| f.focused).or_else(|| {
|
||||
|
|
@ -2567,7 +2567,7 @@ pub fn mouse_interaction(
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct TextInputString(pub String);
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
impl AsMimeTypes for TextInputString {
|
||||
fn available(&self) -> Cow<'static, [String]> {
|
||||
Cow::Owned(
|
||||
|
|
@ -2591,13 +2591,13 @@ impl AsMimeTypes for TextInputString {
|
|||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub(crate) enum DraggingState {
|
||||
Selection,
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
PrepareDnd(Point),
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
Dnd(DndAction, String),
|
||||
}
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub(crate) enum DndOfferState {
|
||||
#[default]
|
||||
|
|
@ -2606,7 +2606,7 @@ pub(crate) enum DndOfferState {
|
|||
Dropped,
|
||||
}
|
||||
#[derive(Debug, Default, Clone)]
|
||||
#[cfg(not(feature = "wayland"))]
|
||||
#[cfg(not(all(feature = "wayland", target_os = "linux")))]
|
||||
pub(crate) struct DndOfferState;
|
||||
|
||||
/// The state of a [`TextInput`].
|
||||
|
|
@ -2680,7 +2680,7 @@ impl State {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
/// Returns the current value of the dragged text in the [`TextInput`].
|
||||
#[must_use]
|
||||
pub fn dragged_text(&self) -> Option<String> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue