Compare commits
15 commits
master
...
yoda-wayla
| Author | SHA1 | Date | |
|---|---|---|---|
| de1247123a | |||
| 12fd244e95 | |||
| 756e5691d7 | |||
| 8163993539 | |||
| f487018708 | |||
|
|
6b069b2b4b | ||
|
|
d33d068c17 | ||
|
|
e424487704 | ||
|
|
aa1c2593ac | ||
|
|
8a7a32ff92 | ||
|
|
f388dfdfe4 | ||
|
|
bb9115558d | ||
| f0c0b8d42e | |||
| 8f6be7984a | |||
| e4d6dc1f68 |
60 changed files with 504 additions and 1038 deletions
631
Cargo.lock
generated
631
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
48
Cargo.toml
48
Cargo.toml
|
|
@ -238,10 +238,10 @@ async-std = "1.0"
|
|||
bitflags = "2.5"
|
||||
bytemuck = { version = "1.0", features = ["derive"] }
|
||||
bytes = "1.6"
|
||||
cosmic-text = { git = "https://github.com/pop-os/cosmic-text.git" }
|
||||
cosmic-text = { path = "../../cosmic-text" }
|
||||
# cosmic-text = "0.10"
|
||||
dark-light = "1.0"
|
||||
cryoglyph = { package = "cryoglyph", git = "https://github.com/pop-os/glyphon.git", tag = "cosmic-0.14" }
|
||||
cryoglyph = { package = "cryoglyph", path = "../../glyphon" }
|
||||
resvg = "0.45"
|
||||
web-sys = "0.3.69"
|
||||
guillotiere = "0.6"
|
||||
|
|
@ -275,8 +275,11 @@ tiny-skia = { version = "0.11", default-features = false, features = [
|
|||
"std",
|
||||
"simd",
|
||||
] }
|
||||
cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "160b086" }
|
||||
softbuffer = { git = "https://github.com/pop-os/softbuffer", tag = "cosmic-4.0" }
|
||||
cctk = { path = "../../cosmic-protocols/client-toolkit", package = "cosmic-client-toolkit" }
|
||||
# Yoda: default-features=false drops softbuffer's x11 / x11-dlopen (pulled
|
||||
# tiny-xlib + as-raw-xcb-connection). The wayland + wayland-dlopen features
|
||||
# are re-activated via iced_tiny_skia's own `wayland` feature propagation.
|
||||
softbuffer = { path = "../../softbuffer", default-features = false }
|
||||
syntect = "5.2"
|
||||
tokio = "1.0"
|
||||
tracing = "0.1"
|
||||
|
|
@ -302,13 +305,40 @@ wayland-client = { version = "0.31.5" }
|
|||
winapi = "0.3"
|
||||
# window_clipboard = "0.4.1"
|
||||
|
||||
window_clipboard = { git = "https://github.com/pop-os/window_clipboard.git", tag = "sctk-0.20" }
|
||||
dnd = { git = "https://github.com/pop-os/window_clipboard.git", tag = "sctk-0.20" }
|
||||
mime = { git = "https://github.com/pop-os/window_clipboard.git", tag = "sctk-0.20" }
|
||||
winit = { git = "https://github.com/pop-os/winit.git", tag = "cosmic-0.14" }
|
||||
winit-core = { git = "https://github.com/pop-os/winit.git", tag = "cosmic-0.14" }
|
||||
# Yoda: window_clipboard pinned to our public fork that has x11 gated behind
|
||||
# an opt-in feature. default-features=false + features=["wayland"] drops
|
||||
# clipboard_x11 + x11rb from the build. Branch yoda-x11-optional on
|
||||
# https://forge.aditua.com/leyoda/window_clipboard.
|
||||
window_clipboard = { path = "../../window_clipboard", default-features = false, features = ["wayland"] }
|
||||
dnd = { path = "../../window_clipboard/dnd" }
|
||||
mime = { path = "../../window_clipboard/mime" }
|
||||
# Yoda: default-features = false drops winit's x11 default, which otherwise
|
||||
# pulls winit-x11, x11-dl, tiny-xlib, as-raw-xcb-connection. Our Wayland-only
|
||||
# fork doesn't need any of that — the wayland + wayland-dlopen features are
|
||||
# re-enabled via iced_winit's own feature propagation from libcosmic-yoda.
|
||||
winit = { path = "../../winit/winit", default-features = false }
|
||||
winit-core = { path = "../../winit/winit-core" }
|
||||
cursor-icon = "1.1.0"
|
||||
|
||||
[patch.'https://github.com/pop-os/softbuffer']
|
||||
softbuffer = { path = "../../softbuffer" }
|
||||
|
||||
[patch.'https://github.com/pop-os/smithay-clipboard']
|
||||
smithay-clipboard = { path = "../../smithay-clipboard" }
|
||||
|
||||
[patch.'https://github.com/pop-os/winit.git']
|
||||
dpi = { path = "../../winit/dpi" }
|
||||
winit = { path = "../../winit/winit" }
|
||||
winit-android = { path = "../../winit/winit-android" }
|
||||
winit-appkit = { path = "../../winit/winit-appkit" }
|
||||
winit-common = { path = "../../winit/winit-common" }
|
||||
winit-core = { path = "../../winit/winit-core" }
|
||||
winit-orbital = { path = "../../winit/winit-orbital" }
|
||||
winit-uikit = { path = "../../winit/winit-uikit" }
|
||||
winit-wayland = { path = "../../winit/winit-wayland" }
|
||||
winit-web = { path = "../../winit/winit-web" }
|
||||
winit-win32 = { path = "../../winit/winit-win32" }
|
||||
winit-x11 = { path = "../../winit/winit-x11" }
|
||||
|
||||
[workspace.lints.rust]
|
||||
rust_2018_idioms = { level = "deny", priority = -1 }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::event::{self, Event};
|
||||
use crate::event::Event;
|
||||
use crate::id::Id;
|
||||
use crate::layout;
|
||||
use crate::mouse;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use crate::mouse;
|
|||
use crate::overlay;
|
||||
use crate::renderer;
|
||||
use crate::widget;
|
||||
use crate::{Clipboard, Event, Layout, Overlay, Point, Rectangle, Shell, Size};
|
||||
use crate::{Clipboard, Event, Layout, Overlay, Shell, Size};
|
||||
|
||||
/// An [`Overlay`] container that displays multiple overlay [`overlay::Element`]
|
||||
/// children.
|
||||
|
|
|
|||
|
|
@ -63,13 +63,3 @@ impl Default for Settings {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "winit")]
|
||||
impl From<Settings> for iced_winit::Settings {
|
||||
fn from(settings: Settings) -> iced_winit::Settings {
|
||||
iced_winit::Settings {
|
||||
id: settings.id,
|
||||
fonts: settings.fonts,
|
||||
is_daemon: settings.is_daemon,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use super::Operation;
|
|||
use crate::{
|
||||
Rectangle,
|
||||
id::Id,
|
||||
widget::operation::{Outcome, focusable::Count},
|
||||
widget::operation::Outcome,
|
||||
};
|
||||
|
||||
/// Produces an [`Operation`] that searches for the Id
|
||||
|
|
|
|||
|
|
@ -25,13 +25,12 @@ use crate::layout;
|
|||
use crate::mouse;
|
||||
use crate::renderer;
|
||||
use crate::text::paragraph::{self, Paragraph};
|
||||
use crate::text::{self, Fragment};
|
||||
use crate::text::{self};
|
||||
use crate::widget::tree::{self, Tree};
|
||||
use crate::{
|
||||
Color, Element, Layout, Length, Pixels, Rectangle, Size, Theme, Widget,
|
||||
};
|
||||
|
||||
use std::borrow::Cow;
|
||||
pub use text::{Alignment, Ellipsize, LineHeight, Shaping, Wrapping};
|
||||
|
||||
/// A bunch of text.
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
#[cfg(feature = "image")]
|
||||
use crate::core::Bytes;
|
||||
|
||||
use crate::core::Color;
|
||||
use crate::core::Radians;
|
||||
use crate::core::Rectangle;
|
||||
use crate::core::image;
|
||||
use crate::core::svg;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
//! Access the clipboard.
|
||||
|
||||
use std::any::Any;
|
||||
|
||||
use dnd::{DndDestinationRectangle, DndSurface};
|
||||
use iced_core::clipboard::DndSource;
|
||||
use window_clipboard::mime::{AllowedMimeTypes, AsMimeTypes};
|
||||
use window_clipboard::mime::AllowedMimeTypes;
|
||||
|
||||
use crate::{oneshot, task, Action, Task};
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ pub use task::Task;
|
|||
pub use user_interface::UserInterface;
|
||||
pub use window::Window;
|
||||
|
||||
use crate::core::Color;
|
||||
use crate::futures::futures::channel::oneshot;
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::fmt::Debug;
|
||||
|
||||
use iced_core::{Rectangle, window::Id};
|
||||
use iced_core::window::Id;
|
||||
|
||||
/// activation Actions
|
||||
pub mod activation;
|
||||
|
|
@ -35,8 +35,6 @@ pub enum Action {
|
|||
InhibitShortcuts(bool),
|
||||
/// Rounded corners in logical space
|
||||
RoundedCorners(iced_core::window::Id, Option<CornerRadius>),
|
||||
/// Blur effect for a surface
|
||||
BlurSurface(Id, Option<Vec<Rectangle>>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Default)]
|
||||
|
|
@ -72,11 +70,6 @@ impl Debug for Action {
|
|||
Action::RoundedCorners(id, v) => {
|
||||
f.debug_tuple("RoundedCorners").field(id).field(v).finish()
|
||||
}
|
||||
Action::BlurSurface(id, rectangles) => f
|
||||
.debug_tuple("BlurSurface")
|
||||
.field(id)
|
||||
.field(rectangles)
|
||||
.finish(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
use std::any::Any;
|
||||
use std::fmt;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::sync::Arc;
|
||||
|
||||
use cctk::sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{
|
||||
Anchor, Gravity,
|
||||
};
|
||||
use iced_core::layout::Limits;
|
||||
use iced_core::window::Id;
|
||||
use iced_core::{Element, Rectangle};
|
||||
use iced_core::Rectangle;
|
||||
|
||||
/// Popup creation details
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
|||
|
|
@ -1,14 +1,9 @@
|
|||
use std::any::Any;
|
||||
use std::fmt;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::sync::Arc;
|
||||
|
||||
use cctk::sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{
|
||||
Anchor, Gravity,
|
||||
};
|
||||
use iced_core::layout::Limits;
|
||||
use cctk::sctk::reexports::protocols::xdg::shell::client::xdg_positioner::Gravity;
|
||||
use iced_core::window::Id;
|
||||
use iced_core::{Element, Point, Rectangle, Size};
|
||||
use iced_core::{Point, Rectangle, Size};
|
||||
|
||||
/// Subsurface creation details
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ impl Pipeline {
|
|||
|
||||
let width_scale = bounds.width / image.width() as f32;
|
||||
let height_scale = bounds.height / image.height() as f32;
|
||||
let quality = match filter_method {
|
||||
let _quality = match filter_method {
|
||||
raster::FilterMethod::Linear => tiny_skia::FilterQuality::Bilinear,
|
||||
raster::FilterMethod::Nearest => tiny_skia::FilterQuality::Nearest,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ svg = ["iced_graphics/svg", "resvg/text"]
|
|||
web-colors = ["iced_graphics/web-colors"]
|
||||
webgl = ["wgpu/webgl"]
|
||||
strict-assertions = []
|
||||
# Yoda: opt-in X11 backend. Pulls tiny-xlib/as-raw-xcb-connection/x11rb
|
||||
# (which otherwise were unconditional direct deps on unix). Wayland-only
|
||||
# builds just leave this off — window/x11.rs and the DRI3 device-id
|
||||
# fallback in window/compositor.rs are cfg-gated on it.
|
||||
x11 = ["dep:as-raw-xcb-connection", "dep:tiny-xlib", "dep:x11rb"]
|
||||
|
||||
[dependencies]
|
||||
iced_debug.workspace = true
|
||||
|
|
@ -57,9 +62,9 @@ wayland-protocols.workspace = true
|
|||
wayland-backend = { version = "0.3.3", features = ["client_system"] }
|
||||
wayland-client = { version = "0.31.2" }
|
||||
wayland-sys = { version = "0.31.1", features = ["dlopen"] }
|
||||
as-raw-xcb-connection = "1.0.1"
|
||||
tiny-xlib = "0.2.3"
|
||||
x11rb = { version = "0.13.1", features = [
|
||||
as-raw-xcb-connection = { version = "1.0.1", optional = true }
|
||||
tiny-xlib = { version = "0.2.3", optional = true }
|
||||
x11rb = { version = "0.13.1", optional = true, features = [
|
||||
"allow-unsafe-code",
|
||||
"dl-libxcb",
|
||||
"dri3",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
use crate::core::Radians;
|
||||
use crate::core::{
|
||||
self, Background, Color, Point, Rectangle, Svg, Transformation, renderer,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ pub use geometry::Geometry;
|
|||
|
||||
use crate::core::renderer;
|
||||
use crate::core::{
|
||||
Background, Color, Font, Pixels, Point, Radians, Rectangle, Size,
|
||||
Transformation, Vector, image::FilterMethod,
|
||||
Background, Color, Font, Pixels, Point, Rectangle, Size,
|
||||
Transformation,
|
||||
};
|
||||
use crate::graphics::mesh;
|
||||
use crate::graphics::text::{Editor, Paragraph};
|
||||
|
|
@ -671,50 +671,6 @@ impl Renderer {
|
|||
});
|
||||
}
|
||||
|
||||
fn draw_overlay(
|
||||
&mut self,
|
||||
overlay: &[impl AsRef<str>],
|
||||
viewport: &Viewport,
|
||||
) {
|
||||
use crate::core::Renderer as _;
|
||||
use crate::core::alignment;
|
||||
use crate::core::text::Renderer as _;
|
||||
|
||||
self.with_layer(
|
||||
Rectangle::with_size(viewport.logical_size()),
|
||||
|renderer| {
|
||||
for (i, line) in overlay.iter().enumerate() {
|
||||
let text = crate::core::Text {
|
||||
content: line.as_ref().to_owned(),
|
||||
bounds: viewport.logical_size(),
|
||||
size: Pixels(20.0),
|
||||
line_height: core::text::LineHeight::default(),
|
||||
font: Font::MONOSPACE,
|
||||
align_x: core::text::Alignment::Left,
|
||||
align_y: alignment::Vertical::Top,
|
||||
shaping: core::text::Shaping::Advanced,
|
||||
wrapping: core::text::Wrapping::Word,
|
||||
ellipsize: core::text::Ellipsize::None,
|
||||
};
|
||||
|
||||
renderer.fill_text(
|
||||
text.clone(),
|
||||
Point::new(11.0, 11.0 + 25.0 * i as f32),
|
||||
Color::from_rgba(0.9, 0.9, 0.9, 1.0),
|
||||
Rectangle::with_size(Size::INFINITE),
|
||||
);
|
||||
|
||||
renderer.fill_text(
|
||||
text,
|
||||
Point::new(11.0, 11.0 + 25.0 * i as f32)
|
||||
+ Vector::new(-1.0, -1.0),
|
||||
Color::BLACK,
|
||||
Rectangle::with_size(Size::INFINITE),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
impl core::Renderer for Renderer {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ pub mod compositor;
|
|||
not(target_os = "redox")
|
||||
))]
|
||||
mod wayland;
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos"), not(target_os = "redox")))]
|
||||
mod x11;
|
||||
|
||||
pub use compositor::Compositor;
|
||||
|
|
|
|||
|
|
@ -16,9 +16,8 @@ use crate::{Engine, Renderer};
|
|||
not(target_os = "redox")
|
||||
))]
|
||||
use super::wayland::get_wayland_device_ids;
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos"), not(target_os = "redox")))]
|
||||
use super::x11::get_x11_device_ids;
|
||||
use std::future::Future;
|
||||
|
||||
/// A window graphics backend for iced powered by `wgpu`.
|
||||
pub struct Compositor {
|
||||
|
|
@ -72,8 +71,10 @@ impl Compositor {
|
|||
not(target_os = "redox")
|
||||
))]
|
||||
let ids = compatible_window.as_ref().and_then(|window| {
|
||||
get_wayland_device_ids(window)
|
||||
.or_else(|| get_x11_device_ids(window))
|
||||
let w = get_wayland_device_ids(window);
|
||||
#[cfg(feature = "x11")]
|
||||
let w = w.or_else(|| get_x11_device_ids(window));
|
||||
w
|
||||
});
|
||||
|
||||
// HACK:
|
||||
|
|
@ -137,12 +138,6 @@ impl Compositor {
|
|||
.clone()
|
||||
.and_then(|window| instance.create_surface(window).ok());
|
||||
|
||||
let mut adapter_options = wgpu::RequestAdapterOptions {
|
||||
power_preference: wgpu::PowerPreference::from_env()
|
||||
.unwrap_or(wgpu::PowerPreference::HighPerformance),
|
||||
compatible_surface: compatible_surface.as_ref(),
|
||||
force_fallback_adapter: false,
|
||||
};
|
||||
let mut adapter = None;
|
||||
#[cfg_attr(not(unix), allow(dead_code))]
|
||||
if std::env::var_os("WGPU_ADAPTER_NAME").is_none() {
|
||||
|
|
@ -204,7 +199,7 @@ impl Compositor {
|
|||
.await;
|
||||
compatible_surface = compatible_window
|
||||
.and_then(|window| instance.create_surface(window).ok());
|
||||
adapter_options = wgpu::RequestAdapterOptions {
|
||||
let adapter_options = wgpu::RequestAdapterOptions {
|
||||
power_preference: wgpu::PowerPreference::from_env()
|
||||
.unwrap_or(wgpu::PowerPreference::HighPerformance),
|
||||
compatible_surface: compatible_surface.as_ref(),
|
||||
|
|
|
|||
|
|
@ -599,7 +599,7 @@ where
|
|||
(x + width) as f64,
|
||||
(y + height) as f64,
|
||||
);
|
||||
let is_hovered = state.state.downcast_ref::<State>().is_hovered;
|
||||
let _is_hovered = state.state.downcast_ref::<State>().is_hovered;
|
||||
|
||||
let mut node = Node::new(Role::Button);
|
||||
node.add_action(Action::Focus);
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ where
|
|||
};
|
||||
|
||||
let bounds = layout.bounds();
|
||||
let is_hovered = cursor.is_over(bounds);
|
||||
let _is_hovered = cursor.is_over(bounds);
|
||||
let Rectangle {
|
||||
x,
|
||||
y,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ use crate::core::{
|
|||
color,
|
||||
};
|
||||
|
||||
use iced_runtime::{Action, Task, task};
|
||||
use iced_runtime::{Task, task};
|
||||
|
||||
/// A widget that aligns its contents inside of its boundaries.
|
||||
///
|
||||
|
|
@ -601,7 +601,7 @@ pub fn visible_bounds(id: Id) -> Task<Option<Rectangle>> {
|
|||
operate: &mut dyn FnMut(&mut dyn Operation<Option<Rectangle>>),
|
||||
) {
|
||||
self.depth += 1;
|
||||
self.traverse(operate);
|
||||
operate(self);
|
||||
self.depth -= 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -293,8 +293,8 @@ fn drawing_bounds<Renderer, Handle>(
|
|||
content_fit: ContentFit,
|
||||
rotation: Rotation,
|
||||
scale: f32,
|
||||
opacity: f32,
|
||||
border_radius: [f32; 4],
|
||||
_opacity: f32,
|
||||
_border_radius: [f32; 4],
|
||||
) -> Rectangle
|
||||
where
|
||||
Renderer: image::Renderer<Handle = Handle>,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
//! Keyed columns distribute content vertically while keeping continuity.
|
||||
//! Distribute content vertically.
|
||||
|
||||
use crate::core::event;
|
||||
use crate::core::layout;
|
||||
use crate::core::mouse;
|
||||
use crate::core::overlay;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ pub mod component;
|
|||
|
||||
#[allow(deprecated)]
|
||||
pub use component::Component;
|
||||
use iced_renderer::core::widget::Operation;
|
||||
|
||||
mod cache;
|
||||
|
||||
|
|
@ -15,7 +14,7 @@ use crate::core::mouse;
|
|||
use crate::core::overlay;
|
||||
use crate::core::renderer;
|
||||
use crate::core::widget::tree::{self, Tree};
|
||||
use crate::core::widget::{self, Widget};
|
||||
use crate::core::widget::Widget;
|
||||
use crate::core::{
|
||||
self, Clipboard, Event, Length, Rectangle, Shell, Size, Vector,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ use crate::core::{
|
|||
self, Clipboard, Element, Length, Rectangle, Shell, Size, Vector, Widget,
|
||||
};
|
||||
|
||||
use iced_renderer::core::widget::Operation;
|
||||
use ouroboros::self_referencing;
|
||||
use std::cell::RefCell;
|
||||
use std::marker::PhantomData;
|
||||
|
|
@ -527,11 +526,11 @@ where
|
|||
renderer: &Renderer,
|
||||
dnd_rectangles: &mut core::clipboard::DndDestinationRectangles,
|
||||
) {
|
||||
let mut tree = tree
|
||||
let tree = tree
|
||||
.state
|
||||
.downcast_ref::<Rc<RefCell<Option<Tree>>>>()
|
||||
.borrow_mut();
|
||||
let mut tree = tree.as_ref().unwrap();
|
||||
let tree = tree.as_ref().unwrap();
|
||||
self.with_element(|element| {
|
||||
element.as_widget().drag_destinations(
|
||||
&tree.children[0],
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#![allow(missing_docs)]
|
||||
use crate::core::event::{self, Event};
|
||||
use crate::core::event::Event;
|
||||
use crate::core::layout;
|
||||
use crate::core::mouse;
|
||||
use crate::core::overlay;
|
||||
|
|
@ -366,7 +366,7 @@ where
|
|||
self.visible_elements
|
||||
.iter_mut()
|
||||
.zip(&mut state.visible_layouts)
|
||||
.map(|(element, (index, layout, tree))| {
|
||||
.for_each(|(element, (index, layout, tree))| {
|
||||
element.as_widget_mut().update(
|
||||
tree,
|
||||
event,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
use iced_renderer::core::mouse::Click;
|
||||
|
||||
use crate::core::event;
|
||||
use crate::core::layout;
|
||||
use crate::core::mouse;
|
||||
use crate::core::overlay;
|
||||
|
|
|
|||
|
|
@ -575,7 +575,7 @@ where
|
|||
align_x: text::Alignment::Default,
|
||||
align_y: alignment::Vertical::Center,
|
||||
shaping: self.text_shaping,
|
||||
wrapping: text::Wrapping::default(),
|
||||
wrapping: self.text_wrap,
|
||||
ellipsize: text::Ellipsize::default(),
|
||||
},
|
||||
Point::new(bounds.x + self.padding.left, bounds.center_y()),
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use crate::core::renderer;
|
|||
use crate::core::widget::{self, Tree};
|
||||
use crate::core::{
|
||||
self, Clipboard, Element, Event, Layout, Point, Rectangle, Shell, Size,
|
||||
Vector, event,
|
||||
Vector,
|
||||
};
|
||||
use crate::pane_grid::{Draggable, TitleBar};
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ use iced_runtime::core::widget::Id;
|
|||
#[cfg(feature = "a11y")]
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::core::event;
|
||||
use crate::core::keyboard;
|
||||
use crate::core::layout;
|
||||
use crate::core::mouse;
|
||||
|
|
@ -933,7 +932,7 @@ where
|
|||
|
||||
let had_input_method = shell.input_method().is_enabled();
|
||||
|
||||
let mut c_event = match event.clone() {
|
||||
let c_event = match event.clone() {
|
||||
Event::Dnd(dnd::DndEvent::Offer(
|
||||
id,
|
||||
dnd::OfferEvent::Enter {
|
||||
|
|
@ -1586,7 +1585,7 @@ where
|
|||
return A11yTree::default();
|
||||
}
|
||||
let window = layout.bounds();
|
||||
let is_hovered = cursor.is_over(window);
|
||||
let _is_hovered = cursor.is_over(window);
|
||||
let Rectangle {
|
||||
x,
|
||||
y,
|
||||
|
|
@ -1670,7 +1669,7 @@ where
|
|||
}))
|
||||
{
|
||||
let scrollbar_bounds = scrollbar.total_bounds;
|
||||
let is_hovered = cursor.is_over(scrollbar_bounds);
|
||||
let _is_hovered = cursor.is_over(scrollbar_bounds);
|
||||
let Rectangle {
|
||||
x,
|
||||
y,
|
||||
|
|
|
|||
|
|
@ -695,7 +695,7 @@ where
|
|||
};
|
||||
|
||||
let bounds = layout.bounds();
|
||||
let is_hovered = cursor.is_over(bounds);
|
||||
let _is_hovered = cursor.is_over(bounds);
|
||||
let Rectangle {
|
||||
x,
|
||||
y,
|
||||
|
|
@ -732,18 +732,14 @@ where
|
|||
node.set_labelled_by(label.clone());
|
||||
}
|
||||
|
||||
if let Ok(min) = self.range.start().clone().try_into() {
|
||||
node.set_min_numeric_value(min);
|
||||
}
|
||||
if let Ok(max) = self.range.end().clone().try_into() {
|
||||
node.set_max_numeric_value(max);
|
||||
}
|
||||
if let Ok(value) = self.value.clone().try_into() {
|
||||
node.set_numeric_value(value);
|
||||
}
|
||||
if let Ok(step) = self.step.clone().try_into() {
|
||||
node.set_numeric_value_step(step);
|
||||
}
|
||||
let Ok(min) = self.range.start().clone().try_into();
|
||||
node.set_min_numeric_value(min);
|
||||
let Ok(max) = self.range.end().clone().try_into();
|
||||
node.set_max_numeric_value(max);
|
||||
let Ok(value) = self.value.clone().try_into();
|
||||
node.set_numeric_value(value);
|
||||
let Ok(step) = self.step.clone().try_into();
|
||||
node.set_numeric_value_step(step);
|
||||
|
||||
// TODO: This could be a setting on the slider
|
||||
node.set_live(iced_accessibility::accesskit::Live::Polite);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
//! Display content on top of other content.
|
||||
|
||||
use crate::core::event;
|
||||
use crate::core::layout;
|
||||
use crate::core::mouse;
|
||||
use crate::core::overlay;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ use crate::core::{
|
|||
|
||||
#[cfg(feature = "a11y")]
|
||||
use std::borrow::Cow;
|
||||
use std::marker::PhantomData;
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub use crate::core::svg::Handle;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use crate::container;
|
||||
|
||||
use crate::core::event;
|
||||
use crate::core::layout;
|
||||
use crate::core::mouse;
|
||||
use crate::core::overlay;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ use std::borrow::Cow;
|
|||
use iced_runtime::core::border::Radius;
|
||||
|
||||
use crate::core::alignment;
|
||||
use crate::core::border;
|
||||
use crate::core::layout;
|
||||
use crate::core::mouse;
|
||||
use crate::core::renderer;
|
||||
|
|
@ -509,7 +508,7 @@ where
|
|||
|
||||
let space = style.handle_margin;
|
||||
|
||||
let toggler_background_bounds = Rectangle {
|
||||
let _toggler_background_bounds = Rectangle {
|
||||
x: bounds.x,
|
||||
y: bounds.y,
|
||||
width: bounds.width,
|
||||
|
|
@ -529,7 +528,7 @@ where
|
|||
style.background,
|
||||
);
|
||||
|
||||
let padding = (style.padding_ratio * bounds.height).round();
|
||||
let _padding = (style.padding_ratio * bounds.height).round();
|
||||
let toggler_foreground_bounds = Rectangle {
|
||||
x: bounds.x
|
||||
+ if self.is_toggled {
|
||||
|
|
@ -570,7 +569,7 @@ where
|
|||
};
|
||||
|
||||
let bounds = layout.bounds();
|
||||
let is_hovered = cursor.is_over(bounds);
|
||||
let _is_hovered = cursor.is_over(bounds);
|
||||
let Rectangle {
|
||||
x,
|
||||
y,
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ cctk = [
|
|||
"xkeysym",
|
||||
"dep:cctk",
|
||||
]
|
||||
# Prevents multiple separate process instances.
|
||||
single-instance = []
|
||||
|
||||
|
||||
[dependencies]
|
||||
|
|
|
|||
|
|
@ -4,11 +4,10 @@ use crate::futures::futures::channel::mpsc;
|
|||
use iced_accessibility::accesskit::{
|
||||
ActivationHandler, Node, NodeId, Role, Tree, TreeId, TreeUpdate,
|
||||
};
|
||||
use iced_accessibility::accesskit_winit::Adapter;
|
||||
use iced_runtime::core;
|
||||
|
||||
pub struct WinitActivationHandler {
|
||||
pub proxy: mpsc::UnboundedSender<Control>,
|
||||
pub(crate) proxy: mpsc::UnboundedSender<Control>,
|
||||
pub title: String,
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +33,7 @@ impl ActivationHandler for WinitActivationHandler {
|
|||
|
||||
pub struct WinitActionHandler {
|
||||
pub id: core::window::Id,
|
||||
pub proxy: mpsc::UnboundedSender<Control>,
|
||||
pub(crate) proxy: mpsc::UnboundedSender<Control>,
|
||||
}
|
||||
|
||||
impl iced_accessibility::accesskit::ActionHandler for WinitActionHandler {
|
||||
|
|
@ -49,7 +48,7 @@ impl iced_accessibility::accesskit::ActionHandler for WinitActionHandler {
|
|||
}
|
||||
|
||||
pub struct WinitDeactivationHandler {
|
||||
pub proxy: mpsc::UnboundedSender<Control>,
|
||||
pub(crate) proxy: mpsc::UnboundedSender<Control>,
|
||||
}
|
||||
|
||||
impl iced_accessibility::accesskit::DeactivationHandler
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ const DRAG_RESIZE_SUPPORTED: bool = false;
|
|||
|
||||
/// If supported by winit, returns a closure that implements cursor resize support.
|
||||
pub fn event_func(
|
||||
window: &dyn winit::window::Window,
|
||||
_window: &dyn winit::window::Window,
|
||||
border_size: f64,
|
||||
) -> Option<
|
||||
Box<
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//! Access the clipboard.
|
||||
|
||||
use std::sync::Mutex;
|
||||
use std::{any::Any, borrow::Cow};
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::Control;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
//! [`winit`]: https://github.com/rust-windowing/winit
|
||||
//! [`iced_runtime`]: https://github.com/iced-rs/iced/tree/0.14/runtime
|
||||
use crate::core::input_method;
|
||||
use std::hash::DefaultHasher;
|
||||
use std::hash::Hash;
|
||||
use std::hash::Hasher;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::core::keyboard;
|
||||
|
|
@ -14,7 +11,6 @@ use crate::core::theme;
|
|||
use crate::core::touch;
|
||||
use crate::core::window;
|
||||
use crate::core::{Event, Point, Size};
|
||||
use iced_futures::core::event::PlatformSpecific;
|
||||
use winit::dpi::PhysicalPosition;
|
||||
use winit::event::ButtonSource;
|
||||
use winit::event::ElementState;
|
||||
|
|
@ -27,7 +23,7 @@ use winit::keyboard::SmolStr;
|
|||
pub fn window_attributes(
|
||||
settings: window::Settings,
|
||||
title: &str,
|
||||
scale_factor: f64,
|
||||
_scale_factor: f64,
|
||||
primary_monitor: Option<winit::monitor::MonitorHandle>,
|
||||
_id: Option<String>,
|
||||
) -> winit::window::WindowAttributes {
|
||||
|
|
@ -178,7 +174,7 @@ pub fn window_attributes(
|
|||
),
|
||||
));
|
||||
}
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
{
|
||||
use winit::platform::wayland::WindowAttributesWayland;
|
||||
|
||||
|
|
@ -396,8 +392,8 @@ pub fn window_event(
|
|||
Ime::Commit(content) => input_method::Event::Commit(content),
|
||||
Ime::Disabled => input_method::Event::Closed,
|
||||
Ime::DeleteSurrounding {
|
||||
before_bytes,
|
||||
after_bytes,
|
||||
before_bytes: _,
|
||||
after_bytes: _,
|
||||
} => todo!(),
|
||||
})),
|
||||
WindowEvent::Focused(focused) => Some(Event::Window(if focused {
|
||||
|
|
@ -411,7 +407,7 @@ pub fn window_event(
|
|||
WindowEvent::DragDropped { paths, .. } => {
|
||||
Some(Event::Window(window::Event::FileDropped(paths.clone())))
|
||||
}
|
||||
WindowEvent::DragLeft { position } => {
|
||||
WindowEvent::DragLeft { position: _ } => {
|
||||
Some(Event::Window(window::Event::FilesHoveredLeft))
|
||||
}
|
||||
|
||||
|
|
@ -642,10 +638,6 @@ pub fn mouse_interaction(
|
|||
Interaction::AllScroll => winit_core::cursor::CursorIcon::AllScroll,
|
||||
Interaction::ZoomIn => winit_core::cursor::CursorIcon::ZoomIn,
|
||||
Interaction::ZoomOut => winit_core::cursor::CursorIcon::ZoomOut,
|
||||
Interaction::Cell => winit_core::cursor::CursorIcon::Cell,
|
||||
Interaction::Move => winit_core::cursor::CursorIcon::Move,
|
||||
Interaction::Copy => winit_core::cursor::CursorIcon::Copy,
|
||||
Interaction::Help => winit_core::cursor::CursorIcon::Help,
|
||||
Interaction::Hidden => {
|
||||
return None;
|
||||
}
|
||||
|
|
@ -704,10 +696,10 @@ enum TouchInternal {
|
|||
///
|
||||
/// [`winit`]: https://github.com/rust-windowing/winit
|
||||
/// [`iced`]: https://github.com/iced-rs/iced/tree/0.12
|
||||
pub fn touch_event(
|
||||
fn touch_event(
|
||||
finger: FingerId,
|
||||
state: TouchInternal,
|
||||
force: Option<Force>,
|
||||
_force: Option<Force>,
|
||||
position: Option<PhysicalPosition<f64>>,
|
||||
scale_factor: f64,
|
||||
) -> touch::Event {
|
||||
|
|
@ -1081,6 +1073,7 @@ pub fn physical_key(
|
|||
///
|
||||
/// [`winit`]: https://github.com/rust-windowing/winit
|
||||
/// [`iced`]: https://github.com/iced-rs/iced/tree/0.12
|
||||
#[allow(deprecated)] // KeyCode::Super/Hyper/Turbo: legacy spec, no Meta variant in this enum
|
||||
pub fn key_code(
|
||||
key_code: winit::keyboard::KeyCode,
|
||||
) -> Option<keyboard::key::Code> {
|
||||
|
|
@ -1285,6 +1278,7 @@ pub fn key_code(
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(deprecated)] // KeyCode::Super/Hyper/Turbo: legacy spec, no Meta variant in this enum
|
||||
pub fn winit_key_code(
|
||||
key_code: keyboard::key::Code,
|
||||
) -> Option<winit::keyboard::KeyCode> {
|
||||
|
|
@ -1595,7 +1589,10 @@ pub fn resize_direction(
|
|||
}
|
||||
}
|
||||
|
||||
// Fields are passed through to winit via `IconProvider: AsAny` for potential
|
||||
// downcast; they are not read directly here.
|
||||
#[derive(Debug)]
|
||||
#[allow(dead_code)]
|
||||
pub struct RawImage(Vec<u8>, Size<u32>);
|
||||
impl IconProvider for RawImage {}
|
||||
impl From<RawImage> for winit_core::icon::Icon {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ mod window;
|
|||
pub use clipboard::Clipboard;
|
||||
pub use error::Error;
|
||||
pub use proxy::Proxy;
|
||||
use winit::dpi::LogicalSize;
|
||||
use winit::dpi::PhysicalPosition;
|
||||
use winit::dpi::PhysicalSize;
|
||||
|
||||
|
|
@ -158,7 +157,8 @@ where
|
|||
|
||||
let (boot_sender, boot_receiver) = oneshot::channel();
|
||||
let (control_sender, control_receiver) = mpsc::unbounded();
|
||||
let (system_theme_sender, system_theme_receiver) = oneshot::channel();
|
||||
// Sender side currently not wired to a producer; receiver gets default.
|
||||
let (_system_theme_sender, system_theme_receiver) = oneshot::channel();
|
||||
|
||||
let instance = Box::pin(run_instance::<P>(
|
||||
program,
|
||||
|
|
@ -179,9 +179,6 @@ where
|
|||
|
||||
struct BootConfig {
|
||||
sender: oneshot::Sender<()>,
|
||||
fonts: Vec<Cow<'static, [u8]>>,
|
||||
graphics_settings: graphics::Settings,
|
||||
is_wayland: bool,
|
||||
}
|
||||
struct Runner<Message: 'static, F> {
|
||||
instance: std::pin::Pin<Box<F>>,
|
||||
|
|
@ -191,9 +188,9 @@ where
|
|||
sender: mpsc::UnboundedSender<Event<Message>>,
|
||||
receiver: mpsc::UnboundedReceiver<Control>,
|
||||
error: Option<Error>,
|
||||
system_theme: Option<oneshot::Sender<theme::Mode>>,
|
||||
#[cfg(feature = "a11y")]
|
||||
control_sender: mpsc::UnboundedSender<Control>,
|
||||
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
adapters: std::collections::HashMap<window::Id, (u64, iced_accessibility::accesskit_winit::Adapter)>,
|
||||
|
||||
|
|
@ -208,16 +205,13 @@ where
|
|||
context,
|
||||
boot: Some(BootConfig {
|
||||
sender: boot_sender,
|
||||
fonts: settings.fonts,
|
||||
graphics_settings,
|
||||
is_wayland,
|
||||
}),
|
||||
id: settings.id,
|
||||
sender: event_sender,
|
||||
receiver: control_receiver,
|
||||
#[cfg(feature = "a11y")]
|
||||
control_sender: control_sender.clone(),
|
||||
error: None,
|
||||
system_theme: Some(system_theme_sender),
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
adapters: Default::default(),
|
||||
|
|
@ -320,12 +314,7 @@ where
|
|||
event_loop: &dyn winit::event_loop::ActiveEventLoop,
|
||||
) {
|
||||
// create initial window
|
||||
let Some(BootConfig {
|
||||
sender,
|
||||
fonts,
|
||||
graphics_settings,
|
||||
is_wayland,
|
||||
}) = self.boot.take()
|
||||
let Some(BootConfig { sender }) = self.boot.take()
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
|
@ -363,6 +352,8 @@ where
|
|||
where
|
||||
F: Future<Output = ()>,
|
||||
{
|
||||
// TODO(yoda): migrate try_next → try_recv (futures-channel API change).
|
||||
#[allow(deprecated)]
|
||||
fn process_event(
|
||||
&mut self,
|
||||
event_loop: &dyn winit::event_loop::ActiveEventLoop,
|
||||
|
|
@ -636,10 +627,7 @@ where
|
|||
#[cfg(feature = "a11y")]
|
||||
fn init_adapter(&mut self, event_loop: &(dyn winit::event_loop::ActiveEventLoop + 'static), id: core::window::Id, window: Arc<dyn winit::window::Window + 'static>) {
|
||||
use crate::a11y::*;
|
||||
use iced_accessibility::accesskit::{
|
||||
ActivationHandler, Node, NodeId, Role,
|
||||
Tree, TreeUpdate,
|
||||
};
|
||||
|
||||
use iced_accessibility::accesskit_winit::Adapter;
|
||||
|
||||
let node_id =
|
||||
|
|
@ -693,6 +681,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(hidden_glob_reexports)] // intentional: internal Event shadows winit::event::Event from `pub use winit`
|
||||
enum Event<Message: 'static> {
|
||||
WindowCreated {
|
||||
id: window::Id,
|
||||
|
|
@ -800,9 +789,6 @@ async fn run_instance<P>(
|
|||
> = None;
|
||||
let mut dnd_surface_id: Option<window::Id> = None;
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
let mut a11y_enabled = false;
|
||||
|
||||
#[cfg(all(feature = "linux-theme-detection", target_os = "linux"))]
|
||||
let mut system_theme = {
|
||||
let to_mode = |color_scheme| match color_scheme {
|
||||
|
|
@ -1395,7 +1381,6 @@ async fn run_instance<P>(
|
|||
}
|
||||
|
||||
let mut uis_stale = false;
|
||||
let mut resized = false;
|
||||
for (id, window) in window_manager.iter_mut() {
|
||||
if skip && !window.resize_enabled {
|
||||
continue;
|
||||
|
|
@ -1448,7 +1433,6 @@ async fn run_instance<P>(
|
|||
// FIXME what to do when we are stuck in a configure event/resize request loop
|
||||
// We don't have control over how winit handles this.
|
||||
window.resize_enabled = true;
|
||||
resized = true;
|
||||
needs_redraw = true;
|
||||
let s = winit::dpi::Size::Logical(
|
||||
requested_size.cast(),
|
||||
|
|
@ -1663,8 +1647,8 @@ async fn run_instance<P>(
|
|||
events.push((Some(id), conversion::a11y(action_request)));
|
||||
}
|
||||
#[cfg(feature = "a11y")]
|
||||
Event::AccessibilityEnabled(enabled) => {
|
||||
a11y_enabled = enabled;
|
||||
Event::AccessibilityEnabled(_enabled) => {
|
||||
// a11y enable signal currently unused at this layer
|
||||
}
|
||||
Event::PlatformSpecific(e) => {
|
||||
crate::platform_specific::handle_event(
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
//! Wayland specific shell
|
||||
//!
|
||||
|
||||
use std::{borrow::Cow, collections::HashMap, sync::Arc};
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
use cctk::sctk::reexports::client::Connection;
|
||||
use iced_graphics::{Compositor, compositor};
|
||||
use iced_graphics::compositor;
|
||||
use iced_runtime::{
|
||||
core::{Vector, window},
|
||||
platform_specific, user_interface,
|
||||
core::{Vector, window}, user_interface,
|
||||
};
|
||||
use winit::raw_window_handle::HasWindowHandle;
|
||||
|
||||
|
|
@ -17,8 +14,6 @@ pub mod wayland;
|
|||
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
pub use wayland::*;
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
use wayland_backend::client::Backend;
|
||||
|
||||
use crate::{CreateCompositor, Program, WindowManager};
|
||||
|
||||
|
|
@ -153,9 +148,12 @@ impl PlatformSpecific {
|
|||
) -> Option<Box<dyn HasWindowHandle + Send + Sync + 'static>> {
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
{
|
||||
return self.wayland.create_surface();
|
||||
self.wayland.create_surface()
|
||||
}
|
||||
#[cfg(not(all(feature = "cctk", target_os = "linux")))]
|
||||
{
|
||||
None
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub(crate) fn update_surface_shm(
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
/// Set by the user callback given to the [`EventLoop::run`] method.
|
||||
///
|
||||
/// Indicates the desired behavior of the event loop after [`Event::RedrawEventsCleared`] is emitted.
|
||||
///
|
||||
/// Defaults to [`Poll`].
|
||||
///
|
||||
/// ## Persistency
|
||||
///
|
||||
/// Almost every change is persistent between multiple calls to the event loop closure within a
|
||||
/// given run loop. The only exception to this is [`ExitWithCode`] which, once set, cannot be unset.
|
||||
/// Changes are **not** persistent between multiple calls to `run_return` - issuing a new call will
|
||||
/// reset the control flow to [`Poll`].
|
||||
///
|
||||
/// [`ExitWithCode`]: Self::ExitWithCode
|
||||
/// [`Poll`]: Self::Poll
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum ControlFlow {
|
||||
/// When the current loop iteration finishes, immediately begin a new iteration regardless of
|
||||
/// whether or not new events are available to process.
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
/// - **Web:** Events are queued and usually sent when `requestAnimationFrame` fires but sometimes
|
||||
/// the events in the queue may be sent before the next `requestAnimationFrame` callback, for
|
||||
/// example when the scaling of the page has changed. This should be treated as an implementation
|
||||
/// detail which should not be relied on.
|
||||
Poll,
|
||||
/// When the current loop iteration finishes, suspend the thread until another event arrives.
|
||||
Wait,
|
||||
/// When the current loop iteration finishes, suspend the thread until either another event
|
||||
/// arrives or the given time is reached.
|
||||
///
|
||||
/// Useful for implementing efficient timers. Applications which want to render at the display's
|
||||
/// native refresh rate should instead use [`Poll`] and the VSync functionality of a graphics API
|
||||
/// to reduce odds of missed frames.
|
||||
///
|
||||
/// [`Poll`]: Self::Poll
|
||||
WaitUntil(std::time::Instant),
|
||||
/// Send a [`LoopDestroyed`] event and stop the event loop. This variant is *sticky* - once set,
|
||||
/// `control_flow` cannot be changed from `ExitWithCode`, and any future attempts to do so will
|
||||
/// result in the `control_flow` parameter being reset to `ExitWithCode`.
|
||||
///
|
||||
/// The contained number will be used as exit code. The [`Exit`] constant is a shortcut for this
|
||||
/// with exit code 0.
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
/// - **Android / iOS / WASM:** The supplied exit code is unused.
|
||||
/// - **Unix:** On most Unix-like platforms, only the 8 least significant bits will be used,
|
||||
/// which can cause surprises with negative exit values (`-42` would end up as `214`). See
|
||||
/// [`std::process::exit`].
|
||||
///
|
||||
/// [`LoopDestroyed`]: Event::LoopDestroyed
|
||||
/// [`Exit`]: ControlFlow::Exit
|
||||
ExitWithCode(i32),
|
||||
}
|
||||
|
|
@ -1,16 +1,9 @@
|
|||
pub mod control_flow;
|
||||
pub mod proxy;
|
||||
pub mod state;
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
use crate::platform_specific::SurfaceIdWrapper;
|
||||
use crate::{
|
||||
Control,
|
||||
futures::futures::channel::mpsc,
|
||||
handlers::{
|
||||
ext_background_effect, overlap::OverlapNotifyV1,
|
||||
text_input::TextInputManager,
|
||||
},
|
||||
handlers::{overlap::OverlapNotifyV1, text_input::TextInputManager},
|
||||
platform_specific::wayland::{
|
||||
handlers::{
|
||||
wp_fractional_scaling::FractionalScalingManager,
|
||||
|
|
@ -33,7 +26,7 @@ use cctk::{
|
|||
reexports::{
|
||||
calloop::{self, EventLoop},
|
||||
client::{
|
||||
ConnectError, Connection, Proxy, globals::registry_queue_init,
|
||||
Connection, Proxy, globals::registry_queue_init,
|
||||
},
|
||||
},
|
||||
registry::RegistryState,
|
||||
|
|
@ -46,8 +39,6 @@ use cctk::{
|
|||
};
|
||||
use raw_window_handle::HasDisplayHandle;
|
||||
use state::{FrameStatus, SctkWindow, send_event};
|
||||
#[cfg(feature = "a11y")]
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
fmt::Debug,
|
||||
|
|
@ -71,8 +62,8 @@ pub struct SctkEventLoop {
|
|||
pub(crate) state: SctkState,
|
||||
}
|
||||
|
||||
#[allow(dead_code)] // payloads kept for Debug; not inspected programmatically
|
||||
pub enum Error {
|
||||
Connect(ConnectError),
|
||||
Calloop(calloop::Error),
|
||||
Global(GlobalError),
|
||||
NoDisplayHandle,
|
||||
|
|
@ -349,26 +340,26 @@ impl SctkEventLoop {
|
|||
&qh,
|
||||
),
|
||||
corner_radius_manager: registry_state.bind_one::<CosmicCornerRadiusManagerV1, _, _>(
|
||||
&qh,
|
||||
1..=1,
|
||||
(),
|
||||
).ok(),
|
||||
&qh,
|
||||
1..=1,
|
||||
(),
|
||||
).ok(),
|
||||
toplevel_manager: ToplevelManagerState::try_new(
|
||||
®istry_state,
|
||||
&qh,
|
||||
),
|
||||
inhibitor_manager: registry_state.bind_one::<zwp_keyboard_shortcuts_inhibit_manager_v1::ZwpKeyboardShortcutsInhibitManagerV1, _, _>(
|
||||
&qh,
|
||||
1..=1,
|
||||
(),
|
||||
).ok(),
|
||||
inhibitor_manager: registry_state.bind_one::<zwp_keyboard_shortcuts_inhibit_manager_v1::ZwpKeyboardShortcutsInhibitManagerV1, _, _>(
|
||||
&qh,
|
||||
1..=1,
|
||||
(),
|
||||
).ok(),
|
||||
text_input_manager: TextInputManager::try_new(®istry_state, &qh),
|
||||
ext_background_effect_manager: ext_background_effect::ExtBackgroundEffectManager::new(&globals, &qh).ok(),
|
||||
registry_state,
|
||||
|
||||
queue_handle: qh,
|
||||
loop_handle,
|
||||
|
||||
|
||||
inhibitor: None,
|
||||
inhibited: false,
|
||||
_cursor_surface: None,
|
||||
|
|
@ -376,7 +367,6 @@ impl SctkEventLoop {
|
|||
outputs: Vec::new(),
|
||||
seats: Vec::new(),
|
||||
windows: Vec::new(),
|
||||
blur_surfaces: HashMap::new(),
|
||||
layer_surfaces: Vec::new(),
|
||||
popups: Vec::new(),
|
||||
lock_surfaces: Vec::new(),
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
use cctk::sctk::reexports::calloop;
|
||||
use iced_futures::futures::{
|
||||
channel::mpsc,
|
||||
task::{Context, Poll},
|
||||
Sink,
|
||||
};
|
||||
use std::pin::Pin;
|
||||
|
||||
/// An event loop proxy that implements `Sink`.
|
||||
#[derive(Debug)]
|
||||
pub struct Proxy<Message: 'static> {
|
||||
raw: calloop::channel::Sender<Message>,
|
||||
}
|
||||
|
||||
impl<Message: 'static> Clone for Proxy<Message> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
raw: self.raw.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<Message: 'static> Proxy<Message> {
|
||||
/// Creates a new [`Proxy`] from an `EventLoopProxy`.
|
||||
pub fn new(raw: calloop::channel::Sender<Message>) -> Self {
|
||||
Self { raw }
|
||||
}
|
||||
/// send an event
|
||||
pub fn send_event(&self, message: Message) {
|
||||
let _ = self.raw.send(message);
|
||||
}
|
||||
}
|
||||
|
||||
impl<Message: 'static> Sink<Message> for Proxy<Message> {
|
||||
type Error = mpsc::SendError;
|
||||
|
||||
fn poll_ready(
|
||||
self: Pin<&mut Self>,
|
||||
_cx: &mut Context<'_>,
|
||||
) -> Poll<Result<(), Self::Error>> {
|
||||
Poll::Ready(Ok(()))
|
||||
}
|
||||
|
||||
fn start_send(
|
||||
self: Pin<&mut Self>,
|
||||
message: Message,
|
||||
) -> Result<(), Self::Error> {
|
||||
let _ = self.raw.send(message);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn poll_flush(
|
||||
self: Pin<&mut Self>,
|
||||
_cx: &mut Context<'_>,
|
||||
) -> Poll<Result<(), Self::Error>> {
|
||||
Poll::Ready(Ok(()))
|
||||
}
|
||||
|
||||
fn poll_close(
|
||||
self: Pin<&mut Self>,
|
||||
_cx: &mut Context<'_>,
|
||||
) -> Poll<Result<(), Self::Error>> {
|
||||
Poll::Ready(Ok(()))
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,6 @@ use crate::{
|
|||
Control,
|
||||
handlers::{
|
||||
activation::IcedRequestData,
|
||||
ext_background_effect,
|
||||
overlap::{OverlapNotificationV1, OverlapNotifyV1},
|
||||
text_input::{Preedit, TextInputManager},
|
||||
},
|
||||
|
|
@ -26,16 +25,15 @@ use iced_futures::{
|
|||
};
|
||||
use raw_window_handle::HasWindowHandle;
|
||||
use std::{
|
||||
collections::{HashMap, HashSet, hash_map::Entry},
|
||||
collections::{HashMap, HashSet},
|
||||
convert::Infallible,
|
||||
fmt::Debug,
|
||||
sync::{Arc, Mutex, atomic::AtomicU32},
|
||||
thread::panicking,
|
||||
time::Duration,
|
||||
};
|
||||
use wayland_backend::client::ObjectId;
|
||||
use winit::{
|
||||
dpi::{LogicalPosition, LogicalSize},
|
||||
dpi::LogicalSize,
|
||||
platform::wayland::WindowExtWayland,
|
||||
};
|
||||
|
||||
|
|
@ -51,7 +49,6 @@ use cctk::{
|
|||
activation::{ActivationState, RequestData},
|
||||
compositor::CompositorState,
|
||||
error::GlobalError,
|
||||
globals::GlobalData,
|
||||
output::OutputState,
|
||||
reexports::{
|
||||
calloop::{LoopHandle, timer::TimeoutAction},
|
||||
|
|
@ -109,7 +106,6 @@ use iced_runtime::{
|
|||
},
|
||||
};
|
||||
use wayland_protocols::{
|
||||
ext::background_effect::v1::client::ext_background_effect_surface_v1::ExtBackgroundEffectSurfaceV1,
|
||||
wp::{
|
||||
fractional_scale::v1::client::wp_fractional_scale_v1::WpFractionalScaleV1,
|
||||
keyboard_shortcuts_inhibit::zv1::client::{
|
||||
|
|
@ -233,9 +229,6 @@ impl CommonSurface {
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct Common {
|
||||
pub(crate) fractional_scale: Option<f64>,
|
||||
pub(crate) has_focus: bool,
|
||||
pub(crate) ime_pos: LogicalPosition<u32>,
|
||||
pub(crate) ime_size: LogicalSize<u32>,
|
||||
pub(crate) size: LogicalSize<u32>,
|
||||
pub(crate) requested_size: (Option<u32>, Option<u32>),
|
||||
pub(crate) wp_viewport: Option<WpViewport>,
|
||||
|
|
@ -245,9 +238,6 @@ impl Default for Common {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
fractional_scale: Default::default(),
|
||||
has_focus: Default::default(),
|
||||
ime_pos: Default::default(),
|
||||
ime_size: Default::default(),
|
||||
size: LogicalSize::new(1, 1),
|
||||
requested_size: (None, None),
|
||||
wp_viewport: None,
|
||||
|
|
@ -340,7 +330,6 @@ pub struct SctkPopupData {
|
|||
pub(crate) parent: PopupParent,
|
||||
pub(crate) toplevel: WlSurface,
|
||||
pub(crate) positioner: Arc<XdgPositioner>,
|
||||
pub(crate) grab: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -445,7 +434,6 @@ pub struct SctkState {
|
|||
pub(crate) popups: Vec<SctkPopup>,
|
||||
pub(crate) subsurfaces: Vec<SctkSubsurface>,
|
||||
pub(crate) lock_surfaces: Vec<SctkLockSurface>,
|
||||
pub(crate) blur_surfaces: HashMap<core::window::Id, Vec<ExtBackgroundEffectSurfaceV1>>,
|
||||
pub(crate) touch_points: HashMap<touch::Finger, (WlSurface, Point)>,
|
||||
|
||||
/// Window updates, which are coming from SCTK or the compositor, which require
|
||||
|
|
@ -488,7 +476,6 @@ pub struct SctkState {
|
|||
pub(crate) toplevel_info: Option<ToplevelInfoState>,
|
||||
pub(crate) toplevel_manager: Option<ToplevelManagerState>,
|
||||
pub(crate) subsurface_state: Option<SubsurfaceState>,
|
||||
pub(crate) ext_background_effect_manager: Option<ext_background_effect::ExtBackgroundEffectManager>,
|
||||
|
||||
pub(crate) activation_token_ctr: u32,
|
||||
pub(crate) token_senders: HashMap<u32, oneshot::Sender<Option<String>>>,
|
||||
|
|
@ -670,7 +657,9 @@ impl SctkState {
|
|||
|
||||
// TODO winit sets cursor size after handling the change for the window, so maybe that should be done as well.
|
||||
}
|
||||
}
|
||||
|
||||
impl SctkState {
|
||||
pub fn get_popup(
|
||||
&mut self,
|
||||
settings: SctkPopupSettings,
|
||||
|
|
@ -881,7 +870,6 @@ impl SctkState {
|
|||
parent: parent.clone(),
|
||||
toplevel: toplevel.clone(),
|
||||
positioner: positioner.clone(),
|
||||
grab: settings.grab,
|
||||
},
|
||||
last_configure: None,
|
||||
_pending_requests: Default::default(),
|
||||
|
|
@ -1093,12 +1081,6 @@ impl SctkState {
|
|||
if let Some(i) = self.layer_surfaces.iter().position(|l| l.id == id) {
|
||||
let l = self.layer_surfaces.remove(i);
|
||||
|
||||
if let Some(blurred) = self.blur_surfaces.remove(&l.id) {
|
||||
for s in blurred {
|
||||
s.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
let (removed, remaining): (Vec<_>, Vec<_>) = self
|
||||
.subsurfaces
|
||||
.drain(..)
|
||||
|
|
@ -1266,7 +1248,7 @@ impl SctkState {
|
|||
let timer = cctk::sctk::reexports::calloop::timer::Timer::from_duration(Duration::from_millis(30));
|
||||
let queue_handle = self.queue_handle.clone();
|
||||
_ = self.loop_handle.insert_source(timer, move |_, _, state| {
|
||||
let Some((mut popup, attempt)) = state.pending_popup.take() else {
|
||||
let Some((popup, attempt)) = state.pending_popup.take() else {
|
||||
return TimeoutAction::Drop;
|
||||
};
|
||||
|
||||
|
|
@ -1352,12 +1334,6 @@ impl SctkState {
|
|||
_ = self.destroyed.insert(id);
|
||||
}
|
||||
|
||||
if let Some(blurred) = self.blur_surfaces.remove(&id) {
|
||||
for s in blurred {
|
||||
s.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
let (removed, remaining): (Vec<_>, Vec<_>) = self
|
||||
.subsurfaces
|
||||
.drain(..)
|
||||
|
|
@ -1469,7 +1445,6 @@ impl SctkState {
|
|||
// TODO how to handle this when there's no lock?
|
||||
if let Some((surface, _)) = self.get_lock_surface(id, &output) {
|
||||
let wl_surface = surface.wl_surface();
|
||||
|
||||
receive_frame(&mut self.frame_status, &wl_surface);
|
||||
}
|
||||
}
|
||||
|
|
@ -1480,11 +1455,6 @@ impl SctkState {
|
|||
})
|
||||
{
|
||||
let surface = self.lock_surfaces.remove(i);
|
||||
if let Some(blurred) = self.blur_surfaces.remove(&surface.id) {
|
||||
for s in blurred {
|
||||
s.destroy();
|
||||
}
|
||||
}
|
||||
let (removed, remaining): (Vec<_>, Vec<_>) = self
|
||||
.subsurfaces
|
||||
.drain(..)
|
||||
|
|
@ -1541,7 +1511,6 @@ impl SctkState {
|
|||
SctkEvent::SubsurfaceEvent (crate::sctk_event::SubsurfaceEventVariant::Created{
|
||||
parent_id,
|
||||
parent,
|
||||
surface: subsurface,
|
||||
qh: self.queue_handle.clone(),
|
||||
common_surface,
|
||||
surface_id: subsurface_settings.id,
|
||||
|
|
@ -1556,7 +1525,7 @@ impl SctkState {
|
|||
let mut destroyed = vec![];
|
||||
if let Some(subsurface) = self.subsurfaces.iter().position(|s| s.id == id) {
|
||||
let subsurface = self.subsurfaces.remove(subsurface);
|
||||
destroyed.push((subsurface.instance.wl_surface.clone(), subsurface.instance.parent.clone(), subsurface.id));
|
||||
destroyed.push((subsurface.instance.wl_surface.clone(), subsurface.instance.parent.clone()));
|
||||
|
||||
subsurface.instance.wl_surface.attach(None, 0, 0);
|
||||
subsurface.instance.wl_surface.commit();
|
||||
|
|
@ -1564,12 +1533,7 @@ impl SctkState {
|
|||
SctkEvent::SubsurfaceEvent( crate::sctk_event::SubsurfaceEventVariant::Destroyed(subsurface.instance) )
|
||||
);
|
||||
}
|
||||
for (destroyed, parent, id) in destroyed {
|
||||
if let Some(blurred) = self.blur_surfaces.remove(&id) {
|
||||
for s in blurred {
|
||||
s.destroy();
|
||||
}
|
||||
}
|
||||
for (destroyed, parent) in destroyed {
|
||||
if let Some((wl_surface, f)) = self.seats.iter_mut().find(|f| {
|
||||
f.kbd_focus.as_ref().is_some_and(|f| *f == destroyed)
|
||||
}).and_then(|f| Some((parent, &mut f.kbd_focus))) {
|
||||
|
|
@ -1599,7 +1563,7 @@ impl SctkState {
|
|||
if let Some(manager) = self.corner_radius_manager.as_ref() {
|
||||
if let Some(w) = self.windows.iter_mut().find(|w| w.id == id) {
|
||||
let geo_size: LogicalSize<f64> = w.window.surface_size().cast::<f64>().to_logical(w.window.scale_factor());
|
||||
let half_min_dim = (geo_size.width as u32).min(geo_size.height as u32) / 2;
|
||||
let half_min_dim = (geo_size.width as u32).min(geo_size.height as u32) / 2 ;
|
||||
|
||||
if let Some(radii) = v {
|
||||
let adjusted_radii = CornerRadius {
|
||||
|
|
@ -1646,97 +1610,6 @@ impl SctkState {
|
|||
}
|
||||
}
|
||||
}
|
||||
Action::BlurSurface(id, rectangles) => {
|
||||
use wayland_protocols::ext::background_effect::v1::client::ext_background_effect_manager_v1;
|
||||
|
||||
if let Some(bg_effect_mgr) = self.ext_background_effect_manager.as_mut() && !bg_effect_mgr.capabilities().contains(ext_background_effect_manager_v1::Capability::Blur) {
|
||||
bg_effect_mgr.enqueue(id, rectangles.clone());
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let s = if let Some(s) = self.popups.iter().find(|s| s.data.id == id) {
|
||||
s.popup.wl_surface()
|
||||
} else if let Some(s) = self.layer_surfaces.iter().find(|s| s.id == id) {
|
||||
s.surface.wl_surface()
|
||||
} else if let Some(s) = self.lock_surfaces.iter().find(|s| s.id == id) {
|
||||
s.session_lock_surface.wl_surface()
|
||||
} else if let Some(subsurface) = self.subsurfaces.iter().find(|s| s.id == id) {
|
||||
&subsurface.instance.wl_surface
|
||||
} else {
|
||||
log::error!("Failed to find surface for blur action");
|
||||
return Ok(());
|
||||
};
|
||||
let existing_blur = self.blur_surfaces.entry(id);
|
||||
match (existing_blur, rectangles) {
|
||||
(Entry::Occupied(occupied_entry), None) => {
|
||||
let blur_surfaces = occupied_entry.remove();
|
||||
for region in blur_surfaces {
|
||||
region.destroy();
|
||||
}
|
||||
},
|
||||
(Entry::Occupied(mut occupied_entry), Some(rectangles)) => {
|
||||
let blur_surfaces = occupied_entry.get_mut();
|
||||
let regions = rectangles.into_iter().map(|rect| {
|
||||
let region = self
|
||||
.compositor_state
|
||||
.wl_compositor()
|
||||
.create_region(&self.queue_handle, ());
|
||||
region.add(
|
||||
rect.x.round() as i32,
|
||||
rect.y.round() as i32,
|
||||
rect.width.round() as i32,
|
||||
rect.height.round() as i32,
|
||||
);
|
||||
region
|
||||
}).collect::<Vec<_>>();
|
||||
if regions.len() > blur_surfaces.len() {
|
||||
// add extra blur surfaces if needed
|
||||
for _ in blur_surfaces.len()..regions.len() {
|
||||
let Some(extra_region) = self.ext_background_effect_manager.as_mut().map(|mgr| mgr.blur(s, &self.queue_handle)) else {
|
||||
log::error!("Failed to create blur effect for surface");
|
||||
return Ok(());
|
||||
};
|
||||
blur_surfaces.push(extra_region);
|
||||
}
|
||||
} else if regions.len() < blur_surfaces.len() {
|
||||
for surface in blur_surfaces.iter().skip(regions.len()) {
|
||||
surface.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
// update existing blur surfaces
|
||||
for (blur_surface, region) in blur_surfaces.iter().zip(regions.into_iter()) {
|
||||
blur_surface.set_blur_region(Some(®ion));
|
||||
}
|
||||
},
|
||||
(Entry::Vacant(..), None) => {
|
||||
// nothing to remove
|
||||
},
|
||||
(Entry::Vacant(vacant_entry), Some(rectangles)) => {
|
||||
if self.ext_background_effect_manager.is_none() {
|
||||
log::error!("Blur effect is not supported.");
|
||||
return Ok(());
|
||||
}
|
||||
let blur_surfaces = rectangles.into_iter().map(|rect| {
|
||||
let region = self
|
||||
.compositor_state
|
||||
.wl_compositor()
|
||||
.create_region(&self.queue_handle, ());
|
||||
region.add(
|
||||
rect.x.round() as i32,
|
||||
rect.y.round() as i32,
|
||||
rect.width.round() as i32,
|
||||
rect.height.round() as i32,
|
||||
);
|
||||
let blur_manager = self.ext_background_effect_manager.as_mut().unwrap();
|
||||
let blur_surface = blur_manager.blur(s, &self.queue_handle);
|
||||
blur_surface.set_blur_region(Some(®ion));
|
||||
blur_surface
|
||||
}).collect::<Vec<_>>();
|
||||
_ = vacant_entry.insert(blur_surfaces);
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ use cctk::sctk::{
|
|||
delegate_activation,
|
||||
reexports::client::protocol::{wl_seat::WlSeat, wl_surface::WlSurface},
|
||||
};
|
||||
use iced_futures::futures::channel::oneshot::Sender;
|
||||
|
||||
use crate::platform_specific::wayland::event_loop::state::SctkState;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,107 +0,0 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use cctk::sctk;
|
||||
use iced_runtime::core::Rectangle;
|
||||
use iced_runtime::platform_specific::wayland::Action;
|
||||
use sctk::globals::GlobalData;
|
||||
use sctk::reexports::client::globals::{BindError, GlobalList};
|
||||
use sctk::reexports::client::protocol::wl_surface::WlSurface;
|
||||
use sctk::reexports::client::{Connection, Dispatch, Proxy, QueueHandle, delegate_dispatch};
|
||||
use wayland_protocols::ext::background_effect::v1::client::ext_background_effect_manager_v1::{Capability, Event, ExtBackgroundEffectManagerV1};
|
||||
use wayland_protocols::ext::background_effect::v1::client::ext_background_effect_surface_v1::ExtBackgroundEffectSurfaceV1;
|
||||
|
||||
use crate::event_loop::state::SctkState;
|
||||
use crate::window;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ExtBackgroundEffectManager {
|
||||
manager: ExtBackgroundEffectManagerV1,
|
||||
capabilities: Capability,
|
||||
queued_blur_actions: HashMap<window::Id, Option<Vec<Rectangle>>>,
|
||||
}
|
||||
|
||||
impl ExtBackgroundEffectManager {
|
||||
pub fn new(
|
||||
globals: &GlobalList,
|
||||
queue_handle: &QueueHandle<SctkState>,
|
||||
) -> Result<Self, BindError> {
|
||||
let manager = globals.bind(queue_handle, 1..=1, GlobalData)?;
|
||||
Ok(Self {
|
||||
manager,
|
||||
capabilities: Capability::empty(),
|
||||
queued_blur_actions: HashMap::new(),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn blur(
|
||||
&mut self,
|
||||
surface: &WlSurface,
|
||||
queue_handle: &QueueHandle<SctkState>,
|
||||
) -> ExtBackgroundEffectSurfaceV1 {
|
||||
self.manager
|
||||
.get_background_effect(surface, queue_handle, ())
|
||||
}
|
||||
|
||||
pub fn enqueue(&mut self, id: window::Id, rects: Option<Vec<Rectangle>>) {
|
||||
_ = self.queued_blur_actions.insert(id, rects);
|
||||
}
|
||||
|
||||
pub fn capabilities(&self) -> Capability {
|
||||
self.capabilities
|
||||
}
|
||||
}
|
||||
|
||||
impl Dispatch<ExtBackgroundEffectManagerV1, GlobalData, SctkState>
|
||||
for ExtBackgroundEffectManager
|
||||
{
|
||||
fn event(
|
||||
state: &mut SctkState,
|
||||
_: &ExtBackgroundEffectManagerV1,
|
||||
event: <ExtBackgroundEffectManagerV1 as Proxy>::Event,
|
||||
_: &GlobalData,
|
||||
_: &Connection,
|
||||
_: &QueueHandle<SctkState>,
|
||||
) {
|
||||
match event {
|
||||
Event::Capabilities { flags } => match flags {
|
||||
wayland_client::WEnum::Value(capability) => {
|
||||
let mut queued_actions = Vec::new();
|
||||
if let Some(bg_effect_mgr) =
|
||||
state.ext_background_effect_manager.as_mut()
|
||||
{
|
||||
bg_effect_mgr.capabilities = capability;
|
||||
queued_actions =
|
||||
bg_effect_mgr.queued_blur_actions.drain().collect();
|
||||
}
|
||||
for (id, rects) in queued_actions {
|
||||
_ = state.handle_action(Action::BlurSurface(id, rects));
|
||||
}
|
||||
}
|
||||
wayland_client::WEnum::Unknown(u) => {
|
||||
log::warn!("Unknown value: {u:?}");
|
||||
}
|
||||
},
|
||||
e => {
|
||||
log::warn!("Ignored event {e:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Dispatch<ExtBackgroundEffectSurfaceV1, (), SctkState>
|
||||
for ExtBackgroundEffectManager
|
||||
{
|
||||
fn event(
|
||||
_: &mut SctkState,
|
||||
_: &ExtBackgroundEffectSurfaceV1,
|
||||
_: <ExtBackgroundEffectSurfaceV1 as Proxy>::Event,
|
||||
_: &(),
|
||||
_: &Connection,
|
||||
_: &QueueHandle<SctkState>,
|
||||
) {
|
||||
// There is no event
|
||||
}
|
||||
}
|
||||
|
||||
delegate_dispatch!(SctkState: [ExtBackgroundEffectManagerV1: GlobalData] => ExtBackgroundEffectManager);
|
||||
delegate_dispatch!(SctkState: [ExtBackgroundEffectSurfaceV1: ()] => ExtBackgroundEffectManager);
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
// handlers
|
||||
pub mod activation;
|
||||
pub mod compositor;
|
||||
pub mod ext_background_effect;
|
||||
pub mod output;
|
||||
pub mod overlap;
|
||||
pub mod seat;
|
||||
|
|
@ -13,14 +12,14 @@ pub mod toplevel;
|
|||
pub mod wp_fractional_scaling;
|
||||
pub mod wp_viewporter;
|
||||
|
||||
use cctk::sctk::{
|
||||
use cctk::{sctk::{
|
||||
delegate_registry, delegate_shm,
|
||||
output::OutputState,
|
||||
registry::{ProvidesRegistryState, RegistryState},
|
||||
registry_handlers,
|
||||
seat::SeatState,
|
||||
shm::{Shm, ShmHandler},
|
||||
};
|
||||
}};
|
||||
|
||||
use crate::platform_specific::wayland::event_loop::state::SctkState;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ impl SeatHandler for SctkState {
|
|||
fn new_seat(
|
||||
&mut self,
|
||||
_conn: &cctk::sctk::reexports::client::Connection,
|
||||
qh: &cctk::sctk::reexports::client::QueueHandle<Self>,
|
||||
_qh: &cctk::sctk::reexports::client::QueueHandle<Self>,
|
||||
seat: cctk::sctk::reexports::client::protocol::wl_seat::WlSeat,
|
||||
) {
|
||||
self.sctk_events.push(SctkEvent::SeatEvent {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
use cctk::{sctk, cosmic_protocols::{
|
||||
corner_radius::v1::client::{
|
||||
use cctk::{sctk, cosmic_protocols::corner_radius::v1::client::{
|
||||
cosmic_corner_radius_manager_v1::CosmicCornerRadiusManagerV1,
|
||||
cosmic_corner_radius_toplevel_v1::CosmicCornerRadiusToplevelV1,
|
||||
},
|
||||
overlap_notify::v1::client::zcosmic_overlap_notification_v1::ZcosmicOverlapNotificationV1,
|
||||
}};
|
||||
}};
|
||||
use sctk::reexports::{
|
||||
client::{Connection, Dispatch, Proxy},
|
||||
|
||||
};
|
||||
|
||||
use crate::event_loop::state::SctkState;
|
||||
use crate::platform_specific::wayland::SctkEvent;
|
||||
|
||||
impl Dispatch<CosmicCornerRadiusManagerV1, ()> for SctkState {
|
||||
fn event(
|
||||
|
|
@ -31,7 +27,7 @@ impl
|
|||
> for SctkState
|
||||
{
|
||||
fn event(
|
||||
state: &mut Self,
|
||||
_state: &mut Self,
|
||||
_proxy: &CosmicCornerRadiusToplevelV1,
|
||||
event: <CosmicCornerRadiusToplevelV1 as Proxy>::Event,
|
||||
_data: &(),
|
||||
|
|
|
|||
|
|
@ -69,10 +69,6 @@ impl Dispatch<ZwpTextInputV3, (), SctkState> for TextInputManager {
|
|||
_conn: &Connection,
|
||||
_qhandle: &QueueHandle<SctkState>,
|
||||
) {
|
||||
if cfg!(not(feature = "single-instance")) {
|
||||
return;
|
||||
}
|
||||
|
||||
let kbd_focus =
|
||||
match state.seats.iter_mut().find_map(|s| s.kbd_focus.clone()) {
|
||||
Some(surface) => surface,
|
||||
|
|
|
|||
|
|
@ -16,10 +16,9 @@ use cctk::sctk::reexports::client::protocol::wl_surface::WlSurface;
|
|||
use cctk::sctk::seat::keyboard::Modifiers;
|
||||
use cursor_icon::CursorIcon;
|
||||
use iced_futures::futures::channel::mpsc;
|
||||
use iced_graphics::{Compositor, compositor};
|
||||
use iced_graphics::compositor;
|
||||
use iced_runtime::core::{Vector, window};
|
||||
use raw_window_handle::{DisplayHandle, HasDisplayHandle, HasWindowHandle};
|
||||
use raw_window_handle::{HasRawDisplayHandle, RawWindowHandle};
|
||||
use raw_window_handle::{HasDisplayHandle, HasWindowHandle, RawWindowHandle};
|
||||
use sctk_event::SctkEvent;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use subsurface_widget::{SubsurfaceInstance, SubsurfaceState};
|
||||
|
|
@ -106,7 +105,7 @@ impl PlatformSpecific {
|
|||
display: OwnedDisplayHandle,
|
||||
) -> Self {
|
||||
self.wayland.winit_event_sender = Some(tx);
|
||||
self.wayland.conn = match display.raw_display_handle() {
|
||||
self.wayland.conn = match display.display_handle().map(|h| h.as_raw()) {
|
||||
Ok(raw_window_handle::RawDisplayHandle::Wayland(
|
||||
wayland_display_handle,
|
||||
)) => {
|
||||
|
|
@ -189,12 +188,12 @@ impl WaylandSpecific {
|
|||
winit_event_sender,
|
||||
proxy,
|
||||
sender,
|
||||
display_handle,
|
||||
conn,
|
||||
display_handle: _,
|
||||
conn: _,
|
||||
surface_ids,
|
||||
modifiers,
|
||||
subsurface_state,
|
||||
surface_subsurfaces,
|
||||
surface_subsurfaces: _,
|
||||
} = self;
|
||||
|
||||
match e {
|
||||
|
|
@ -237,7 +236,7 @@ impl WaylandSpecific {
|
|||
&mut self,
|
||||
keep: F,
|
||||
) {
|
||||
self.surface_subsurfaces.retain(|k, v| keep(*k))
|
||||
self.surface_subsurfaces.retain(|k, _v| keep(*k))
|
||||
}
|
||||
|
||||
pub(crate) fn clear_subsurface_list(&mut self) {
|
||||
|
|
@ -250,7 +249,7 @@ impl WaylandSpecific {
|
|||
wl_surface: &WlSurface,
|
||||
) {
|
||||
let subsurfaces = crate::subsurface_widget::take_subsurfaces();
|
||||
let mut entry = self.surface_subsurfaces.entry(id);
|
||||
let entry = self.surface_subsurfaces.entry(id);
|
||||
let surface_subsurfaces = entry.or_default();
|
||||
let Some(subsurface_state) = self.subsurface_state.as_mut() else {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use crate::{
|
|||
SurfaceIdWrapper, UserInterfaces,
|
||||
wayland::{
|
||||
conversion::{
|
||||
modifiers_to_native, pointer_axis_to_native,
|
||||
modifiers_to_native,
|
||||
pointer_button_to_native,
|
||||
},
|
||||
keymap::{self, keysym_to_key},
|
||||
|
|
@ -25,10 +25,9 @@ use iced_futures::{
|
|||
},
|
||||
},
|
||||
},
|
||||
event,
|
||||
futures::{SinkExt, channel::mpsc},
|
||||
};
|
||||
use iced_graphics::{Compositor, compositor};
|
||||
use iced_graphics::compositor;
|
||||
use iced_runtime::{
|
||||
core::{
|
||||
Point,
|
||||
|
|
@ -40,9 +39,7 @@ use iced_runtime::{
|
|||
user_interface,
|
||||
};
|
||||
|
||||
use cctk::{
|
||||
cosmic_protocols::overlap_notify::v1::client::zcosmic_overlap_notification_v1,
|
||||
sctk::{
|
||||
use cctk::sctk::{
|
||||
output::OutputInfo,
|
||||
reexports::{
|
||||
calloop::channel,
|
||||
|
|
@ -67,11 +64,8 @@ use cctk::{
|
|||
wlr_layer::{Layer, LayerSurfaceConfigure},
|
||||
xdg::{popup::PopupConfigure, window::WindowConfigure},
|
||||
},
|
||||
},
|
||||
wayland_client::protocol::wl_subsurface::WlSubsurface,
|
||||
};
|
||||
};
|
||||
use std::{
|
||||
any::Any,
|
||||
collections::HashMap,
|
||||
num::NonZeroU32,
|
||||
sync::{Arc, Mutex},
|
||||
|
|
@ -288,7 +282,6 @@ pub enum SubsurfaceEventVariant {
|
|||
Created {
|
||||
parent_id: window::Id,
|
||||
parent: WlSurface,
|
||||
surface: WlSurface,
|
||||
qh: QueueHandle<SctkState>,
|
||||
common_surface: CommonSurface,
|
||||
surface_id: SurfaceId,
|
||||
|
|
@ -380,12 +373,6 @@ impl SctkEvent {
|
|||
(variant.position.0, variant.position.1).into(),
|
||||
)
|
||||
}
|
||||
events.push((
|
||||
id.clone(),
|
||||
iced_runtime::core::Event::Mouse(
|
||||
mouse::Event::CursorEntered,
|
||||
),
|
||||
));
|
||||
events.push((
|
||||
id,
|
||||
iced_runtime::core::Event::Mouse(
|
||||
|
|
@ -516,7 +503,7 @@ impl SctkEvent {
|
|||
),
|
||||
),
|
||||
),
|
||||
SurfaceIdWrapper::Window(id) => {
|
||||
SurfaceIdWrapper::Window(_id) => {
|
||||
Some(iced_runtime::core::Event::Window(
|
||||
window::Event::Unfocused,
|
||||
))
|
||||
|
|
@ -544,7 +531,7 @@ impl SctkEvent {
|
|||
),
|
||||
),
|
||||
),
|
||||
SurfaceIdWrapper::Subsurface(id) => None,
|
||||
SurfaceIdWrapper::Subsurface(_id) => None,
|
||||
})
|
||||
{
|
||||
events.push((
|
||||
|
|
@ -578,7 +565,7 @@ impl SctkEvent {
|
|||
),
|
||||
),
|
||||
),
|
||||
SurfaceIdWrapper::Window(id) => {
|
||||
SurfaceIdWrapper::Window(_id) => {
|
||||
Some(iced_runtime::core::Event::Window(
|
||||
window::Event::Focused,
|
||||
))
|
||||
|
|
@ -1515,7 +1502,6 @@ impl SctkEvent {
|
|||
common,
|
||||
z,
|
||||
parent,
|
||||
surface: _,
|
||||
qh,
|
||||
surface_id,
|
||||
display,
|
||||
|
|
|
|||
|
|
@ -57,9 +57,7 @@ use wayland_protocols::wp::{
|
|||
};
|
||||
use winit::window::WindowId;
|
||||
|
||||
use crate::platform_specific::{
|
||||
SurfaceIdWrapper, event_loop::state::SctkState,
|
||||
};
|
||||
use crate::platform_specific::event_loop::state::SctkState;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Plane {
|
||||
|
|
@ -409,7 +407,10 @@ impl SubsurfaceState {
|
|||
.unwrap();
|
||||
canvas[0..width as usize * height as usize * 4].copy_from_slice(data);
|
||||
surface.damage_buffer(0, 0, width as i32, height as i32);
|
||||
buffer.attach_to(&surface);
|
||||
if let Err(err) = buffer.attach_to(&surface) {
|
||||
log::warn!("failed to attach shm buffer to subsurface: {err}");
|
||||
return;
|
||||
}
|
||||
surface.offset(offset.x as i32, offset.y as i32);
|
||||
wp_viewport.set_destination(
|
||||
(width as f64 / scale) as i32,
|
||||
|
|
@ -622,7 +623,7 @@ impl Drop for SubsurfaceState {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct SubsurfaceInstance {
|
||||
pub struct SubsurfaceInstance {
|
||||
pub(crate) wl_surface: WlSurface,
|
||||
pub(crate) wl_subsurface: WlSubsurface,
|
||||
pub(crate) wp_viewport: WpViewport,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use crate::platform_specific::wayland::Action;
|
||||
use cctk::sctk::reexports::{
|
||||
calloop::{LoopHandle, channel},
|
||||
calloop::channel,
|
||||
client::{
|
||||
Proxy, QueueHandle,
|
||||
protocol::{wl_display::WlDisplay, wl_surface::WlSurface},
|
||||
protocol::wl_display::WlDisplay,
|
||||
},
|
||||
};
|
||||
use raw_window_handle::HandleError;
|
||||
|
|
@ -91,7 +91,7 @@ impl winit::window::Window for SctkWinitWindow {
|
|||
}
|
||||
}
|
||||
|
||||
fn set_cursor_visible(&self, visible: bool) {
|
||||
fn set_cursor_visible(&self, _visible: bool) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
|
@ -203,35 +203,35 @@ impl winit::window::Window for SctkWinitWindow {
|
|||
// TODO refer to winit for implementation
|
||||
}
|
||||
|
||||
fn set_outer_position(&self, position: winit::dpi::Position) {}
|
||||
fn set_outer_position(&self, _position: winit::dpi::Position) {}
|
||||
|
||||
fn outer_size(&self) -> winit::dpi::PhysicalSize<u32> {
|
||||
// XXX not applicable to wrapped surfaces
|
||||
Default::default()
|
||||
}
|
||||
|
||||
fn set_min_surface_size(&self, min_size: Option<winit::dpi::Size>) {
|
||||
fn set_min_surface_size(&self, _min_size: Option<winit::dpi::Size>) {
|
||||
// XXX not applicable to wrapped surfaces
|
||||
}
|
||||
|
||||
fn set_max_surface_size(&self, max_size: Option<winit::dpi::Size>) {
|
||||
fn set_max_surface_size(&self, _max_size: Option<winit::dpi::Size>) {
|
||||
// XXX not applicable to wrapped surfaces
|
||||
}
|
||||
|
||||
fn set_surface_resize_increments(
|
||||
&self,
|
||||
increments: Option<winit::dpi::Size>,
|
||||
_increments: Option<winit::dpi::Size>,
|
||||
) {
|
||||
log::warn!(
|
||||
"`set_surface_resize_increments` is not implemented for Wayland"
|
||||
)
|
||||
}
|
||||
|
||||
fn set_title(&self, title: &str) {
|
||||
fn set_title(&self, _title: &str) {
|
||||
// XXX not applicable to wrapped surfaces
|
||||
}
|
||||
|
||||
fn set_transparent(&self, transparent: bool) {
|
||||
fn set_transparent(&self, _transparent: bool) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
|
|
@ -286,37 +286,23 @@ impl winit::window::Window for SctkWinitWindow {
|
|||
_ = self.tx.send(Action::SetImePurpose(purpose));
|
||||
}
|
||||
|
||||
fn set_blur(&self, blur: bool) {
|
||||
_ = self.tx.send(Action::Action(
|
||||
iced_runtime::platform_specific::wayland::Action::BlurSurface(
|
||||
self.id.inner(),
|
||||
if blur {
|
||||
Some(vec![iced_runtime::core::Rectangle {
|
||||
x: 0.,
|
||||
y: 0.,
|
||||
width: f32::MAX,
|
||||
height: f32::MAX,
|
||||
}])
|
||||
} else {
|
||||
None
|
||||
},
|
||||
),
|
||||
));
|
||||
fn set_blur(&self, _blur: bool) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {}
|
||||
fn set_visible(&self, _visible: bool) {}
|
||||
|
||||
fn is_visible(&self) -> Option<bool> {
|
||||
None
|
||||
}
|
||||
|
||||
fn set_resizable(&self, resizable: bool) {}
|
||||
fn set_resizable(&self, _resizable: bool) {}
|
||||
|
||||
fn is_resizable(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn set_enabled_buttons(&self, buttons: winit::window::WindowButtons) {
|
||||
fn set_enabled_buttons(&self, _buttons: winit::window::WindowButtons) {
|
||||
// TODO v5 of xdg_shell.
|
||||
}
|
||||
|
||||
|
|
@ -324,7 +310,7 @@ impl winit::window::Window for SctkWinitWindow {
|
|||
WindowButtons::all()
|
||||
}
|
||||
|
||||
fn set_minimized(&self, minimized: bool) {
|
||||
fn set_minimized(&self, _minimized: bool) {
|
||||
// XXX not applicable to the wrapped surfaces
|
||||
}
|
||||
|
||||
|
|
@ -333,7 +319,7 @@ impl winit::window::Window for SctkWinitWindow {
|
|||
None
|
||||
}
|
||||
|
||||
fn set_maximized(&self, maximized: bool) {
|
||||
fn set_maximized(&self, _maximized: bool) {
|
||||
// XXX can't minimize the wrapped surfaces
|
||||
}
|
||||
|
||||
|
|
@ -344,7 +330,7 @@ impl winit::window::Window for SctkWinitWindow {
|
|||
|
||||
fn set_fullscreen(
|
||||
&self,
|
||||
fullscreen: Option<winit_core::monitor::Fullscreen>,
|
||||
_fullscreen: Option<winit_core::monitor::Fullscreen>,
|
||||
) {
|
||||
// XXX can't fullscreen the wrapped surfaces
|
||||
}
|
||||
|
|
@ -354,7 +340,7 @@ impl winit::window::Window for SctkWinitWindow {
|
|||
None
|
||||
}
|
||||
|
||||
fn set_decorations(&self, decorations: bool) {
|
||||
fn set_decorations(&self, _decorations: bool) {
|
||||
// XXX no decorations supported for the wrapped surfaces
|
||||
}
|
||||
|
||||
|
|
@ -362,26 +348,26 @@ impl winit::window::Window for SctkWinitWindow {
|
|||
false
|
||||
}
|
||||
|
||||
fn set_window_level(&self, level: winit::window::WindowLevel) {}
|
||||
fn set_window_level(&self, _level: winit::window::WindowLevel) {}
|
||||
|
||||
fn set_window_icon(&self, window_icon: Option<winit_core::icon::Icon>) {}
|
||||
fn set_window_icon(&self, _window_icon: Option<winit_core::icon::Icon>) {}
|
||||
|
||||
fn focus_window(&self) {}
|
||||
|
||||
fn request_user_attention(
|
||||
&self,
|
||||
request_type: Option<winit::window::UserAttentionType>,
|
||||
_request_type: Option<winit::window::UserAttentionType>,
|
||||
) {
|
||||
// XXX can't request attention on wrapped surfaces
|
||||
}
|
||||
|
||||
fn set_theme(&self, theme: Option<winit::window::Theme>) {}
|
||||
fn set_theme(&self, _theme: Option<winit::window::Theme>) {}
|
||||
|
||||
fn theme(&self) -> Option<winit::window::Theme> {
|
||||
None
|
||||
}
|
||||
|
||||
fn set_content_protected(&self, protected: bool) {}
|
||||
fn set_content_protected(&self, _protected: bool) {}
|
||||
|
||||
fn title(&self) -> String {
|
||||
String::new()
|
||||
|
|
@ -434,14 +420,14 @@ impl winit::window::Window for SctkWinitWindow {
|
|||
|
||||
fn set_cursor_position(
|
||||
&self,
|
||||
position: winit::dpi::Position,
|
||||
_position: winit::dpi::Position,
|
||||
) -> Result<(), winit::error::RequestError> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn set_cursor_grab(
|
||||
&self,
|
||||
mode: winit::window::CursorGrabMode,
|
||||
_mode: winit::window::CursorGrabMode,
|
||||
) -> Result<(), winit::error::RequestError> {
|
||||
todo!()
|
||||
}
|
||||
|
|
@ -452,7 +438,7 @@ impl winit::window::Window for SctkWinitWindow {
|
|||
|
||||
fn request_ime_update(
|
||||
&self,
|
||||
request: winit::window::ImeRequest,
|
||||
_request: winit::window::ImeRequest,
|
||||
) -> Result<(), winit::window::ImeRequestError> {
|
||||
todo!()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use crate::futures::futures::{
|
|||
use crate::graphics::shell;
|
||||
use crate::runtime::Action;
|
||||
use crate::runtime::window;
|
||||
use std::hash::DefaultHasher;
|
||||
use std::pin::Pin;
|
||||
|
||||
/// An event loop proxy with backpressure that implements `Sink`.
|
||||
|
|
@ -34,7 +33,7 @@ impl<T: 'static> Proxy<T> {
|
|||
const MAX_SIZE: usize = 100;
|
||||
|
||||
/// Creates a new [`Proxy`] from an `EventLoopProxy`.
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
raw: winit::event_loop::EventLoopProxy,
|
||||
event_sender: mpsc::UnboundedSender<Event<T>>,
|
||||
) -> (Self, impl Future<Output = ()>) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use crate::core::text;
|
|||
use crate::core::theme::{self, Base};
|
||||
use crate::core::time::Instant;
|
||||
use crate::core::{
|
||||
Color, Element, InputMethod, Padding, Point, Rectangle, Size, Text, Vector,
|
||||
Color, InputMethod, Padding, Point, Rectangle, Size, Text, Vector,
|
||||
};
|
||||
use crate::graphics::Compositor;
|
||||
use crate::program::{self, Program};
|
||||
|
|
@ -26,10 +26,6 @@ use winit::monitor::MonitorHandle;
|
|||
use std::collections::BTreeMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub(crate) type ViewFn<M, T, R> = Arc<
|
||||
Box<dyn Fn() -> Option<Element<'static, M, T, R>> + Send + Sync + 'static>,
|
||||
>;
|
||||
|
||||
pub struct WindowManager<P, C>
|
||||
where
|
||||
P: Program,
|
||||
|
|
@ -325,6 +321,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
// TODO(yoda): migrate to Window::request_ime_update(ImeRequest::*).
|
||||
// Legacy set_ime_* still functional but deprecated; full migration
|
||||
// requires ImeCapabilities + ImeRequestData reshape.
|
||||
#[allow(deprecated)]
|
||||
fn enable_ime(
|
||||
&mut self,
|
||||
cursor: Rectangle,
|
||||
|
|
@ -355,6 +355,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(deprecated)] // see TODO on enable_ime
|
||||
fn disable_ime(&mut self) {
|
||||
if self.ime_state.is_some() {
|
||||
self.raw.set_ime_allowed(false);
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ where
|
|||
self.ready = ready;
|
||||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
pub(crate) fn set_a11y_ready(&mut self, ready: bool) {
|
||||
self.a11y_ready = ready;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue