mirror of
https://codeberg.org/waydeer/layer-shika.git
synced 2025-12-12 14:25:54 +00:00
refactor: renaming
This commit is contained in:
parent
dc9374b76d
commit
408355e980
5 changed files with 19 additions and 22 deletions
|
|
@ -137,7 +137,7 @@ impl LayerShika<NeedsComponent> {
|
|||
|
||||
impl LayerShika<HasComponent> {
|
||||
#[must_use]
|
||||
pub fn dimensions(mut self, width: u32, height: u32) -> Self {
|
||||
pub fn size(mut self, width: u32, height: u32) -> Self {
|
||||
self.config.dimensions = WindowDimension::new(width, height);
|
||||
self
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,9 @@ pub mod prelude {
|
|||
|
||||
pub use crate::{slint, slint_interpreter};
|
||||
|
||||
pub use layer_shika_domain::prelude::{Margins, ScaleFactor, WindowConfig, WindowDimension};
|
||||
pub use layer_shika_domain::prelude::{
|
||||
LogicalSize, Margins, PhysicalSize, ScaleFactor, WindowConfig, WindowDimension,
|
||||
};
|
||||
|
||||
pub use layer_shika_adapters::platform::wayland::Anchor;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
use crate::value_objects::output_info::OutputInfo;
|
||||
use std::fmt;
|
||||
use std::rc::Rc;
|
||||
|
||||
type OutputFilter = Rc<dyn Fn(&OutputInfo) -> bool>;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum OutputPolicy {
|
||||
AllOutputs,
|
||||
PrimaryOnly,
|
||||
Custom(Box<dyn Fn(&OutputInfo) -> bool>),
|
||||
Custom(OutputFilter),
|
||||
}
|
||||
|
||||
impl OutputPolicy {
|
||||
|
|
@ -28,7 +32,7 @@ impl OutputPolicy {
|
|||
where
|
||||
F: Fn(&OutputInfo) -> bool + 'static,
|
||||
{
|
||||
Self::Custom(Box::new(filter))
|
||||
Self::Custom(Rc::new(filter))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -38,21 +42,12 @@ impl Default for OutputPolicy {
|
|||
}
|
||||
}
|
||||
|
||||
impl Clone for OutputPolicy {
|
||||
fn clone(&self) -> Self {
|
||||
match self {
|
||||
OutputPolicy::AllOutputs | OutputPolicy::Custom(_) => OutputPolicy::AllOutputs,
|
||||
OutputPolicy::PrimaryOnly => OutputPolicy::PrimaryOnly,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for OutputPolicy {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
OutputPolicy::AllOutputs => write!(f, "OutputPolicy::AllOutputs"),
|
||||
OutputPolicy::PrimaryOnly => write!(f, "OutputPolicy::PrimaryOnly"),
|
||||
OutputPolicy::Custom(_) => write!(f, "OutputPolicy::Custom(<function>)"),
|
||||
OutputPolicy::Custom(_) => write!(f, "OutputPolicy::Custom(<filter>)"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
src/lib.rs
10
src/lib.rs
|
|
@ -22,7 +22,7 @@
|
|||
//! ```rust,no_run
|
||||
//! use layer_shika::prelude::*;
|
||||
//!
|
||||
//! LayerShika::from_file("ui/main.slint", Some("AppWindow"))?
|
||||
//! LayerShika::from_file("ui/main.slint")?
|
||||
//! .height(42)
|
||||
//! .anchor(AnchorEdges::top_bar())
|
||||
//! .exclusive_zone(42)
|
||||
|
|
@ -63,10 +63,10 @@
|
|||
pub mod prelude;
|
||||
|
||||
pub use layer_shika_composition::{
|
||||
AnchorEdges, AnchorStrategy, Error, EventContext, EventLoopHandle, KeyboardInteractivity,
|
||||
Layer, LayerShika, OutputGeometry, OutputHandle, OutputInfo, OutputPolicy, OutputRegistry,
|
||||
PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest, PopupSize, PopupWindow,
|
||||
Result, ShellControl, ShellRuntime, SingleWindowShell, DEFAULT_WINDOW_NAME,
|
||||
AnchorEdges, AnchorStrategy, DEFAULT_WINDOW_NAME, Error, EventContext, EventLoopHandle,
|
||||
KeyboardInteractivity, Layer, LayerShika, OutputGeometry, OutputHandle, OutputInfo,
|
||||
OutputPolicy, OutputRegistry, PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest,
|
||||
PopupSize, PopupWindow, Result, ShellControl, ShellRuntime, SingleWindowShell,
|
||||
};
|
||||
|
||||
pub use layer_shika_composition::{
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
#![allow(clippy::pub_use)]
|
||||
|
||||
pub use crate::{
|
||||
Error, EventContext, EventLoopHandle, LayerShika, PopupWindow, Result, ShellControl,
|
||||
ShellRuntime, SingleWindowShell, DEFAULT_WINDOW_NAME,
|
||||
DEFAULT_WINDOW_NAME, Error, EventContext, EventLoopHandle, LayerShika, PopupWindow, Result,
|
||||
ShellControl, ShellRuntime, SingleWindowShell,
|
||||
};
|
||||
|
||||
pub use crate::{
|
||||
|
|
@ -25,7 +25,7 @@ pub use crate::{
|
|||
};
|
||||
|
||||
pub use layer_shika_composition::prelude::{
|
||||
Anchor, Margins, ScaleFactor, WindowConfig, WindowDimension,
|
||||
Anchor, LogicalSize, Margins, PhysicalSize, ScaleFactor, WindowConfig, WindowDimension,
|
||||
};
|
||||
|
||||
pub use crate::calloop;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue