mirror of
https://codeberg.org/waydeer/layer-shika.git
synced 2026-01-22 08:15:54 +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(crate) mod managed_proxies;
|
||||||
pub mod ops;
|
pub mod ops;
|
||||||
pub(crate) mod outputs;
|
pub(crate) mod outputs;
|
||||||
|
pub(crate) mod rendering;
|
||||||
pub(crate) mod session_lock;
|
pub(crate) mod session_lock;
|
||||||
pub(crate) mod shell_adapter;
|
pub(crate) mod shell_adapter;
|
||||||
pub(crate) mod surfaces;
|
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::errors::{LayerShikaError, Result};
|
||||||
use crate::rendering::slint_integration::platform::CustomSlintPlatform;
|
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_context::SessionLockContext;
|
||||||
use crate::wayland::session_lock::lock_surface::LockSurface;
|
use crate::wayland::session_lock::lock_surface::LockSurface;
|
||||||
use crate::wayland::surfaces::app_state::AppState;
|
use crate::wayland::surfaces::app_state::AppState;
|
||||||
|
|
@ -395,3 +396,9 @@ impl SessionLockManager {
|
||||||
.count()
|
.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},
|
managed_proxies::{ManagedWlKeyboard, ManagedWlPointer},
|
||||||
ops::WaylandSystemOps,
|
ops::WaylandSystemOps,
|
||||||
outputs::{OutputManager, OutputManagerContext},
|
outputs::{OutputManager, OutputManagerContext},
|
||||||
|
rendering::RenderableSet,
|
||||||
session_lock::OutputFilter,
|
session_lock::OutputFilter,
|
||||||
surfaces::layer_surface::{SurfaceCtx, SurfaceSetupParams},
|
surfaces::layer_surface::{SurfaceCtx, SurfaceSetupParams},
|
||||||
surfaces::popup_manager::{PopupContext, PopupManager},
|
surfaces::popup_manager::{PopupContext, PopupManager},
|
||||||
|
|
@ -627,15 +628,10 @@ impl WaylandShellSystem {
|
||||||
|
|
||||||
update_timers_and_animations();
|
update_timers_and_animations();
|
||||||
|
|
||||||
for surface in self.state.all_outputs() {
|
self.state.render_all_dirty()?;
|
||||||
surface.window().render_frame_if_dirty().map_err(|e| {
|
if let Some(lock_manager) = self.state.lock_manager() {
|
||||||
RenderingError::Operation {
|
lock_manager.render_all_dirty()?;
|
||||||
message: e.to_string(),
|
|
||||||
}
|
|
||||||
})?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.state.render_lock_frames()?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("Initial configuration complete, requesting final render");
|
info!("Initial configuration complete, requesting final render");
|
||||||
|
|
@ -643,15 +639,10 @@ impl WaylandShellSystem {
|
||||||
RenderableWindow::request_redraw(surface.window().as_ref());
|
RenderableWindow::request_redraw(surface.window().as_ref());
|
||||||
}
|
}
|
||||||
update_timers_and_animations();
|
update_timers_and_animations();
|
||||||
for surface in self.state.all_outputs() {
|
self.state.render_all_dirty()?;
|
||||||
surface
|
if let Some(lock_manager) = self.state.lock_manager() {
|
||||||
.window()
|
lock_manager.render_all_dirty()?;
|
||||||
.render_frame_if_dirty()
|
|
||||||
.map_err(|e| RenderingError::Operation {
|
|
||||||
message: e.to_string(),
|
|
||||||
})?;
|
|
||||||
}
|
}
|
||||||
self.state.render_lock_frames()?;
|
|
||||||
self.connection
|
self.connection
|
||||||
.flush()
|
.flush()
|
||||||
.map_err(|e| LayerShikaError::WaylandProtocol { source: e })?;
|
.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
|
connection
|
||||||
.flush()
|
.flush()
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
use super::event_context::SharedPointerSerial;
|
use super::event_context::SharedPointerSerial;
|
||||||
use super::keyboard_state::KeyboardState;
|
use super::keyboard_state::KeyboardState;
|
||||||
use super::surface_state::SurfaceState;
|
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::egl::context_factory::RenderContextFactory;
|
||||||
|
use crate::rendering::femtovg::renderable_window::RenderableWindow;
|
||||||
use crate::rendering::slint_integration::platform::CustomSlintPlatform;
|
use crate::rendering::slint_integration::platform::CustomSlintPlatform;
|
||||||
use crate::wayland::globals::context::GlobalContext;
|
use crate::wayland::globals::context::GlobalContext;
|
||||||
use crate::wayland::input::KeyboardInputState;
|
use crate::wayland::input::KeyboardInputState;
|
||||||
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::rendering::RenderableSet;
|
||||||
use crate::wayland::session_lock::lock_context::SessionLockContext;
|
use crate::wayland::session_lock::lock_context::SessionLockContext;
|
||||||
use crate::wayland::session_lock::manager::callbacks::{
|
use crate::wayland::session_lock::manager::callbacks::{
|
||||||
create_lock_callback, create_lock_callback_with_output_filter,
|
create_lock_callback, create_lock_callback_with_output_filter,
|
||||||
|
|
@ -223,16 +225,6 @@ impl AppState {
|
||||||
Ok(())
|
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> {
|
pub fn session_lock_component_name(&self) -> Option<String> {
|
||||||
self.lock_manager
|
self.lock_manager
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|
@ -926,3 +918,17 @@ impl AppState {
|
||||||
removed
|
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