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