loop: Schedule rendering for running animations on idle
This commit is contained in:
parent
568c8032b7
commit
5125337b42
1 changed files with 33 additions and 1 deletions
34
src/main.rs
34
src/main.rs
|
|
@ -12,7 +12,10 @@ use anyhow::{Context, Result};
|
|||
use std::{ffi::OsString, os::unix::prelude::AsRawFd, sync::Arc};
|
||||
use tracing::{error, info, warn};
|
||||
|
||||
use crate::wayland::handlers::compositor::client_compositor_state;
|
||||
use crate::wayland::{
|
||||
handlers::{compositor::client_compositor_state, screencopy::PendingScreencopyBuffers},
|
||||
protocols::screencopy::SessionType,
|
||||
};
|
||||
|
||||
pub mod backend;
|
||||
pub mod config;
|
||||
|
|
@ -76,6 +79,35 @@ fn main() -> Result<()> {
|
|||
}
|
||||
}
|
||||
data.state.common.shell.refresh();
|
||||
if data.state.common.shell.animations_going() {
|
||||
for output in data.state.common.shell.outputs() {
|
||||
let mut scheduled_sessions = None;
|
||||
if let Some(sessions) = output.user_data().get::<PendingScreencopyBuffers>() {
|
||||
scheduled_sessions
|
||||
.get_or_insert_with(Vec::new)
|
||||
.extend(sessions.borrow_mut().drain(..));
|
||||
}
|
||||
|
||||
data.state.backend.schedule_render(
|
||||
&data.state.common.event_loop_handle,
|
||||
&output,
|
||||
scheduled_sessions.as_ref().map(|sessions| {
|
||||
sessions
|
||||
.iter()
|
||||
.filter(|(s, _)| match s.session_type() {
|
||||
SessionType::Output(o) | SessionType::Workspace(o, _)
|
||||
if &o == output =>
|
||||
{
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
})
|
||||
.cloned()
|
||||
.collect::<Vec<_>>()
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
state::Common::refresh_focus(&mut data.state);
|
||||
|
||||
// send out events
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue