From 983056abfc94fc449419fa69bede7026c1794302 Mon Sep 17 00:00:00 2001 From: drendog Date: Thu, 4 Dec 2025 02:55:55 +0100 Subject: [PATCH] refactor: rename window to surface to avoid mislead --- crates/adapters/src/lib.rs | 2 +- crates/adapters/src/wayland/config.rs | 28 ++-- .../wayland/event_handling/app_dispatcher.rs | 12 +- .../src/wayland/outputs/output_manager.rs | 6 +- crates/adapters/src/wayland/shell_adapter.rs | 38 ++--- .../src/wayland/surfaces/app_state.rs | 119 +++++++-------- crates/composition/src/layer_surface.rs | 10 +- crates/composition/src/lib.rs | 14 +- crates/composition/src/popup_builder.rs | 6 +- crates/composition/src/shell.rs | 142 +++++++++--------- crates/composition/src/shell_runtime.rs | 2 +- crates/composition/src/system.rs | 12 +- crates/domain/src/config.rs | 12 +- crates/domain/src/prelude.rs | 4 +- crates/domain/src/value_objects/dimensions.rs | 6 +- src/lib.rs | 26 ++-- src/prelude.rs | 8 +- src/shell.rs | 6 +- src/window.rs | 2 - 19 files changed, 225 insertions(+), 230 deletions(-) diff --git a/crates/adapters/src/lib.rs b/crates/adapters/src/lib.rs index 212769e..2b88827 100644 --- a/crates/adapters/src/lib.rs +++ b/crates/adapters/src/lib.rs @@ -6,7 +6,7 @@ pub(crate) mod wayland; pub use rendering::femtovg::popup_window::PopupWindow; -pub use wayland::config::{MultiWindowConfig, ShellWindowConfig, WaylandWindowConfig}; +pub use wayland::config::{MultiSurfaceConfig, ShellSurfaceConfig, WaylandSurfaceConfig}; pub use wayland::facade::WindowingSystemFacade; pub use wayland::shell_adapter::WaylandWindowingSystem; pub use wayland::surfaces::app_state::AppState; diff --git a/crates/adapters/src/wayland/config.rs b/crates/adapters/src/wayland/config.rs index 9f753de..d8ea95d 100644 --- a/crates/adapters/src/wayland/config.rs +++ b/crates/adapters/src/wayland/config.rs @@ -1,4 +1,4 @@ -use layer_shika_domain::config::WindowConfig as DomainWindowConfig; +use layer_shika_domain::config::SurfaceConfig as DomainSurfaceConfig; use layer_shika_domain::value_objects::anchor::AnchorEdges; use layer_shika_domain::value_objects::keyboard_interactivity::KeyboardInteractivity as DomainKeyboardInteractivity; use layer_shika_domain::value_objects::layer::Layer; @@ -22,7 +22,7 @@ pub(crate) struct LayerSurfaceConfig { } #[derive(Clone)] -pub struct WaylandWindowConfig { +pub struct WaylandSurfaceConfig { pub height: u32, pub width: u32, pub layer: zwlr_layer_shell_v1::Layer, @@ -37,12 +37,12 @@ pub struct WaylandWindowConfig { pub output_policy: OutputPolicy, } -impl WaylandWindowConfig { +impl WaylandSurfaceConfig { #[must_use] pub fn from_domain_config( component_definition: ComponentDefinition, compilation_result: Option>, - domain_config: DomainWindowConfig, + domain_config: DomainSurfaceConfig, ) -> Self { Self { height: domain_config.dimensions.height(), @@ -102,35 +102,35 @@ const fn convert_keyboard_interactivity( } #[derive(Clone)] -pub struct ShellWindowConfig { +pub struct ShellSurfaceConfig { pub name: String, - pub config: WaylandWindowConfig, + pub config: WaylandSurfaceConfig, } #[derive(Clone)] -pub struct MultiWindowConfig { - pub windows: Vec, +pub struct MultiSurfaceConfig { + pub surfaces: Vec, pub compilation_result: Rc, } -impl MultiWindowConfig { +impl MultiSurfaceConfig { pub fn new(compilation_result: Rc) -> Self { Self { - windows: Vec::new(), + surfaces: Vec::new(), compilation_result, } } #[must_use] - pub fn add_window(mut self, name: impl Into, config: WaylandWindowConfig) -> Self { - self.windows.push(ShellWindowConfig { + pub fn add_surface(mut self, name: impl Into, config: WaylandSurfaceConfig) -> Self { + self.surfaces.push(ShellSurfaceConfig { name: name.into(), config, }); self } - pub fn primary_config(&self) -> Option<&WaylandWindowConfig> { - self.windows.first().map(|w| &w.config) + pub fn primary_config(&self) -> Option<&WaylandSurfaceConfig> { + self.surfaces.first().map(|s| &s.config) } } diff --git a/crates/adapters/src/wayland/event_handling/app_dispatcher.rs b/crates/adapters/src/wayland/event_handling/app_dispatcher.rs index f56d2bc..8e008e4 100644 --- a/crates/adapters/src/wayland/event_handling/app_dispatcher.rs +++ b/crates/adapters/src/wayland/event_handling/app_dispatcher.rs @@ -206,12 +206,12 @@ impl Dispatch for AppState { if let Some(window) = state.get_window_by_key_mut(&key) { window.handle_pointer_enter(serial, &surface, surface_x, surface_y); } - state.set_active_window_key(Some(key)); + state.set_active_surface_key(Some(key)); } else if let Some(key) = state.get_key_by_popup(&surface_id).cloned() { if let Some(window) = state.get_window_by_key_mut(&key) { window.handle_pointer_enter(serial, &surface, surface_x, surface_y); } - state.set_active_window_key(Some(key)); + state.set_active_surface_key(Some(key)); } } @@ -220,16 +220,16 @@ impl Dispatch for AppState { surface_y, .. } => { - if let Some(window) = state.active_window_mut() { + if let Some(window) = state.active_surface_mut() { window.handle_pointer_motion(surface_x, surface_y); } } wl_pointer::Event::Leave { .. } => { - if let Some(window) = state.active_window_mut() { + if let Some(window) = state.active_surface_mut() { window.handle_pointer_leave(); } - state.set_active_window_key(None); + state.set_active_surface_key(None); } wl_pointer::Event::Button { @@ -237,7 +237,7 @@ impl Dispatch for AppState { state: button_state, .. } => { - if let Some(window) = state.active_window_mut() { + if let Some(window) = state.active_surface_mut() { window.handle_pointer_button(serial, button_state); } } diff --git a/crates/adapters/src/wayland/outputs/output_manager.rs b/crates/adapters/src/wayland/outputs/output_manager.rs index bcdc555..aeb8b02 100644 --- a/crates/adapters/src/wayland/outputs/output_manager.rs +++ b/crates/adapters/src/wayland/outputs/output_manager.rs @@ -2,7 +2,7 @@ use crate::{ errors::{LayerShikaError, Result}, rendering::egl::context_factory::RenderContextFactory, wayland::{ - config::{LayerSurfaceConfig, WaylandWindowConfig}, + config::{LayerSurfaceConfig, WaylandSurfaceConfig}, shell_adapter::WaylandWindowingSystem, surfaces::{ app_state::AppState, @@ -60,7 +60,7 @@ struct PendingOutput { pub struct OutputManager { context: OutputManagerContext, - config: WaylandWindowConfig, + config: WaylandSurfaceConfig, pub(crate) layer_surface_config: LayerSurfaceConfig, output_mapping: OutputMapping, pending_outputs: RefCell>, @@ -69,7 +69,7 @@ pub struct OutputManager { impl OutputManager { pub(crate) fn new( context: OutputManagerContext, - config: WaylandWindowConfig, + config: WaylandSurfaceConfig, layer_surface_config: LayerSurfaceConfig, ) -> Self { Self { diff --git a/crates/adapters/src/wayland/shell_adapter.rs b/crates/adapters/src/wayland/shell_adapter.rs index 532ff8c..f537c8d 100644 --- a/crates/adapters/src/wayland/shell_adapter.rs +++ b/crates/adapters/src/wayland/shell_adapter.rs @@ -1,5 +1,5 @@ use crate::wayland::{ - config::{LayerSurfaceConfig, ShellWindowConfig, WaylandWindowConfig}, + config::{LayerSurfaceConfig, ShellSurfaceConfig, WaylandSurfaceConfig}, globals::context::GlobalContext, managed_proxies::ManagedWlPointer, outputs::{OutputManager, OutputManagerContext}, @@ -50,11 +50,11 @@ struct OutputSetup { main_surface_id: ObjectId, window: Rc, builder: WindowStateBuilder, - shell_window_name: String, + shell_surface_name: String, } struct OutputManagerParams<'a> { - config: &'a WaylandWindowConfig, + config: &'a WaylandSurfaceConfig, global_ctx: &'a GlobalContext, connection: &'a Connection, layer_surface_config: LayerSurfaceConfig, @@ -72,7 +72,7 @@ pub struct WaylandWindowingSystem { } impl WaylandWindowingSystem { - pub fn new(config: &WaylandWindowConfig) -> Result { + pub fn new(config: &WaylandSurfaceConfig) -> Result { info!("Initializing WindowingSystem"); let (connection, mut event_queue) = Self::init_wayland_connection()?; let event_loop = @@ -88,15 +88,15 @@ impl WaylandWindowingSystem { }) } - pub fn new_multi(configs: &[ShellWindowConfig]) -> Result { + pub fn new_multi(configs: &[ShellSurfaceConfig]) -> Result { if configs.is_empty() { return Err(LayerShikaError::InvalidInput { - message: "At least one window config is required".into(), + message: "At least one surface config is required".into(), }); } info!( - "Initializing WindowingSystem with {} window configs", + "Initializing WindowingSystem with {} surface configs", configs.len() ); let (connection, mut event_queue) = Self::init_wayland_connection()?; @@ -119,7 +119,7 @@ impl WaylandWindowingSystem { Ok((connection, event_queue)) } - fn create_layer_surface_config(config: &WaylandWindowConfig) -> LayerSurfaceConfig { + fn create_layer_surface_config(config: &WaylandSurfaceConfig) -> LayerSurfaceConfig { LayerSurfaceConfig { anchor: config.anchor, margin: config.margin, @@ -131,7 +131,7 @@ impl WaylandWindowingSystem { } fn create_output_setups( - config: &WaylandWindowConfig, + config: &WaylandSurfaceConfig, global_ctx: &GlobalContext, connection: &Connection, event_queue: &mut EventQueue, @@ -198,7 +198,7 @@ impl WaylandWindowingSystem { main_surface_id, window, builder, - shell_window_name: "default".to_string(), + shell_surface_name: "default".to_string(), }); } @@ -251,9 +251,9 @@ impl WaylandWindowingSystem { popup_managers.push(Rc::clone(&popup_manager)); layer_surfaces.push(per_output_window.layer_surface()); - app_state.add_shell_window( + app_state.add_shell_surface( &setup.output_id, - &setup.shell_window_name, + &setup.shell_surface_name, setup.main_surface_id, per_output_window, ); @@ -263,7 +263,7 @@ impl WaylandWindowingSystem { } fn init_state( - config: &WaylandWindowConfig, + config: &WaylandSurfaceConfig, connection: &Connection, event_queue: &mut EventQueue, ) -> Result { @@ -330,7 +330,7 @@ impl WaylandWindowingSystem { } fn init_state_multi( - configs: &[ShellWindowConfig], + configs: &[ShellSurfaceConfig], connection: &Connection, event_queue: &mut EventQueue, ) -> Result { @@ -399,7 +399,7 @@ impl WaylandWindowingSystem { } fn create_output_setups_multi( - configs: &[ShellWindowConfig], + configs: &[ShellSurfaceConfig], global_ctx: &GlobalContext, connection: &Connection, event_queue: &mut EventQueue, @@ -419,7 +419,7 @@ impl WaylandWindowingSystem { if !config.output_policy.should_render(&temp_info) { info!( - "Skipping shell window '{}' on output {} due to output policy", + "Skipping shell surface '{}' on output {} due to output policy", shell_config.name, output_index ); continue; @@ -469,7 +469,7 @@ impl WaylandWindowingSystem { } info!( - "Created setup for shell window '{}' on output {}", + "Created setup for shell surface '{}' on output {}", shell_config.name, output_index ); @@ -478,7 +478,7 @@ impl WaylandWindowingSystem { main_surface_id, window, builder, - shell_window_name: shell_config.name.clone(), + shell_surface_name: shell_config.name.clone(), }); } } @@ -561,7 +561,7 @@ impl WaylandWindowingSystem { pub(crate) fn initialize_renderer( surface: &Rc, - config: &WaylandWindowConfig, + config: &WaylandSurfaceConfig, render_factory: &Rc, ) -> Result> { let init_size = PhysicalSize::new(1, 1); diff --git a/crates/adapters/src/wayland/surfaces/app_state.rs b/crates/adapters/src/wayland/surfaces/app_state.rs index b5d60b0..80ca4ec 100644 --- a/crates/adapters/src/wayland/surfaces/app_state.rs +++ b/crates/adapters/src/wayland/surfaces/app_state.rs @@ -14,16 +14,16 @@ use wayland_client::backend::ObjectId; pub type PerOutputWindow = WindowState; #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ShellWindowKey { +pub struct ShellSurfaceKey { pub output_handle: OutputHandle, - pub shell_window_name: String, + pub surface_name: String, } -impl ShellWindowKey { - pub fn new(output_handle: OutputHandle, shell_window_name: impl Into) -> Self { +impl ShellSurfaceKey { + pub fn new(output_handle: OutputHandle, surface_name: impl Into) -> Self { Self { output_handle, - shell_window_name: shell_window_name.into(), + surface_name: surface_name.into(), } } } @@ -31,13 +31,13 @@ impl ShellWindowKey { pub struct AppState { output_registry: OutputRegistry, output_mapping: OutputMapping, - windows: HashMap, - surface_to_key: HashMap, + surfaces: HashMap, + surface_to_key: HashMap, _pointer: ManagedWlPointer, shared_pointer_serial: Rc, output_manager: Option>>, registry_name_to_output_id: HashMap, - active_window_key: Option, + active_surface_key: Option, } impl AppState { @@ -45,13 +45,13 @@ impl AppState { Self { output_registry: OutputRegistry::new(), output_mapping: OutputMapping::new(), - windows: HashMap::new(), + surfaces: HashMap::new(), surface_to_key: HashMap::new(), _pointer: pointer, shared_pointer_serial: shared_serial, output_manager: None, registry_name_to_output_id: HashMap::new(), - active_window_key: None, + active_surface_key: None, } } @@ -75,12 +75,12 @@ impl AppState { self.registry_name_to_output_id.remove(&name) } - pub fn add_shell_window( + pub fn add_shell_surface( &mut self, output_id: &ObjectId, - shell_window_name: &str, + surface_name: &str, main_surface_id: ObjectId, - window: PerOutputWindow, + surface_state: PerOutputWindow, ) { let handle = self.output_mapping.get(output_id).unwrap_or_else(|| { let h = self.output_mapping.insert(output_id.clone()); @@ -91,25 +91,25 @@ impl AppState { h }); - let key = ShellWindowKey::new(handle, shell_window_name); + let key = ShellSurfaceKey::new(handle, surface_name); self.surface_to_key.insert(main_surface_id, key.clone()); - self.windows.insert(key, window); + self.surfaces.insert(key, surface_state); } pub fn add_output( &mut self, output_id: &ObjectId, main_surface_id: ObjectId, - window: PerOutputWindow, + surface_state: PerOutputWindow, ) { - self.add_shell_window(output_id, "default", main_surface_id, window); + self.add_shell_surface(output_id, "default", main_surface_id, surface_state); } pub fn remove_output(&mut self, handle: OutputHandle) -> Vec { self.output_registry.remove(handle); let keys_to_remove: Vec<_> = self - .windows + .surfaces .keys() .filter(|k| k.output_handle == handle) .cloned() @@ -117,7 +117,7 @@ impl AppState { let mut removed = Vec::new(); for key in keys_to_remove { - if let Some(window) = self.windows.remove(&key) { + if let Some(window) = self.surfaces.remove(&key) { removed.push(window); } } @@ -127,12 +127,12 @@ impl AppState { removed } - pub fn get_window_by_key(&self, key: &ShellWindowKey) -> Option<&PerOutputWindow> { - self.windows.get(key) + pub fn get_window_by_key(&self, key: &ShellSurfaceKey) -> Option<&PerOutputWindow> { + self.surfaces.get(key) } - pub fn get_window_by_key_mut(&mut self, key: &ShellWindowKey) -> Option<&mut PerOutputWindow> { - self.windows.get_mut(key) + pub fn get_window_by_key_mut(&mut self, key: &ShellSurfaceKey) -> Option<&mut PerOutputWindow> { + self.surfaces.get_mut(key) } pub fn get_window_by_name( @@ -140,8 +140,8 @@ impl AppState { output_handle: OutputHandle, shell_window_name: &str, ) -> Option<&PerOutputWindow> { - let key = ShellWindowKey::new(output_handle, shell_window_name); - self.windows.get(&key) + let key = ShellSurfaceKey::new(output_handle, shell_window_name); + self.surfaces.get(&key) } pub fn get_window_by_name_mut( @@ -149,8 +149,8 @@ impl AppState { output_handle: OutputHandle, shell_window_name: &str, ) -> Option<&mut PerOutputWindow> { - let key = ShellWindowKey::new(output_handle, shell_window_name); - self.windows.get_mut(&key) + let key = ShellSurfaceKey::new(output_handle, shell_window_name); + self.surfaces.get_mut(&key) } pub fn get_output_by_output_id(&self, output_id: &ObjectId) -> Option<&PerOutputWindow> { @@ -169,7 +169,7 @@ impl AppState { } fn get_first_window_for_output(&self, handle: OutputHandle) -> Option<&PerOutputWindow> { - self.windows + self.surfaces .iter() .find(|(k, _)| k.output_handle == handle) .map(|(_, v)| v) @@ -179,7 +179,7 @@ impl AppState { &mut self, handle: OutputHandle, ) -> Option<&mut PerOutputWindow> { - self.windows + self.surfaces .iter_mut() .find(|(k, _)| k.output_handle == handle) .map(|(_, v)| v) @@ -188,7 +188,7 @@ impl AppState { pub fn get_output_by_surface(&self, surface_id: &ObjectId) -> Option<&PerOutputWindow> { self.surface_to_key .get(surface_id) - .and_then(|key| self.windows.get(key)) + .and_then(|key| self.surfaces.get(key)) } pub fn get_output_by_surface_mut( @@ -197,19 +197,19 @@ impl AppState { ) -> Option<&mut PerOutputWindow> { self.surface_to_key .get(surface_id) - .and_then(|key| self.windows.get_mut(key)) + .and_then(|key| self.surfaces.get_mut(key)) } pub fn get_output_by_layer_surface_mut( &mut self, layer_surface_id: &ObjectId, ) -> Option<&mut PerOutputWindow> { - self.windows + self.surfaces .values_mut() .find(|window| window.layer_surface().as_ref().id() == *layer_surface_id) } - pub fn get_key_by_surface(&self, surface_id: &ObjectId) -> Option<&ShellWindowKey> { + pub fn get_key_by_surface(&self, surface_id: &ObjectId) -> Option<&ShellSurfaceKey> { self.surface_to_key.get(surface_id) } @@ -231,22 +231,22 @@ impl AppState { self.output_registry.active_handle() } - pub fn set_active_window_key(&mut self, key: Option) { + pub fn set_active_surface_key(&mut self, key: Option) { if let Some(ref k) = key { self.output_registry.set_active(Some(k.output_handle)); } else { self.output_registry.set_active(None); } - self.active_window_key = key; + self.active_surface_key = key; } - pub fn active_window_key(&self) -> Option<&ShellWindowKey> { - self.active_window_key.as_ref() + pub fn active_surface_key(&self) -> Option<&ShellSurfaceKey> { + self.active_surface_key.as_ref() } - pub fn active_window_mut(&mut self) -> Option<&mut PerOutputWindow> { - let key = self.active_window_key.clone()?; - self.windows.get_mut(&key) + pub fn active_surface_mut(&mut self) -> Option<&mut PerOutputWindow> { + let key = self.active_surface_key.clone()?; + self.surfaces.get_mut(&key) } pub fn primary_output(&self) -> Option<&PerOutputWindow> { @@ -266,25 +266,25 @@ impl AppState { } pub fn all_outputs(&self) -> impl Iterator { - self.windows.values() + self.surfaces.values() } pub fn all_outputs_mut(&mut self) -> impl Iterator { - self.windows.values_mut() + self.surfaces.values_mut() } pub fn windows_for_output( &self, handle: OutputHandle, ) -> impl Iterator { - self.windows + self.surfaces .iter() .filter(move |(k, _)| k.output_handle == handle) - .map(|(k, v)| (k.shell_window_name.as_str(), v)) + .map(|(k, v)| (k.surface_name.as_str(), v)) } - pub fn windows_with_keys(&self) -> impl Iterator { - self.windows.iter() + pub fn windows_with_keys(&self) -> impl Iterator { + self.surfaces.iter() } pub const fn shared_pointer_serial(&self) -> &Rc { @@ -292,7 +292,7 @@ impl AppState { } pub fn find_output_by_popup(&self, popup_surface_id: &ObjectId) -> Option<&PerOutputWindow> { - self.windows.values().find(|window| { + self.surfaces.values().find(|window| { window .popup_manager() .as_ref() @@ -305,7 +305,7 @@ impl AppState { &mut self, popup_surface_id: &ObjectId, ) -> Option<&mut PerOutputWindow> { - self.windows.values_mut().find(|window| { + self.surfaces.values_mut().find(|window| { window .popup_manager() .as_ref() @@ -314,8 +314,8 @@ impl AppState { }) } - pub fn get_key_by_popup(&self, popup_surface_id: &ObjectId) -> Option<&ShellWindowKey> { - self.windows.iter().find_map(|(key, window)| { + pub fn get_key_by_popup(&self, popup_surface_id: &ObjectId) -> Option<&ShellSurfaceKey> { + self.surfaces.iter().find_map(|(key, window)| { window .popup_manager() .as_ref() @@ -352,24 +352,21 @@ impl AppState { &self.output_registry } - pub fn shell_window_names(&self) -> Vec<&str> { + pub fn shell_surface_names(&self) -> Vec<&str> { let mut names: Vec<_> = self - .windows + .surfaces .keys() - .map(|k| k.shell_window_name.as_str()) + .map(|k| k.surface_name.as_str()) .collect(); names.sort_unstable(); names.dedup(); names } - pub fn windows_by_shell_name( - &self, - shell_window_name: &str, - ) -> impl Iterator { - self.windows + pub fn surfaces_by_name(&self, surface_name: &str) -> impl Iterator { + self.surfaces .iter() - .filter(move |(k, _)| k.shell_window_name == shell_window_name) + .filter(move |(k, _)| k.surface_name == surface_name) .map(|(_, v)| v) } @@ -378,7 +375,7 @@ impl AppState { } pub fn outputs_with_handles(&self) -> impl Iterator { - self.windows + self.surfaces .iter() .map(|(key, window)| (key.output_handle, window)) } @@ -399,7 +396,7 @@ impl AppState { return Vec::new(); }; - self.windows + self.surfaces .iter_mut() .filter(|(k, _)| k.output_handle == handle) .map(|(_, v)| v) diff --git a/crates/composition/src/layer_surface.rs b/crates/composition/src/layer_surface.rs index 6962808..312a9b7 100644 --- a/crates/composition/src/layer_surface.rs +++ b/crates/composition/src/layer_surface.rs @@ -61,20 +61,20 @@ impl<'a> LayerSurfaceHandle<'a> { } } -pub trait ShellWindowConfigHandler { - fn configure_window(&self, instance: &ComponentInstance, surface: LayerSurfaceHandle<'_>); +pub trait ShellSurfaceConfigHandler { + fn configure_surface(&self, instance: &ComponentInstance, surface: LayerSurfaceHandle<'_>); } -impl ShellWindowConfigHandler for F +impl ShellSurfaceConfigHandler for F where F: Fn(&ComponentInstance, LayerSurfaceHandle<'_>), { - fn configure_window(&self, instance: &ComponentInstance, surface: LayerSurfaceHandle<'_>) { + fn configure_surface(&self, instance: &ComponentInstance, surface: LayerSurfaceHandle<'_>) { self(instance, surface); } } #[derive(Debug, Clone)] -pub struct ShellWindowHandle { +pub struct ShellSurfaceHandle { pub name: String, } diff --git a/crates/composition/src/lib.rs b/crates/composition/src/lib.rs index d9901ac..1ea3728 100644 --- a/crates/composition/src/lib.rs +++ b/crates/composition/src/lib.rs @@ -27,15 +27,15 @@ pub use layer_shika_domain::value_objects::popup_request::{ PopupHandle, PopupPlacement, PopupRequest, PopupSize, }; pub use popup_builder::PopupBuilder; -pub use shell_runtime::{DEFAULT_WINDOW_NAME, ShellRuntime}; +pub use shell_runtime::{DEFAULT_SURFACE_NAME, ShellRuntime}; pub use system::{EventContext, EventLoopHandle, ShellControl, SingleWindowShell}; pub use value_conversion::IntoValue; -pub use layer_surface::{LayerSurfaceHandle, ShellWindowConfigHandler, ShellWindowHandle}; +pub use layer_surface::{LayerSurfaceHandle, ShellSurfaceConfigHandler, ShellSurfaceHandle}; pub use shell::{ DEFAULT_COMPONENT_NAME, Shell, ShellBuilder, ShellEventContext, ShellEventLoopHandle, - WindowConfigBuilder, WindowDefinition, + SurfaceConfigBuilder, SurfaceDefinition, }; pub mod calloop { @@ -60,13 +60,13 @@ pub enum Error { pub mod prelude { pub use crate::{ - AnchorEdges, AnchorStrategy, DEFAULT_COMPONENT_NAME, DEFAULT_WINDOW_NAME, EventContext, + AnchorEdges, AnchorStrategy, DEFAULT_COMPONENT_NAME, DEFAULT_SURFACE_NAME, EventContext, EventLoopHandle, IntoValue, KeyboardInteractivity, Layer, LayerSurfaceHandle, OutputGeometry, OutputHandle, OutputInfo, OutputPolicy, OutputRegistry, PopupBuilder, PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest, PopupSize, PopupWindow, Result, Shell, ShellBuilder, ShellControl, ShellEventContext, ShellEventLoopHandle, - ShellRuntime, ShellWindowConfigHandler, ShellWindowHandle, SingleWindowShell, - WindowConfigBuilder, WindowDefinition, + ShellRuntime, ShellSurfaceConfigHandler, ShellSurfaceHandle, SingleWindowShell, + SurfaceConfigBuilder, SurfaceDefinition, }; pub use crate::calloop::{Generic, Interest, Mode, PostAction, RegistrationToken, Timer}; @@ -74,7 +74,7 @@ pub mod prelude { pub use crate::{slint, slint_interpreter}; pub use layer_shika_domain::prelude::{ - LogicalSize, Margins, PhysicalSize, ScaleFactor, WindowConfig, WindowDimension, + LogicalSize, Margins, PhysicalSize, ScaleFactor, SurfaceConfig, SurfaceDimension, }; pub use layer_shika_adapters::platform::wayland::Anchor; diff --git a/crates/composition/src/popup_builder.rs b/crates/composition/src/popup_builder.rs index da95b97..4f36f57 100644 --- a/crates/composition/src/popup_builder.rs +++ b/crates/composition/src/popup_builder.rs @@ -148,7 +148,7 @@ impl<'a> PopupBuilder<'a> { let request = self.build_request(); let control = self.shell.control(); - self.shell.with_all_windows(|_name, instance| { + self.shell.with_all_surfaces(|_name, instance| { let request_clone = request.clone(); let control_clone = control.clone(); @@ -174,7 +174,7 @@ impl<'a> PopupBuilder<'a> { let control = self.shell.control(); let component_name = request.component.clone(); - self.shell.with_all_windows(|_name, instance| { + self.shell.with_all_surfaces(|_name, instance| { let request_clone = request.clone(); let control_clone = control.clone(); let component_clone = component_name.clone(); @@ -205,7 +205,7 @@ impl<'a> PopupBuilder<'a> { let resize_callback = self.resize_callback.clone(); let control = self.shell.control(); - self.shell.with_all_windows(|_name, instance| { + self.shell.with_all_surfaces(|_name, instance| { let component_clone = component_name.clone(); let control_clone = control.clone(); let close_cb = close_callback.clone(); diff --git a/crates/composition/src/shell.rs b/crates/composition/src/shell.rs index cfbd249..61f86d8 100644 --- a/crates/composition/src/shell.rs +++ b/crates/composition/src/shell.rs @@ -11,13 +11,13 @@ use layer_shika_adapters::platform::slint_interpreter::{ CompilationResult, Compiler, ComponentInstance, Value, }; use layer_shika_adapters::{ - AppState, ShellWindowConfig, WaylandWindowConfig, WindowState, WindowingSystemFacade, + AppState, ShellSurfaceConfig, WaylandSurfaceConfig, WindowState, WindowingSystemFacade, }; -use layer_shika_domain::config::WindowConfig; +use layer_shika_domain::config::SurfaceConfig; use layer_shika_domain::entities::output_registry::OutputRegistry; use layer_shika_domain::errors::DomainError; use layer_shika_domain::prelude::{ - AnchorEdges, KeyboardInteractivity, Layer, Margins, OutputPolicy, ScaleFactor, WindowDimension, + AnchorEdges, KeyboardInteractivity, Layer, Margins, OutputPolicy, ScaleFactor, SurfaceDimension, }; use layer_shika_domain::value_objects::output_handle::OutputHandle; use layer_shika_domain::value_objects::output_info::OutputInfo; @@ -30,9 +30,9 @@ use std::rc::Rc; pub const DEFAULT_COMPONENT_NAME: &str = "Main"; #[derive(Debug, Clone)] -pub struct WindowDefinition { +pub struct SurfaceDefinition { pub component: String, - pub config: WindowConfig, + pub config: SurfaceConfig, } enum CompilationSource { @@ -43,40 +43,40 @@ enum CompilationSource { pub struct ShellBuilder { compilation: CompilationSource, - windows: Vec, + surfaces: Vec, } impl ShellBuilder { - pub fn window(self, component: impl Into) -> WindowConfigBuilder { - WindowConfigBuilder { + pub fn surface(self, component: impl Into) -> SurfaceConfigBuilder { + SurfaceConfigBuilder { shell_builder: self, component: component.into(), - config: WindowConfig::default(), + config: SurfaceConfig::default(), } } #[must_use] - pub fn discover_windows( + pub fn discover_surfaces( mut self, components: impl IntoIterator>, ) -> Self { for component in components { - self.windows.push(WindowDefinition { + self.surfaces.push(SurfaceDefinition { component: component.into(), - config: WindowConfig::default(), + config: SurfaceConfig::default(), }); } self } pub fn build(self) -> Result { - let windows = if self.windows.is_empty() { - vec![WindowDefinition { + let surfaces = if self.surfaces.is_empty() { + vec![SurfaceDefinition { component: DEFAULT_COMPONENT_NAME.to_string(), - config: WindowConfig::default(), + config: SurfaceConfig::default(), }] } else { - self.windows + self.surfaces }; let compilation_result = match self.compilation { @@ -116,32 +116,32 @@ impl ShellBuilder { CompilationSource::Compiled(result) => result, }; - Shell::new(compilation_result, windows) + Shell::new(compilation_result, surfaces) } } -pub struct WindowConfigBuilder { +pub struct SurfaceConfigBuilder { shell_builder: ShellBuilder, component: String, - config: WindowConfig, + config: SurfaceConfig, } -impl WindowConfigBuilder { +impl SurfaceConfigBuilder { #[must_use] pub fn size(mut self, width: u32, height: u32) -> Self { - self.config.dimensions = WindowDimension::new(width, height); + self.config.dimensions = SurfaceDimension::new(width, height); self } #[must_use] pub fn height(mut self, height: u32) -> Self { - self.config.dimensions = WindowDimension::new(self.config.dimensions.width(), height); + self.config.dimensions = SurfaceDimension::new(self.config.dimensions.width(), height); self } #[must_use] pub fn width(mut self, width: u32) -> Self { - self.config.dimensions = WindowDimension::new(width, self.config.dimensions.height()); + self.config.dimensions = SurfaceDimension::new(width, self.config.dimensions.height()); self } @@ -194,9 +194,9 @@ impl WindowConfigBuilder { } #[must_use] - pub fn window(self, component: impl Into) -> WindowConfigBuilder { + pub fn surface(self, component: impl Into) -> SurfaceConfigBuilder { let shell_builder = self.complete(); - shell_builder.window(component) + shell_builder.surface(component) } pub fn build(self) -> Result { @@ -209,7 +209,7 @@ impl WindowConfigBuilder { } fn complete(mut self) -> ShellBuilder { - self.shell_builder.windows.push(WindowDefinition { + self.shell_builder.surfaces.push(SurfaceDefinition { component: self.component, config: self.config, }); @@ -219,7 +219,7 @@ impl WindowConfigBuilder { pub struct Shell { inner: Rc>, - windows: HashMap, + surfaces: HashMap, compilation_result: Rc, popup_command_sender: channel::Sender, } @@ -231,7 +231,7 @@ impl Shell { path: path.as_ref().to_path_buf(), compiler: Compiler::default(), }, - windows: Vec::new(), + surfaces: Vec::new(), } } @@ -241,7 +241,7 @@ impl Shell { path: path.as_ref().to_path_buf(), compiler, }, - windows: Vec::new(), + surfaces: Vec::new(), } } @@ -251,7 +251,7 @@ impl Shell { code: code.into(), compiler: Compiler::default(), }, - windows: Vec::new(), + surfaces: Vec::new(), } } @@ -261,14 +261,14 @@ impl Shell { code: code.into(), compiler, }, - windows: Vec::new(), + surfaces: Vec::new(), } } pub fn from_compilation(result: Rc) -> ShellBuilder { ShellBuilder { compilation: CompilationSource::Compiled(result), - windows: Vec::new(), + surfaces: Vec::new(), } } @@ -278,7 +278,7 @@ impl Shell { code: String::new(), compiler: Compiler::default(), }, - windows: Vec::new(), + surfaces: Vec::new(), } } @@ -316,7 +316,7 @@ impl Shell { pub(crate) fn new( compilation_result: Rc, - definitions: Vec, + definitions: Vec, ) -> Result { log::info!("Creating Shell with {} windows", definitions.len()); @@ -342,7 +342,7 @@ impl Shell { fn new_single_window( compilation_result: Rc, - definition: WindowDefinition, + definition: SurfaceDefinition, ) -> Result { let component_definition = compilation_result .component(&definition.component) @@ -355,7 +355,7 @@ impl Shell { }) })?; - let wayland_config = WaylandWindowConfig::from_domain_config( + let wayland_config = WaylandSurfaceConfig::from_domain_config( component_definition, Some(Rc::clone(&compilation_result)), definition.config.clone(), @@ -367,12 +367,12 @@ impl Shell { let (sender, receiver) = channel::channel(); - let mut windows = HashMap::new(); - windows.insert(definition.component.clone(), definition); + let mut surfaces = HashMap::new(); + surfaces.insert(definition.component.clone(), definition); let shell = Self { inner: Rc::clone(&inner_rc), - windows, + surfaces, compilation_result, popup_command_sender: sender, }; @@ -386,9 +386,9 @@ impl Shell { fn new_multi_window( compilation_result: Rc, - definitions: Vec, + definitions: Vec, ) -> Result { - let shell_configs: Vec = definitions + let shell_configs: Vec = definitions .iter() .map(|def| { let component_definition = compilation_result @@ -402,13 +402,13 @@ impl Shell { }) })?; - let wayland_config = WaylandWindowConfig::from_domain_config( + let wayland_config = WaylandSurfaceConfig::from_domain_config( component_definition, Some(Rc::clone(&compilation_result)), def.config.clone(), ); - Ok(ShellWindowConfig { + Ok(ShellSurfaceConfig { name: def.component.clone(), config: wayland_config, }) @@ -421,14 +421,14 @@ impl Shell { let (sender, receiver) = channel::channel(); - let mut windows = HashMap::new(); + let mut surfaces = HashMap::new(); for definition in definitions { - windows.insert(definition.component.clone(), definition); + surfaces.insert(definition.component.clone(), definition); } let shell = Self { inner: Rc::clone(&inner_rc), - windows, + surfaces, compilation_result, popup_command_sender: sender, }; @@ -436,8 +436,8 @@ impl Shell { shell.setup_popup_command_handler(receiver)?; log::info!( - "Shell created (multi-window mode) with windows: {:?}", - shell.window_names() + "Shell created (multi-surface mode) with surfaces: {:?}", + shell.surface_names() ); Ok(shell) @@ -492,12 +492,12 @@ impl Shell { ShellControl::new(self.popup_command_sender.clone()) } - pub fn window_names(&self) -> Vec<&str> { - self.windows.keys().map(String::as_str).collect() + pub fn surface_names(&self) -> Vec<&str> { + self.surfaces.keys().map(String::as_str).collect() } - pub fn has_window(&self, name: &str) -> bool { - self.windows.contains_key(name) + pub fn has_surface(&self, name: &str) -> bool { + self.surfaces.contains_key(name) } pub fn event_loop_handle(&self) -> ShellEventLoopHandle { @@ -507,17 +507,17 @@ impl Shell { pub fn run(&mut self) -> Result<()> { log::info!( "Starting Shell event loop with {} windows", - self.windows.len() + self.surfaces.len() ); self.inner.borrow_mut().run()?; Ok(()) } - pub fn with_window(&self, name: &str, f: F) -> Result + pub fn with_surface(&self, name: &str, f: F) -> Result where F: FnOnce(&ComponentInstance) -> R, { - if !self.windows.contains_key(name) { + if !self.surfaces.contains_key(name) { return Err(Error::Domain(DomainError::Configuration { message: format!("Window '{}' not found", name), })); @@ -528,7 +528,7 @@ impl Shell { system .app_state() - .windows_by_shell_name(name) + .surfaces_by_name(name) .next() .map(|window| f(window.component_instance())) .ok_or_else(|| { @@ -538,15 +538,15 @@ impl Shell { }) } - pub fn with_all_windows(&self, mut f: F) + pub fn with_all_surfaces(&self, mut f: F) where F: FnMut(&str, &ComponentInstance), { let facade = self.inner.borrow(); let system = facade.inner_ref(); - for name in self.windows.keys() { - for window in system.app_state().windows_by_shell_name(name) { + for name in self.surfaces.keys() { + for window in system.app_state().surfaces_by_name(name) { f(name, window.component_instance()); } } @@ -595,7 +595,7 @@ impl Shell { F: Fn(ShellControl) -> R + 'static, R: IntoValue, { - if !self.windows.contains_key(window_name) { + if !self.surfaces.contains_key(window_name) { return Err(Error::Domain(DomainError::Configuration { message: format!("Window '{}' not found", window_name), })); @@ -606,7 +606,7 @@ impl Shell { let facade = self.inner.borrow(); let system = facade.inner_ref(); - for window in system.app_state().windows_by_shell_name(window_name) { + for window in system.app_state().surfaces_by_name(window_name) { let handler_rc = Rc::clone(&handler); let control_clone = control.clone(); if let Err(e) = window @@ -637,7 +637,7 @@ impl Shell { F: Fn(&[Value], ShellControl) -> R + 'static, R: IntoValue, { - if !self.windows.contains_key(window_name) { + if !self.surfaces.contains_key(window_name) { return Err(Error::Domain(DomainError::Configuration { message: format!("Window '{}' not found", window_name), })); @@ -648,7 +648,7 @@ impl Shell { let facade = self.inner.borrow(); let system = facade.inner_ref(); - for window in system.app_state().windows_by_shell_name(window_name) { + for window in system.app_state().surfaces_by_name(window_name) { let handler_rc = Rc::clone(&handler); let control_clone = control.clone(); if let Err(e) = window @@ -729,15 +729,15 @@ impl Shell { Ok(()) } - pub fn apply_window_config(&self, window_name: &str, f: F) + pub fn apply_surface_config(&self, window_name: &str, f: F) where F: Fn(&ComponentInstance, LayerSurfaceHandle<'_>), { let facade = self.inner.borrow(); let system = facade.inner_ref(); - if self.windows.contains_key(window_name) { - for window in system.app_state().windows_by_shell_name(window_name) { + if self.surfaces.contains_key(window_name) { + for window in system.app_state().surfaces_by_name(window_name) { let surface_handle = LayerSurfaceHandle::from_window_state(window); f(window.component_instance(), surface_handle); } @@ -791,8 +791,8 @@ impl ShellRuntime for Shell { let facade = self.inner.borrow(); let system = facade.inner_ref(); - if self.windows.contains_key(name) { - for window in system.app_state().windows_by_shell_name(name) { + if self.surfaces.contains_key(name) { + for window in system.app_state().surfaces_by_name(name) { f(window.component_instance()); } } @@ -805,8 +805,8 @@ impl ShellRuntime for Shell { let facade = self.inner.borrow(); let system = facade.inner_ref(); - for name in self.windows.keys() { - for window in system.app_state().windows_by_shell_name(name) { + for name in self.surfaces.keys() { + for window in system.app_state().surfaces_by_name(name) { f(name, window.component_instance()); } } @@ -833,7 +833,7 @@ impl<'a> FromAppState<'a> for ShellEventContext<'a> { impl ShellEventContext<'_> { pub fn get_window_component(&self, name: &str) -> Option<&ComponentInstance> { self.app_state - .windows_by_shell_name(name) + .surfaces_by_name(name) .next() .map(WindowState::component_instance) } diff --git a/crates/composition/src/shell_runtime.rs b/crates/composition/src/shell_runtime.rs index f546a2e..fba8b0a 100644 --- a/crates/composition/src/shell_runtime.rs +++ b/crates/composition/src/shell_runtime.rs @@ -1,6 +1,6 @@ use layer_shika_adapters::platform::slint_interpreter::ComponentInstance; -pub const DEFAULT_WINDOW_NAME: &str = "main"; +pub const DEFAULT_SURFACE_NAME: &str = "main"; pub trait ShellRuntime { type LoopHandle; diff --git a/crates/composition/src/system.rs b/crates/composition/src/system.rs index 2c2d5cb..ddc90ff 100644 --- a/crates/composition/src/system.rs +++ b/crates/composition/src/system.rs @@ -1,5 +1,5 @@ use crate::event_loop::{EventLoopHandleBase, FromAppState}; -use crate::shell_runtime::{DEFAULT_WINDOW_NAME, ShellRuntime}; +use crate::shell_runtime::{DEFAULT_SURFACE_NAME, ShellRuntime}; use crate::value_conversion::IntoValue; use crate::{Error, Result}; use layer_shika_adapters::errors::EventLoopError; @@ -9,9 +9,9 @@ use layer_shika_adapters::platform::slint_interpreter::{ CompilationResult, ComponentDefinition, ComponentInstance, Value, }; use layer_shika_adapters::{ - AppState, PopupManager, WaylandWindowConfig, WindowState, WindowingSystemFacade, + AppState, PopupManager, WaylandSurfaceConfig, WindowState, WindowingSystemFacade, }; -use layer_shika_domain::config::WindowConfig; +use layer_shika_domain::config::SurfaceConfig; use layer_shika_domain::entities::output_registry::OutputRegistry; use layer_shika_domain::errors::DomainError; use layer_shika_domain::value_objects::dimensions::PopupDimensions; @@ -563,9 +563,9 @@ impl SingleWindowShell { pub(crate) fn new( component_definition: ComponentDefinition, compilation_result: Option>, - config: WindowConfig, + config: SurfaceConfig, ) -> Result { - let wayland_config = WaylandWindowConfig::from_domain_config( + let wayland_config = WaylandSurfaceConfig::from_domain_config( component_definition, compilation_result, config, @@ -579,7 +579,7 @@ impl SingleWindowShell { let shell = Self { inner: Rc::clone(&inner_rc), popup_command_sender: sender, - window_name: DEFAULT_WINDOW_NAME.to_string(), + window_name: DEFAULT_SURFACE_NAME.to_string(), }; shell.setup_popup_command_handler(receiver)?; diff --git a/crates/domain/src/config.rs b/crates/domain/src/config.rs index e3aec3b..8ee39af 100644 --- a/crates/domain/src/config.rs +++ b/crates/domain/src/config.rs @@ -1,14 +1,14 @@ use crate::dimensions::ScaleFactor; use crate::value_objects::anchor::AnchorEdges; -use crate::value_objects::dimensions::WindowDimension; +use crate::value_objects::dimensions::SurfaceDimension; use crate::value_objects::keyboard_interactivity::KeyboardInteractivity; use crate::value_objects::layer::Layer; use crate::value_objects::margins::Margins; use crate::value_objects::output_policy::OutputPolicy; #[derive(Debug, Clone)] -pub struct WindowConfig { - pub dimensions: WindowDimension, +pub struct SurfaceConfig { + pub dimensions: SurfaceDimension, pub margin: Margins, pub exclusive_zone: i32, pub scale_factor: ScaleFactor, @@ -19,11 +19,11 @@ pub struct WindowConfig { pub output_policy: OutputPolicy, } -impl WindowConfig { +impl SurfaceConfig { #[must_use] pub fn new() -> Self { Self { - dimensions: WindowDimension::default(), + dimensions: SurfaceDimension::default(), margin: Margins::default(), exclusive_zone: -1, namespace: "layer-shika".to_owned(), @@ -36,7 +36,7 @@ impl WindowConfig { } } -impl Default for WindowConfig { +impl Default for SurfaceConfig { fn default() -> Self { Self::new() } diff --git a/crates/domain/src/prelude.rs b/crates/domain/src/prelude.rs index 75a5173..653ad78 100644 --- a/crates/domain/src/prelude.rs +++ b/crates/domain/src/prelude.rs @@ -1,6 +1,6 @@ #![allow(clippy::pub_use)] -pub use crate::config::WindowConfig; +pub use crate::config::SurfaceConfig; pub use crate::dimensions::{ LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, ScaleFactor, }; @@ -9,7 +9,7 @@ pub use crate::errors::{DomainError, Result}; pub use crate::surface_dimensions::SurfaceDimensions; pub use crate::value_objects::anchor::AnchorEdges; pub use crate::value_objects::anchor_strategy::AnchorStrategy; -pub use crate::value_objects::dimensions::{PopupDimensions, WindowDimension}; +pub use crate::value_objects::dimensions::{PopupDimensions, SurfaceDimension}; pub use crate::value_objects::keyboard_interactivity::KeyboardInteractivity; pub use crate::value_objects::layer::Layer; pub use crate::value_objects::margins::Margins; diff --git a/crates/domain/src/value_objects/dimensions.rs b/crates/domain/src/value_objects/dimensions.rs index c2a8428..e3e732a 100644 --- a/crates/domain/src/value_objects/dimensions.rs +++ b/crates/domain/src/value_objects/dimensions.rs @@ -1,10 +1,10 @@ #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub struct WindowDimension { +pub struct SurfaceDimension { width: u32, height: u32, } -impl WindowDimension { +impl SurfaceDimension { pub fn new(width: u32, height: u32) -> Self { Self { width: if width == 0 { @@ -33,7 +33,7 @@ impl WindowDimension { } } -impl Default for WindowDimension { +impl Default for SurfaceDimension { fn default() -> Self { Self { width: 20, diff --git a/src/lib.rs b/src/lib.rs index c822c34..06b7437 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ //! layer-shika: A Wayland layer shell library with Slint UI integration //! -//! This crate provides a high-level API for creating Wayland layer shell windows +//! This crate provides a high-level API for creating Wayland layer shell surfaces //! with Slint-based user interfaces. It's built on a clean architecture with three //! internal layers (domain, adapters, composition), but users should only depend on //! this root crate. @@ -22,7 +22,7 @@ //! The API is organized into conceptual facets: //! //! - [`shell`] – Main runtime and shell composition types -//! - [`window`] – Window configuration, layers, anchors, and popup types +//! - [`window`] – Surface configuration, layers, anchors, and popup types //! - [`output`] – Output (monitor) info, geometry, and policies //! - [`event`] – Event loop handles and contexts //! - [`slint_integration`] – Slint framework re-exports and wrappers @@ -30,13 +30,13 @@ //! //! # Quick Start //! -//! Single-window use case: +//! Single-surface use case: //! //! ```rust,no_run //! use layer_shika::prelude::*; //! //! Shell::from_file("ui/bar.slint") -//! .window("Main") +//! .surface("Main") //! .height(42) //! .anchor(AnchorEdges::top_bar()) //! .exclusive_zone(42) @@ -45,18 +45,18 @@ //! # Ok::<(), layer_shika::Error>(()) //! ``` //! -//! # Multi-Window Shell +//! # Multi-Surface Shell //! -//! Same API naturally extends to multiple windows: +//! Same API naturally extends to multiple surfaces: //! //! ```rust,no_run //! use layer_shika::prelude::*; //! //! Shell::from_file("ui/shell.slint") -//! .window("TopBar") +//! .surface("TopBar") //! .height(42) //! .anchor(AnchorEdges::top_bar()) -//! .window("Dock") +//! .surface("Dock") //! .height(64) //! .anchor(AnchorEdges::bottom_bar()) //! .build()? @@ -74,10 +74,10 @@ //! let compilation = Shell::compile_file("ui/shell.slint")?; //! //! Shell::from_compilation(compilation) -//! .window("TopBar") +//! .surface("TopBar") //! .output_policy(OutputPolicy::AllOutputs) //! .height(42) -//! .window("Dock") +//! .surface("Dock") //! .output_policy(OutputPolicy::PrimaryOnly) //! .height(64) //! .build()? @@ -98,9 +98,9 @@ pub mod window; pub use layer_shika_composition::{Error, Result}; pub use shell::{ - DEFAULT_COMPONENT_NAME, DEFAULT_WINDOW_NAME, LayerSurfaceHandle, Shell, ShellBuilder, - ShellControl, ShellEventContext, ShellEventLoopHandle, ShellRuntime, ShellWindowConfigHandler, - ShellWindowHandle, SingleWindowShell, WindowConfigBuilder, WindowDefinition, + DEFAULT_COMPONENT_NAME, DEFAULT_SURFACE_NAME, LayerSurfaceHandle, Shell, ShellBuilder, + ShellControl, ShellEventContext, ShellEventLoopHandle, ShellRuntime, ShellSurfaceConfigHandler, + ShellSurfaceHandle, SingleWindowShell, SurfaceConfigBuilder, SurfaceDefinition, }; pub use window::{ diff --git a/src/prelude.rs b/src/prelude.rs index e4c6f34..04693e5 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -9,9 +9,9 @@ #![allow(clippy::pub_use)] pub use crate::shell::{ - DEFAULT_COMPONENT_NAME, DEFAULT_WINDOW_NAME, LayerSurfaceHandle, Shell, ShellBuilder, - ShellControl, ShellEventContext, ShellEventLoopHandle, ShellRuntime, ShellWindowConfigHandler, - ShellWindowHandle, SingleWindowShell, WindowConfigBuilder, WindowDefinition, + DEFAULT_COMPONENT_NAME, DEFAULT_SURFACE_NAME, LayerSurfaceHandle, Shell, ShellBuilder, + ShellControl, ShellEventContext, ShellEventLoopHandle, ShellRuntime, ShellSurfaceConfigHandler, + ShellSurfaceHandle, SingleWindowShell, SurfaceConfigBuilder, SurfaceDefinition, }; pub use crate::window::{ @@ -28,7 +28,7 @@ pub use crate::slint_integration::{PopupWindow, slint, slint_interpreter}; pub use crate::{Error, Result}; pub use layer_shika_composition::prelude::{ - Anchor, LogicalSize, Margins, PhysicalSize, ScaleFactor, WindowConfig, WindowDimension, + Anchor, LogicalSize, Margins, PhysicalSize, ScaleFactor, SurfaceConfig, SurfaceDimension, }; pub use crate::calloop; diff --git a/src/shell.rs b/src/shell.rs index e3172f3..c55b681 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -1,5 +1,5 @@ pub use layer_shika_composition::{ - DEFAULT_COMPONENT_NAME, DEFAULT_WINDOW_NAME, LayerSurfaceHandle, Shell, ShellBuilder, - ShellControl, ShellEventContext, ShellEventLoopHandle, ShellRuntime, ShellWindowConfigHandler, - ShellWindowHandle, SingleWindowShell, WindowConfigBuilder, WindowDefinition, + DEFAULT_COMPONENT_NAME, DEFAULT_SURFACE_NAME, LayerSurfaceHandle, Shell, ShellBuilder, + ShellControl, ShellEventContext, ShellEventLoopHandle, ShellRuntime, ShellSurfaceConfigHandler, + ShellSurfaceHandle, SingleWindowShell, SurfaceConfigBuilder, SurfaceDefinition, }; diff --git a/src/window.rs b/src/window.rs index 8ddb858..a57fb33 100644 --- a/src/window.rs +++ b/src/window.rs @@ -2,5 +2,3 @@ pub use layer_shika_composition::{ AnchorEdges, AnchorStrategy, KeyboardInteractivity, Layer, PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest, PopupSize, }; - -pub use layer_shika_composition::DEFAULT_WINDOW_NAME;