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> {
|
impl LayerShika<HasComponent> {
|
||||||
#[must_use]
|
#[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.config.dimensions = WindowDimension::new(width, height);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,9 @@ pub mod prelude {
|
||||||
|
|
||||||
pub use crate::{slint, slint_interpreter};
|
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;
|
pub use layer_shika_adapters::platform::wayland::Anchor;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
use crate::value_objects::output_info::OutputInfo;
|
use crate::value_objects::output_info::OutputInfo;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
type OutputFilter = Rc<dyn Fn(&OutputInfo) -> bool>;
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
pub enum OutputPolicy {
|
pub enum OutputPolicy {
|
||||||
AllOutputs,
|
AllOutputs,
|
||||||
PrimaryOnly,
|
PrimaryOnly,
|
||||||
Custom(Box<dyn Fn(&OutputInfo) -> bool>),
|
Custom(OutputFilter),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OutputPolicy {
|
impl OutputPolicy {
|
||||||
|
|
@ -28,7 +32,7 @@ impl OutputPolicy {
|
||||||
where
|
where
|
||||||
F: Fn(&OutputInfo) -> bool + 'static,
|
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 {
|
impl fmt::Debug for OutputPolicy {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
OutputPolicy::AllOutputs => write!(f, "OutputPolicy::AllOutputs"),
|
OutputPolicy::AllOutputs => write!(f, "OutputPolicy::AllOutputs"),
|
||||||
OutputPolicy::PrimaryOnly => write!(f, "OutputPolicy::PrimaryOnly"),
|
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
|
//! ```rust,no_run
|
||||||
//! use layer_shika::prelude::*;
|
//! use layer_shika::prelude::*;
|
||||||
//!
|
//!
|
||||||
//! LayerShika::from_file("ui/main.slint", Some("AppWindow"))?
|
//! LayerShika::from_file("ui/main.slint")?
|
||||||
//! .height(42)
|
//! .height(42)
|
||||||
//! .anchor(AnchorEdges::top_bar())
|
//! .anchor(AnchorEdges::top_bar())
|
||||||
//! .exclusive_zone(42)
|
//! .exclusive_zone(42)
|
||||||
|
|
@ -63,10 +63,10 @@
|
||||||
pub mod prelude;
|
pub mod prelude;
|
||||||
|
|
||||||
pub use layer_shika_composition::{
|
pub use layer_shika_composition::{
|
||||||
AnchorEdges, AnchorStrategy, Error, EventContext, EventLoopHandle, KeyboardInteractivity,
|
AnchorEdges, AnchorStrategy, DEFAULT_WINDOW_NAME, Error, EventContext, EventLoopHandle,
|
||||||
Layer, LayerShika, OutputGeometry, OutputHandle, OutputInfo, OutputPolicy, OutputRegistry,
|
KeyboardInteractivity, Layer, LayerShika, OutputGeometry, OutputHandle, OutputInfo,
|
||||||
PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest, PopupSize, PopupWindow,
|
OutputPolicy, OutputRegistry, PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest,
|
||||||
Result, ShellControl, ShellRuntime, SingleWindowShell, DEFAULT_WINDOW_NAME,
|
PopupSize, PopupWindow, Result, ShellControl, ShellRuntime, SingleWindowShell,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use layer_shika_composition::{
|
pub use layer_shika_composition::{
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
#![allow(clippy::pub_use)]
|
#![allow(clippy::pub_use)]
|
||||||
|
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
Error, EventContext, EventLoopHandle, LayerShika, PopupWindow, Result, ShellControl,
|
DEFAULT_WINDOW_NAME, Error, EventContext, EventLoopHandle, LayerShika, PopupWindow, Result,
|
||||||
ShellRuntime, SingleWindowShell, DEFAULT_WINDOW_NAME,
|
ShellControl, ShellRuntime, SingleWindowShell,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
|
|
@ -25,7 +25,7 @@ pub use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use layer_shika_composition::prelude::{
|
pub use layer_shika_composition::prelude::{
|
||||||
Anchor, Margins, ScaleFactor, WindowConfig, WindowDimension,
|
Anchor, LogicalSize, Margins, PhysicalSize, ScaleFactor, WindowConfig, WindowDimension,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use crate::calloop;
|
pub use crate::calloop;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue