mirror of
https://codeberg.org/waydeer/layer-shika.git
synced 2026-01-22 07:05:56 +00:00
refactor: minor changes
This commit is contained in:
parent
6264cca368
commit
9d2e8e6756
9 changed files with 59 additions and 35 deletions
|
|
@ -9,7 +9,7 @@ pub use rendering::femtovg::popup_window::PopupWindow;
|
|||
pub use wayland::config::{MultiSurfaceConfig, ShellSurfaceConfig, WaylandSurfaceConfig};
|
||||
pub use wayland::ops::WaylandSystemOps;
|
||||
pub use wayland::session_lock::{
|
||||
create_lock_property_operation_with_output_filter, LockSurfaceOutputContext, OutputFilter,
|
||||
LockSurfaceOutputContext, OutputFilter, create_lock_property_operation_with_output_filter,
|
||||
};
|
||||
pub use wayland::shell_adapter::WaylandShellSystem;
|
||||
pub use wayland::surfaces::app_state::AppState;
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ 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 layer_shika_domain::value_objects::output_handle::OutputHandle;
|
||||
use slint_interpreter::{ComponentInstance, CompilationResult};
|
||||
use slint_interpreter::Value;
|
||||
use slint_interpreter::{CompilationResult, ComponentInstance};
|
||||
use smithay_client_toolkit::reexports::calloop::LoopHandle;
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
@ -38,7 +38,10 @@ pub trait WaylandSystemOps {
|
|||
filter: OutputFilter,
|
||||
);
|
||||
|
||||
fn register_session_lock_property_operation(&mut self, property_operation: LockPropertyOperation);
|
||||
fn register_session_lock_property_operation(
|
||||
&mut self,
|
||||
property_operation: LockPropertyOperation,
|
||||
);
|
||||
|
||||
fn session_lock_component_name(&self) -> Option<String>;
|
||||
|
||||
|
|
|
|||
|
|
@ -161,10 +161,14 @@ impl OutputManager {
|
|||
_output_id: &ObjectId,
|
||||
queue_handle: &QueueHandle<AppState>,
|
||||
) -> Result<(SurfaceState, ObjectId)> {
|
||||
let layer_shell = self.context.layer_shell.as_ref().ok_or_else(|| {
|
||||
LayerShikaError::InvalidInput {
|
||||
message: "wlr-layer-shell protocol not available - cannot create layer surfaces".into(),
|
||||
}
|
||||
let layer_shell =
|
||||
self.context
|
||||
.layer_shell
|
||||
.as_ref()
|
||||
.ok_or_else(|| LayerShikaError::InvalidInput {
|
||||
message:
|
||||
"wlr-layer-shell protocol not available - cannot create layer surfaces"
|
||||
.into(),
|
||||
})?;
|
||||
|
||||
let setup_params = SurfaceSetupParams {
|
||||
|
|
|
|||
|
|
@ -220,10 +220,6 @@ impl Clone for LockPropertyOperation {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_lock_property_operation(name: impl Into<String>, value: Value) -> LockPropertyOperation {
|
||||
LockPropertyOperation::new(name, value)
|
||||
}
|
||||
|
||||
pub fn create_lock_property_operation_with_output_filter<F>(
|
||||
name: impl Into<String>,
|
||||
value: Value,
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ use wayland_client::{
|
|||
use wayland_protocols::ext::session_lock::v1::client::ext_session_lock_v1::ExtSessionLockV1;
|
||||
|
||||
pub use callbacks::{
|
||||
create_lock_property_operation_with_output_filter, LockCallback, LockPropertyOperation,
|
||||
OutputFilter,
|
||||
LockCallback, LockPropertyOperation, OutputFilter,
|
||||
create_lock_property_operation_with_output_filter,
|
||||
};
|
||||
pub use state::{ActiveLockSurface, LockConfigureContext, LockSurfaceOutputContext};
|
||||
|
||||
|
|
@ -331,7 +331,10 @@ impl SessionLockManager {
|
|||
self.callbacks.push(callback);
|
||||
}
|
||||
|
||||
pub(crate) fn register_property_operation(&mut self, property_operation: LockPropertyOperation) {
|
||||
pub(crate) fn register_property_operation(
|
||||
&mut self,
|
||||
property_operation: LockPropertyOperation,
|
||||
) {
|
||||
for (_, surface) in &self.lock_surfaces {
|
||||
surface.apply_property_operation(&property_operation);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,15 +179,17 @@ impl ActiveLockSurface {
|
|||
|
||||
for property_op in &context.property_operations {
|
||||
if property_op.should_apply(&callback_context) {
|
||||
if let Err(err) =
|
||||
property_op.apply_to_component(component.component_instance())
|
||||
{
|
||||
if let Err(err) = property_op.apply_to_component(component.component_instance()) {
|
||||
info!(
|
||||
"Failed to set lock property '{}': {err}",
|
||||
property_op.name()
|
||||
);
|
||||
} else {
|
||||
info!("Set lock property '{}' on output {:?}", property_op.name(), context.output_handle);
|
||||
info!(
|
||||
"Set lock property '{}' on output {:?}",
|
||||
property_op.name(),
|
||||
context.output_handle
|
||||
);
|
||||
}
|
||||
} else {
|
||||
info!(
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ pub mod lock_surface;
|
|||
pub mod manager;
|
||||
|
||||
pub use manager::{
|
||||
create_lock_property_operation_with_output_filter, LockCallback, LockPropertyOperation,
|
||||
LockSurfaceOutputContext, OutputFilter, SessionLockManager,
|
||||
LockCallback, LockPropertyOperation, LockSurfaceOutputContext, OutputFilter,
|
||||
SessionLockManager, create_lock_property_operation_with_output_filter,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -159,10 +159,14 @@ impl WaylandShellSystem {
|
|||
pointer: &Rc<WlPointer>,
|
||||
layer_surface_config: &LayerSurfaceConfig,
|
||||
) -> Result<Vec<OutputSetup>> {
|
||||
let layer_shell = global_ctx.layer_shell.as_ref().ok_or_else(|| {
|
||||
LayerShikaError::InvalidInput {
|
||||
message: "wlr-layer-shell protocol not available - cannot create layer surfaces".into(),
|
||||
}
|
||||
let layer_shell =
|
||||
global_ctx
|
||||
.layer_shell
|
||||
.as_ref()
|
||||
.ok_or_else(|| LayerShikaError::InvalidInput {
|
||||
message:
|
||||
"wlr-layer-shell protocol not available - cannot create layer surfaces"
|
||||
.into(),
|
||||
})?;
|
||||
|
||||
let mut setups = Vec::new();
|
||||
|
|
@ -473,7 +477,9 @@ impl WaylandShellSystem {
|
|||
.map_err(|e| LayerShikaError::PlatformSetup { source: e })?;
|
||||
app_state.set_slint_platform(Rc::clone(&platform));
|
||||
|
||||
info!("Minimal state initialized successfully (no layer surfaces, empty Slint platform for session locks)");
|
||||
info!(
|
||||
"Minimal state initialized successfully (no layer surfaces, empty Slint platform for session locks)"
|
||||
);
|
||||
|
||||
Ok(app_state)
|
||||
}
|
||||
|
|
@ -485,10 +491,14 @@ impl WaylandShellSystem {
|
|||
event_queue: &mut EventQueue<AppState>,
|
||||
pointer: &Rc<WlPointer>,
|
||||
) -> Result<Vec<OutputSetup>> {
|
||||
let layer_shell = global_ctx.layer_shell.as_ref().ok_or_else(|| {
|
||||
LayerShikaError::InvalidInput {
|
||||
message: "wlr-layer-shell protocol not available - cannot create layer surfaces".into(),
|
||||
}
|
||||
let layer_shell =
|
||||
global_ctx
|
||||
.layer_shell
|
||||
.as_ref()
|
||||
.ok_or_else(|| LayerShikaError::InvalidInput {
|
||||
message:
|
||||
"wlr-layer-shell protocol not available - cannot create layer surfaces"
|
||||
.into(),
|
||||
})?;
|
||||
|
||||
let mut setups = Vec::new();
|
||||
|
|
@ -902,8 +912,12 @@ impl WaylandSystemOps for WaylandShellSystem {
|
|||
.register_session_lock_callback_with_filter(callback_name, handler, filter);
|
||||
}
|
||||
|
||||
fn register_session_lock_property_operation(&mut self, property_operation: LockPropertyOperation) {
|
||||
self.state.register_session_lock_property_operation(property_operation);
|
||||
fn register_session_lock_property_operation(
|
||||
&mut self,
|
||||
property_operation: LockPropertyOperation,
|
||||
) {
|
||||
self.state
|
||||
.register_session_lock_property_operation(property_operation);
|
||||
}
|
||||
|
||||
fn session_lock_component_name(&self) -> Option<String> {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@ use crate::wayland::session_lock::lock_context::SessionLockContext;
|
|||
use crate::wayland::session_lock::manager::callbacks::{
|
||||
create_lock_callback, create_lock_callback_with_output_filter,
|
||||
};
|
||||
use crate::wayland::session_lock::{LockCallback, LockPropertyOperation, OutputFilter, SessionLockManager};
|
||||
use crate::wayland::session_lock::{
|
||||
LockCallback, LockPropertyOperation, OutputFilter, SessionLockManager,
|
||||
};
|
||||
use layer_shika_domain::entities::output_registry::OutputRegistry;
|
||||
use layer_shika_domain::value_objects::handle::SurfaceHandle;
|
||||
use layer_shika_domain::value_objects::lock_config::LockConfig;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue