diff --git a/masonry/src/app/render_root.rs b/masonry/src/app/render_root.rs index 1d0542bcd8..4e57bdfd89 100644 --- a/masonry/src/app/render_root.rs +++ b/masonry/src/app/render_root.rs @@ -4,6 +4,7 @@ use std::collections::{HashMap, VecDeque}; use accesskit::{ActionRequest, TreeUpdate}; +use cursor_icon::CursorIcon; use parley::fontique::{self, Blob, Collection, CollectionOptions, SourceCache}; use parley::{FontContext, LayoutContext}; use tracing::{info_span, warn}; @@ -36,7 +37,6 @@ use crate::passes::update::{ }; use crate::passes::{PassTracing, recurse_on_children}; use crate::util::AnyMap; -use cursor_icon::CursorIcon; /// We ensure that any valid initial IME area is sent to the platform by storing an invalid initial /// IME area as the `last_sent_ime_area`. diff --git a/masonry/src/core/box_constraints.rs b/masonry/src/core/box_constraints.rs index a68ffcf702..129bbfe9cb 100644 --- a/masonry/src/core/box_constraints.rs +++ b/masonry/src/core/box_constraints.rs @@ -1,6 +1,8 @@ // Copyright 2019 the Xilem Authors and the Druid Authors // SPDX-License-Identifier: Apache-2.0 +pub use crate::debug_panic; + use vello::kurbo::Size; /// Constraints for layout. diff --git a/masonry/src/core/contexts.rs b/masonry/src/core/contexts.rs index d3546052ce..4d9e838687 100644 --- a/masonry/src/core/contexts.rs +++ b/masonry/src/core/contexts.rs @@ -10,6 +10,7 @@ use dpi::{LogicalPosition, PhysicalPosition}; use parley::{FontContext, LayoutContext}; use tracing::{trace, warn}; use tree_arena::{ArenaMutList, ArenaRefList}; +use vello::kurbo::{Affine, Insets, Point, Rect, Size, Vec2}; use crate::app::{MutateCallback, RenderRootSignal, RenderRootState}; use crate::core::{ @@ -17,7 +18,7 @@ use crate::core::{ FromDynWidget, PropertiesMut, PropertiesRef, ResizeDirection, Widget, WidgetId, WidgetMut, WidgetPod, WidgetRef, WidgetState, }; -use crate::kurbo::{Affine, Insets, Point, Rect, Size, Vec2}; +use crate::debug_panic; use crate::passes::layout::run_layout_on; use crate::peniko::Color; use crate::util::{AnyMap, get_debug_color}; diff --git a/masonry/src/core/events.rs b/masonry/src/core/events.rs index 69c6ff79b0..d109b4baf8 100644 --- a/masonry/src/core/events.rs +++ b/masonry/src/core/events.rs @@ -3,12 +3,12 @@ //! Events. +use ui_events::keyboard::KeyboardEvent; +use vello::kurbo::Rect; + use crate::dpi::PhysicalSize; -use crate::kurbo::Rect; use crate::util::Duration; -use ui_events::keyboard::KeyboardEvent; - // TODO - Occluded(bool) event // TODO - winit ActivationTokenDone thing // TODO - Suspended/Resume/NewEvents/MemoryWarning diff --git a/masonry/src/core/object_fit.rs b/masonry/src/core/object_fit.rs index 419cfa1990..54153d47c8 100644 --- a/masonry/src/core/object_fit.rs +++ b/masonry/src/core/object_fit.rs @@ -1,7 +1,7 @@ // Copyright 2025 the Xilem Authors // SPDX-License-Identifier: Apache-2.0 -use crate::kurbo::{Affine, Size}; +use vello::kurbo::{Affine, Size}; // These are based on https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit /// Strategies for inscribing a rectangle inside another rectangle. diff --git a/masonry/src/core/properties.rs b/masonry/src/core/properties.rs index 80f7691673..080786cb0c 100644 --- a/masonry/src/core/properties.rs +++ b/masonry/src/core/properties.rs @@ -1,13 +1,12 @@ // Copyright 2025 the Xilem Authors // SPDX-License-Identifier: Apache-2.0 -use crate::util::AnyMap; - use std::any::TypeId; use std::collections::HashMap; use std::default::Default; use crate::core::Widget; +use crate::util::AnyMap; /// A marker trait that indicates that a type is intended to be used as a widget's property. /// diff --git a/masonry/src/core/text.rs b/masonry/src/core/text.rs index adf3949f25..f78b21db2e 100644 --- a/masonry/src/core/text.rs +++ b/masonry/src/core/text.rs @@ -21,7 +21,7 @@ pub type ArcStr = std::sync::Arc; /// This enables updating of brush details without performing relayouts; /// the inner values are indexes into the `brushes` argument to [`render_text()`]. /// -/// [`Brush`]: crate::parley::Brush +/// [`Brush`]: parley::Brush #[derive(Clone, PartialEq, Default, Debug)] pub struct BrushIndex(pub usize); diff --git a/masonry/src/core/widget.rs b/masonry/src/core/widget.rs index 2e75cacb49..99b22eb1a9 100644 --- a/masonry/src/core/widget.rs +++ b/masonry/src/core/widget.rs @@ -12,13 +12,13 @@ use smallvec::SmallVec; use tracing::field::DisplayValue; use tracing::{Span, trace_span}; use vello::Scene; +use vello::kurbo::{Point, Size}; use crate::core::{ AccessCtx, AccessEvent, BoxConstraints, ComposeCtx, EventCtx, LayoutCtx, PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Update, UpdateCtx, WidgetRef, }; -use crate::kurbo::{Point, Size}; /// A unique identifier for a single [`Widget`]. /// diff --git a/masonry/src/core/widget_mut.rs b/masonry/src/core/widget_mut.rs index f8c1153a0c..653d6d6995 100644 --- a/masonry/src/core/widget_mut.rs +++ b/masonry/src/core/widget_mut.rs @@ -3,8 +3,9 @@ use std::any::TypeId; +use vello::kurbo::Affine; + use crate::core::{FromDynWidget, MutateCtx, Property, Widget}; -use crate::kurbo::Affine; /// A rich mutable reference to a [`Widget`]. /// diff --git a/masonry/src/doc/02_implementing_widget.md b/masonry/src/doc/02_implementing_widget.md index 02be846b8f..1d36e447d3 100644 --- a/masonry/src/doc/02_implementing_widget.md +++ b/masonry/src/doc/02_implementing_widget.md @@ -441,7 +441,7 @@ The next one is about creating a container widgets, and the complications it add [`PaintCtx::size()`]: crate::core::PaintCtx::size [`UpdateCtx::request_paint_only()`]: crate::core::UpdateCtx::request_paint_only [`ButtonPressed`]: crate::core::Action::ButtonPressed -[`vello::Scene`]: crate::vello::Scene +[`vello::Scene`]: vello::Scene [`Role::Button`]: accesskit::Role::Button [`RenderRoot::edit_root_widget()`]: crate::app::RenderRoot::edit_root_widget [`Label::set_text()`]: crate::widgets::Label::set_text diff --git a/masonry/src/passes/event.rs b/masonry/src/passes/event.rs index ddb2f0b7d6..cf916d60c3 100644 --- a/masonry/src/passes/event.rs +++ b/masonry/src/passes/event.rs @@ -5,11 +5,12 @@ use tracing::{debug, info_span, trace}; use crate::Handled; use crate::app::{RenderRoot, RenderRootSignal}; +use crate::core::keyboard::{Key, KeyState, NamedKey}; use crate::core::{ AccessEvent, EventCtx, PointerEvent, PointerInfo, PointerUpdate, PropertiesMut, TextEvent, Widget, WidgetId, - keyboard::{Key, KeyState, NamedKey}, }; +use crate::debug_panic; use crate::dpi::{LogicalPosition, PhysicalPosition}; use crate::passes::{enter_span, merge_state_up}; diff --git a/masonry/src/passes/layout.rs b/masonry/src/passes/layout.rs index 0ec884c973..1a73618f92 100644 --- a/masonry/src/passes/layout.rs +++ b/masonry/src/passes/layout.rs @@ -12,6 +12,7 @@ use vello::kurbo::{Point, Rect, Size}; use crate::app::{RenderRoot, RenderRootSignal, WindowSizePolicy}; use crate::core::{BoxConstraints, LayoutCtx, PropertiesMut, Widget, WidgetPod, WidgetState}; +use crate::debug_panic; use crate::passes::{enter_span_if, recurse_on_children}; // --- MARK: RUN LAYOUT diff --git a/masonry/src/passes/paint.rs b/masonry/src/passes/paint.rs index 8134d8dea4..50b2a7a44e 100644 --- a/masonry/src/passes/paint.rs +++ b/masonry/src/passes/paint.rs @@ -6,12 +6,11 @@ use std::collections::HashMap; use tracing::{info_span, trace}; use tree_arena::ArenaMut; use vello::Scene; -use vello::kurbo::Affine; +use vello::kurbo::{Affine, Rect}; use vello::peniko::{Color, Fill, Mix}; use crate::app::{RenderRoot, RenderRootState}; use crate::core::{DefaultProperties, PaintCtx, PropertiesRef, Widget, WidgetId, WidgetState}; -use crate::kurbo::Rect; use crate::passes::{enter_span_if, recurse_on_children}; use crate::util::{AnyMap, get_debug_color, stroke}; diff --git a/masonry/src/properties/background.rs b/masonry/src/properties/background.rs index 14ef898d82..60dc21e537 100644 --- a/masonry/src/properties/background.rs +++ b/masonry/src/properties/background.rs @@ -3,8 +3,9 @@ use std::any::TypeId; +use vello::kurbo::Rect; + use crate::core::{Property, UpdateCtx}; -use crate::kurbo::Rect; use crate::peniko::color::{AlphaColor, Srgb}; use crate::properties::types::Gradient; diff --git a/masonry/src/properties/border_width.rs b/masonry/src/properties/border_width.rs index 342c3ad956..ff6711dad4 100644 --- a/masonry/src/properties/border_width.rs +++ b/masonry/src/properties/border_width.rs @@ -3,8 +3,9 @@ use std::any::TypeId; +use vello::kurbo::{Point, RoundedRect, Size, Vec2}; + use crate::core::{BoxConstraints, Property, UpdateCtx}; -use crate::kurbo::{Point, RoundedRect, Size, Vec2}; use crate::properties::CornerRadius; /// The width of a widget's border, in logical pixels. diff --git a/masonry/src/properties/padding.rs b/masonry/src/properties/padding.rs index 9398883f27..246214ae12 100644 --- a/masonry/src/properties/padding.rs +++ b/masonry/src/properties/padding.rs @@ -3,8 +3,9 @@ use std::any::TypeId; +use vello::kurbo::{Point, Size, Vec2}; + use crate::core::{BoxConstraints, Property, UpdateCtx}; -use crate::kurbo::{Point, Size, Vec2}; /// The width of padding between a widget's border and its contents. #[derive(Default, Clone, Copy, Debug, PartialEq)] diff --git a/masonry/src/properties/types/gradient.rs b/masonry/src/properties/types/gradient.rs index d39212cd24..0016918e66 100644 --- a/masonry/src/properties/types/gradient.rs +++ b/masonry/src/properties/types/gradient.rs @@ -1,7 +1,8 @@ // Copyright 2025 the Xilem Authors // SPDX-License-Identifier: Apache-2.0 -use crate::kurbo::{Point, Rect}; +use vello::kurbo::{Point, Rect}; + use crate::peniko::color::{ColorSpaceTag, HueDirection}; use crate::peniko::{ColorStops, ColorStopsSource, Extend}; diff --git a/masonry/src/testing/harness.rs b/masonry/src/testing/harness.rs index 1aa8d3cdca..b69e3dfe1e 100644 --- a/masonry/src/testing/harness.rs +++ b/masonry/src/testing/harness.rs @@ -15,6 +15,7 @@ use image::{DynamicImage, ImageFormat, ImageReader, Rgba, RgbaImage}; use oxipng::{Options, optimize_from_memory}; use tracing::debug; use vello::RendererOptions; +use vello::kurbo::{Point, Size, Vec2}; use vello::util::{RenderContext, block_on_wgpu}; use wgpu::{ BufferDescriptor, BufferUsages, CommandEncoderDescriptor, Extent3d, TexelCopyBufferInfo, @@ -31,7 +32,6 @@ use crate::core::{ WidgetRef, WindowEvent, }; use crate::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize}; -use crate::kurbo::{Point, Size, Vec2}; use crate::peniko::{Blob, Color}; use crate::testing::screenshots::get_image_diff; use crate::util::Duration; diff --git a/masonry/src/testing/mod.rs b/masonry/src/testing/mod.rs index 930a83d164..456642467c 100644 --- a/masonry/src/testing/mod.rs +++ b/masonry/src/testing/mod.rs @@ -9,8 +9,7 @@ mod recorder_widget; mod screenshots; mod wrapper_widget; -pub use crate::assert_failing_render_snapshot; -pub use crate::assert_render_snapshot; +pub use crate::{assert_failing_render_snapshot, assert_render_snapshot}; pub use harness::{PRIMARY_MOUSE, TestHarness, TestHarnessParams}; pub use modular_widget::ModularWidget; diff --git a/masonry/src/testing/modular_widget.rs b/masonry/src/testing/modular_widget.rs index 7e6b94975e..8d3cee51f5 100644 --- a/masonry/src/testing/modular_widget.rs +++ b/masonry/src/testing/modular_widget.rs @@ -8,13 +8,13 @@ use cursor_icon::CursorIcon; use smallvec::SmallVec; use tracing::trace_span; use vello::Scene; +use vello::kurbo::{Point, Size}; use crate::core::{ AccessCtx, AccessEvent, BoxConstraints, ComposeCtx, EventCtx, LayoutCtx, PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId, WidgetRef, find_widget_under_pointer, }; -use crate::kurbo::{Point, Size}; pub type PointerEventFn = dyn FnMut(&mut S, &mut EventCtx, &mut PropertiesMut<'_>, &PointerEvent); diff --git a/masonry/src/testing/recorder_widget.rs b/masonry/src/testing/recorder_widget.rs index f1f17ddaeb..9698982628 100644 --- a/masonry/src/testing/recorder_widget.rs +++ b/masonry/src/testing/recorder_widget.rs @@ -17,13 +17,13 @@ use accesskit::{Node, Role}; use cursor_icon::CursorIcon; use smallvec::SmallVec; use vello::Scene; +use vello::kurbo::{Point, Size}; use crate::core::{ AccessCtx, AccessEvent, BoxConstraints, ComposeCtx, EventCtx, LayoutCtx, PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId, WidgetRef, }; -use crate::kurbo::{Point, Size}; /// A wrapper widget that records each time one of its methods is called. /// diff --git a/masonry/src/testing/wrapper_widget.rs b/masonry/src/testing/wrapper_widget.rs index 64060d0e40..14d1afa6ec 100644 --- a/masonry/src/testing/wrapper_widget.rs +++ b/masonry/src/testing/wrapper_widget.rs @@ -6,13 +6,13 @@ use std::any::TypeId; use accesskit::{Node, Role}; use smallvec::{SmallVec, smallvec}; use vello::Scene; +use vello::kurbo::{Point, Size}; use crate::core::{ AccessCtx, AccessEvent, BoxConstraints, ComposeCtx, EventCtx, LayoutCtx, PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId, WidgetMut, WidgetPod, }; -use crate::kurbo::{Point, Size}; /// A basic wrapper widget that can replace its child. pub struct WrapperWidget { diff --git a/masonry/src/theme.rs b/masonry/src/theme.rs index a1ba571593..21ce2af6e5 100644 --- a/masonry/src/theme.rs +++ b/masonry/src/theme.rs @@ -5,8 +5,10 @@ #![allow(missing_docs, reason = "Names are self-explanatory.")] +use parley::GenericFamily; +use vello::kurbo::Insets; + use crate::core::{DefaultProperties, StyleProperty, StyleSet}; -use crate::kurbo::Insets; use crate::peniko::Color; use crate::properties::types::Gradient; use crate::properties::{ @@ -15,8 +17,6 @@ use crate::properties::{ }; use crate::widgets::Button; -use parley::GenericFamily; - // Colors are from https://sashat.me/2017/01/11/list-of-20-simple-distinct-colors/ // They're picked for visual distinction and accessibility (99 percent) diff --git a/masonry/src/util.rs b/masonry/src/util.rs index 8bf171055a..9baab3fea6 100644 --- a/masonry/src/util.rs +++ b/masonry/src/util.rs @@ -7,10 +7,7 @@ use std::any::Any; use std::hash::Hash; use vello::Scene; -use vello::kurbo::Join; -use vello::kurbo::{ - Affine, Rect, Shape, Stroke, {self}, -}; +use vello::kurbo::{Affine, Join, Point, Rect, Shape, Stroke}; use vello::peniko::{BrushRef, Color, ColorStopsSource, Fill, Gradient}; /// Panic in debug and `tracing::error` in release mode. @@ -126,8 +123,8 @@ impl UnitPoint { } /// Given a rectangle, resolve the point within the rectangle. - pub fn resolve(self, rect: Rect) -> kurbo::Point { - kurbo::Point::new( + pub fn resolve(self, rect: Rect) -> Point { + Point::new( rect.x0 + self.u * (rect.x1 - rect.x0), rect.y0 + self.v * (rect.y1 - rect.y0), ) @@ -164,14 +161,10 @@ pub fn fill_color(scene: &mut Scene, path: &impl Shape, color: Color) { // --- #[cfg(not(target_arch = "wasm32"))] -pub use std::time::Instant; -#[cfg(target_arch = "wasm32")] -pub use web_time::Instant; +pub use std::time::{Duration, Instant}; -#[cfg(not(target_arch = "wasm32"))] -pub use std::time::Duration; #[cfg(target_arch = "wasm32")] -pub use web_time::Duration; +pub use web_time::{Duration, Instant}; // --- diff --git a/masonry/src/widgets/align.rs b/masonry/src/widgets/align.rs index c1d5b80b92..691622f1dd 100644 --- a/masonry/src/widgets/align.rs +++ b/masonry/src/widgets/align.rs @@ -12,12 +12,12 @@ use accesskit::{Node, Role}; use smallvec::{SmallVec, smallvec}; use tracing::{Span, trace_span}; use vello::Scene; +use vello::kurbo::{Rect, Size}; use crate::core::{ AccessCtx, AccessEvent, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Widget, WidgetId, WidgetPod, }; -use crate::kurbo::{Rect, Size}; use crate::util::UnitPoint; // TODO - Have child widget type as generic argument diff --git a/masonry/src/widgets/button.rs b/masonry/src/widgets/button.rs index 14665d478c..499b6e1595 100644 --- a/masonry/src/widgets/button.rs +++ b/masonry/src/widgets/button.rs @@ -9,14 +9,13 @@ use accesskit::{Node, Role}; use smallvec::{SmallVec, smallvec}; use tracing::{Span, trace, trace_span}; use vello::Scene; -use vello::kurbo::Affine; +use vello::kurbo::{Affine, Size}; use crate::core::{ AccessCtx, AccessEvent, Action, ArcStr, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId, WidgetMut, WidgetPod, }; -use crate::kurbo::Size; use crate::properties::*; use crate::theme; use crate::util::{fill, stroke}; diff --git a/masonry/src/widgets/flex.rs b/masonry/src/widgets/flex.rs index ec308eeb58..05f7c55206 100644 --- a/masonry/src/widgets/flex.rs +++ b/masonry/src/widgets/flex.rs @@ -8,14 +8,14 @@ use smallvec::SmallVec; use tracing::{Span, trace_span}; use vello::Scene; use vello::kurbo::common::FloatExt; -use vello::kurbo::{Affine, Line, Stroke, Vec2}; +use vello::kurbo::{Affine, Line, Point, Rect, Size, Stroke, Vec2}; use crate::core::{ AccessCtx, AccessEvent, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Widget, WidgetId, WidgetMut, WidgetPod, }; -use crate::kurbo::{Point, Rect, Size}; +use crate::debug_panic; /// A container with either horizontal or vertical layout. /// diff --git a/masonry/src/widgets/grid.rs b/masonry/src/widgets/grid.rs index 9075cbc69d..a7be96763f 100644 --- a/masonry/src/widgets/grid.rs +++ b/masonry/src/widgets/grid.rs @@ -5,14 +5,14 @@ use accesskit::{Node, Role}; use smallvec::SmallVec; use tracing::{Span, trace_span}; use vello::Scene; -use vello::kurbo::{Affine, Line, Stroke}; +use vello::kurbo::{Affine, Line, Point, Size, Stroke}; use crate::core::{ AccessCtx, AccessEvent, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Widget, WidgetId, WidgetMut, WidgetPod, }; -use crate::kurbo::{Point, Size}; +use crate::debug_panic; /// A widget that arranges its children in a grid. /// diff --git a/masonry/src/widgets/image.rs b/masonry/src/widgets/image.rs index df90aa65a6..f8fa6a589d 100644 --- a/masonry/src/widgets/image.rs +++ b/masonry/src/widgets/image.rs @@ -8,7 +8,7 @@ use accesskit::{Node, Role}; use smallvec::SmallVec; use tracing::{Span, trace_span}; use vello::Scene; -use vello::kurbo::Affine; +use vello::kurbo::{Affine, Size}; use vello::peniko::{BlendMode, Image as ImageBuf}; use crate::core::{ @@ -16,7 +16,6 @@ use crate::core::{ PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId, WidgetMut, }; -use crate::kurbo::Size; // TODO - Resolve name collision between masonry_winit::Image and peniko::Image diff --git a/masonry/src/widgets/label.rs b/masonry/src/widgets/label.rs index 7f03938def..4a5db32f22 100644 --- a/masonry/src/widgets/label.rs +++ b/masonry/src/widgets/label.rs @@ -19,6 +19,7 @@ use crate::core::{ PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, StyleProperty, StyleSet, TextEvent, Update, UpdateCtx, Widget, WidgetId, WidgetMut, render_text, }; +use crate::debug_panic; use crate::theme; use crate::theme::default_text_styles; diff --git a/masonry/src/widgets/progress_bar.rs b/masonry/src/widgets/progress_bar.rs index a90553f2ef..3f3dfd8047 100644 --- a/masonry/src/widgets/progress_bar.rs +++ b/masonry/src/widgets/progress_bar.rs @@ -7,13 +7,13 @@ use accesskit::{Node, Role}; use smallvec::{SmallVec, smallvec}; use tracing::{Span, trace_span}; use vello::Scene; +use vello::kurbo::{Point, Size}; use crate::core::{ AccessCtx, AccessEvent, ArcStr, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId, WidgetMut, WidgetPod, }; -use crate::kurbo::{Point, Size}; use crate::theme; use crate::util::{UnitPoint, fill_lin_gradient, stroke}; use crate::widgets::{Label, LineBreaking}; diff --git a/masonry/src/widgets/root_widget.rs b/masonry/src/widgets/root_widget.rs index 23e296bd14..36b095cae0 100644 --- a/masonry/src/widgets/root_widget.rs +++ b/masonry/src/widgets/root_widget.rs @@ -7,14 +7,13 @@ use accesskit::{Node, Role}; use smallvec::{SmallVec, smallvec}; use tracing::{Span, trace_span}; use vello::Scene; -use vello::kurbo::Point; +use vello::kurbo::{Point, Size}; use crate::core::{ AccessCtx, AccessEvent, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, UpdateCtx, Widget, WidgetId, WidgetMut, WidgetPod, }; -use crate::kurbo::Size; use crate::properties::{Background, Padding}; use crate::util::fill; diff --git a/masonry/src/widgets/scroll_bar.rs b/masonry/src/widgets/scroll_bar.rs index 764fe2d82f..f92e506ef7 100644 --- a/masonry/src/widgets/scroll_bar.rs +++ b/masonry/src/widgets/scroll_bar.rs @@ -5,14 +5,13 @@ use accesskit::{Node, Role}; use smallvec::SmallVec; use tracing::{Span, trace_span}; use vello::Scene; -use vello::kurbo::Rect; +use vello::kurbo::{Point, Rect, Size}; use crate::core::{ AccessCtx, AccessEvent, AllowRawMut, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId, WidgetMut, }; -use crate::kurbo::{Point, Size}; use crate::theme; use crate::util::{fill_color, stroke}; use crate::widgets::Axis; diff --git a/masonry/src/widgets/sized_box.rs b/masonry/src/widgets/sized_box.rs index f3f1b02801..50927172a1 100644 --- a/masonry/src/widgets/sized_box.rs +++ b/masonry/src/widgets/sized_box.rs @@ -9,7 +9,7 @@ use accesskit::{Node, Role}; use smallvec::{SmallVec, smallvec}; use tracing::{Span, trace_span, warn}; use vello::Scene; -use vello::kurbo::{Affine, RoundedRectRadii}; +use vello::kurbo::{Affine, Point, RoundedRectRadii, Size}; use vello::peniko::{Brush, Fill}; use crate::core::{ @@ -17,7 +17,6 @@ use crate::core::{ PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, UpdateCtx, Widget, WidgetId, WidgetMut, WidgetPod, }; -use crate::kurbo::{Point, Size}; use crate::properties::{Background, Padding}; use crate::util::stroke; diff --git a/masonry/src/widgets/spinner.rs b/masonry/src/widgets/spinner.rs index dfa9eee4d3..f6afb45914 100644 --- a/masonry/src/widgets/spinner.rs +++ b/masonry/src/widgets/spinner.rs @@ -9,14 +9,13 @@ use accesskit::{Node, Role}; use smallvec::SmallVec; use tracing::{Span, trace_span}; use vello::Scene; -use vello::kurbo::{Affine, Cap, Line, Stroke}; +use vello::kurbo::{Affine, Cap, Line, Point, Size, Stroke, Vec2}; use crate::core::{ AccessCtx, AccessEvent, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId, WidgetMut, }; -use crate::kurbo::{Point, Size, Vec2}; use crate::peniko::Color; use crate::theme; diff --git a/masonry/src/widgets/split.rs b/masonry/src/widgets/split.rs index 2eb2ec9016..8952cf40aa 100644 --- a/masonry/src/widgets/split.rs +++ b/masonry/src/widgets/split.rs @@ -4,21 +4,21 @@ //! A widget which splits an area in two, with a settable ratio, and optional draggable resizing. use accesskit::{Node, Role}; +use cursor_icon::CursorIcon; use smallvec::{SmallVec, smallvec}; use tracing::{Span, trace_span, warn}; use vello::Scene; +use vello::kurbo::{Line, Point, Rect, Size}; use crate::core::{ AccessCtx, AccessEvent, BoxConstraints, EventCtx, FromDynWidget, LayoutCtx, PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Widget, WidgetId, WidgetMut, WidgetPod, }; -use crate::kurbo::{Line, Point, Rect, Size}; use crate::peniko::Color; use crate::theme; use crate::util::{fill_color, stroke}; use crate::widgets::flex::Axis; -use cursor_icon::CursorIcon; /// A container containing two other widgets, splitting the area either horizontally or vertically. /// diff --git a/masonry/src/widgets/tests/safety_rails.rs b/masonry/src/widgets/tests/safety_rails.rs index a4a844b3e8..40fe61f263 100644 --- a/masonry/src/widgets/tests/safety_rails.rs +++ b/masonry/src/widgets/tests/safety_rails.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use smallvec::smallvec; +use vello::kurbo::{Point, Size}; use crate::core::{PointerButton, Update, Widget, WidgetId, WidgetPod}; -use crate::kurbo::{Point, Size}; use crate::testing::{ModularWidget, TestHarness, TestWidgetExt}; use crate::theme::default_property_set; use crate::widgets::Flex; diff --git a/masonry/src/widgets/tests/status_change.rs b/masonry/src/widgets/tests/status_change.rs index 2ac0f50385..62246ae5e0 100644 --- a/masonry/src/widgets/tests/status_change.rs +++ b/masonry/src/widgets/tests/status_change.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use assert_matches::assert_matches; +use vello::kurbo::Vec2; use crate::core::{PointerButton, PointerEvent, Update, WidgetId}; -use crate::kurbo::Vec2; use crate::testing::{ PRIMARY_MOUSE, Record, Recording, TestHarness, TestWidgetExt as _, widget_ids, }; diff --git a/masonry/src/widgets/text_area.rs b/masonry/src/widgets/text_area.rs index dcff900855..259dd901fb 100644 --- a/masonry/src/widgets/text_area.rs +++ b/masonry/src/widgets/text_area.rs @@ -5,6 +5,7 @@ use std::mem::Discriminant; use std::time::Instant; use accesskit::{Node, NodeId, Role}; +use cursor_icon::CursorIcon; use parley::PlainEditor; use parley::editor::{Generation, SplitString}; use parley::layout::Alignment; @@ -20,9 +21,9 @@ use crate::core::{ PointerButton, PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, StyleProperty, TextEvent, Update, UpdateCtx, Widget, WidgetId, WidgetMut, render_text, }; +use crate::debug_panic; use crate::theme::default_text_styles; use crate::{palette, theme}; -use cursor_icon::CursorIcon; /// `TextArea` implements the core of interactive text. /// diff --git a/masonry/src/widgets/variable_label.rs b/masonry/src/widgets/variable_label.rs index 8788cefb32..44f8d78c8f 100644 --- a/masonry/src/widgets/variable_label.rs +++ b/masonry/src/widgets/variable_label.rs @@ -6,6 +6,7 @@ use std::cmp::Ordering; use accesskit::{Node, Role}; +use parley::style::FontWeight; use smallvec::{SmallVec, smallvec}; use tracing::{Span, trace_span}; use vello::Scene; @@ -16,7 +17,6 @@ use crate::core::{ PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, StyleProperty, TextEvent, Update, UpdateCtx, Widget, WidgetId, WidgetMut, WidgetPod, }; -use crate::parley::style::FontWeight; use crate::widgets::Label; /// An `f32` value which can move towards a target value at a linear rate over time. diff --git a/masonry/src/widgets/virtual_scroll.rs b/masonry/src/widgets/virtual_scroll.rs index 08601bc673..18f902f896 100644 --- a/masonry/src/widgets/virtual_scroll.rs +++ b/masonry/src/widgets/virtual_scroll.rs @@ -3,7 +3,8 @@ #![warn(missing_docs)] -use std::{collections::HashMap, ops::Range}; +use std::collections::HashMap; +use std::ops::Range; use vello::kurbo::{Point, Size, Vec2}; @@ -13,6 +14,7 @@ use crate::core::{ PaintCtx, PointerEvent, PropertiesMut, PropertiesRef, RegisterCtx, ScrollDelta, TextEvent, Update, UpdateCtx, Widget, WidgetId, WidgetMut, WidgetPod, }; +use crate::debug_panic; /// The action type sent by the [`VirtualScroll`] widget. /// diff --git a/masonry/src/widgets/zstack.rs b/masonry/src/widgets/zstack.rs index 0257f6357a..2b468ad096 100644 --- a/masonry/src/widgets/zstack.rs +++ b/masonry/src/widgets/zstack.rs @@ -4,13 +4,13 @@ use accesskit::{Node, Role}; use smallvec::SmallVec; use tracing::trace_span; +use vello::Scene; +use vello::kurbo::{Point, Size}; use crate::core::{ AccessCtx, BoxConstraints, LayoutCtx, PaintCtx, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, Widget, WidgetId, WidgetMut, WidgetPod, }; -use crate::kurbo::{Point, Size}; -use crate::vello::Scene; struct Child { widget: WidgetPod, diff --git a/masonry_winit/examples/virtual_fizzbuzz.rs b/masonry_winit/examples/virtual_fizzbuzz.rs index 4b51019666..fe171871b4 100644 --- a/masonry_winit/examples/virtual_fizzbuzz.rs +++ b/masonry_winit/examples/virtual_fizzbuzz.rs @@ -13,7 +13,6 @@ use masonry_winit::app::{AppDriver, DriverCtx}; use masonry_winit::core::{Action, ArcStr, StyleProperty, WidgetId, WidgetPod}; use masonry_winit::dpi::LogicalSize; use masonry_winit::widgets::{Label, RootWidget, VirtualScroll, VirtualScrollAction}; - use winit::window::Window; /// The widget kind contained in the scroll area. This is a type parameter (`W`) of [`VirtualScroll`], diff --git a/masonry_winit/src/event_loop_runner.rs b/masonry_winit/src/event_loop_runner.rs index d020d6ca23..d6bd3f5d94 100644 --- a/masonry_winit/src/event_loop_runner.rs +++ b/masonry_winit/src/event_loop_runner.rs @@ -10,6 +10,7 @@ use masonry::core::DefaultProperties; use masonry::theme::default_property_set; use masonry::util::Instant; use tracing::{debug, error, info, info_span}; +use ui_events_winit::{WindowEventReducer, WindowEventTranslation}; use vello::kurbo::Affine; use vello::util::{RenderContext, RenderSurface}; use vello::{AaSupport, RenderParams, Renderer, RendererOptions, Scene}; @@ -26,7 +27,6 @@ use crate::app::{ }; use crate::core::{TextEvent, Widget, WidgetId, WindowEvent}; use crate::peniko::Color; -use ui_events_winit::{WindowEventReducer, WindowEventTranslation}; #[derive(Debug)] pub enum MasonryUserEvent { diff --git a/xilem/src/view/virtual_scroll.rs b/xilem/src/view/virtual_scroll.rs index 418708d2be..51e875b2a5 100644 --- a/xilem/src/view/virtual_scroll.rs +++ b/xilem/src/view/virtual_scroll.rs @@ -3,10 +3,8 @@ use std::{collections::HashMap, marker::PhantomData, ops::Range}; -use masonry_winit::{ - core::{FromDynWidget, Widget, WidgetPod}, - widgets::{self, VirtualScrollAction}, -}; +use masonry_winit::core::{FromDynWidget, Widget, WidgetPod}; +use masonry_winit::widgets::{self, VirtualScrollAction}; use private::VirtualScrollState; use xilem_core::{AsyncCtx, DynMessage, MessageResult, View, ViewId, ViewMarker, ViewPathTracker};