mirror of
https://codeberg.org/waydeer/layer-shika.git
synced 2026-01-01 17:35:55 +00:00
chore: format
This commit is contained in:
parent
7a80655bfc
commit
b0fae9867c
7 changed files with 30 additions and 43 deletions
|
|
@ -3,9 +3,9 @@ use crate::wayland::config::ShellSurfaceConfig;
|
|||
use crate::wayland::surfaces::app_state::AppState;
|
||||
use layer_shika_domain::value_objects::lock_config::LockConfig;
|
||||
use layer_shika_domain::value_objects::lock_state::LockState;
|
||||
use slint_interpreter::Value;
|
||||
use layer_shika_domain::value_objects::output_handle::OutputHandle;
|
||||
use slint_interpreter::ComponentInstance;
|
||||
use slint_interpreter::Value;
|
||||
use smithay_client_toolkit::reexports::calloop::LoopHandle;
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
@ -26,11 +26,7 @@ pub trait WaylandSystemOps {
|
|||
|
||||
fn session_lock_state(&self) -> Option<LockState>;
|
||||
|
||||
fn register_session_lock_callback(
|
||||
&mut self,
|
||||
callback_name: &str,
|
||||
handler: SessionLockCallback,
|
||||
);
|
||||
fn register_session_lock_callback(&mut self, callback_name: &str, handler: SessionLockCallback);
|
||||
|
||||
fn app_state(&self) -> &AppState;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ use layer_shika_domain::value_objects::lock_state::LockState;
|
|||
use log::info;
|
||||
use slint::{
|
||||
LogicalPosition, LogicalSize, SharedString, WindowPosition, WindowSize,
|
||||
platform::{
|
||||
WindowAdapter, WindowEvent, femtovg_renderer::FemtoVGRenderer,
|
||||
},
|
||||
platform::{WindowAdapter, WindowEvent, femtovg_renderer::FemtoVGRenderer},
|
||||
};
|
||||
use slint_interpreter::{CompilationResult, ComponentDefinition, ComponentInstance, Value};
|
||||
use std::collections::HashMap;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@ use log::info;
|
|||
use std::rc::Rc;
|
||||
use wayland_client::{Proxy, backend::ObjectId, protocol::wl_surface::WlSurface};
|
||||
use wayland_protocols::ext::session_lock::v1::client::ext_session_lock_surface_v1::ExtSessionLockSurfaceV1;
|
||||
use wayland_protocols::wp::fractional_scale::v1::client::{
|
||||
wp_fractional_scale_v1::WpFractionalScaleV1,
|
||||
};
|
||||
use wayland_protocols::wp::fractional_scale::v1::client::wp_fractional_scale_v1::WpFractionalScaleV1;
|
||||
use wayland_protocols::wp::viewporter::client::wp_viewport::WpViewport;
|
||||
|
||||
pub struct LockSurface {
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@ use super::keyboard_state::KeyboardState;
|
|||
use super::surface_state::SurfaceState;
|
||||
use crate::errors::{LayerShikaError, Result};
|
||||
use crate::rendering::egl::context_factory::RenderContextFactory;
|
||||
use crate::rendering::slint_integration::platform::CustomSlintPlatform;
|
||||
use crate::wayland::globals::context::GlobalContext;
|
||||
use crate::wayland::managed_proxies::{ManagedWlKeyboard, ManagedWlPointer};
|
||||
use crate::wayland::outputs::{OutputManager, OutputMapping};
|
||||
use crate::wayland::session_lock::lock_context::SessionLockContext;
|
||||
use crate::wayland::session_lock::lock_manager::{LockCallback, SessionLockManager};
|
||||
use crate::rendering::slint_integration::platform::CustomSlintPlatform;
|
||||
use layer_shika_domain::entities::output_registry::OutputRegistry;
|
||||
use layer_shika_domain::value_objects::handle::SurfaceHandle;
|
||||
use layer_shika_domain::value_objects::output_handle::OutputHandle;
|
||||
use layer_shika_domain::value_objects::lock_config::LockConfig;
|
||||
use layer_shika_domain::value_objects::lock_state::LockState;
|
||||
use layer_shika_domain::value_objects::output_handle::OutputHandle;
|
||||
use layer_shika_domain::value_objects::output_info::OutputInfo;
|
||||
use slint_interpreter::{CompilationResult, ComponentDefinition, Value};
|
||||
use std::cell::RefCell;
|
||||
|
|
@ -152,13 +152,13 @@ impl AppState {
|
|||
}
|
||||
|
||||
let context = self.create_lock_context()?;
|
||||
let (definition, compilation_result) =
|
||||
self.resolve_lock_component(component_name)?;
|
||||
let platform = self.slint_platform.as_ref().ok_or_else(|| {
|
||||
LayerShikaError::InvalidInput {
|
||||
message: "Slint platform not initialized".to_string(),
|
||||
}
|
||||
})?;
|
||||
let (definition, compilation_result) = self.resolve_lock_component(component_name)?;
|
||||
let platform =
|
||||
self.slint_platform
|
||||
.as_ref()
|
||||
.ok_or_else(|| LayerShikaError::InvalidInput {
|
||||
message: "Slint platform not initialized".to_string(),
|
||||
})?;
|
||||
let mut manager = SessionLockManager::new(
|
||||
context,
|
||||
definition,
|
||||
|
|
@ -208,13 +208,11 @@ impl AppState {
|
|||
message: "No compilation result available for session lock".to_string(),
|
||||
})?;
|
||||
|
||||
let definition = compilation_result.component(component_name).ok_or_else(|| {
|
||||
LayerShikaError::InvalidInput {
|
||||
message: format!(
|
||||
"Component '{component_name}' not found in compilation result"
|
||||
),
|
||||
}
|
||||
})?;
|
||||
let definition = compilation_result
|
||||
.component(component_name)
|
||||
.ok_or_else(|| LayerShikaError::InvalidInput {
|
||||
message: format!("Component '{component_name}' not found in compilation result"),
|
||||
})?;
|
||||
|
||||
Ok((definition, Some(compilation_result)))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ mod event_loop;
|
|||
mod layer_surface;
|
||||
mod popup;
|
||||
mod popup_builder;
|
||||
mod session_lock;
|
||||
mod selection;
|
||||
mod selector;
|
||||
mod session_lock;
|
||||
mod shell;
|
||||
mod shell_config;
|
||||
mod shell_runtime;
|
||||
|
|
@ -41,9 +41,9 @@ pub use layer_shika_domain::value_objects::{
|
|||
pub use layer_surface::{LayerSurfaceHandle, ShellSurfaceConfigHandler};
|
||||
pub use popup::PopupShell;
|
||||
pub use popup_builder::PopupBuilder;
|
||||
pub use session_lock::{SessionLock, SessionLockBuilder};
|
||||
pub use selection::Selection;
|
||||
pub use selector::{Output, Selector, Surface, SurfaceInfo};
|
||||
pub use session_lock::{SessionLock, SessionLockBuilder};
|
||||
pub use shell_runtime::{DEFAULT_SURFACE_NAME, ShellRuntime};
|
||||
pub use system::{
|
||||
CallbackContext, EventDispatchContext, RuntimeSurfaceConfigBuilder, ShellControl,
|
||||
|
|
@ -95,8 +95,7 @@ pub mod prelude {
|
|||
SessionLock, SessionLockBuilder, Shell, ShellBuilder, ShellConfig, ShellControl,
|
||||
ShellEventContext, ShellEventLoop, ShellRuntime, ShellSurfaceConfigHandler, Surface,
|
||||
SurfaceComponentConfig, SurfaceConfigBuilder, SurfaceControlHandle, SurfaceDefinition,
|
||||
SurfaceEntry, SurfaceHandle, SurfaceInfo,
|
||||
SurfaceMetadata, SurfaceRegistry,
|
||||
SurfaceEntry, SurfaceHandle, SurfaceInfo, SurfaceMetadata, SurfaceRegistry,
|
||||
};
|
||||
|
||||
pub use crate::calloop::{Generic, Interest, Mode, PostAction, RegistrationToken, Timer};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
use crate::{Error, Result};
|
||||
use crate::IntoValue;
|
||||
use crate::calloop::channel;
|
||||
use crate::slint_interpreter::Value;
|
||||
use crate::system::{SessionLockCommand, ShellCommand};
|
||||
use crate::{Error, Result};
|
||||
use layer_shika_adapters::WaylandSystemOps;
|
||||
use layer_shika_domain::dimensions::ScaleFactor;
|
||||
use layer_shika_domain::errors::DomainError;
|
||||
|
|
@ -10,9 +11,8 @@ use layer_shika_domain::value_objects::lock_state::LockState;
|
|||
use layer_shika_domain::value_objects::margins::Margins;
|
||||
use layer_shika_domain::value_objects::output_policy::OutputPolicy;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::rc::Weak;
|
||||
use std::rc::Rc;
|
||||
use crate::slint_interpreter::Value;
|
||||
use std::rc::Weak;
|
||||
|
||||
pub struct SessionLock {
|
||||
system: Weak<RefCell<dyn WaylandSystemOps>>,
|
||||
|
|
@ -81,9 +81,11 @@ impl SessionLock {
|
|||
// Send deactivate command via channel to be processed outside borrow context
|
||||
self.command_sender
|
||||
.send(ShellCommand::SessionLock(SessionLockCommand::Deactivate))
|
||||
.map_err(|e| Error::Domain(DomainError::InvalidInput {
|
||||
message: format!("Failed to send session lock command: {e:?}"),
|
||||
}))?;
|
||||
.map_err(|e| {
|
||||
Error::Domain(DomainError::InvalidInput {
|
||||
message: format!("Failed to send session lock command: {e:?}"),
|
||||
})
|
||||
})?;
|
||||
|
||||
log::info!("SessionLockCommand::Deactivate queued successfully");
|
||||
Ok(())
|
||||
|
|
@ -134,7 +136,6 @@ impl SessionLock {
|
|||
pub fn component_name(&self) -> &str {
|
||||
&self.component_name
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pub struct SessionLockBuilder {
|
||||
|
|
|
|||
|
|
@ -803,10 +803,7 @@ impl Shell {
|
|||
let component = builder.component_name().to_string();
|
||||
if self.compilation_result.component(&component).is_none() {
|
||||
return Err(Error::Domain(DomainError::Configuration {
|
||||
message: format!(
|
||||
"Component '{}' not found in compilation result",
|
||||
component
|
||||
),
|
||||
message: format!("Component '{}' not found in compilation result", component),
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue