mirror of
https://codeberg.org/waydeer/layer-shika.git
synced 2026-01-22 05:55:55 +00:00
refactor: unify rendering paths
This commit is contained in:
parent
7f5828f35d
commit
f0b9660dd2
5 changed files with 40 additions and 28 deletions
|
|
@ -5,6 +5,7 @@ pub(crate) mod input;
|
|||
pub(crate) mod managed_proxies;
|
||||
pub mod ops;
|
||||
pub(crate) mod outputs;
|
||||
pub(crate) mod rendering;
|
||||
pub(crate) mod session_lock;
|
||||
pub(crate) mod shell_adapter;
|
||||
pub(crate) mod surfaces;
|
||||
|
|
|
|||
5
crates/adapters/src/wayland/rendering.rs
Normal file
5
crates/adapters/src/wayland/rendering.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
use crate::errors::Result;
|
||||
|
||||
pub trait RenderableSet {
|
||||
fn render_all_dirty(&self) -> Result<()>;
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ pub mod state;
|
|||
|
||||
use crate::errors::{LayerShikaError, Result};
|
||||
use crate::rendering::slint_integration::platform::CustomSlintPlatform;
|
||||
use crate::wayland::rendering::RenderableSet;
|
||||
use crate::wayland::session_lock::lock_context::SessionLockContext;
|
||||
use crate::wayland::session_lock::lock_surface::LockSurface;
|
||||
use crate::wayland::surfaces::app_state::AppState;
|
||||
|
|
@ -395,3 +396,9 @@ impl SessionLockManager {
|
|||
.count()
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderableSet for SessionLockManager {
|
||||
fn render_all_dirty(&self) -> Result<()> {
|
||||
rendering::render_frames(&self.lock_surfaces)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use crate::wayland::{
|
|||
managed_proxies::{ManagedWlKeyboard, ManagedWlPointer},
|
||||
ops::WaylandSystemOps,
|
||||
outputs::{OutputManager, OutputManagerContext},
|
||||
rendering::RenderableSet,
|
||||
session_lock::OutputFilter,
|
||||
surfaces::layer_surface::{SurfaceCtx, SurfaceSetupParams},
|
||||
surfaces::popup_manager::{PopupContext, PopupManager},
|
||||
|
|
@ -627,15 +628,10 @@ impl WaylandShellSystem {
|
|||
|
||||
update_timers_and_animations();
|
||||
|
||||
for surface in self.state.all_outputs() {
|
||||
surface.window().render_frame_if_dirty().map_err(|e| {
|
||||
RenderingError::Operation {
|
||||
message: e.to_string(),
|
||||
}
|
||||
})?;
|
||||
self.state.render_all_dirty()?;
|
||||
if let Some(lock_manager) = self.state.lock_manager() {
|
||||
lock_manager.render_all_dirty()?;
|
||||
}
|
||||
|
||||
self.state.render_lock_frames()?;
|
||||
}
|
||||
|
||||
info!("Initial configuration complete, requesting final render");
|
||||
|
|
@ -643,15 +639,10 @@ impl WaylandShellSystem {
|
|||
RenderableWindow::request_redraw(surface.window().as_ref());
|
||||
}
|
||||
update_timers_and_animations();
|
||||
for surface in self.state.all_outputs() {
|
||||
surface
|
||||
.window()
|
||||
.render_frame_if_dirty()
|
||||
.map_err(|e| RenderingError::Operation {
|
||||
message: e.to_string(),
|
||||
})?;
|
||||
self.state.render_all_dirty()?;
|
||||
if let Some(lock_manager) = self.state.lock_manager() {
|
||||
lock_manager.render_all_dirty()?;
|
||||
}
|
||||
self.state.render_lock_frames()?;
|
||||
self.connection
|
||||
.flush()
|
||||
.map_err(|e| LayerShikaError::WaylandProtocol { source: e })?;
|
||||
|
|
@ -720,7 +711,9 @@ impl WaylandShellSystem {
|
|||
}
|
||||
}
|
||||
|
||||
shared_data.render_lock_frames()?;
|
||||
if let Some(lock_manager) = shared_data.lock_manager() {
|
||||
lock_manager.render_all_dirty()?;
|
||||
}
|
||||
|
||||
connection
|
||||
.flush()
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
use super::event_context::SharedPointerSerial;
|
||||
use super::keyboard_state::KeyboardState;
|
||||
use super::surface_state::SurfaceState;
|
||||
use crate::errors::{LayerShikaError, Result};
|
||||
use crate::errors::{LayerShikaError, RenderingError, Result};
|
||||
use crate::rendering::egl::context_factory::RenderContextFactory;
|
||||
use crate::rendering::femtovg::renderable_window::RenderableWindow;
|
||||
use crate::rendering::slint_integration::platform::CustomSlintPlatform;
|
||||
use crate::wayland::globals::context::GlobalContext;
|
||||
use crate::wayland::input::KeyboardInputState;
|
||||
use crate::wayland::managed_proxies::{ManagedWlKeyboard, ManagedWlPointer};
|
||||
use crate::wayland::outputs::{OutputManager, OutputMapping};
|
||||
use crate::wayland::rendering::RenderableSet;
|
||||
use crate::wayland::session_lock::lock_context::SessionLockContext;
|
||||
use crate::wayland::session_lock::manager::callbacks::{
|
||||
create_lock_callback, create_lock_callback_with_output_filter,
|
||||
|
|
@ -223,16 +225,6 @@ impl AppState {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn render_lock_frames(&self) -> Result<()> {
|
||||
if let Some(manager) = self.lock_manager.as_ref() {
|
||||
if manager.state() != LockState::Locked && manager.state() != LockState::Locking {
|
||||
return Ok(());
|
||||
}
|
||||
manager.render_frames()?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn session_lock_component_name(&self) -> Option<String> {
|
||||
self.lock_manager
|
||||
.as_ref()
|
||||
|
|
@ -926,3 +918,17 @@ impl AppState {
|
|||
removed
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderableSet for AppState {
|
||||
fn render_all_dirty(&self) -> Result<()> {
|
||||
for surface in self.all_outputs() {
|
||||
surface
|
||||
.window()
|
||||
.render_frame_if_dirty()
|
||||
.map_err(|e| RenderingError::Operation {
|
||||
message: e.to_string(),
|
||||
})?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue