screencopy: Use send_success_when_ready for other forms of capture
A little annoying to add a `loop_handle` argument to `render_output`, but generally straightforward.
This commit is contained in:
parent
10c05bc1d4
commit
905d021552
4 changed files with 28 additions and 13 deletions
|
|
@ -28,7 +28,7 @@ use crate::{
|
||||||
handlers::{
|
handlers::{
|
||||||
compositor::FRAME_TIME_FILTER,
|
compositor::FRAME_TIME_FILTER,
|
||||||
data_device::get_dnd_icon,
|
data_device::get_dnd_icon,
|
||||||
screencopy::{render_session, FrameHolder, PendingImageCopyData, SessionData},
|
screencopy::{render_session, FrameHolder, SessionData},
|
||||||
},
|
},
|
||||||
protocols::workspace::WorkspaceHandle,
|
protocols::workspace::WorkspaceHandle,
|
||||||
},
|
},
|
||||||
|
|
@ -1150,6 +1150,7 @@ pub fn render_output<'d, R>(
|
||||||
output: &Output,
|
output: &Output,
|
||||||
cursor_mode: CursorMode,
|
cursor_mode: CursorMode,
|
||||||
screen_filter: &'d mut ScreenFilterStorage,
|
screen_filter: &'d mut ScreenFilterStorage,
|
||||||
|
loop_handle: &calloop::LoopHandle<'static, State>,
|
||||||
) -> Result<RenderOutputResult<'d>, RenderError<R::Error>>
|
) -> Result<RenderOutputResult<'d>, RenderError<R::Error>>
|
||||||
where
|
where
|
||||||
R: Renderer
|
R: Renderer
|
||||||
|
|
@ -1332,11 +1333,7 @@ where
|
||||||
match result {
|
match result {
|
||||||
Ok((res, mut elements)) => {
|
Ok((res, mut elements)) => {
|
||||||
for (session, frame) in output.take_pending_frames() {
|
for (session, frame) in output.take_pending_frames() {
|
||||||
if let Some(PendingImageCopyData { frame, damage, .. }) = render_session::<
|
if let Some(pending_image_copy_data) = render_session::<_, _, GlesTexture>(
|
||||||
_,
|
|
||||||
_,
|
|
||||||
GlesTexture,
|
|
||||||
>(
|
|
||||||
renderer,
|
renderer,
|
||||||
&session.user_data().get::<SessionData>().unwrap(),
|
&session.user_data().get::<SessionData>().unwrap(),
|
||||||
frame,
|
frame,
|
||||||
|
|
@ -1437,7 +1434,11 @@ where
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
)? {
|
)? {
|
||||||
frame.success(output.current_transform(), damage, now);
|
pending_image_copy_data.send_success_when_ready(
|
||||||
|
output.current_transform(),
|
||||||
|
loop_handle,
|
||||||
|
now,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ impl WinitState {
|
||||||
&self.output,
|
&self.output,
|
||||||
CursorMode::NotDefault,
|
CursorMode::NotDefault,
|
||||||
&mut self.screen_filter_state,
|
&mut self.screen_filter_state,
|
||||||
|
&state.event_loop_handle,
|
||||||
) {
|
) {
|
||||||
Ok(RenderOutputResult { damage, states, .. }) => {
|
Ok(RenderOutputResult { damage, states, .. }) => {
|
||||||
std::mem::drop(fb);
|
std::mem::drop(fb);
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,7 @@ impl Surface {
|
||||||
&self.output,
|
&self.output,
|
||||||
render::CursorMode::NotDefault,
|
render::CursorMode::NotDefault,
|
||||||
&mut self.screen_filter_state,
|
&mut self.screen_filter_state,
|
||||||
|
&state.event_loop_handle,
|
||||||
) {
|
) {
|
||||||
Ok(RenderOutputResult { damage, states, .. }) => {
|
Ok(RenderOutputResult { damage, states, .. }) => {
|
||||||
self.surface
|
self.surface
|
||||||
|
|
|
||||||
|
|
@ -471,8 +471,12 @@ pub fn render_workspace_to_buffer(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(PendingImageCopyData { frame, damage, .. }) = result {
|
if let Some(pending_image_copy_data) = result {
|
||||||
frame.success(transform, damage, common.clock.now())
|
pending_image_copy_data.send_success_when_ready(
|
||||||
|
transform,
|
||||||
|
&common.event_loop_handle,
|
||||||
|
common.clock.now(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -702,8 +706,12 @@ pub fn render_window_to_buffer(
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(PendingImageCopyData { frame, damage, .. }) = result {
|
if let Some(pending_image_copy_data) = result {
|
||||||
frame.success(Transform::Normal, damage, common.clock.now())
|
pending_image_copy_data.send_success_when_ready(
|
||||||
|
Transform::Normal,
|
||||||
|
&common.event_loop_handle,
|
||||||
|
common.clock.now(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -858,7 +866,11 @@ pub fn render_cursor_to_buffer(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(PendingImageCopyData { frame, damage, .. }) = result {
|
if let Some(pending_image_copy_data) = result {
|
||||||
frame.success(Transform::Normal, damage, common.clock.now())
|
pending_image_copy_data.send_success_when_ready(
|
||||||
|
Transform::Normal,
|
||||||
|
&common.event_loop_handle,
|
||||||
|
common.clock.now(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue