Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs #177

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ where
cursor: mouse::Cursor,
);

/// Applies an [`Operation`] to the [`Overlay`].
/// Applies an [`crate::widget::Operation`] to the [`Overlay`].
fn operate(
&mut self,
_layout: Layout<'_>,
Expand Down
14 changes: 7 additions & 7 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
pub use task::Task;
pub use user_interface::UserInterface;

use crate::core::{Color, widget};
use crate::core::{widget, Color};

Check warning on line 44 in runtime/src/lib.rs

View workflow job for this annotation

GitHub Actions / widget

unused import: `Color`

Check warning on line 44 in runtime/src/lib.rs

View workflow job for this annotation

GitHub Actions / all

unused import: `Color`

Check warning on line 44 in runtime/src/lib.rs

View workflow job for this annotation

GitHub Actions / widget

unused import: `Color`

Check warning on line 44 in runtime/src/lib.rs

View workflow job for this annotation

GitHub Actions / all

unused import: `Color`
use crate::futures::futures::channel::oneshot;

use std::borrow::Cow;
Expand Down Expand Up @@ -146,14 +146,14 @@
/// The appearance of a program.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Appearance {
/// The background [`Color`] of the application.
pub background_color: Color,
/// The background [`iced_core::Color`] of the application.
pub background_color: iced_core::Color,

/// The default text [`Color`] of the application.
pub text_color: Color,
/// The default text [`iced_core::Color`] of the application.
pub text_color: iced_core::Color,

/// The default icon [`Color`] of the application.
pub icon_color: Color,
/// The default icon [`iced_core::Color`] of the application.
pub icon_color: iced_core::Color,
}

/// The default style of a [`Program`].
Expand Down
2 changes: 1 addition & 1 deletion src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub trait Program: Sized {
}

#[cfg(feature = "winit")]
/// Runs the [`Program`] with the given [`Settings`](crate::Settings) and a closure that creates the initial state.
/// Runs the [`Program`] with the given settings, and a closure that creates the initial state.
fn run_with<I>(
self,
settings: crate::Settings,
Expand Down
6 changes: 3 additions & 3 deletions widget/src/checkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,14 @@ where
}

#[cfg(feature = "a11y")]
/// Sets the name of the [`Button`].
/// Sets the name of the [`Checkbox`].
pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self {
self.name = Some(name.into());
self
}

#[cfg(feature = "a11y")]
/// Sets the description of the [`Button`].
/// Sets the description of the [`Checkbox`].
pub fn description_widget<T: iced_accessibility::Describes>(
mut self,
description: &T,
Expand All @@ -282,7 +282,7 @@ where
}

