Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions libwayshot/examples/waymirror-egl/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,11 @@ impl WaylandEGLState {
gl::BindTexture(gl::TEXTURE_2D, self.gl_texture);
gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::LINEAR as i32);

use libwayshot::WayshotTarget;
self.wayshot
.bind_output_frame_to_gl_texture(
.bind_target_frame_to_gl_texture(
true,
&self.wayshot.get_all_outputs()[0].wl_output,
&WayshotTarget::Screen(self.wayshot.get_all_outputs()[0].wl_output.clone()),
None,
)
.unwrap();
Expand Down
5 changes: 3 additions & 2 deletions libwayshot/examples/waymirror.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,16 @@ impl Dispatch<xdg_surface::XdgSurface, ()> for State {
_: &Connection,
_: &QueueHandle<Self>,
) {
use libwayshot::WayshotTarget;
if let xdg_surface::Event::Configure { serial, .. } = event {
xdg_surface.ack_configure(serial);
state.configured = true;
let surface = state.base_surface.as_ref().unwrap();
let (_frame_format, guard, _bo) = state
.wayshot
.capture_output_frame_dmabuf(
.capture_target_frame_dmabuf(
true,
&state.wayshot.get_all_outputs()[0].wl_output,
&WayshotTarget::Screen(state.wayshot.get_all_outputs()[0].wl_output.clone()),
None,
)
.unwrap();
Expand Down
7 changes: 6 additions & 1 deletion libwayshot/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ pub struct CaptureFrameState {
pub(crate) session_done: bool,
}

impl CaptureFrameState {
pub(crate) fn dmabuf_formats(&self) -> &[DMAFrameFormat] {
&self.dmabuf_formats
}
}

impl Dispatch<ZwpLinuxDmabufV1, ()> for CaptureFrameState {
fn event(
_frame: &mut Self,
Expand Down Expand Up @@ -303,7 +309,6 @@ impl Dispatch<ExtImageCopyCaptureSessionV1, ()> for CaptureFrameState {
} => {
let set_format = state.formats.first_mut().unwrap();
set_format.format = format;
//set_format.format = wayland_client::protocol::wl_shm::Format::Xbgr8888; // <-- For Cosmic
}
ext_image_copy_capture_session_v1::Event::DmabufFormat { format, .. } => {
state.dmabuf_formats.push(DMAFrameFormat {
Expand Down
2 changes: 2 additions & 0 deletions libwayshot/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pub enum Error {
EGLImageToTexProcNotFoundError,
#[error("Capture failed: {0}")]
CaptureFailed(String),
#[error("Unsupported for some reason: {0}")]
Unsupported(String),
}

#[cfg(test)]
Expand Down
Loading