iced-yoda/runtime/src/platform_specific/wayland/subsurface.rs
Votre Nom 8a7a32ff92
Some checks are pending
Audit / vulnerabilities (push) Waiting to run
Check / wasm (push) Waiting to run
Check / widget (push) Waiting to run
Document / all (push) Waiting to run
Format / all (push) Waiting to run
Lint / all (push) Waiting to run
Test / all (macOS-latest, 1.88) (push) Waiting to run
Test / all (macOS-latest, beta) (push) Waiting to run
Test / all (macOS-latest, stable) (push) Waiting to run
Test / all (ubuntu-latest, 1.88) (push) Waiting to run
Test / all (ubuntu-latest, beta) (push) Waiting to run
Test / all (ubuntu-latest, stable) (push) Waiting to run
Test / all (windows-latest, 1.88) (push) Waiting to run
Test / all (windows-latest, beta) (push) Waiting to run
Test / all (windows-latest, stable) (push) Waiting to run
yoda: cargo fix --lib across all crates — drop ~115 trivial warnings
Auto-applied suggestions (unused imports, _-prefixed unused params,
redundant mutability) on iced_core, iced_widget, iced_runtime, iced_winit,
iced_wgpu, iced_graphics, iced_tiny_skia. From 170 warnings down to 55.

Leyoda 2026 – GPLv3
2026-05-05 16:45:37 +02:00

84 lines
2.2 KiB
Rust

use std::fmt;
use std::hash::{Hash, Hasher};
use cctk::sctk::reexports::protocols::xdg::shell::client::xdg_positioner::Gravity;
use iced_core::window::Id;
use iced_core::{Point, Rectangle, Size};
/// Subsurface creation details
#[derive(Debug, Clone)]
pub struct SctkSubsurfaceSettings {
/// XXX must be unique, id of the parent
pub parent: Id,
/// XXX must be unique, id of the subsurface
pub id: Id,
/// anchor position of the subsurface
pub loc: Point,
/// size of the subsurface
pub size: Option<Size>,
// pub subsurface_view: Option<Arc<dyn Any + Send + Sync>>,
/// Z
pub z: i32,
/// Steal Keyboard focus from parent while open.
/// Will not work on a regular window.
pub steal_keyboard_focus: bool,
/// offset of the subsurface from the anchor
pub offset: (i32, i32),
/// the gravity of the popup
pub gravity: Gravity,
/// input zone
/// None results in accepting all input
pub input_zone: Option<Vec<Rectangle>>,
}
impl Hash for SctkSubsurfaceSettings {
fn hash<H: Hasher>(&self, state: &mut H) {
self.id.hash(state);
}
}
#[derive(Clone)]
/// Window Action
pub enum Action {
/// create a window and receive a message with its Id
Subsurface {
/// subsurface
subsurface: SctkSubsurfaceSettings,
},
/// destroy the subsurface
Destroy {
/// id of the subsurface
id: Id,
},
/// reposition the subsurface
Reposition {
/// id of the subsurface
id: Id,
x: i32,
y: i32,
},
}
impl fmt::Debug for Action {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Action::Subsurface { subsurface, .. } => write!(
f,
"Action::SubsurfaceAction::Subsurface {{ subsurface: {:?} }}",
subsurface
),
Action::Destroy { id } => write!(
f,
"Action::SubsurfaceAction::Destroy {{ id: {:?} }}",
id
),
Action::Reposition { id, x, y } => write!(
f,
"Action::SubsurfaceAction::Reposition {{ id: {:?}, x: {:?}, y: {:?} }}",
id, x, y
),
}
}
}