#[cfg(feature = "a11y")]
/// Sets the description of the [`Button`].
/// Sets the description of the [`Checkbox`].
pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self {
self.description =
Some(iced_accessibility::Description::Text(description.into()));
Expand Down
8 changes: 4 additions & 4 deletions widget/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ impl<'a, Handle> Image<'a, Handle> {
}

#[cfg(feature = "a11y")]
/// Sets the name of the [`Button`].
/// Sets the name of the [`Image`].
pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self {
self.name = Some(name.into());
self
}

#[cfg(feature = "a11y")]
/// Sets the description of the [`Button`].
/// Sets the description of the [`Image`].
pub fn description_widget<T: iced_accessibility::Describes>(
mut self,
description: &T,
Expand All @@ -168,15 +168,15 @@ impl<'a, Handle> Image<'a, Handle> {
}

#[cfg(feature = "a11y")]
/// Sets the description of the [`Button`].
/// Sets the description of the [`Image`].
pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self {
self.description =
Some(iced_accessibility::Description::Text(description.into()));
self
}

#[cfg(feature = "a11y")]
/// Sets the label of the [`Button`].
/// Sets the label of the [`Image`].
pub fn label(mut self, label: &dyn iced_accessibility::Labels) -> Self {
self.label =
Some(label.label().into_iter().map(|l| l.into()).collect());
Expand Down
8 changes: 4 additions & 4 deletions widget/src/scrollable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,14 @@ where
}

#[cfg(feature = "a11y")]
/// Sets the name of the [`Button`].
/// Sets the name of the [`Scrollable`].
pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self {
self.name = Some(name.into());
self
}

#[cfg(feature = "a11y")]
/// Sets the description of the [`Button`].
/// Sets the description of the [`Scrollable`].
pub fn description_widget(
mut self,
description: &impl iced_accessibility::Describes,
Expand All @@ -287,15 +287,15 @@ where
}

#[cfg(feature = "a11y")]
/// Sets the description of the [`Button`].
/// Sets the description of the [`Scrollable`].
pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self {
self.description =
Some(iced_accessibility::Description::Text(description.into()));
self
}

#[cfg(feature = "a11y")]
/// Sets the label of the [`Button`].
/// Sets the label of the [`Scrollable`].
pub fn label(mut self, label: &dyn iced_accessibility::Labels) -> Self {
self.label =
Some(label.label().into_iter().map(|l| l.into()).collect());
Expand Down
8 changes: 4 additions & 4 deletions widget/src/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,14 @@ where
}

#[cfg(feature = "a11y")]
/// Sets the name of the [`Button`].
/// Sets the name of the [`Slider`].
pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self {
self.name = Some(name.into());
self
}

#[cfg(feature = "a11y")]
/// Sets the description of the [`Button`].
/// Sets the description of the [`Slider`].
pub fn description_widget(
mut self,
description: &impl iced_accessibility::Describes,
Expand All @@ -258,15 +258,15 @@ where
}

#[cfg(feature = "a11y")]
/// Sets the description of the [`Button`].
/// Sets the description of the [`Slider`].
pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self {
self.description =
Some(iced_accessibility::Description::Text(description.into()));
self
}

#[cfg(feature = "a11y")]
/// Sets the label of the [`Button`].
/// Sets the label of the [`Slider`].
pub fn label(mut self, label: &dyn iced_accessibility::Labels) -> Self {
self.label =
Some(label.label().into_iter().map(|l| l.into()).collect());
Expand Down
8 changes: 4 additions & 4 deletions widget/src/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ where
}

#[cfg(feature = "a11y")]
/// Sets the name of the [`Button`].
/// Sets the name of the [`Svg`].
pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self {
self.name = Some(name.into());
self
}

#[cfg(feature = "a11y")]
/// Sets the description of the [`Button`].
/// Sets the description of the [`Svg`].
pub fn description_widget<T: iced_accessibility::Describes>(
mut self,
description: &T,
Expand All @@ -198,15 +198,15 @@ where
}

#[cfg(feature = "a11y")]
/// Sets the description of the [`Button`].
/// Sets the description of the [`Svg`].
pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self {
self.description =
Some(iced_accessibility::Description::Text(description.into()));
self
}

#[cfg(feature = "a11y")]
/// Sets the label of the [`Button`].
/// Sets the label of the [`Svg`].
pub fn label(mut self, label: &dyn iced_accessibility::Labels) -> Self {
self.label =
Some(label.label().into_iter().map(|l| l.into()).collect());
Expand Down
8 changes: 4 additions & 4 deletions widget/src/toggler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,14 @@ where
}

#[cfg(feature = "a11y")]
/// Sets the name of the [`Button`].
/// Sets the name of the [`Toggler`].
pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self {
self.name = Some(name.into());
self
}

#[cfg(feature = "a11y")]
/// Sets the description of the [`Button`].
/// Sets the description of the [`Toggler`].
pub fn description_widget<T: iced_accessibility::Describes>(
mut self,
description: &T,
Expand All @@ -282,15 +282,15 @@ where
}

#[cfg(feature = "a11y")]
/// Sets the description of the [`Button`].
/// Sets the description of the [`Toggler`].
pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self {
self.description =
Some(iced_accessibility::Description::Text(description.into()));
self
}

#[cfg(feature = "a11y")]
/// Sets the label of the [`Button`] using another widget.
/// Sets the label of the [`Toggler`] using another widget.
pub fn labeled_by_widget(
mut self,
label: &dyn iced_accessibility::Labels,
Expand Down
4 changes: 3 additions & 1 deletion winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ keywords.workspace = true
workspace = true

[features]
default = ["x11", "wayland", "wayland-dlopen", "wayland-csd-adwaita"]
default = ["x11"]
debug = ["iced_runtime/debug"]
system = ["sysinfo"]
program = []
Expand All @@ -30,6 +30,8 @@ wayland = [
"xkbcommon-dl",
"xkeysym",
"iced_runtime/wayland",
"wayland-dlopen",
"wayland-csd-adwaita",
]
wayland-dlopen = ["winit/wayland-dlopen"]
wayland-csd-adwaita = ["winit/wayland-csd-adwaita"]
Expand Down
22 changes: 17 additions & 5 deletions winit/src/platform_specific/mod.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
//! Wayland specific shell
//!

use std::collections::HashMap;

use iced_graphics::Compositor;
use iced_runtime::{core::window, platform_specific, Debug};
use sctk::reexports::client::Connection;
use wayland::sctk_event::UserInterfaces;
use iced_runtime::{core::window, user_interface, Debug};

#[cfg(all(feature = "wayland", target_os = "linux"))]
pub mod wayland;

#[cfg(all(feature = "wayland", target_os = "linux"))]
pub use wayland::*;
#[cfg(all(feature = "wayland", target_os = "linux"))]
use wayland_backend::client::Backend;

use crate::{program::WindowManager, Program};
Expand Down Expand Up @@ -52,7 +53,7 @@ impl PlatformSpecific {
) {
match action {
#[cfg(all(feature = "wayland", target_os = "linux"))]
platform_specific::Action::Wayland(a) => {
iced_runtime::platform_specific::Action::Wayland(a) => {
self.send_wayland(wayland::Action::Action(a));
}
}
Expand Down Expand Up @@ -92,7 +93,7 @@ impl PlatformSpecific {
wayland_display_handle.display.as_ptr().cast(),
)
};
Connection::from_backend(backend)
sctk::reexports::client::Connection::from_backend(backend)
}
_ => {
return;
Expand Down Expand Up @@ -136,6 +137,17 @@ impl PlatformSpecific {
}
}

pub type UserInterfaces<'a, P> = HashMap<
window::Id,
user_interface::UserInterface<
'a,
<P as Program>::Message,
<P as Program>::Theme,
<P as Program>::Renderer,
>,
rustc_hash::FxBuildHasher,
>;

pub(crate) fn handle_event<'a, P, C>(
e: Event,
events: &mut Vec<(Option<window::Id>, iced_runtime::core::Event)>,
Expand Down
3 changes: 1 addition & 2 deletions winit/src/platform_specific/wayland/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use sctk::reexports::calloop;
use sctk::reexports::client::protocol::wl_surface::WlSurface;
use sctk::seat::keyboard::Modifiers;
use sctk_event::SctkEvent;
use sctk_event::UserInterfaces;
use std::{collections::HashMap, sync::Arc};
use subsurface_widget::{SubsurfaceInstance, SubsurfaceState};
use wayland_backend::client::ObjectId;
Expand Down Expand Up @@ -128,7 +127,7 @@ impl WaylandSpecific {
compositor: &mut C,
window_manager: &mut WindowManager<P, C>,
debug: &mut Debug,
user_interfaces: &mut UserInterfaces<'a, P>,
user_interfaces: &mut super::UserInterfaces<'a, P>,
clipboard: &mut crate::Clipboard,
#[cfg(feature = "a11y")] adapters: &mut HashMap<
window::Id,
Expand Down
Loading
Loading